Sequence of steps for getting presence and sending msg


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?



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) {



//am good till here


final Roster r = conn1.getRoster();

try {

Thread.sleep(10000); //this is so that we dont act too fast

} catch (InterruptedException e) {



Iterator i = r.getEntries();

RosterEntry ri = null;

while (i.hasNext()) {

ri = (RosterEntry);

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)) {


} else

if (ri.getStatus().equals(RosterPacket.ItemStatus.UNSUBCRIPTION_PENDING)) {




… Here is the log raw packets:

Sent pkt:

Hey Bharat,

It seems that the problem is the JID that you are using to locate the AOL user. Let say that you XMPP server name that you are connected is When an XMPP client that is connected to wants to contact a user in AOL, MSN, yahoo, etc. a gateway is going to be required so that the server can establish a connection to the legacy network (e.g. AOL). If that gateway is not installed then there is no way for that connection to happen.

Moreover, if a gateway is available then you need to be registered with the gateway. When you register you are telling the gateway that your XMPP address corresponds to an AOL account. After you did that the gateway will know when you come online and update your status in the AOL network.

Gateways also have their own XMPP address. Usually people use the name of the legacy network. For instance following our example it would be Moreover, AOL accounts will be seen as Therefore if you want to contact xyz, that is an AOL account, then the correct address will be


– Gato