Closed Shakarhaba closed 12 years ago
Functions defined in plugins appear under the plugin's name under the connection object. So this plugin's exports appear as conn.roster.*.
From reading the code of the plugin, I see get() which is documented that it gets the roster on the server, so
connection.roster.get();
should be all you need. You can then use findItem() to get a specific jid from the roster, or access the items array yourself. The structure of the items is also documented in the code: https://github.com/metajack/strophejs-plugins/blob/master/roster/strophe.roster.js#L21-37
In the future, please file such bugs on the strophejs-plugins project instead of here. Or better yet, ask questions on the Strophe.js mailing list: http://groups.google.com/group/strophe
Strophe js has a great amount of plugins, in this case I'm trying to use the roster plugin. I haven't found documentation related to plugin usage so I'm kind of lost and I would really appreciate your help. Roster plugin: https://github.com/metajack/strophejs-plugins/tree/master/roster
What I've done is add both the Strophejs .js file and the Strophe.roster.js file to my .html file like this (plus the jQuery lib):
I've stablished a connection with the server successfully, the user I'm connecting appears in Jabber clients such as Pidgin.
function OnConnectionStatus(nStatus) { if (nStatus == Strophe.Status.CONNECTING) { } else if (nStatus == Strophe.Status.CONNFAIL) { console.log('connection error'); } else if (nStatus == Strophe.Status.DISCONNECTING) { } else if (nStatus == Strophe.Status.DISCONNECTED) { } else if (nStatus == Strophe.Status.CONNECTED) { console.log('connected'); OnConnected(); } }
Also, I get the connected message in the terminal, so the connection is well made. But I don't know how to proceed from here, I don't know how to call the roster plugin from the OnConnected function so I get the roster (buddy list), I want to create some html/css markup with this info and show it in my html.
I would really appreciate if you could tell me how to call the plugins and in this particular case how to get the roster. Thank you so much in advanced!