Hi,
Here’'s what I am doing. I create an XMPP connection, login and all is good till here as I can see that i have successfully logged in through the debugger. Then I try to first send a message to a logged in AOL user. Even though I see that the packet was sent in the enhanced debugger, the AOL user doesnt get it. Also, I add some AOL users manually to my roster by roster.createEntry(“user”); This I believe would send subscribe message to the user and then I can be informed of their presence auto.
When I get my roster, I iterate through it and see all thsoe entries. However, my presence object is always null and the status of the entry is “subscribe” (RosterPacket.ItemStatus.SUBSCRIPTION_PENDING)
I would expect the Presence object to be not null if the user is online. Am I missing something here?
Thanks,
Bharat
…
final XMPPConnection conn1 = new XMPPConnection(cf);
conn1.login(“scott”, “tiger”, “TEST”, false);
try {
Thread.sleep(10000); //this is so that we dont act too fast
} catch (InterruptedException e) {
e.printStackTrace();
}
//am good till here
conn1.createChat("xyz@aol.com").sendMessage(“test”);
final Roster r = conn1.getRoster();
try {
Thread.sleep(10000); //this is so that we dont act too fast
} catch (InterruptedException e) {
e.printStackTrace();
}
Iterator i = r.getEntries();
RosterEntry ri = null;
while (i.hasNext()) {
ri = (RosterEntry) i.next();
System.out.println(ri.getName() + ", " + ri.getUser() + ", " + ri.getStatus() + ", " + ri.getType());
Presence p = r.getPresence(ri.getUser());
if (p!=null) {
System.out.println("Presence: " + p.getMode());
}
if (ri.getStatus().equals(RosterPacket.ItemStatus.SUBSCRIPTION_PENDING)) {
System.out.println(“SUBSCRIPTION_PENDING”);
} else
if (ri.getStatus().equals(RosterPacket.ItemStatus.UNSUBCRIPTION_PENDING)) {
System.out.println(“UNSUBCRIPTION_PENDING”);
}
}
… Here is the log raw packets:
Sent pkt: