Commit 3cf67188 authored by ichim-david's avatar ichim-david

Fixed the following:

- Fixed function has inconsistent return points by always specifying
  returns instead of returning only on condition
- Set room-jid as data-room-jid attribute to validate html5
- Added missing semicolon
parent 447c3a8d
...@@ -186,7 +186,8 @@ ...@@ -186,7 +186,8 @@
var msgs = store.get(hex_sha1(this.get('own_jid')+bare_jid)) || []; var msgs = store.get(hex_sha1(this.get('own_jid')+bare_jid)) || [];
if (msgs.length) { if (msgs.length) {
return sjcl.decrypt(hex_sha1(this.get('own_jid')), msgs[msgs.length-1]); return sjcl.decrypt(hex_sha1(this.get('own_jid')), msgs[msgs.length-1]);
} }
return undefined;
}, },
clearMessages: function (jid) { clearMessages: function (jid) {
...@@ -651,7 +652,9 @@ ...@@ -651,7 +652,9 @@
}, },
room_template: _.template( room_template: _.template(
'<dd class="available-chatroom">' + '<dd class="available-chatroom">' +
'<a class="open-room" room-jid="{{jid}}" title="Click to open this chatroom" href="#">' + '<a class="open-room" data-room-jid="{{jid}}"' +
' title="Click to open this chatroom"' +
' href="#">' +
'{{name}}</a></dd>'), '{{name}}</a></dd>'),
tab_template: _.template('<li><a class="s" href="#chatrooms">Rooms</a></li>'), tab_template: _.template('<li><a class="s" href="#chatrooms">Rooms</a></li>'),
...@@ -701,7 +704,7 @@ ...@@ -701,7 +704,7 @@
ev.preventDefault(); ev.preventDefault();
var name, jid; var name, jid;
if (ev.type === 'click') { if (ev.type === 'click') {
jid = $(ev.target).attr('room-jid'); jid = $(ev.target).attr('data-room-jid');
} else { } else {
name = _.str.strip($(ev.target).find('input.new-chatroom-name').val()).toLowerCase(); name = _.str.strip($(ev.target).find('input.new-chatroom-name').val()).toLowerCase();
if (name) { if (name) {
...@@ -1115,12 +1118,13 @@ ...@@ -1115,12 +1118,13 @@
view.messageReceived(message); view.messageReceived(message);
xmppchat.roster.addResource(partner_jid, resource); xmppchat.roster.addResource(partner_jid, resource);
}, this)); }, this));
return; return undefined;
} else if (!view.isVisible()) { } else if (!view.isVisible()) {
this.showChat(partner_jid); this.showChat(partner_jid);
} }
view.messageReceived(message); view.messageReceived(message);
xmppchat.roster.addResource(partner_jid, resource); xmppchat.roster.addResource(partner_jid, resource);
return true;
}, },
initialize: function () { initialize: function () {
...@@ -1394,6 +1398,7 @@ ...@@ -1394,6 +1398,7 @@
if (item) { if (item) {
return _.size(item.get('resources')); return _.size(item.get('resources'));
} }
return 0;
}, },
getNumOnlineContacts: function () { getNumOnlineContacts: function () {
...@@ -1779,7 +1784,7 @@ ...@@ -1779,7 +1784,7 @@
$(document).unbind('jarnxmpp.connected'); $(document).unbind('jarnxmpp.connected');
$(document).bind('jarnxmpp.connected', $.proxy(function (ev, connection) { $(document).bind('jarnxmpp.connected', $.proxy(function (ev, connection) {
this.connection = connection this.connection = connection;
// this.connection.xmlInput = function (body) { console.log(body); }; // this.connection.xmlInput = function (body) { console.log(body); };
// this.connection.xmlOutput = function (body) { console.log(body); }; // this.connection.xmlOutput = function (body) { console.log(body); };
this.connection.bare_jid = Strophe.getBareJidFromJid(this.connection.jid); this.connection.bare_jid = Strophe.getBareJidFromJid(this.connection.jid);
......
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