powered by Jive Software

Getting Full Jid

Hi guys

Im pretty new to smack and Im faced with the following problem while trying to get the full JID.

I’m using roster.getPresences and then getfrom() to get the full JID but it keeps returning me what I have passed into this method. (i.e if if pass in “user1” it will return “user1” and "user1@127.0.0.1" will return "user1@127.0.0.1". How do I get the full JID (with the resources at the back) and p.isAvailable() keeps returning false although it states avaliable in the server’s admin panel.

public String getFullJid (String user) {
String fullJid = null;
Presence p=null;
Roster roster = connection.getRoster();
Iterator userPresences = roster.getPresences(user);
while (userPresences.hasNext()){
p=userPresences.next();
fullJid+= “\n” + p.getFrom() +" " + p.isAvailable();
}
return fullJid;
}

By the way, to use this method of getting the full JID, can I use the IP address instead of a dns resovleable name.

e.g I pass in example@127.0.0.1 instead of example@domain.com as the domain name

Thanks!

Droopy

Hi,

I faced the same problem!

Is there a way to get Full JID of a Roster (including Resource)?

Please give a sample code if possible,

any help would be appreciated

1 Like