Skip to content

Commit de23f65

Browse files
committed
jshint fixes for roster plugin
1 parent fc9aeae commit de23f65

1 file changed

Lines changed: 24 additions & 24 deletions

File tree

roster/strophe.roster.js

Lines changed: 24 additions & 24 deletions
Original file line numberDiff line numberDiff line change
@@ -51,7 +51,7 @@ Strophe.addConnectionPlugin('roster',
5151
*/
5252
init: function(conn)
5353
{
54-
this._connection = conn;
54+
this._connection = conn;
5555
this.items = [];
5656
// Override the connect and attach methods to always add presence and roster handlers.
5757
// They are removed when the connection disconnects, so must be added on connection.
@@ -77,24 +77,24 @@ Strophe.addConnectionPlugin('roster',
7777
conn.connect = function(jid, pass, callback, wait, hold)
7878
{
7979
oldCallback = callback;
80-
if (typeof arguments[0] == "undefined")
81-
arguments[0] = null;
82-
if (typeof arguments[1] == "undefined")
83-
arguments[1] = null;
84-
arguments[2] = newCallback;
85-
_connect.apply(conn, arguments);
80+
if (typeof jid == "undefined")
81+
jid = null;
82+
if (typeof pass == "undefined")
83+
pass = null;
84+
callback = newCallback;
85+
_connect.apply(conn, [jid, pass, callback, wait, hold]);
8686
};
8787
conn.attach = function(jid, sid, rid, callback, wait, hold, wind)
8888
{
8989
oldCallback = callback;
90-
if (typeof arguments[0] == "undefined")
91-
arguments[0] = null;
92-
if (typeof arguments[1] == "undefined")
93-
arguments[1] = null;
94-
if (typeof arguments[2] == "undefined")
95-
arguments[2] = null;
96-
arguments[3] = newCallback;
97-
_attach.apply(conn, arguments);
90+
if (typeof jid == "undefined")
91+
jid = null;
92+
if (typeof sid == "undefined")
93+
sid = null;
94+
if (typeof rid == "undefined")
95+
rid = null;
96+
callback = newCallback;
97+
_attach.apply(conn, [jid, sid, rid, callback, wait, hold, wind]);
9898
};
9999

100100
Strophe.addNamespace('ROSTER_VER', 'urn:xmpp:features:rosterver');
@@ -207,7 +207,7 @@ Strophe.addConnectionPlugin('roster',
207207
unsubscribe: function(jid, message)
208208
{
209209
var pres = $pres({to: jid, type: "unsubscribe"});
210-
if (message && message != "")
210+
if (message && message !== "")
211211
pres.c("status").t(message);
212212
this._connection.send(pres);
213213
},
@@ -221,7 +221,7 @@ Strophe.addConnectionPlugin('roster',
221221
authorize: function(jid, message)
222222
{
223223
var pres = $pres({to: jid, type: "subscribed"});
224-
if (message && message != "")
224+
if (message && message !== "")
225225
pres.c("status").t(message);
226226
this._connection.send(pres);
227227
},
@@ -235,7 +235,7 @@ Strophe.addConnectionPlugin('roster',
235235
unauthorize: function(jid, message)
236236
{
237237
var pres = $pres({to: jid, type: "unsubscribed"});
238-
if (message && message != "")
238+
if (message && message !== "")
239239
pres.c("status").t(message);
240240
this._connection.send(pres);
241241
},
@@ -340,9 +340,9 @@ Strophe.addConnectionPlugin('roster',
340340
{
341341
// TODO: add timestamp
342342
item.resources[Strophe.getResourceFromJid(jid)] = {
343-
show : (presence.getElementsByTagName('show').length != 0) ? Strophe.getText(presence.getElementsByTagName('show')[0]) : "",
344-
status : (presence.getElementsByTagName('status').length != 0) ? Strophe.getText(presence.getElementsByTagName('status')[0]) : "",
345-
priority : (presence.getElementsByTagName('priority').length != 0) ? Strophe.getText(presence.getElementsByTagName('priority')[0]) : ""
343+
show : (presence.getElementsByTagName('show').length !== 0) ? Strophe.getText(presence.getElementsByTagName('show')[0]) : "",
344+
status : (presence.getElementsByTagName('status').length !== 0) ? Strophe.getText(presence.getElementsByTagName('status')[0]) : "",
345+
priority : (presence.getElementsByTagName('priority').length !== 0) ? Strophe.getText(presence.getElementsByTagName('priority')[0]) : ""
346346
};
347347
}
348348
else
@@ -371,7 +371,7 @@ Strophe.addConnectionPlugin('roster',
371371
var id = iq.getAttribute('id');
372372
var from = iq.getAttribute('from');
373373
// Receiving client MUST ignore stanza unless it has no from or from = user's JID.
374-
if (from && from != "" && from != this._connection.jid && from != Strophe.getBareJidFromJid(this._connection.jid))
374+
if (from && from !== "" && from != this._connection.jid && from != Strophe.getBareJidFromJid(this._connection.jid))
375375
return true;
376376
var iqresult = $iq({type: 'result', id: id, from: this._connection.jid});
377377
this._connection.send(iqresult);
@@ -384,7 +384,7 @@ Strophe.addConnectionPlugin('roster',
384384
_updateItems : function(iq)
385385
{
386386
var query = iq.getElementsByTagName('query');
387-
if (query.length != 0)
387+
if (query.length !== 0)
388388
{
389389
this.ver = query.item(0).getAttribute('ver');
390390
var self = this;
@@ -420,7 +420,7 @@ Strophe.addConnectionPlugin('roster',
420420
return;
421421
}
422422

423-
var item = this.findItem(jid);
423+
item = this.findItem(jid);
424424
if (!item)
425425
{
426426
this.items.push({

0 commit comments

Comments
 (0)