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",
"description": "Web-based XMPP/Jabber chat client written in javascript",
"version": "0.9.0",
"version": "0.9.1",
"license": "MPL",
"devDependencies": {
"jasmine": "https://github.com/jcbrand/jasmine.git#1_3_x",
......@@ -18,7 +18,7 @@
"backbone.browserStorage": "*",
"backbone.overview": "*",
"otr": "0.2.12",
"crypto-js-evanvosberg": "~3.1.2",
"crypto-js-evanvosberg": "3.1.2-5",
"almond": "~0.3.0",
"requirejs-text": "~2.0.12",
"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;
with (obj) {
__p += '<form id="converse-login" method="post">\n <label>' +
((__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) +
'</label>\n <input type="password" name="password" placeholder="password">\n <input class="submit" type="submit" value="' +
((__t = (label_login)) == null ? '' : __t) +
......@@ -829,7 +829,9 @@ __p += '<form class="add-chatroom" action="" method="post">\n <label>' +
((__t = (label_nickname)) == null ? '' : __t) +
'</label>\n <input type="text" name="nick" class="new-chatroom-nick"\n placeholder="' +
((__t = (label_nickname)) == null ? '' : __t) +
'"/>\n <label>' +
'"/>\n <label' +
((__t = (server_label_global_attr)) == null ? '' : __t) +
'>' +
((__t = (label_server)) == null ? '' : __t) +
'</label>\n <input type="' +
((__t = (server_input_type)) == null ? '' : __t) +
......@@ -863,7 +865,8 @@ return __p
this["templates"]["roster_item"] = function(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) {
__p += '<a class="open-chat" title="Name: ' +
((__t = (fullname)) == null ? '' : __t) +
......@@ -877,9 +880,13 @@ __p += '<a class="open-chat" title="Name: ' +
((__t = (desc_status)) == null ? '' : __t) +
'"></span>' +
((__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) +
'" href="#"></a>\n';
} ;
__p += '\n';
}
return __p
......
This diff is collapsed.
......@@ -886,6 +886,8 @@
white-space: nowrap; }
#conversejs .chatroom .participant-list li.moderator {
color: #8f2831; }
#conversejs .chatroom .participant-list li.visitor {
color: #A3A3A3; }
#conversejs .chatroom .chat-textarea {
border-bottom-right-radius: 0; }
#conversejs .chatroom .chat-area {
......
This diff is collapsed.
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]
* 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]
* Add a test to check that notifications are played in chat rooms. [jcbrand]
* Enable automatic reconnection when ``prebind`` and ``prebind_url`` are
specified. [jcbrand]
* #339 Require the JID to be specified when using ``keepalive`` with
``prebind``. Also add a logout API method. [jcbrand]
* #333 Enable automatic reconnection when ``prebind`` and ``prebind_url`` are specified. [jcbrand]
* #339 Require the JID to be specified when using ``keepalive`` with ``prebind``. Also add a logout API method. [jcbrand]
* #349 Indicate visitors in chat rooms. [c143]
0.9.0 (2015-03-06)
------------------
......
......@@ -48,9 +48,9 @@ copyright = u'2014, JC Brand'
# built documents.
#
# The short X.Y version.
version = '0.9.0'
version = '0.9.1'
# 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
# for a list of supported languages.
......
......@@ -41,9 +41,8 @@ directory:
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
Or alternatively, if you don't have GNU Make:
......@@ -272,14 +271,26 @@ The returned roster contact objects have these attributes:
| 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
----------------
get
~~~
Returns an object representing a chat box, if that chat box is already open.
If the chat box is not already open, this method will return ``null``.
Returns an object representing a chat box.
To return a single chat box, provide the JID of the contact you're chatting
with in that chat box::
......@@ -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'])
*The returned chat box contains the following methods:*
*The returned chat box object contains the following methods:*
+-------------+------------------------------------------+
| Method | Description |
......@@ -327,6 +338,8 @@ To return an array of chat boxes, provide an array of JIDs::
+-------------+------------------------------------------+
| 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:*
......
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",
"version": "0.9.0",
"version": "0.9.1",
"description": "Browser based XMPP instant messaging client",
"main": "main.js",
"directories": {
......
This diff is collapsed.
......@@ -11,13 +11,57 @@
var b64_sha1 = converse_api.env.b64_sha1;
return describe("Converse", $.proxy(function(mock, test_utils) {
describe("Authentication", function () {
it("needs either a bosh_service_url a websocket_url or both", function () {
expect(converse.initConnection.bind({})).toThrow(
new Error("initConnection: you must supply a value for either the bosh_service_url or websocket_url or both."));
});
describe("with prebind", function () {
it("needs a jid when also using keepalive", function () {
var connection = converse.connection;
var jid = converse.jid;
converse.bosh_service_url = "localhost";
converse.connection = undefined;
converse.jid = undefined;
converse.keepalive = true;
converse.prebind = true;
expect(converse.initConnection.bind(converse)).toThrow(
new Error("initConnection: when using 'keepalive' with 'prebind, you must supply the JID of the current user."));
converse.bosh_service_url = undefined;
converse.connection = connection;
converse.jid = jid;
converse.keepalive = undefined;
converse.prebind = undefined;
});
it("needs jid, rid and sid values when not using keepalive", function () {
var connection = converse.connection;
var jid = converse.jid;
converse.bosh_service_url = "localhost";
converse.connection = undefined;
converse.jid = undefined;
converse.keepalive = false;
converse.prebind = true;
expect(converse.initConnection.bind(converse)).toThrow(
new Error("initConnection: If you use prebind and not keepalive, then you MUST supply JID, RID and SID values"));
converse.bosh_service_url = undefined;
converse.connection = connection;
converse.jid = jid;
converse.keepalive = undefined;
converse.prebind = undefined;
});
});
});
describe("The \"tokens\" API", $.proxy(function () {
beforeEach($.proxy(function () {
beforeEach(function () {
test_utils.closeAllChatBoxes();
test_utils.clearBrowserStorage();
converse.rosterview.model.reset();
test_utils.createContacts('current');
}, converse));
});
it("has a method for retrieving the next RID", $.proxy(function () {
var old_connection = converse.connection;
......@@ -57,26 +101,32 @@
it("has a method 'get' which returns wrapped contacts", $.proxy(function () {
// Check that it returns nothing if a non-existing JID is given
expect(converse_api.contacts.get('non-existing@jabber.org')).toBeFalsy();
// Check when a single jid is given
var jid = mock.cur_names[0].replace(/ /g,'.').toLowerCase() + '@localhost';
var attrs = converse_api.contacts.get(jid);
expect(typeof attrs).toBe('object');
expect(attrs.fullname).toBe(mock.cur_names[0]);
expect(attrs.jid).toBe(jid);
// You can retrieve multiple contacts by passing in an array
var jid2 = mock.cur_names[1].replace(/ /g,'.').toLowerCase() + '@localhost';
var list = converse_api.contacts.get([jid, jid2]);
expect(Array.isArray(list)).toBeTruthy();
expect(list[0].fullname).toBe(mock.cur_names[0]);
expect(list[1].fullname).toBe(mock.cur_names[1]);
// Check that all JIDs are returned if you call without any parameters
list = converse_api.contacts.get();
expect(list.length).toBe(mock.cur_names.length);
}, converse));
it("has a method 'add' with which contacts can be added", $.proxy(function () {
var error = new TypeError('contacts.add: invalid jid');
expect(converse_api.contacts.add).toThrow(error);
expect(converse_api.contacts.add.bind(converse_api, "invalid jid")).toThrow(error);
spyOn(converse.connection.roster, 'add');
converse_api.contacts.add("newcontact@example.org");
expect(converse.connection.roster.add).toHaveBeenCalled();
}, converse));
}, converse));
describe("The \"chats\" API", $.proxy(function() {
......@@ -87,21 +137,23 @@
test_utils.createContacts('current');
}, converse));
it("has a method 'get' which returns a wrapped chat box if it's already open", $.proxy(function () {
it("has a method 'get' which returns a wrapped chat box", $.proxy(function () {
// Test on chat that doesn't exist.
expect(converse_api.chats.get('non-existing@jabber.org')).toBeFalsy();
// Test on chat that's not open
var jid = mock.cur_names[0].replace(/ /g,'.').toLowerCase() + '@localhost';
var box = converse_api.chats.get(jid);
expect(box).toBe(null);
expect(box instanceof Object).toBeTruthy();
var chatboxview = this.chatboxviews.get(jid);
expect(chatboxview.$el.is(':visible')).toBeFalsy();
// Test for single JID
test_utils.openChatBoxFor(jid);
box = converse_api.chats.get(jid);
expect(box instanceof Object).toBeTruthy();
expect(box.get('box_id')).toBe(b64_sha1(jid));
var chatboxview = this.chatboxviews.get(jid);
chatboxview = this.chatboxviews.get(jid);
expect(chatboxview.$el.is(':visible')).toBeTruthy();
// Test for multiple JIDs
......
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