Commit e6c5a6c5 authored by JC Brand's avatar JC Brand

Merge pull request #2 from alecghica/master

Code clean up + updated error message
parents ffbacad9 0f9c088c
......@@ -8,7 +8,7 @@ Permission is hereby granted, free of charge, to any person obtaining
a copy of this software and associated documentation files (the "Software"),
to deal in the Software without restriction, including without limitation
the rights to use, copy, modify, merge, publish, distribute, sublicense,
and/or sell copies of the Software, and to permit persons to whom the
and/or sell copies of the Software, and to permit persons to whom the
Software is furnished to do so, subject to the following conditions:
The above copyright notice and this permission notice shall be included
......
......@@ -12,7 +12,7 @@ Features
It has the following features:
* Manually or automically subscribe to other users.
* Manually or automically subscribe to other users.
* With manual roster subscriptions, you can accept or decline contact requests.
* Chat statuses (online, busy, away, offline)
* Custom status message
......@@ -20,7 +20,7 @@ It has the following features:
* Third person messages (/me )
* Multi-user chat in chatrooms
* Topics can be set for chatrooms
* Full name and profile picture support
* Full name and profile picture support
Converse.js is used by collective.xmpp.chat_, which is a Plone_ instant
messaging add-on.
......
......@@ -30,7 +30,7 @@
}
#connecting-to-chat {
background: url('/spinner.gif') no-repeat;
background: url(images/spinner.gif) no-repeat left;
padding-left: 1.4em;
}
......
......@@ -460,8 +460,8 @@
}
else if (match[1] === "help") {
msgs = [
'<strong>/help</strong>: Show this menu',
'<strong>/clear</strong>: Remove messages'
'<strong>/help</strong>: Show this menu',
'<strong>/clear</strong>: Remove messages'
];
this.addHelpMessages(msgs);
return;
......@@ -501,7 +501,7 @@
this.$el.data('composing', false);
} else {
composing = this.$el.data('composing');
if (!composing) {
if (!composing) {
if (ev.keyCode != 47) {
// We don't send composing messages if the message
// starts with forward-slash.
......@@ -931,10 +931,10 @@
initialize: function () {
xmppchat.connection.muc.join(
this.model.get('jid'),
this.model.get('nick'),
$.proxy(this.onChatRoomMessage, this),
$.proxy(this.onChatRoomPresence, this),
this.model.get('jid'),
this.model.get('nick'),
$.proxy(this.onChatRoomMessage, this),
$.proxy(this.onChatRoomPresence, this),
$.proxy(this.onChatRoomRoster, this));
},
......@@ -978,7 +978,7 @@
}
} else {
if (sender === this.model.get('nick')) {
// Our own message which is already appended
// Our own message which is already appended
return true;
} else {
$chat_content.find('div.chat-event').remove();
......@@ -1292,7 +1292,7 @@
that = this,
subscription = item.get('subscription');
this.$el.addClass(item.get('presence_type'));
if (ask === 'subscribe') {
this.$el.addClass('pending-xmpp-contact');
this.$el.html(this.pending_template(item.toJSON()));
......@@ -1678,14 +1678,14 @@
store.set(xmppchat.connection.bare_jid+'-xmpp-status', value);
},
getStatusMessage: function () {
return store.get(xmppchat.connection.bare_jid+'-xmpp-custom-status');
},
setStatusMessage: function (status_message) {
xmppchat.connection.send($pres({'type':this.getStatus()}).c('status').t(status_message));
this.set({'status_message': status_message});
store.set(xmppchat.connection.bare_jid+'-xmpp-custom-status', status_message);
},
getStatusMessage: function () {
return store.get(xmppchat.connection.bare_jid+'-xmpp-custom-status');
}
});
......@@ -1815,8 +1815,10 @@
}).render();
$(document).bind('jarnxmpp.disconnected', $.proxy(function (ev, conn) {
$connecting.show();
$toggle.hide();
$connecting.show();
$connecting.html('Unable to communicate with chat server');
$connecting.css('background-image', "url(images/error_icon.png)");
console.log("Connection Failed :(");
}, this));
......
......@@ -9,7 +9,7 @@
</head>
<body>
<h1>Converse.js Demo Page</h1>
Log in with your Jabber/XMPP ID and password.
Log in with your Jabber/XMPP ID and password.
<!-- login dialog -->
<div id='login_dialog' class='hidden'>
<label>Login ID:</label>
......
......@@ -192,11 +192,11 @@
for (i=10; i<15; i++) {
expect($(contacts[i]).attr('class').split(' ',1)[0]).toEqual('away');
}
// The next five are unavailable
// The next five are unavailable
for (i=15; i<20; i++) {
expect($(contacts[i]).attr('class').split(' ',1)[0]).toEqual('unavailable');
}
// The next 20 are offline
// The next 20 are offline
for (i=20; i<40; i++) {
expect($(contacts[i]).attr('class').split(' ',1)[0]).toEqual('offline');
}
......
......@@ -35,7 +35,7 @@
expect(this.storage.getOpenChats()).toEqual(['chat1@localhost', 'chat2@localhost']);
this.storage.addOpenChat('chat3@localhost');
expect(this.storage.getOpenChats()).toEqual(['chat1@localhost',
expect(this.storage.getOpenChats()).toEqual(['chat1@localhost',
'chat2@localhost',
'chat3@localhost']);
});
......@@ -47,12 +47,12 @@
this.storage.addOpenChat('chat1@localhost');
this.storage.addOpenChat('chat2@localhost');
this.storage.addOpenChat('chat3@localhost');
expect(this.storage.getOpenChats()).toEqual(['chat1@localhost',
expect(this.storage.getOpenChats()).toEqual(['chat1@localhost',
'chat2@localhost',
'chat3@localhost']);
this.storage.removeOpenChat('chat2@localhost');
expect(this.storage.getOpenChats()).toEqual(['chat1@localhost',
expect(this.storage.getOpenChats()).toEqual(['chat1@localhost',
'chat3@localhost']);
this.storage.removeOpenChat('chat1@localhost');
......@@ -84,7 +84,7 @@
expect(msgs.length).toEqual(i+1);
expect(msgs[i]).toEqual(jasmine.any(String));
// First two space separated strings are ISO date and direction
// First two space separated strings are ISO date and direction
var msg_arr = msgs[i].split(' ', 2);
// Check that first string is ISO format
expect(msg_arr[0]).toMatch(iso_regex);
......
require(["jquery",
"spec/StorageSpec",
require(["jquery",
"spec/StorageSpec",
"spec/RosterSpec"], function($) {
$(function($) {
......
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