1
0
Fork 0
mirror of https://github.com/vanitasvitae/Smack.git synced 2025-09-09 00:59:39 +02:00

Call XMPPConnection.sendIqRequestAndWaitForResponse(IQ) where possible

Refactored using

find . -type f -name "*.java" |\
	 xargs sed -i -E |\
		's/\.createStanzaCollectorAndSend\((\w+)\)\.nextResultOrThrow\(\);/.sendIqRequestAndWaitForResponse(\1);/'

and some manual refactoring.
This commit is contained in:
Florian Schmaus 2021-05-11 22:03:24 +02:00
parent c9ea1c11b6
commit aab48570c9
53 changed files with 206 additions and 188 deletions

View file

@ -699,7 +699,7 @@ public final class Roster extends Manager {
}
}
rosterPacket.addRosterItem(item);
connection.createStanzaCollectorAndSend(rosterPacket).nextResultOrThrow();
connection.sendIqRequestAndWaitForResponse(rosterPacket);
}
/**
@ -852,7 +852,7 @@ public final class Roster extends Manager {
// Set the item type as REMOVE so that the server will delete the entry
item.setItemType(RosterPacket.ItemType.remove);
packet.addRosterItem(item);
connection.createStanzaCollectorAndSend(packet).nextResultOrThrow();
connection.sendIqRequestAndWaitForResponse(packet);
}
/**

View file

@ -110,7 +110,7 @@ public final class RosterEntry extends Manager {
// Create a new roster item with the current RosterEntry and the *new* name. Note that we can't set the name of
// RosterEntry right away, as otherwise the updated event wont get fired, because equalsDeep would return true.
packet.addRosterItem(toRosterItem(this, name));
connection().createStanzaCollectorAndSend(packet).nextResultOrThrow();
connection().sendIqRequestAndWaitForResponse(packet);
// We have received a result response to the IQ set, the name was successfully changed
item.setName(name);

View file

@ -85,7 +85,7 @@ public class RosterGroup extends Manager {
item.removeGroupName(this.name);
item.addGroupName(name);
packet.addRosterItem(item);
connection().createStanzaCollectorAndSend(packet).nextResultOrThrow();
connection().sendIqRequestAndWaitForResponse(packet);
}
}
}
@ -180,7 +180,7 @@ public class RosterGroup extends Manager {
item.addGroupName(getName());
packet.addRosterItem(item);
// Wait up to a certain number of seconds for a reply from the server.
connection().createStanzaCollectorAndSend(packet).nextResultOrThrow();
connection().sendIqRequestAndWaitForResponse(packet);
}
}
}
@ -211,7 +211,7 @@ public class RosterGroup extends Manager {
item.removeGroupName(this.getName());
packet.addRosterItem(item);
// Wait up to a certain number of seconds for a reply from the server.
connection().createStanzaCollectorAndSend(packet).nextResultOrThrow();
connection().sendIqRequestAndWaitForResponse(packet);
}
}
}