mirror of
https://github.com/vanitasvitae/Smack.git
synced 2024-11-22 20:12:07 +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 messageListener;
|
||||||
private final StanzaListener presenceListener;
|
private final StanzaListener presenceListener;
|
||||||
private final StanzaListener subjectListener;
|
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 final StanzaListener declinesListener;
|
||||||
|
|
||||||
private String subject;
|
private String subject;
|
||||||
|
@ -317,8 +320,7 @@ public class MultiUserChat {
|
||||||
StanzaTypeFilter.PRESENCE));
|
StanzaTypeFilter.PRESENCE));
|
||||||
connection.addSyncStanzaListener(subjectListener, new AndFilter(fromRoomFilter,
|
connection.addSyncStanzaListener(subjectListener, new AndFilter(fromRoomFilter,
|
||||||
MessageWithSubjectFilter.INSTANCE, new NotFilter(MessageTypeFilter.ERROR)));
|
MessageWithSubjectFilter.INSTANCE, new NotFilter(MessageTypeFilter.ERROR)));
|
||||||
connection.addSyncStanzaListener(declinesListener, new AndFilter(new StanzaExtensionFilter(MUCUser.ELEMENT,
|
connection.addSyncStanzaListener(declinesListener, DECLINE_FILTER);
|
||||||
MUCUser.NAMESPACE), new NotFilter(MessageTypeFilter.ERROR)));
|
|
||||||
connection.addPacketInterceptor(presenceInterceptor, new AndFilter(new ToFilter(room),
|
connection.addPacketInterceptor(presenceInterceptor, new AndFilter(new ToFilter(room),
|
||||||
StanzaTypeFilter.PRESENCE));
|
StanzaTypeFilter.PRESENCE));
|
||||||
messageCollector = connection.createPacketCollector(fromRoomGroupchatFilter);
|
messageCollector = connection.createPacketCollector(fromRoomGroupchatFilter);
|
||||||
|
|
Loading…
Reference in a new issue