mirror of
https://github.com/vanitasvitae/Smack.git
synced 2024-11-25 21:42:07 +01:00
Invoke MUC invitation listener async
Basically the same fix as 191c4429da
was
for file transfer listeners, just for MUC invitation listeners.
This commit is contained in:
parent
d6ab0cf463
commit
ecc13e2e91
1 changed files with 12 additions and 6 deletions
|
@ -43,6 +43,7 @@ import org.jivesoftware.smack.filter.NotFilter;
|
||||||
import org.jivesoftware.smack.filter.PacketTypeFilter;
|
import org.jivesoftware.smack.filter.PacketTypeFilter;
|
||||||
import org.jivesoftware.smack.packet.Message;
|
import org.jivesoftware.smack.packet.Message;
|
||||||
import org.jivesoftware.smack.packet.Packet;
|
import org.jivesoftware.smack.packet.Packet;
|
||||||
|
import org.jivesoftware.smack.util.Async;
|
||||||
import org.jivesoftware.smackx.disco.AbstractNodeInformationProvider;
|
import org.jivesoftware.smackx.disco.AbstractNodeInformationProvider;
|
||||||
import org.jivesoftware.smackx.disco.ServiceDiscoveryManager;
|
import org.jivesoftware.smackx.disco.ServiceDiscoveryManager;
|
||||||
import org.jivesoftware.smackx.disco.packet.DiscoverInfo;
|
import org.jivesoftware.smackx.disco.packet.DiscoverInfo;
|
||||||
|
@ -121,16 +122,21 @@ public class MultiUserChatManager extends Manager {
|
||||||
// listeners if the message includes an invitation.
|
// listeners if the message includes an invitation.
|
||||||
invitationPacketListener = new PacketListener() {
|
invitationPacketListener = new PacketListener() {
|
||||||
public void processPacket(Packet packet) {
|
public void processPacket(Packet packet) {
|
||||||
Message message = (Message) packet;
|
final Message message = (Message) packet;
|
||||||
// Get the MUCUser extension
|
// Get the MUCUser extension
|
||||||
MUCUser mucUser = MUCUser.from(message);
|
final MUCUser mucUser = MUCUser.from(message);
|
||||||
// Check if the MUCUser extension includes an invitation
|
// Check if the MUCUser extension includes an invitation
|
||||||
if (mucUser.getInvite() != null) {
|
if (mucUser.getInvite() != null) {
|
||||||
// Fire event for invitation listeners
|
// Fire event for invitation listeners
|
||||||
MultiUserChat muc = getMultiUserChat(packet.getFrom());
|
final MultiUserChat muc = getMultiUserChat(packet.getFrom());
|
||||||
for (InvitationListener listener : invitationsListeners) {
|
for (final InvitationListener listener : invitationsListeners) {
|
||||||
listener.invitationReceived(connection(), muc, mucUser.getInvite().getFrom(),
|
Async.go(new Runnable() {
|
||||||
mucUser.getInvite().getReason(), mucUser.getPassword(), message);
|
@Override
|
||||||
|
public void run() {
|
||||||
|
listener.invitationReceived(connection(), muc, mucUser.getInvite().getFrom(),
|
||||||
|
mucUser.getInvite().getReason(), mucUser.getPassword(), message);
|
||||||
|
}
|
||||||
|
});
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in a new issue