mirror of
https://github.com/vanitasvitae/Smack.git
synced 2024-11-25 21:42:07 +01:00
Use asEntityBareJidOrThrow() in ChatMarkersManager listener
This commit is contained in:
parent
b12f5a1591
commit
0b9cce507d
1 changed files with 5 additions and 4 deletions
|
@ -1,6 +1,6 @@
|
||||||
/**
|
/**
|
||||||
*
|
*
|
||||||
* Copyright © 2016 Fernando Ramirez
|
* Copyright © 2016 Fernando Ramirez, 2018 Florian Schmaus
|
||||||
*
|
*
|
||||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||||
* you may not use this file except in compliance with the License.
|
* you may not use this file except in compliance with the License.
|
||||||
|
@ -48,7 +48,6 @@ import org.jivesoftware.smackx.chat_markers.filter.EligibleForChatMarker;
|
||||||
import org.jivesoftware.smackx.disco.ServiceDiscoveryManager;
|
import org.jivesoftware.smackx.disco.ServiceDiscoveryManager;
|
||||||
|
|
||||||
import org.jxmpp.jid.EntityBareJid;
|
import org.jxmpp.jid.EntityBareJid;
|
||||||
import org.jxmpp.jid.EntityFullJid;
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Chat Markers Manager class (XEP-0333).
|
* Chat Markers Manager class (XEP-0333).
|
||||||
|
@ -138,8 +137,10 @@ public final class ChatMarkersManager extends Manager {
|
||||||
SmackException.NotLoggedInException {
|
SmackException.NotLoggedInException {
|
||||||
final Message message = (Message) packet;
|
final Message message = (Message) packet;
|
||||||
|
|
||||||
EntityFullJid fullFrom = message.getFrom().asEntityFullJidIfPossible();
|
// Note that this listener is used together with a PossibleFromTypeFilter.ENTITY_BARE_JID filter, hence
|
||||||
EntityBareJid bareFrom = fullFrom.asEntityBareJid();
|
// every message is guaranteed to have a from address which is representable as bare JID.
|
||||||
|
EntityBareJid bareFrom = message.getFrom().asEntityBareJidOrThrow();
|
||||||
|
|
||||||
final Chat chat = chatManager.chatWith(bareFrom);
|
final Chat chat = chatManager.chatWith(bareFrom);
|
||||||
|
|
||||||
asyncButOrdered.performAsyncButOrdered(chat, new Runnable() {
|
asyncButOrdered.performAsyncButOrdered(chat, new Runnable() {
|
||||||
|
|
Loading…
Reference in a new issue