This thread is archived
10 Replies Last post: Jun 5, 2006 3:34 PM by elhit  
elhit Bronze 32 posts since
May 30, 2006
Currently Being Moderated

Jun 4, 2006 11:20 AM

change contact group?

Hi

 

Is it possible to change the group of a contact, I mean:

 

if first contact1 belongs to groupA, is it possible to make contact1 to belong to groupB?

 

thx

 

e07

Jon Silver 173 posts since
Dec 21, 2005
Currently Being Moderated
Jun 5, 2006 2:22 AM in response to: elhit
Re: change contact group?

Sure you can

 


RosterGroup#addEntry(RosterEntry entry)

 

if you want to remove someone from a group then there is also

 


RosterGroup#removeEntry(RosterEntry entry);

 

hth

 

 

Jon

Jon Silver 173 posts since
Dec 21, 2005
Currently Being Moderated
Jun 5, 2006 3:30 AM in response to: elhit
Re: change contact group?

not as far as I''m aware of. Roster#removeEntry(RosterEntry entry) would remove the contact from your Roster but RosterGroup#removeEntry(RosterEntry entry) would simply remove that contact from the specified group.

Jon Silver 173 posts since
Dec 21, 2005
Currently Being Moderated
Jun 5, 2006 4:21 AM in response to: elhit
Re: change contact group?

As far as I know they wont be called, but I could be wrong.

 

To update your gui with the correct display after you have added/removed an entry from a group you could simply call a method to redraw your roster. As long as your roster drawing code included pulling groups and their members then it should show the updated list

Jon Silver 173 posts since
Dec 21, 2005
Currently Being Moderated
Jun 5, 2006 5:11 AM in response to: elhit
Re: change contact group?

So something like this could be called after you have either added or deleted a RosterEntry from a RosterGroup.

 



Roster roster;
// Get all RosterGroups from your Roster
Iterator groupsIter = roster.getGroups();

// Loop through each group and display its members
while(groupsIter.hasNext()) {
    RosterGroup rosterGroup = (RosterGroup)groupsIter.next();
    System.out.println("Group: " + rosterGroup.getName());

    // Get the members of each group.
    Iterator groupEntries = rosterGroup.getEntries();
    while(groupEntries.hasNext()) {
        RosterEntry rosterEntry = (RosterEntry)groupEntries.next();
        System.out.println("Contact: " + rosterEntry.getUser()):
    }

}

 

More Like This

  • Retrieving data ...