How to make presence updated unidirectionally

Suppose that I have two user account, for example, A and B in the Jive messenger server. and A had added B to its roster, but A wasn’‘t in B’'s roster.

Thus

1)when B is offline, if A logins, B is shown “offline” in A roster

  1. then B log on the server successfully

  2. all online friends in B’'s roster are noticed that B is currently online

Because A isn’‘t in B’‘s roster, so A don’‘t accept this notice message, and can’'t make the status of B updated in its roster.

I wonder which way I can take to make A noticed whenever B changes its presence.

Thanks

Eric

If B is in A’'s roster then A should be notified when B changes his/her presence. Is this not working as expected? If you meant the opposite – one option would be directed presence – the XMPP spec allows you to send presence directly to another user.

Regards,

Matt

I add B to A’'s roster by means of inserting the following data to database directly

"INSERT INTO jiveRoster (rosterID, username, jid, sub, ask, recv, nick) VALUES (75, ‘‘A’’, ‘‘B@192.168.50.95’’, 1, -1, -1, ‘‘FriendB’’)

If B is in A’'s roster then A should be notified > when

B changes his/her presence. Is this not working as

expected?

Yes, It’‘s not working as expected. I wonder whether it’'s correct way or not?

Thanks

Eric

Hey ericluo,

Since you are adding the roster items directly to the database you will need to add another row in order to make things work.

What you need is to have two roster items (i.e. 2 rows in jiveRoster). One row represents the TO presence subscription which is what you already has. What you are missing is another row that represents the FROM presence subscription. Therefore, you need to execute this other SQL query:

INSERT INTO jiveRoster (rosterID, username, jid, sub, ask, recv, nick) VALUES (76, ‘‘B’’, ‘‘A@192.168.50.95’’, 2, -1, -1, ‘‘FriendB’’)

FYI, clients should not show roster items with presence FROM.

Regards,

– Gato