1
0
Fork 0
mirror of https://codeberg.org/Mercury-IM/Smack synced 2024-12-22 12:37:58 +01:00

Don't request receipts for messages without a body

SMACK-709
This commit is contained in:
Florian Schmaus 2015-12-14 11:34:18 +01:00
parent 09364e571c
commit 72c7137ff1

View file

@ -32,6 +32,7 @@ import org.jivesoftware.smack.XMPPConnectionRegistry;
import org.jivesoftware.smack.XMPPException;
import org.jivesoftware.smack.filter.AndFilter;
import org.jivesoftware.smack.filter.MessageTypeFilter;
import org.jivesoftware.smack.filter.MessageWithBodiesFilter;
import org.jivesoftware.smack.filter.NotFilter;
import org.jivesoftware.smack.filter.StanzaFilter;
import org.jivesoftware.smack.filter.StanzaExtensionFilter;
@ -244,13 +245,17 @@ public class DeliveryReceiptManager extends Manager {
/**
* A filter for stanzas to request delivery receipts for. Notably those are message stanzas of type normal, chat or
* headline, which <b>do not</b>contain a delivery receipt, i.e. are ack messages.
* headline, which <b>do not</b>contain a delivery receipt, i.e. are ack messages, and have a body extension.
*
* @see <a href="http://xmpp.org/extensions/xep-0184.html#when-ack">XEP-184 § 5.4 Ack Messages</a>
*/
private static final StanzaFilter MESSAGES_TO_REQUEST_RECEIPTS_FOR = new AndFilter(
MessageTypeFilter.NORMAL_OR_CHAT_OR_HEADLINE, new NotFilter(new StanzaExtensionFilter(
DeliveryReceipt.ELEMENT, DeliveryReceipt.NAMESPACE)));
// @formatter:off
MessageTypeFilter.NORMAL_OR_CHAT_OR_HEADLINE,
new NotFilter(new StanzaExtensionFilter(DeliveryReceipt.ELEMENT, DeliveryReceipt.NAMESPACE)),
MessageWithBodiesFilter.INSTANCE
);
// @formatter:on
private static final StanzaListener AUTO_ADD_DELIVERY_RECEIPT_REQUESTS_LISTENER = new StanzaListener() {
@Override
@ -261,7 +266,9 @@ public class DeliveryReceiptManager extends Manager {
};
/**
* Enables automatic requests of delivery receipts for outgoing messages of type 'normal', 'chat' or 'headline.
* Enables automatic requests of delivery receipts for outgoing messages of
* {@link Message.Type#normal}, {@link Message.Type#chat} or {@link Message.Type#headline}, and
* with a {@link Message.Body} extension.
*
* @since 4.1
* @see #dontAutoAddDeliveryReceiptRequests()