Hi All,
I’m implementing a simple messaging system using the Smack API, and I’m trying to work with RosterGroup, but not getting very far. I have two users, userA and userB. userA has a Roster with one entry, userB, userB has a Roster with one entry, userA. There are many more users that userA can send a message to.
I want userA to send a message to userB, given certain conditions, one of which being that userB should be a valid recipient of userA’s message. For this, I thought I’d use RosterGroup and have userB associated with that group:
// create a RosterGroup
rosterA.createGroup(“test_group”);
// add userB to userA’s Roster
String[] groups = {“test_group”};
rosterA.createEntry(username, nickname, groups);
Where:
rosterA is userA’s Roster
username is userB’s username
nickname is userB’s nickname
So userA will send it’s message to userB, provided that userB is in the right group.
But it’s not working. Before sending the message, I iterate through userA’s roster and query each entry’s groups, but although I get userB’s entry, it doesn’t have any RosterGroups associated with it.
Can anyone help me with this?