From ecc13e2e9125cc11e13e9da76bf06e387992a132 Mon Sep 17 00:00:00 2001 From: Florian Schmaus Date: Tue, 30 Dec 2014 20:04:27 +0100 Subject: [PATCH] Invoke MUC invitation listener async Basically the same fix as 191c4429da6f2982d80c80bef81d7902a9640e6d was for file transfer listeners, just for MUC invitation listeners. --- .../smackx/muc/MultiUserChatManager.java | 18 ++++++++++++------ 1 file changed, 12 insertions(+), 6 deletions(-) diff --git a/smack-extensions/src/main/java/org/jivesoftware/smackx/muc/MultiUserChatManager.java b/smack-extensions/src/main/java/org/jivesoftware/smackx/muc/MultiUserChatManager.java index 1d0e4c050..c563374bf 100644 --- a/smack-extensions/src/main/java/org/jivesoftware/smackx/muc/MultiUserChatManager.java +++ b/smack-extensions/src/main/java/org/jivesoftware/smackx/muc/MultiUserChatManager.java @@ -43,6 +43,7 @@ import org.jivesoftware.smack.filter.NotFilter; import org.jivesoftware.smack.filter.PacketTypeFilter; import org.jivesoftware.smack.packet.Message; import org.jivesoftware.smack.packet.Packet; +import org.jivesoftware.smack.util.Async; import org.jivesoftware.smackx.disco.AbstractNodeInformationProvider; import org.jivesoftware.smackx.disco.ServiceDiscoveryManager; import org.jivesoftware.smackx.disco.packet.DiscoverInfo; @@ -121,16 +122,21 @@ public class MultiUserChatManager extends Manager { // listeners if the message includes an invitation. invitationPacketListener = new PacketListener() { public void processPacket(Packet packet) { - Message message = (Message) packet; + final Message message = (Message) packet; // Get the MUCUser extension - MUCUser mucUser = MUCUser.from(message); + final MUCUser mucUser = MUCUser.from(message); // Check if the MUCUser extension includes an invitation if (mucUser.getInvite() != null) { // Fire event for invitation listeners - MultiUserChat muc = getMultiUserChat(packet.getFrom()); - for (InvitationListener listener : invitationsListeners) { - listener.invitationReceived(connection(), muc, mucUser.getInvite().getFrom(), - mucUser.getInvite().getReason(), mucUser.getPassword(), message); + final MultiUserChat muc = getMultiUserChat(packet.getFrom()); + for (final InvitationListener listener : invitationsListeners) { + Async.go(new Runnable() { + @Override + public void run() { + listener.invitationReceived(connection(), muc, mucUser.getInvite().getFrom(), + mucUser.getInvite().getReason(), mucUser.getPassword(), message); + } + }); } } }