mirror of
https://codeberg.org/Mercury-IM/Smack
synced 2024-12-23 04:57:58 +01:00
Fix MUC invitationPacketListener ClassCastException
Make sure that the Packets are of type Message. To prevent: E/AbstractXMPPConnection﹕ Exception in packet listener java.lang.ClassCastException: org.jivesoftware.smack.packet.Presence cannot be cast to org.jivesoftware.smack.packet.Message at org.jivesoftware.smackx.muc.MultiUserChatManager$2.processPacket(MultiUserChatM anager.java:124) at org.jivesoftware.smack.AbstractXMPPConnection.notifiyReceivedListeners(Abstract XMPPConnection.java:854) at org.jivesoftware.smack.AbstractXMPPConnection$ListenerNotification.run(Abstract XMPPConnection.java:876) at java.util.concurrent.Executors$RunnableAdapter.call(Executors.java:390) at java.util.concurrent.FutureTask.run(FutureTask.java:234) at java.util.concurrent.ScheduledThreadPoolExecutor$ScheduledFutureTask.access$201 (ScheduledThreadPoolExecutor.java:153) at java.util.concurrent.ScheduledThreadPoolExecutor$ScheduledFutureTask.run(Schedu ledThreadPoolExecutor.java:267) at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1080) at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:573) at java.lang.Thread.run(Thread.java:856)
This commit is contained in:
parent
b348ebfd6d
commit
6a2bc0c02d
1 changed files with 3 additions and 2 deletions
|
@ -41,6 +41,7 @@ import org.jivesoftware.smack.filter.MessageTypeFilter;
|
|||
import org.jivesoftware.smack.filter.PacketExtensionFilter;
|
||||
import org.jivesoftware.smack.filter.PacketFilter;
|
||||
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.smackx.disco.AbstractNodeInformationProvider;
|
||||
|
@ -100,7 +101,7 @@ public class MultiUserChatManager extends Manager {
|
|||
return multiUserChatManager;
|
||||
}
|
||||
|
||||
private static final PacketFilter invitationFilter = new AndFilter(new PacketExtensionFilter(new MUCUser()),
|
||||
private static final PacketFilter INVITATION_FILTER = new AndFilter(PacketTypeFilter.MESSAGE, new PacketExtensionFilter(new MUCUser()),
|
||||
new NotFilter(MessageTypeFilter.ERROR));
|
||||
|
||||
private final Set<InvitationListener> invitationsListeners = new CopyOnWriteArraySet<InvitationListener>();
|
||||
|
@ -134,7 +135,7 @@ public class MultiUserChatManager extends Manager {
|
|||
}
|
||||
}
|
||||
};
|
||||
connection.addPacketListener(invitationPacketListener, invitationFilter);
|
||||
connection.addPacketListener(invitationPacketListener, INVITATION_FILTER);
|
||||
}
|
||||
|
||||
/**
|
||||
|
|
Loading…
Reference in a new issue