maxpowel / jQuery-XMPP-plugin

Javascript library for the XMMP protocol
http://plugins.jquery.com/project/xmpp-lib
163 stars 50 forks source link

How to get Roster? #4

Closed zenwong closed 12 years ago

zenwong commented 12 years ago

is there anyway to get the roster?

using sendCommand? but I'm not sure what I need to put in rawCommand.

maxpowel commented 12 years ago

Hi! When you connect to your xmpp server, the server should send you the roster. It is caught and sent to onPresence event, one event per user in the roster. But it is only optional (as is said here http://xmpp.org/rfcs/rfc3921.html#intro-requirements) so I will add a way to do an excplicity roster request. I will notice when this feature is ready, hope today

maxpowel commented 12 years ago

I have just pushed this feature. Once you are connected the roster can be fetched like this: $.xmpp.getRoster(function(roster){ //process roster });

The callback function will recibe an array containing the roster. Every entry of this array is an object with the values name, subscription an jid. You can see the basic-connection.html example to see how it works.

If your problem is solved, please close the issue. Thanks!

zenwong commented 12 years ago

It's working, thanks dude

ghost commented 12 years ago

The getRoster callback is never called, but I received the iq response through onIq.

I am using ejabberd 2.1.2-2ubuntu0.1 as xmpp server.

ghost commented 12 years ago

Hi, I am getting this error message "TypeError $.xmpp is undefined" in firefox and, "Uncaught TypeError: Cannot call method 'connect' of undefined" in chrome.

It was working fine but suddenly i am seeing this messages