Hi,
I’'m trying to add a user to a roster. With the sub field in the jiveroster table having the value 3. I have tried:
private Roster r;
private RosterItem item;
private JID jid_full;
jid_full = new JID(jid);
r = rManager.getRoster(roster);
item = r.createRosterItem(jid_full, jid_full.getNode(), null, true, true); //OK
item.setSubStatus(RosterItem.SUB_BOTH);
The user gets added to the roster, but the value of sub is 0 in the db even though I have called setSubStatus on the rosteritem. The got thing about this code is that the changes is immediately reflected in the Jabber client.
I have also tried:
private Roster r;
private RosterItem item;
private JID jid_full;
private RosterItemProvider rosterItemProvider;
jid_full = new JID(jid);
item = new RosterItem(jid_full, RosterItem.SUB_BOTH, RosterItem.ASK_NONE, RosterItem.RECV_NONE, jid_full.getNode(), null);
rosterItemProvider = RosterItemProvider.getInstance();
rosterItemProvider.createItem(roster, item);
This also adds the user to the roster and also sets the sub field to 3. The only problem with this code is that the changes aren’'t reflected in the Jabber client.
So I’'m trying to get the best of both worlds, I would like to set the sub field to 3 (RosterItem.SUB_BOTH) and have the changes reflected immediately in the connected Jabber clients. Any help or pointers are very welcome. Thanks.
Kind regards,
Nick