1
0
Fork 0
mirror of https://github.com/vanitasvitae/Smack.git synced 2025-09-10 17:49:38 +02:00

Small tweaks.

git-svn-id: http://svn.igniterealtime.org/svn/repos/smack/trunk@6183 b35dd754-fafc-0310-a699-88a17e54d16e
This commit is contained in:
Alex Wenckus 2006-11-20 23:09:11 +00:00 committed by alex
parent b34d338b31
commit 1f3ab16aad
4 changed files with 35 additions and 26 deletions

View file

@ -445,16 +445,24 @@ public class MultiUserChat {
// Wait for a presence packet back from the server.
PacketFilter responseFilter =
new AndFilter(
new FromMatchesFilter(room + "/" + nickname),
new PacketTypeFilter(Presence.class));
PacketCollector response = connection.createPacketCollector(responseFilter);
// Send join packet.
connection.sendPacket(joinPresence);
// Wait up to a certain number of seconds for a reply.
Presence presence = (Presence) response.nextResult(timeout);
// Stop queuing results
response.cancel();
new AndFilter(
new FromMatchesFilter(room + "/" + nickname),
new PacketTypeFilter(Presence.class));
PacketCollector response = null;
Presence presence;
try {
response = connection.createPacketCollector(responseFilter);
// Send join packet.
connection.sendPacket(joinPresence);
// Wait up to a certain number of seconds for a reply.
presence = (Presence) response.nextResult(timeout);
}
finally {
// Stop queuing results
if (response != null) {
response.cancel();
}
}
if (presence == null) {
throw new XMPPException("No response from server.");
@ -795,6 +803,9 @@ public class MultiUserChat {
/**
* Fires invitation rejection listeners.
*
* @param invitee the user being invited.
* @param reason the reason for the rejection
*/
private void fireInvitationRejectionListeners(String invitee, String reason) {
InvitationRejectionListener[] listeners;