mirror of
https://codeberg.org/Mercury-IM/Smack
synced 2024-11-27 00:32:07 +01:00
Add/remove the local entry to/from only if the server didn't answer an error to the request. SMACK-73
git-svn-id: http://svn.igniterealtime.org/svn/repos/smack/trunk@2707 b35dd754-fafc-0310-a699-88a17e54d16e
This commit is contained in:
parent
569538130d
commit
ca9c6aea93
1 changed files with 4 additions and 3 deletions
|
@ -178,7 +178,6 @@ public class RosterGroup {
|
||||||
// Only add the entry if it isn't already in the list.
|
// Only add the entry if it isn't already in the list.
|
||||||
synchronized (entries) {
|
synchronized (entries) {
|
||||||
if (!entries.contains(entry)) {
|
if (!entries.contains(entry)) {
|
||||||
entries.add(entry);
|
|
||||||
RosterPacket packet = new RosterPacket();
|
RosterPacket packet = new RosterPacket();
|
||||||
packet.setType(IQ.Type.SET);
|
packet.setType(IQ.Type.SET);
|
||||||
packet.addRosterItem(RosterEntry.toRosterItem(entry));
|
packet.addRosterItem(RosterEntry.toRosterItem(entry));
|
||||||
|
@ -198,6 +197,8 @@ public class RosterGroup {
|
||||||
else if (response.getType() == IQ.Type.ERROR) {
|
else if (response.getType() == IQ.Type.ERROR) {
|
||||||
throw new XMPPException(response.getError());
|
throw new XMPPException(response.getError());
|
||||||
}
|
}
|
||||||
|
// Add the new entry to the group since the server processed the request successfully
|
||||||
|
entries.add(entry);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -226,8 +227,6 @@ public class RosterGroup {
|
||||||
collector = connection
|
collector = connection
|
||||||
.createPacketCollector(new PacketIDFilter(packet.getPacketID()));
|
.createPacketCollector(new PacketIDFilter(packet.getPacketID()));
|
||||||
connection.sendPacket(packet);
|
connection.sendPacket(packet);
|
||||||
// Remove the entry locally
|
|
||||||
entries.remove(entry);
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
if (collector != null) {
|
if (collector != null) {
|
||||||
|
@ -240,6 +239,8 @@ public class RosterGroup {
|
||||||
else if (response.getType() == IQ.Type.ERROR) {
|
else if (response.getType() == IQ.Type.ERROR) {
|
||||||
throw new XMPPException(response.getError());
|
throw new XMPPException(response.getError());
|
||||||
}
|
}
|
||||||
|
// Remove the entry locally since the server processed the request successfully
|
||||||
|
entries.remove(entry);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Loading…
Reference in a new issue