Commit c508b996 authored by JC Brand's avatar JC Brand

Merge pull request #442 from jcbrand/mam

Message Archive Management
parents 8ab0d7e8 96253f96
This diff is collapsed.
......@@ -6,6 +6,8 @@ Changelog
* #439 auto_login and keepalive not working [jcbrand]
* #440 null added as resource to contact [jcbrand]
* Add new event serviceDiscovered [jcbrand]
* Add a new configuration setting `muc_history_max_stanzas`. [jcbrand]
0.9.4 (2015-07-04)
------------------
......
......@@ -53,6 +53,23 @@ This enables anonymous login if the XMPP server supports it. This option can be
used together with `auto_login`_ to automatically and anonymously log a user in
as soon as the page loads.
archived_messages_page_size
---------------------------
* Default: ``20``
See also: `message_archiving`
This feature applies to `XEP-0313: Message Archive Management (MAM) <https://xmpp.org/extensions/xep-0313.html>`_
and will only take effect if your server supports MAM.
It allows you to specify the maximum amount of archived messages to be returned per query.
When you open a chat box or room, archived messages will be displayed (if
available) and the amount returned will be no more than the page size.
You will be able to query for even older messages by scrolling upwards in the chat box or room
(the so-called infinite scrolling pattern).
prebind
~~~~~~~
......@@ -327,6 +344,19 @@ See also:
`XEP-0198 <http://xmpp.org/extensions/xep-0198.html>`_, specifically
with regards to "stream resumption".
message_archiving
-----------------
* Default: ``never``
Provides support for `XEP-0313: Message Archive Management <https://xmpp.org/extensions/xep-0313.html>`_
This sets the default archiving preference. Valid values are ``never``, ``always`` and ``roster``.
``roster`` means that only messages to and from JIDs in your roster will be
archived. The other two values are self-explanatory.
message_carbons
---------------
......@@ -348,6 +378,23 @@ Message carbons is the XEP (Jabber protocol extension) specifically drafted to
solve this problem, while `forward_messages`_ uses
`stanza forwarding <http://www.xmpp.org/extensions/xep-0297.html>`_
muc_history_max_stanzas
-----------------------
* Default: ``undefined``
This option allows you to specify the maximum amount of messages to be shown in a
chat room when you enter it. By default, the amount specified in the room
configuration or determined by the server will be returned.
Please note, this option is not related to
`XEP-0313 Message Archive Management <https://xmpp.org/extensions/xep-0313.html>`_,
which also allows you to show archived chat room messages, but follows a
different approach.
If you're using MAM for archiving chat room messages, you might want to set
this option to zero.
expose_rid_and_sid
------------------
......
This diff is collapsed.
......@@ -26,18 +26,19 @@ require.config({
"jquery-private": "src/jquery-private",
"jquery.browser": "components/jquery.browser/dist/jquery.browser",
"jquery.easing": "components/jquery-easing-original/index", // XXX: Only required for https://conversejs.org website
"moment": "components/momentjs/min/moment.min",
"moment": "components/momentjs/moment",
"strophe": "components/strophejs/src/wrapper",
"strophe-base64": "components/strophejs/src/base64",
"strophe-bosh": "components/strophejs/src/bosh",
"strophe-core": "components/strophejs/src/core",
"strophe": "components/strophejs/src/wrapper",
"strophe-md5": "components/strophejs/src/md5",
"strophe-polyfill": "components/strophejs/src/polyfills",
"strophe-sha1": "components/strophejs/src/sha1",
"strophe-websocket": "components/strophejs/src/websocket",
"strophe-polyfill": "components/strophejs/src/polyfills",
"strophe.disco": "components/strophejs-plugins/disco/strophe.disco",
"strophe.vcard": "src/strophe.vcard",
"strophe.ping": "src/strophe.ping",
"strophe.rsm": "components/strophejs-plugins/rsm/strophe.rsm",
"strophe.vcard": "src/strophe.vcard",
"text": 'components/requirejs-text/text',
"tpl": 'components/requirejs-tpl-jcbrand/tpl',
"typeahead": "components/typeahead.js/index",
......@@ -185,10 +186,9 @@ require.config({
'crypto.sha1': { deps: ['crypto.core'] },
'crypto.sha256': { deps: ['crypto.core'] },
'bigint': { deps: ['crypto'] },
'strophe.disco': { deps: ['strophe'] },
'strophe.ping': { deps: ['strophe'] },
'strophe.register': { deps: ['strophe'] },
'strophe.vcard': { deps: ['strophe'] },
'strophe.ping': { deps: ['strophe'] }
'strophe.vcard': { deps: ['strophe'] }
}
});
......
......@@ -652,7 +652,7 @@
var message_date = new Date();
expect($time.length).toEqual(1);
expect($time.attr('class')).toEqual('chat-date');
expect($time.attr('datetime')).toEqual(moment(message_date).format("YYYY-MM-DD"));
expect($time.data('isodate')).toEqual(moment(message_date).format());
expect($time.text()).toEqual(moment(message_date).format("dddd MMM Do YYYY"));
// Normal checks for the 2nd message
......
......@@ -299,6 +299,10 @@
var box = converse_api.chats.open(jid);
expect(box instanceof Object).toBeTruthy();
expect(box.get('box_id')).toBe(b64_sha1(jid));
expect(
Object.keys(box),
['close', 'endOTR', 'focus', 'get', 'initiateOTR', 'is_chatroom', 'maximize', 'minimize', 'open', 'set']
);
var chatboxview = this.chatboxviews.get(jid);
expect(chatboxview.$el.is(':visible')).toBeTruthy();
......
(function (root, factory) {
define([
"jquery",
"mock",
"test_utils"
], function ($, mock, test_utils) {
return factory($, mock, test_utils);
}
);
} (this, function ($, mock, test_utils) {
"use strict";
var Strophe = converse_api.env.Strophe;
describe("Service Discovery", $.proxy(function (mock, test_utils) {
describe("Whenever converse.js discovers a new server feature", $.proxy(function (mock, test_utils) {
it("emits the serviceDiscovered event", function () {
spyOn(converse, 'emit');
converse.features.create({'var': Strophe.NS.MAM});
expect(converse.emit).toHaveBeenCalled();
expect(converse.emit.argsForCall[0][1].get('var')).toBe(Strophe.NS.MAM);
});
}, converse, mock, test_utils));
}, converse, mock, test_utils));
}));
This diff is collapsed.
......@@ -4,9 +4,10 @@ define("converse-dependencies", [
"otr",
"moment_with_locales",
"strophe",
"strophe.vcard",
"strophe.disco",
"strophe.ping",
"strophe.rsm",
"strophe.vcard",
"backbone.browserStorage",
"backbone.overview",
"jquery.browser",
......
......@@ -3,9 +3,10 @@ define("converse-dependencies", [
"utils",
"moment_with_locales",
"strophe",
"strophe.vcard",
"strophe.disco",
"strophe.ping",
"strophe.rsm",
"strophe.vcard",
"backbone.browserStorage",
"backbone.overview",
"jquery.browser",
......
......@@ -3,9 +3,10 @@ define("converse-dependencies", [
"utils",
"moment_with_locales",
"strophe",
"strophe.vcard",
"strophe.disco",
"strophe.ping",
"strophe.rsm",
"strophe.vcard",
"bootstrapJS", // XXX: Can be removed, only for https://conversejs.org
"backbone.browserStorage",
"backbone.overview",
......
......@@ -5,9 +5,10 @@ define("converse-dependencies", [
"otr",
"moment_with_locales",
"strophe",
"strophe.vcard",
"strophe.disco",
"strophe.ping",
"strophe.rsm",
"strophe.vcard",
"bootstrapJS", // XXX: Only for https://conversejs.org
"backbone.browserStorage",
"backbone.overview",
......
<div class="chat-message {{extra_classes}}">
<div class="chat-message {{extra_classes}}" data-isodate="{{isodate}}">
<span class="chat-message-{{sender}}">{{time}} **{{username}} </span>
<span class="chat-message-content">{{message}}</span>
</div>
<div class="chat-message {{extra_classes}}">
<div class="chat-message {{extra_classes}}" data-isodate="{{isodate}}">
<span class="chat-message-{{sender}}">{{time}} {{username}}:&nbsp;</span>
<span class="chat-message-content">{{message}}</span>
</div>
<time class="chat-date" datetime="{{isodate}}">{{datestring}}</time>
<time class="chat-date" data-isodate="{{isodate}}">{{datestring}}</time>
......@@ -50,6 +50,41 @@
return this;
};
$.fn.addEmoticons = function (allowed) {
if (allowed) {
if (this.length > 0) {
this.each(function (i, obj) {
var text = $(obj).html();
text = text.replace(/&gt;:\)/g, '<span class="emoticon icon-evil"></span>');
text = text.replace(/:\)/g, '<span class="emoticon icon-smiley"></span>');
text = text.replace(/:\-\)/g, '<span class="emoticon icon-smiley"></span>');
text = text.replace(/;\)/g, '<span class="emoticon icon-wink"></span>');
text = text.replace(/;\-\)/g, '<span class="emoticon icon-wink"></span>');
text = text.replace(/:D/g, '<span class="emoticon icon-grin"></span>');
text = text.replace(/:\-D/g, '<span class="emoticon icon-grin"></span>');
text = text.replace(/:P/g, '<span class="emoticon icon-tongue"></span>');
text = text.replace(/:\-P/g, '<span class="emoticon icon-tongue"></span>');
text = text.replace(/:p/g, '<span class="emoticon icon-tongue"></span>');
text = text.replace(/:\-p/g, '<span class="emoticon icon-tongue"></span>');
text = text.replace(/8\)/g, '<span class="emoticon icon-cool"></span>');
text = text.replace(/:S/g, '<span class="emoticon icon-confused"></span>');
text = text.replace(/:\\/g, '<span class="emoticon icon-wondering"></span>');
text = text.replace(/:\/ /g, '<span class="emoticon icon-wondering"></span>');
text = text.replace(/&gt;:\(/g, '<span class="emoticon icon-angry"></span>');
text = text.replace(/:\(/g, '<span class="emoticon icon-sad"></span>');
text = text.replace(/:\-\(/g, '<span class="emoticon icon-sad"></span>');
text = text.replace(/:O/g, '<span class="emoticon icon-shocked"></span>');
text = text.replace(/:\-O/g, '<span class="emoticon icon-shocked"></span>');
text = text.replace(/\=\-O/g, '<span class="emoticon icon-shocked"></span>');
text = text.replace(/\(\^.\^\)b/g, '<span class="emoticon icon-thumbs-up"></span>');
text = text.replace(/&lt;3/g, '<span class="emoticon icon-heart"></span>');
$(obj).html(text);
});
}
}
return this;
};
var utils = {
// Translation machinery
// ---------------------
......
......@@ -60,7 +60,9 @@ require([
require([
"console-runner",
"spec/converse",
"spec/disco",
"spec/protocol",
"spec/mam",
"spec/otr",
"spec/eventemitter",
"spec/controlbox",
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment