mirror of
https://codeberg.org/Mercury-IM/Smack
synced 2024-12-22 20:47:57 +01:00
Filter MUC 'decline' messages by type 'normal'
and not by '!error' as this there are presence stanzas containing the muc#user namespace also send to the client, which results in a ClassCastException in the StanzaListener.
This commit is contained in:
parent
a9d5cd4a61
commit
54790cd380
1 changed files with 4 additions and 2 deletions
|
@ -135,6 +135,9 @@ public class MultiUserChat {
|
|||
private final StanzaListener messageListener;
|
||||
private final StanzaListener presenceListener;
|
||||
private final StanzaListener subjectListener;
|
||||
|
||||
private static final StanzaFilter DECLINE_FILTER = new AndFilter(MessageTypeFilter.NORMAL,
|
||||
new StanzaExtensionFilter(MUCUser.ELEMENT, MUCUser.NAMESPACE));
|
||||
private final StanzaListener declinesListener;
|
||||
|
||||
private String subject;
|
||||
|
@ -317,8 +320,7 @@ public class MultiUserChat {
|
|||
StanzaTypeFilter.PRESENCE));
|
||||
connection.addSyncStanzaListener(subjectListener, new AndFilter(fromRoomFilter,
|
||||
MessageWithSubjectFilter.INSTANCE, new NotFilter(MessageTypeFilter.ERROR)));
|
||||
connection.addSyncStanzaListener(declinesListener, new AndFilter(new StanzaExtensionFilter(MUCUser.ELEMENT,
|
||||
MUCUser.NAMESPACE), new NotFilter(MessageTypeFilter.ERROR)));
|
||||
connection.addSyncStanzaListener(declinesListener, DECLINE_FILTER);
|
||||
connection.addPacketInterceptor(presenceInterceptor, new AndFilter(new ToFilter(room),
|
||||
StanzaTypeFilter.PRESENCE));
|
||||
messageCollector = connection.createPacketCollector(fromRoomGroupchatFilter);
|
||||
|
|
Loading…
Reference in a new issue