Initial work on adding support for headline messages.

This commit is contained in:
JC Brand 2016-03-09 08:14:09 +00:00
parent 86a1b66270
commit a1b31cd1ed
4 changed files with 40 additions and 2 deletions

View File

@ -47,6 +47,7 @@ require.config({
"converse-api": "src/converse-api",
"converse-controlbox": "src/converse-controlbox",
"converse-core": "src/converse-core",
"converse-headline": "src/converse-notification",
"converse-muc": "src/converse-muc",
"converse-notification": "src/converse-notification",
"converse-otr": "src/converse-otr",
@ -230,6 +231,7 @@ if (typeof define !== 'undefined') {
"converse-register", // XEP-0077 In-band registration
"converse-ping", // XEP-0199 XMPP Ping
"converse-notification",// HTML5 Notifications
"converse-headline", // Support for headline messages
/* END: Removable components */
], function(converse_api) {

View File

@ -1468,9 +1468,10 @@
.html(converse.templates.chatbox(
_.extend(this.model.toJSON(), {
show_toolbar: converse.show_toolbar,
show_textarea: true,
title: this.model.get('fullname'),
info_close: __('Close this chat box'),
info_minimize: __('Minimize this chat box'),
info_view: __('View more information on this person'),
label_personal_message: __('Personal message')
}
)

33
src/converse-headline.js Normal file
View File

@ -0,0 +1,33 @@
// Converse.js (A browser based XMPP chat client)
// http://conversejs.org
//
// Copyright (c) 2012-2016, Jan-Carel Brand <jc@opkode.com>
// Licensed under the Mozilla Public License (MPLv2)
//
/*global define */
(function (root, factory) {
define("converse-headline", ["converse-core", "converse-api"], factory);
}(this, function (converse, converse_api) {
"use strict";
var $ = converse_api.env.jQuery,
utils = converse_api.env.utils,
Strophe = converse_api.env.Strophe,
_ = converse_api.env._;
// For translations
var __ = utils.__.bind(converse);
var ___ = utils.___;
var supports_html5_notification = "Notification" in window;
converse_api.plugins.add('headline', {
initialize: function () {
/* The initialize function gets called as soon as the plugin is
* loaded by converse.js's plugin machinery.
*/
// TODO
}
});
}));

View File

@ -9,7 +9,7 @@
{[ if (url) { ]}
<a href="{{url}}" target="_blank" class="user">
{[ } ]}
{{ fullname }}
{{ title }}
{[ if (url) { ]}
</a>
{[ } ]}
@ -18,6 +18,7 @@
</div>
<div class="chat-body">
<div class="chat-content"></div>
{[ if (show_textarea) { ]}
<form class="sendXMPPMessage" action="" method="post">
{[ if (show_toolbar) { ]}
<ul class="chat-toolbar no-text-select"></ul>
@ -27,5 +28,6 @@
class="chat-textarea"
placeholder="{{label_personal_message}}"/>
</form>
{[ } ]}
</div>
</div>