Commit a2d27ee9 authored by JC Brand's avatar JC Brand

Merge branch 'master' into anon_login

Conflicts:
	converse.js
parents 1545fe9c 5ec7c67b
{ {
"name": "converse.js", "name": "converse.js",
"description": "Web-based XMPP/Jabber chat client written in javascript", "description": "Web-based XMPP/Jabber chat client written in javascript",
"version": "0.9.0", "version": "0.9.1",
"license": "MPL", "license": "MPL",
"devDependencies": { "devDependencies": {
"jasmine": "https://github.com/jcbrand/jasmine.git#1_3_x", "jasmine": "https://github.com/jcbrand/jasmine.git#1_3_x",
...@@ -18,7 +18,7 @@ ...@@ -18,7 +18,7 @@
"backbone.browserStorage": "*", "backbone.browserStorage": "*",
"backbone.overview": "*", "backbone.overview": "*",
"otr": "0.2.12", "otr": "0.2.12",
"crypto-js-evanvosberg": "~3.1.2", "crypto-js-evanvosberg": "3.1.2-5",
"almond": "~0.3.0", "almond": "~0.3.0",
"requirejs-text": "~2.0.12", "requirejs-text": "~2.0.12",
"requirejs-tpl-jcbrand": "*", "requirejs-tpl-jcbrand": "*",
......
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
...@@ -483,7 +483,7 @@ var __t, __p = '', __e = _.escape; ...@@ -483,7 +483,7 @@ var __t, __p = '', __e = _.escape;
with (obj) { with (obj) {
__p += '<form id="converse-login" method="post">\n <label>' + __p += '<form id="converse-login" method="post">\n <label>' +
((__t = (label_username)) == null ? '' : __t) + ((__t = (label_username)) == null ? '' : __t) +
'</label>\n <input type="username" name="jid" placeholder="user@server">\n <label>' + '</label>\n <input type="email" name="jid" placeholder="user@server">\n <label>' +
((__t = (label_password)) == null ? '' : __t) + ((__t = (label_password)) == null ? '' : __t) +
'</label>\n <input type="password" name="password" placeholder="password">\n <input class="submit" type="submit" value="' + '</label>\n <input type="password" name="password" placeholder="password">\n <input class="submit" type="submit" value="' +
((__t = (label_login)) == null ? '' : __t) + ((__t = (label_login)) == null ? '' : __t) +
...@@ -829,7 +829,9 @@ __p += '<form class="add-chatroom" action="" method="post">\n <label>' + ...@@ -829,7 +829,9 @@ __p += '<form class="add-chatroom" action="" method="post">\n <label>' +
((__t = (label_nickname)) == null ? '' : __t) + ((__t = (label_nickname)) == null ? '' : __t) +
'</label>\n <input type="text" name="nick" class="new-chatroom-nick"\n placeholder="' + '</label>\n <input type="text" name="nick" class="new-chatroom-nick"\n placeholder="' +
((__t = (label_nickname)) == null ? '' : __t) + ((__t = (label_nickname)) == null ? '' : __t) +
'"/>\n <label>' + '"/>\n <label' +
((__t = (server_label_global_attr)) == null ? '' : __t) +
'>' +
((__t = (label_server)) == null ? '' : __t) + ((__t = (label_server)) == null ? '' : __t) +
'</label>\n <input type="' + '</label>\n <input type="' +
((__t = (server_input_type)) == null ? '' : __t) + ((__t = (server_input_type)) == null ? '' : __t) +
...@@ -863,7 +865,8 @@ return __p ...@@ -863,7 +865,8 @@ return __p
this["templates"]["roster_item"] = function(obj) { this["templates"]["roster_item"] = function(obj) {
obj || (obj = {}); obj || (obj = {});
var __t, __p = '', __e = _.escape; var __t, __p = '', __e = _.escape, __j = Array.prototype.join;
function print() { __p += __j.call(arguments, '') }
with (obj) { with (obj) {
__p += '<a class="open-chat" title="Name: ' + __p += '<a class="open-chat" title="Name: ' +
((__t = (fullname)) == null ? '' : __t) + ((__t = (fullname)) == null ? '' : __t) +
...@@ -877,9 +880,13 @@ __p += '<a class="open-chat" title="Name: ' + ...@@ -877,9 +880,13 @@ __p += '<a class="open-chat" title="Name: ' +
((__t = (desc_status)) == null ? '' : __t) + ((__t = (desc_status)) == null ? '' : __t) +
'"></span>' + '"></span>' +
((__t = (fullname)) == null ? '' : __t) + ((__t = (fullname)) == null ? '' : __t) +
'</a>\n<a class="remove-xmpp-contact icon-remove" title="' + '</a>\n';
if (allow_contact_removal) { ;
__p += '\n<a class="remove-xmpp-contact icon-remove" title="' +
((__t = (desc_remove)) == null ? '' : __t) + ((__t = (desc_remove)) == null ? '' : __t) +
'" href="#"></a>\n'; '" href="#"></a>\n';
} ;
__p += '\n';
} }
return __p return __p
......
This diff is collapsed.
...@@ -886,6 +886,8 @@ ...@@ -886,6 +886,8 @@
white-space: nowrap; } white-space: nowrap; }
#conversejs .chatroom .participant-list li.moderator { #conversejs .chatroom .participant-list li.moderator {
color: #8f2831; } color: #8f2831; }
#conversejs .chatroom .participant-list li.visitor {
color: #A3A3A3; }
#conversejs .chatroom .chat-textarea { #conversejs .chatroom .chat-textarea {
border-bottom-right-radius: 0; } border-bottom-right-radius: 0; }
#conversejs .chatroom .chat-area { #conversejs .chatroom .chat-area {
......
This diff is collapsed.
Changelog Changelog
========= =========
0.9.1 (Unreleased) 0.9.2 (Undefined)
-----------------
* Bugfix. Prevent attaching twice during initialization. [jcbrand]
* API method chats.get can now also return chat boxes which haven't been opened yet. [jcbrand]
* Add API method contacts.add. [pzia]
* #356 Fix the plugin extend function. [floriancargoet]
* #357 Fix the known bug where a state notification reopens a chat box. [floriancargoet]
* #358 Bugfix. Chat rooms show the same occupants bug. [floriancargoet]
0.9.1 (2015-03-26)
------------------ ------------------
* Set the JID input field in the login form to ``type=email``. [chatme] * Set the JID input field in the login form to ``type=email``. [chatme]
* New configuration setting ``allow_contact_removal``. [jcbrand] * New configuration setting `allow_contact_removal <https://conversejs.org/docs/html/configuration.html#allow-contact-removal>`_ [jcbrand]
* Document that event handlers receive 'event' obj as first arg. [jcbrand] * Document that event handlers receive 'event' obj as first arg. [jcbrand]
* Add a test to check that notifications are played in chat rooms. [jcbrand] * Add a test to check that notifications are played in chat rooms. [jcbrand]
* Enable automatic reconnection when ``prebind`` and ``prebind_url`` are * #333 Enable automatic reconnection when ``prebind`` and ``prebind_url`` are specified. [jcbrand]
specified. [jcbrand] * #339 Require the JID to be specified when using ``keepalive`` with ``prebind``. Also add a logout API method. [jcbrand]
* #339 Require the JID to be specified when using ``keepalive`` with * #349 Indicate visitors in chat rooms. [c143]
``prebind``. Also add a logout API method. [jcbrand]
0.9.0 (2015-03-06) 0.9.0 (2015-03-06)
------------------ ------------------
......
...@@ -48,9 +48,9 @@ copyright = u'2014, JC Brand' ...@@ -48,9 +48,9 @@ copyright = u'2014, JC Brand'
# built documents. # built documents.
# #
# The short X.Y version. # The short X.Y version.
version = '0.9.0' version = '0.9.1'
# The full version, including alpha/beta/rc tags. # The full version, including alpha/beta/rc tags.
release = '0.9.0' release = '0.9.1'
# The language for content autogenerated by Sphinx. Refer to documentation # The language for content autogenerated by Sphinx. Refer to documentation
# for a list of supported languages. # for a list of supported languages.
......
...@@ -41,9 +41,8 @@ directory: ...@@ -41,9 +41,8 @@ directory:
make dev make dev
On Windows you need to specify Makefile.win to be used by running: On Windows you need to specify Makefile.win to be used by running: ::
::
make -f Makefile.win dev make -f Makefile.win dev
Or alternatively, if you don't have GNU Make: Or alternatively, if you don't have GNU Make:
...@@ -272,14 +271,26 @@ The returned roster contact objects have these attributes: ...@@ -272,14 +271,26 @@ The returned roster contact objects have these attributes:
| vcard_updated | When last the buddy's VCard was updated. | | vcard_updated | When last the buddy's VCard was updated. |
+----------------+--------------------------------------------------------------------------------------------------------------------------------------+ +----------------+--------------------------------------------------------------------------------------------------------------------------------------+
add
~~~
Add a contact.
Provide the JID of the contact you want to add::
converse.chats.add('buddy@example.com')
You may also provide the fullname. If not present, we use the jid as fullname.
converse.chats.add('buddy@example.com', 'Buddy')
"chats" grouping "chats" grouping
---------------- ----------------
get get
~~~ ~~~
Returns an object representing a chat box, if that chat box is already open. Returns an object representing a chat box.
If the chat box is not already open, this method will return ``null``.
To return a single chat box, provide the JID of the contact you're chatting To return a single chat box, provide the JID of the contact you're chatting
with in that chat box:: with in that chat box::
...@@ -308,7 +319,7 @@ To return an array of chat boxes, provide an array of JIDs:: ...@@ -308,7 +319,7 @@ To return an array of chat boxes, provide an array of JIDs::
converse.chats.open(['buddy1@example.com', 'buddy2@example.com']) converse.chats.open(['buddy1@example.com', 'buddy2@example.com'])
*The returned chat box contains the following methods:* *The returned chat box object contains the following methods:*
+-------------+------------------------------------------+ +-------------+------------------------------------------+
| Method | Description | | Method | Description |
...@@ -327,6 +338,8 @@ To return an array of chat boxes, provide an array of JIDs:: ...@@ -327,6 +338,8 @@ To return an array of chat boxes, provide an array of JIDs::
+-------------+------------------------------------------+ +-------------+------------------------------------------+
| close | Close the chat box. | | close | Close the chat box. |
+-------------+------------------------------------------+ +-------------+------------------------------------------+
| open | Opens the chat box. |
+-------------+------------------------------------------+
*The get and set methods can be used to retrieve and change the following attributes:* *The get and set methods can be used to retrieve and change the following attributes:*
......
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
{ {
"name": "converse.js", "name": "converse.js",
"version": "0.9.0", "version": "0.9.1",
"description": "Browser based XMPP instant messaging client", "description": "Browser based XMPP instant messaging client",
"main": "main.js", "main": "main.js",
"directories": { "directories": {
......
...@@ -431,7 +431,7 @@ ...@@ -431,7 +431,7 @@
this.chatboxes.onMessage(msg); this.chatboxes.onMessage(msg);
expect(converse.emit).toHaveBeenCalledWith('message', msg); expect(converse.emit).toHaveBeenCalledWith('message', msg);
}, converse)); }, converse));
waits(250); waits(50);
runs($.proxy(function () { runs($.proxy(function () {
// Check that the chatbox and its view now exist // Check that the chatbox and its view now exist
var chatbox = this.chatboxes.get(sender_jid); var chatbox = this.chatboxes.get(sender_jid);
...@@ -462,15 +462,11 @@ ...@@ -462,15 +462,11 @@
var contact_name = mock.cur_names[0]; var contact_name = mock.cur_names[0];
var contact_jid = contact_name.replace(/ /g,'.').toLowerCase() + '@localhost'; var contact_jid = contact_name.replace(/ /g,'.').toLowerCase() + '@localhost';
spyOn(this, 'emit'); spyOn(this, 'emit');
runs(function () {
test_utils.openChatBoxFor(contact_jid); test_utils.openChatBoxFor(contact_jid);
var chatview = converse.chatboxviews.get(contact_jid); var chatview = this.chatboxviews.get(contact_jid);
expect(chatview.$el.is(':visible')).toBeTruthy();
expect(chatview.model.get('minimized')).toBeFalsy(); expect(chatview.model.get('minimized')).toBeFalsy();
chatview.$el.find('.toggle-chatbox-button').click(); chatview.$el.find('.toggle-chatbox-button').click();
});
waits(50);
runs($.proxy(function () {
var chatview = this.chatboxviews.get(contact_jid);
expect(chatview.model.get('minimized')).toBeTruthy(); expect(chatview.model.get('minimized')).toBeTruthy();
var message = 'This message is sent to a minimized chatbox'; var message = 'This message is sent to a minimized chatbox';
var sender_jid = mock.cur_names[0].replace(/ /g,'.').toLowerCase() + '@localhost'; var sender_jid = mock.cur_names[0].replace(/ /g,'.').toLowerCase() + '@localhost';
...@@ -483,12 +479,10 @@ ...@@ -483,12 +479,10 @@
.c('active', {'xmlns': 'http://jabber.org/protocol/chatstates'}).tree(); .c('active', {'xmlns': 'http://jabber.org/protocol/chatstates'}).tree();
this.chatboxes.onMessage(msg); this.chatboxes.onMessage(msg);
expect(this.emit).toHaveBeenCalledWith('message', msg); expect(this.emit).toHaveBeenCalledWith('message', msg);
}, converse));
waits(50);
runs($.proxy(function () {
var trimmed_chatboxes = this.minimized_chats; var trimmed_chatboxes = this.minimized_chats;
var trimmedview = trimmed_chatboxes.get(contact_jid); var trimmedview = trimmed_chatboxes.get(contact_jid);
var $count = trimmedview.$el.find('.chat-head-message-count'); var $count = trimmedview.$el.find('.chat-head-message-count');
expect(chatview.$el.is(':visible')).toBeFalsy();
expect(trimmedview.model.get('minimized')).toBeTruthy(); expect(trimmedview.model.get('minimized')).toBeTruthy();
expect($count.is(':visible')).toBeTruthy(); expect($count.is(':visible')).toBeTruthy();
expect($count.html()).toBe('1'); expect($count.html()).toBe('1');
...@@ -501,23 +495,14 @@ ...@@ -501,23 +495,14 @@
}).c('body').t('This message is also sent to a minimized chatbox').up() }).c('body').t('This message is also sent to a minimized chatbox').up()
.c('active', {'xmlns': 'http://jabber.org/protocol/chatstates'}).tree() .c('active', {'xmlns': 'http://jabber.org/protocol/chatstates'}).tree()
); );
}, converse)); expect(chatview.$el.is(':visible')).toBeFalsy();
waits(50);
runs($.proxy(function () {
var trimmed_chatboxes = this.minimized_chats;
var trimmedview = trimmed_chatboxes.get(contact_jid);
var $count = trimmedview.$el.find('.chat-head-message-count');
expect(trimmedview.model.get('minimized')).toBeTruthy(); expect(trimmedview.model.get('minimized')).toBeTruthy();
$count = trimmedview.$el.find('.chat-head-message-count');
expect($count.is(':visible')).toBeTruthy(); expect($count.is(':visible')).toBeTruthy();
expect($count.html()).toBe('2'); expect($count.html()).toBe('2');
trimmedview.$el.find('.restore-chat').click(); trimmedview.$el.find('.restore-chat').click();
}, converse));
waits(250);
runs($.proxy(function () {
var trimmed_chatboxes = this.minimized_chats;
expect(trimmed_chatboxes.keys().length).toBe(0); expect(trimmed_chatboxes.keys().length).toBe(0);
}, converse)); }, converse));
}, converse));
it("will indicate when it has a time difference of more than a day between it and its predecessor", $.proxy(function () { it("will indicate when it has a time difference of more than a day between it and its predecessor", $.proxy(function () {
spyOn(converse, 'emit'); spyOn(converse, 'emit');
...@@ -591,11 +576,7 @@ ...@@ -591,11 +576,7 @@
it("can be sent from a chatbox, and will appear inside it", $.proxy(function () { it("can be sent from a chatbox, and will appear inside it", $.proxy(function () {
spyOn(converse, 'emit'); spyOn(converse, 'emit');
var contact_jid = mock.cur_names[0].replace(/ /g,'.').toLowerCase() + '@localhost'; var contact_jid = mock.cur_names[0].replace(/ /g,'.').toLowerCase() + '@localhost';
runs(function () {
test_utils.openChatBoxFor(contact_jid); test_utils.openChatBoxFor(contact_jid);
});
waits(250);
runs(function () {
expect(converse.emit).toHaveBeenCalledWith('chatBoxFocused', jasmine.any(Object)); expect(converse.emit).toHaveBeenCalledWith('chatBoxFocused', jasmine.any(Object));
var view = this.chatboxviews.get(contact_jid); var view = this.chatboxviews.get(contact_jid);
var message = 'This message is sent from this chatbox'; var message = 'This message is sent from this chatbox';
...@@ -605,7 +586,6 @@ ...@@ -605,7 +586,6 @@
expect(view.model.messages.length, 2); expect(view.model.messages.length, 2);
expect(converse.emit.mostRecentCall.args, ['messageSend', message]); expect(converse.emit.mostRecentCall.args, ['messageSend', message]);
expect(view.$el.find('.chat-content').find('.chat-message').last().find('.chat-message-content').text()).toEqual(message); expect(view.$el.find('.chat-content').find('.chat-message').last().find('.chat-message-content').text()).toEqual(message);
}.bind(converse));
}, converse)); }, converse));
it("is sanitized to prevent Javascript injection attacks", $.proxy(function () { it("is sanitized to prevent Javascript injection attacks", $.proxy(function () {
...@@ -697,6 +677,23 @@ ...@@ -697,6 +677,23 @@
describe("A Chat Status Notification", $.proxy(function () { describe("A Chat Status Notification", $.proxy(function () {
it("does not open automatically if a chat state notification is received", $.proxy(function () {
spyOn(converse, 'emit');
var sender_jid = mock.cur_names[1].replace(/ /g,'.').toLowerCase() + '@localhost';
// <composing> state
var msg = $msg({
from: sender_jid,
to: this.connection.jid,
type: 'chat',
id: (new Date()).getTime()
}).c('body').c('composing', {'xmlns': Strophe.NS.CHATSTATES}).tree();
this.chatboxes.onMessage(msg);
expect(converse.emit).toHaveBeenCalledWith('message', msg);
var chatboxview = this.chatboxviews.get(sender_jid);
expect(chatboxview).toBeDefined();
expect(chatboxview.$el.is(':visible')).toBeFalsy(); // The chat box is not visible
}, converse));
describe("An active notification", $.proxy(function () { describe("An active notification", $.proxy(function () {
it("is sent when the user opens a chat box", $.proxy(function () { it("is sent when the user opens a chat box", $.proxy(function () {
spyOn(converse.connection, 'send'); spyOn(converse.connection, 'send');
......
This diff is collapsed.
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