mirror of
https://github.com/vanitasvitae/Smack.git
synced 2024-11-26 14:02:06 +01:00
Fixes a problem renaming a RosterGroup
git-svn-id: http://svn.igniterealtime.org/svn/repos/smack/trunk@2176 b35dd754-fafc-0310-a699-88a17e54d16e
This commit is contained in:
parent
b73060d000
commit
b194d99054
1 changed files with 8 additions and 3 deletions
|
@ -92,18 +92,23 @@ public class RosterGroup {
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Sets the name of the group.
|
* Sets the name of the group. Changing the group's name is like moving all the group entries
|
||||||
|
* of the group to a new group specified by the new name. Since this group won't have entries
|
||||||
|
* it will be removed from the roster. This means that all the references to this object will
|
||||||
|
* be invalid and will need to be updated to the new group specified by the new name.
|
||||||
*
|
*
|
||||||
* @param name the name of the group.
|
* @param name the name of the group.
|
||||||
*/
|
*/
|
||||||
public void setName(String name) {
|
public void setName(String name) {
|
||||||
this.name = name;
|
|
||||||
synchronized (entries) {
|
synchronized (entries) {
|
||||||
for (int i=0; i<entries.size(); i++) {
|
for (int i=0; i<entries.size(); i++) {
|
||||||
RosterPacket packet = new RosterPacket();
|
RosterPacket packet = new RosterPacket();
|
||||||
packet.setType(IQ.Type.SET);
|
packet.setType(IQ.Type.SET);
|
||||||
RosterEntry entry = (RosterEntry)entries.get(i);
|
RosterEntry entry = (RosterEntry)entries.get(i);
|
||||||
packet.addRosterItem(RosterEntry.toRosterItem(entry));
|
RosterPacket.Item item = RosterEntry.toRosterItem(entry);
|
||||||
|
item.removeGroupName(this.name);
|
||||||
|
item.addGroupName(name);
|
||||||
|
packet.addRosterItem(item);
|
||||||
connection.sendPacket(packet);
|
connection.sendPacket(packet);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in a new issue