mirror of
https://codeberg.org/Mercury-IM/Smack
synced 2024-11-22 14:22:05 +01:00
Use PossibleFromTypeFilter for MultiUserChat's presence listener
This commit is contained in:
parent
105192d7e7
commit
271ac7ee7a
1 changed files with 4 additions and 6 deletions
|
@ -47,6 +47,7 @@ import org.jivesoftware.smack.filter.MessageWithSubjectFilter;
|
||||||
import org.jivesoftware.smack.filter.MessageWithThreadFilter;
|
import org.jivesoftware.smack.filter.MessageWithThreadFilter;
|
||||||
import org.jivesoftware.smack.filter.NotFilter;
|
import org.jivesoftware.smack.filter.NotFilter;
|
||||||
import org.jivesoftware.smack.filter.OrFilter;
|
import org.jivesoftware.smack.filter.OrFilter;
|
||||||
|
import org.jivesoftware.smack.filter.PossibleFromTypeFilter;
|
||||||
import org.jivesoftware.smack.filter.PresenceTypeFilter;
|
import org.jivesoftware.smack.filter.PresenceTypeFilter;
|
||||||
import org.jivesoftware.smack.filter.StanzaExtensionFilter;
|
import org.jivesoftware.smack.filter.StanzaExtensionFilter;
|
||||||
import org.jivesoftware.smack.filter.StanzaFilter;
|
import org.jivesoftware.smack.filter.StanzaFilter;
|
||||||
|
@ -203,11 +204,7 @@ public class MultiUserChat {
|
||||||
@Override
|
@Override
|
||||||
public void processStanza(final Stanza packet) {
|
public void processStanza(final Stanza packet) {
|
||||||
final Presence presence = (Presence) packet;
|
final Presence presence = (Presence) packet;
|
||||||
final EntityFullJid from = presence.getFrom().asEntityFullJidIfPossible();
|
final EntityFullJid from = presence.getFrom().asEntityFullJidOrThrow();
|
||||||
if (from == null) {
|
|
||||||
LOGGER.warning("Presence not from a full JID: " + presence.getFrom());
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
final EntityFullJid myRoomJID = myRoomJid;
|
final EntityFullJid myRoomJID = myRoomJid;
|
||||||
final boolean isUserStatusModification = presence.getFrom().equals(myRoomJID);
|
final boolean isUserStatusModification = presence.getFrom().equals(myRoomJID);
|
||||||
|
|
||||||
|
@ -342,7 +339,8 @@ public class MultiUserChat {
|
||||||
// Setup the messageListeners and presenceListeners *before* the join presence is send.
|
// Setup the messageListeners and presenceListeners *before* the join presence is send.
|
||||||
connection.addSyncStanzaListener(messageListener, fromRoomGroupchatFilter);
|
connection.addSyncStanzaListener(messageListener, fromRoomGroupchatFilter);
|
||||||
connection.addSyncStanzaListener(presenceListener, new AndFilter(fromRoomFilter,
|
connection.addSyncStanzaListener(presenceListener, new AndFilter(fromRoomFilter,
|
||||||
StanzaTypeFilter.PRESENCE));
|
StanzaTypeFilter.PRESENCE,
|
||||||
|
PossibleFromTypeFilter.ENTITY_FULL_JID));
|
||||||
// @formatter:off
|
// @formatter:off
|
||||||
connection.addSyncStanzaListener(subjectListener,
|
connection.addSyncStanzaListener(subjectListener,
|
||||||
new AndFilter(fromRoomFilter,
|
new AndFilter(fromRoomFilter,
|
||||||
|
|
Loading…
Reference in a new issue