Skip to content

Commit b1f364e

Browse files
committed
plugin now works with multiple connections
1 parent de23f65 commit b1f364e

1 file changed

Lines changed: 26 additions & 29 deletions

File tree

roster/strophe.roster.js

Lines changed: 26 additions & 29 deletions
Original file line numberDiff line numberDiff line change
@@ -15,34 +15,6 @@
1515
*/
1616
Strophe.addConnectionPlugin('roster',
1717
{
18-
_connection: null,
19-
20-
_callbacks : [],
21-
/** Property: items
22-
* Roster items
23-
* [
24-
* {
25-
* name : "",
26-
* jid : "",
27-
* subscription : "",
28-
* ask : "",
29-
* groups : ["", ""],
30-
* resources : {
31-
* myresource : {
32-
* show : "",
33-
* status : "",
34-
* priority : ""
35-
* }
36-
* }
37-
* }
38-
* ]
39-
*/
40-
items : [],
41-
/** Property: ver
42-
* current roster revision
43-
* always null if server doesn't support xep 237
44-
*/
45-
ver : null,
4618
/** Function: init
4719
* Plugin init
4820
*
@@ -52,7 +24,32 @@ Strophe.addConnectionPlugin('roster',
5224
init: function(conn)
5325
{
5426
this._connection = conn;
55-
this.items = [];
27+
this._callbacks = [];
28+
/** Property: items
29+
* Roster items
30+
* [
31+
* {
32+
* name : "",
33+
* jid : "",
34+
* subscription : "",
35+
* ask : "",
36+
* groups : ["", ""],
37+
* resources : {
38+
* myresource : {
39+
* show : "",
40+
* status : "",
41+
* priority : ""
42+
* }
43+
* }
44+
* }
45+
* ]
46+
*/
47+
items = [];
48+
/** Property: ver
49+
* current roster revision
50+
* always null if server doesn't support xep 237
51+
*/
52+
ver = null;
5653
// Override the connect and attach methods to always add presence and roster handlers.
5754
// They are removed when the connection disconnects, so must be added on connection.
5855
var oldCallback, roster = this, _connect = conn.connect, _attach = conn.attach;

0 commit comments

Comments
 (0)