Source:
<code>private ChatMarkersManager(XMPPConnection connection) { super(connection); connection.addStanzaInterceptor(new StanzaListener() { @Override public void processStanza(Stanza packet) throws NotConnectedException, InterruptedException, SmackException.NotLoggedInException { Message message = (Message) packet; if (shouldDiscardMessage(message)) { return; } <START> if (message.getBodies().isEmpty()) { <END> return; } if (CHAT_MARKERS_FILTER.accept(message)) { return; } message.addExtension(new ChatMarkersElements.MarkableExtension()); } }, MESSAGE_FILTER); connection.addSyncStanzaListener(new StanzaListener() { @Override public void processStanza(Stanza packet) throws NotConnectedException, InterruptedException, SmackException.NotLoggedInException { final Message message = (Message) packet; if (shouldDiscardMessage(message)) { return; } EntityFullJid fullFrom = message.getFrom().asEntityFullJidIfPossible(); EntityBareJid bareFrom = fullFrom.asEntityBareJid(); final Chat chat = ChatManager.getInstanceFor(connection()).chatWith(bareFrom); List<ChatMarkersListener> listeners; synchronized (incomingListeners) { listeners = new ArrayList<>(incomingListeners.size()); listeners.addAll(incomingListeners); } final List<ChatMarkersListener> finalListeners = listeners; asyncButOrdered.performAsyncButOrdered(chat, new Runnable() { @Override public void run() { for (ChatMarkersListener listener : finalListeners) { if (ChatMarkersElements.MarkableExtension.from(message) != null) { listener.newChatMarkerMessage(ChatMarkersState.markable, message, chat); } else if (ChatMarkersElements.ReceivedExtension.from(message) != null) { listener.newChatMarkerMessage(ChatMarkersState.received, message, chat); } else if (ChatMarkersElements.DisplayedExtension.from(message) != null) { listener.newChatMarkerMessage(ChatMarkersState.displayed, message, chat); } else if (ChatMarkersElements.AcknowledgedExtension.from(message) != null) { listener.newChatMarkerMessage(ChatMarkersState.acknowledged, message, chat); } } } }); } }, INCOMING_MESSAGE_FILTER); ServiceDiscoveryManager.getInstanceFor(connection).addFeature(ChatMarkersElements.NAMESPACE); }</code><technical_language>checked a filter instead. MessagesWithBodies filter</technical_language>

Target:
private ChatMarkersManager(XMPPConnection connection) { super(connection); connection.addStanzaInterceptor(new StanzaListener() { @Override public void processStanza(Stanza packet) throws NotConnectedException, InterruptedException, SmackException.NotLoggedInException { Message message = (Message) packet; message.addExtension(new ChatMarkersElements.MarkableExtension()); } }, OUTGOING_MESSAGE_FILTER); connection.addSyncStanzaListener(new StanzaListener() { @Override public void processStanza(Stanza packet) throws NotConnectedException, InterruptedException, SmackException.NotLoggedInException { final Message message = (Message) packet; EntityFullJid fullFrom = message.getFrom().asEntityFullJidIfPossible(); EntityBareJid bareFrom = fullFrom.asEntityBareJid(); final Chat chat = ChatManager.getInstanceFor(connection()).chatWith(bareFrom); asyncButOrdered.performAsyncButOrdered(chat, new Runnable() { @Override public void run() { for (ChatMarkersListener listener : incomingListeners) { if (ChatMarkersElements.MarkableExtension.from(message) != null) { listener.newChatMarkerMessage(ChatMarkersState.markable, message, chat); } else if (ChatMarkersElements.ReceivedExtension.from(message) != null) { listener.newChatMarkerMessage(ChatMarkersState.received, message, chat); } else if (ChatMarkersElements.DisplayedExtension.from(message) != null) { listener.newChatMarkerMessage(ChatMarkersState.displayed, message, chat); } else if (ChatMarkersElements.AcknowledgedExtension.from(message) != null) { listener.newChatMarkerMessage(ChatMarkersState.acknowledged, message, chat); } } } }); } }, INCOMING_MESSAGE_FILTER); ServiceDiscoveryManager.getInstanceFor(connection).addFeature(ChatMarkersElements.NAMESPACE); }