Fixed JSLint warnings
This commit is contained in:
parent
dbf20052c3
commit
aad263868a
@ -12,7 +12,7 @@
|
|||||||
|
|
||||||
// AMD/global registrations
|
// AMD/global registrations
|
||||||
(function (root, factory) {
|
(function (root, factory) {
|
||||||
if (console===undefined || console.log===undefined) {
|
if (typeof console === undefined || typeof console.log === undefined) {
|
||||||
console = { log: function () {}, error: function () {} };
|
console = { log: function () {}, error: function () {} };
|
||||||
}
|
}
|
||||||
if (typeof define === 'function' && define.amd) {
|
if (typeof define === 'function' && define.amd) {
|
||||||
@ -68,15 +68,15 @@
|
|||||||
}).c("x", {
|
}).c("x", {
|
||||||
xmlns: Strophe.NS.MUC
|
xmlns: Strophe.NS.MUC
|
||||||
});
|
});
|
||||||
if (password != null) {
|
if (password !== null) {
|
||||||
msg.cnode(Strophe.xmlElement("password", [], password));
|
msg.cnode(Strophe.xmlElement("password", [], password));
|
||||||
}
|
}
|
||||||
if (this._muc_handler == null) {
|
if (this._muc_handler === null) {
|
||||||
this._muc_handler = this._connection.addHandler(function(stanza) {
|
this._muc_handler = this._connection.addHandler(function(stanza) {
|
||||||
var from, handler, handlers, id, roomname, x, xmlns, xquery, _i, _len;
|
var from, handler, handlers, id, roomname, x, xmlns, xquery, _i, _len;
|
||||||
from = stanza.getAttribute('from');
|
from = stanza.getAttribute('from');
|
||||||
roomname = from.split("/")[0];
|
roomname = from.split("/")[0];
|
||||||
if (!_this.rooms[roomname]) return true;
|
if (!_this.rooms[roomname]) { return true; }
|
||||||
room = _this.rooms[roomname];
|
room = _this.rooms[roomname];
|
||||||
handlers = {};
|
handlers = {};
|
||||||
if (stanza.nodeName === "message") {
|
if (stanza.nodeName === "message") {
|
||||||
@ -96,19 +96,23 @@
|
|||||||
}
|
}
|
||||||
for (id in handlers) {
|
for (id in handlers) {
|
||||||
handler = handlers[id];
|
handler = handlers[id];
|
||||||
if (!handler(stanza, room)) delete handlers[id];
|
if (!handler(stanza, room)) { delete handlers[id]; }
|
||||||
}
|
}
|
||||||
return true;
|
return true;
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
if ((_base = this.rooms)[room] == null) {
|
if ((_base = this.rooms)[room] === null) {
|
||||||
_base[room] = new XmppRoom(this, room, nick, password);
|
_base[room] = new XmppRoom(this, room, nick, password);
|
||||||
}
|
}
|
||||||
if (pres_handler_cb) {
|
if (pres_handler_cb) {
|
||||||
this.rooms[room].addHandler('presence', pres_handler_cb);
|
this.rooms[room].addHandler('presence', pres_handler_cb);
|
||||||
}
|
}
|
||||||
if (msg_handler_cb) this.rooms[room].addHandler('message', msg_handler_cb);
|
if (msg_handler_cb) {
|
||||||
if (roster_cb) this.rooms[room].addHandler('roster', roster_cb);
|
this.rooms[room].addHandler('message', msg_handler_cb);
|
||||||
|
}
|
||||||
|
if (roster_cb) {
|
||||||
|
this.rooms[room].addHandler('roster', roster_cb);
|
||||||
|
}
|
||||||
return this._connection.send(msg);
|
return this._connection.send(msg);
|
||||||
},
|
},
|
||||||
|
|
||||||
@ -137,8 +141,10 @@
|
|||||||
from: this._connection.jid,
|
from: this._connection.jid,
|
||||||
to: room_nick
|
to: room_nick
|
||||||
});
|
});
|
||||||
if (exit_msg != null) presence.c("status", exit_msg);
|
if (exit_msg !== null) {
|
||||||
if (handler_cb != null) {
|
presence.c("status", exit_msg);
|
||||||
|
}
|
||||||
|
if (handler_cb !== null) {
|
||||||
this._connection.addHandler(handler_cb, null, "presence", null, presenceid);
|
this._connection.addHandler(handler_cb, null, "presence", null, presenceid);
|
||||||
}
|
}
|
||||||
this._connection.send(presence);
|
this._connection.send(presence);
|
||||||
@ -158,7 +164,7 @@
|
|||||||
*/
|
*/
|
||||||
var msg, msgid, parent, room_nick;
|
var msg, msgid, parent, room_nick;
|
||||||
room_nick = this.test_append_nick(room, nick);
|
room_nick = this.test_append_nick(room, nick);
|
||||||
type = type || (nick != null ? "chat" : "groupchat");
|
type = type || (nick !== null ? "chat" : "groupchat");
|
||||||
msgid = this._connection.getUniqueId();
|
msgid = this._connection.getUniqueId();
|
||||||
msg = $msg({
|
msg = $msg({
|
||||||
to: room_nick,
|
to: room_nick,
|
||||||
@ -169,12 +175,9 @@
|
|||||||
xmlns: Strophe.NS.CLIENT
|
xmlns: Strophe.NS.CLIENT
|
||||||
}).t(message);
|
}).t(message);
|
||||||
msg.up();
|
msg.up();
|
||||||
if (html_message != null) {
|
if (html_message !== null) {
|
||||||
msg.c("html", {
|
msg.c("html", {xmlns: Strophe.NS.XHTML_IM}).c("body", {xmlns: Strophe.NS.XHTML}).h(html_message);
|
||||||
xmlns: Strophe.NS.XHTML_IM
|
|
||||||
}).c("body", {
|
|
||||||
xmlns: Strophe.NS.XHTML
|
|
||||||
}).h(html_message);
|
|
||||||
if (msg.node.childNodes.length === 0) {
|
if (msg.node.childNodes.length === 0) {
|
||||||
parent = msg.node.parentNode;
|
parent = msg.node.parentNode;
|
||||||
msg.up().up();
|
msg.up().up();
|
||||||
@ -222,7 +225,9 @@
|
|||||||
}).c('invite', {
|
}).c('invite', {
|
||||||
to: receiver
|
to: receiver
|
||||||
});
|
});
|
||||||
if (reason != null) invitation.c('reason', reason);
|
if (reason !== null) {
|
||||||
|
invitation.c('reason', reason);
|
||||||
|
}
|
||||||
this._connection.send(invitation);
|
this._connection.send(invitation);
|
||||||
return msgid;
|
return msgid;
|
||||||
},
|
},
|
||||||
@ -244,8 +249,8 @@
|
|||||||
xmlns: 'jabber:x:conference',
|
xmlns: 'jabber:x:conference',
|
||||||
jid: room
|
jid: room
|
||||||
};
|
};
|
||||||
if (reason != null) attrs.reason = reason;
|
if (reason !== null) { attrs.reason = reason; }
|
||||||
if (password != null) attrs.password = password;
|
if (password !== null) { attrs.password = password; }
|
||||||
invitation = $msg({
|
invitation = $msg({
|
||||||
from: this._connection.jid,
|
from: this._connection.jid,
|
||||||
to: receiver,
|
to: receiver,
|
||||||
@ -293,7 +298,7 @@
|
|||||||
});
|
});
|
||||||
stanza = config.tree();
|
stanza = config.tree();
|
||||||
id = this._connection.sendIQ(stanza);
|
id = this._connection.sendIQ(stanza);
|
||||||
if (handler_cb != null) {
|
if (handler_cb !== null) {
|
||||||
this._connection.addHandler(function(stanza) { handler_cb(stanza);
|
this._connection.addHandler(function(stanza) { handler_cb(stanza);
|
||||||
return false;
|
return false;
|
||||||
}, Strophe.NS.MUC_OWNER, "iq", null, id);
|
}, Strophe.NS.MUC_OWNER, "iq", null, id);
|
||||||
@ -405,7 +410,7 @@
|
|||||||
}).c("query", {
|
}).c("query", {
|
||||||
xmlns: Strophe.NS.MUC_ADMIN
|
xmlns: Strophe.NS.MUC_ADMIN
|
||||||
}).cnode(item.node);
|
}).cnode(item.node);
|
||||||
if (reason != null) iq.c("reason", reason);
|
if (reason !== null) { iq.c("reason", reason); }
|
||||||
return this._connection.sendIQ(iq.tree(), handler_cb, error_cb);
|
return this._connection.sendIQ(iq.tree(), handler_cb, error_cb);
|
||||||
},
|
},
|
||||||
|
|
||||||
@ -515,8 +520,8 @@
|
|||||||
from: this._connection.jid,
|
from: this._connection.jid,
|
||||||
to: room_nick
|
to: room_nick
|
||||||
});
|
});
|
||||||
if (show != null) presence.c('show', show).up();
|
if (show !== null) { presence.c('show', show).up(); }
|
||||||
if (status != null) presence.c('status', status);
|
if (status !== null) { presence.c('status', status); }
|
||||||
return this._connection.send(presence.tree());
|
return this._connection.send(presence.tree());
|
||||||
},
|
},
|
||||||
|
|
||||||
@ -537,7 +542,7 @@
|
|||||||
return this._connection.sendIQ(iq, handle_cb);
|
return this._connection.sendIQ(iq, handle_cb);
|
||||||
},
|
},
|
||||||
test_append_nick: function(room, nick) {
|
test_append_nick: function(room, nick) {
|
||||||
return room + (nick != null ? "/" + (Strophe.escapeNode(nick)) : "");
|
return room + (nick !== null ? "/" + (Strophe.escapeNode(nick)) : "");
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
|
||||||
@ -555,7 +560,7 @@
|
|||||||
this.password = password;
|
this.password = password;
|
||||||
this._roomRosterHandler = __bind(this._roomRosterHandler, this);
|
this._roomRosterHandler = __bind(this._roomRosterHandler, this);
|
||||||
this._addOccupant = __bind(this._addOccupant, this);
|
this._addOccupant = __bind(this._addOccupant, this);
|
||||||
if (client.muc) this.client = client.muc;
|
if (client.muc) { this.client = client.muc; }
|
||||||
this.name = Strophe.getBareJidFromJid(name);
|
this.name = Strophe.getBareJidFromJid(name);
|
||||||
this.client.rooms[this.name] = this;
|
this.client.rooms[this.name] = this;
|
||||||
this.addHandler('presence', this._roomRosterHandler);
|
this.addHandler('presence', this._roomRosterHandler);
|
||||||
@ -753,7 +758,7 @@
|
|||||||
_ref = this._roster_handlers;
|
_ref = this._roster_handlers;
|
||||||
for (id in _ref) {
|
for (id in _ref) {
|
||||||
handler = _ref[id];
|
handler = _ref[id];
|
||||||
if (!handler(this.roster, this)) delete this._roster_handlers[id];
|
if (!handler(this.roster, this)) { delete this._roster_handlers[id]; }
|
||||||
}
|
}
|
||||||
return true;
|
return true;
|
||||||
};
|
};
|
||||||
@ -845,6 +850,7 @@
|
|||||||
for (_k = 0, _len3 = _ref.length; _k < _len3; _k++) {
|
for (_k = 0, _len3 = _ref.length; _k < _len3; _k++) {
|
||||||
field = _ref[_k];
|
field = _ref[_k];
|
||||||
if (!(!field.attributes.type)) continue;
|
if (!(!field.attributes.type)) continue;
|
||||||
|
|
||||||
attrs = field.attributes;
|
attrs = field.attributes;
|
||||||
this.x.push({
|
this.x.push({
|
||||||
"var": attrs["var"].textContent,
|
"var": attrs["var"].textContent,
|
||||||
@ -862,7 +868,6 @@
|
|||||||
};
|
};
|
||||||
|
|
||||||
return RoomConfig;
|
return RoomConfig;
|
||||||
|
|
||||||
})();
|
})();
|
||||||
|
|
||||||
Occupant = (function() {
|
Occupant = (function() {
|
||||||
|
Loading…
Reference in New Issue
Block a user