powered by Jive Software

Adding JIDs to a Roster

Ok, so don’t ask why just yet.

I’m addin JIDs, manually, to active user’s rosters. All is good except when I add the JID, and group, to the roster - the newly added JID shows “offline” when in fact they are indeed online.

Any ideas?

TIA,

Kit

Hey Kit,

Ok, so don’t ask why just yet.

Why? Why we cannot ask why?

I’m addin JIDs, manually, to active user’s rosters. All is good except when I add the JID, and group, to the roster - the newly added JID shows “offline” when in fact they are indeed online.

How are you adding contacts to the roster? In XMPP adding a contact to a roster is usually a 2 steps process. 1) Add contact to roster and 2) Subscribe to the presence of the user. If you do #2 without #1 then the server with do #1 for you. It seems that you are only doing #1 thus presences are not updated.

Regards,

– Gato

Ok, so here’s what I had to do to solve the problem.

I’m using the createRosterItem() method because I want them to appear under a specific group name.

rItem = roster.createRosterItem(newJid, addJid, groups, true, false);

rItem.setSubStatus(RosterItem.SUB_BOTH);

roster.updateRosterItem(rItem);

Presence packet = new Presence();

packet.setFrom(newJid);

packet.setTo(addJid);

this.sessionMgr.userBroadcast(toJid, packet);

It did not work without the Presence packet bit…

Thanks,

Kit