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

Merge branch '4.3'

This commit is contained in:
Florian Schmaus 2019-02-17 22:28:01 +01:00
commit 825a5836eb
2 changed files with 16 additions and 11 deletions

View file

@ -1,6 +1,6 @@
/** /**
* *
* Copyright 2013-2014 Georg Lukas, 2015 Florian Schmaus * Copyright 2013-2014 Georg Lukas, 2015-2019 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.
@ -74,8 +74,16 @@ import org.jxmpp.jid.Jid;
*/ */
public final class DeliveryReceiptManager extends Manager { public final class DeliveryReceiptManager extends Manager {
private static final StanzaFilter MESSAGES_WITH_DELIVERY_RECEIPT_REQUEST = new AndFilter(StanzaTypeFilter.MESSAGE, /**
new StanzaExtensionFilter(new DeliveryReceiptRequest())); * Filters all non-error messages with receipt requests.
* See <a href="https://xmpp.org/extensions/xep-0184.html#when">XEP-0184 § 5.</a> "A sender could request receipts
* on any non-error content message (chat, groupchat, headline, or normal)"
*/
private static final StanzaFilter NON_ERROR_GROUPCHAT_MESSAGES_WITH_DELIVERY_RECEIPT_REQUEST = new AndFilter(
StanzaTypeFilter.MESSAGE,
new StanzaExtensionFilter(new DeliveryReceiptRequest()),
new NotFilter(MessageTypeFilter.ERROR));
private static final StanzaFilter MESSAGES_WITH_DELIVERY_RECEIPT = new AndFilter(StanzaTypeFilter.MESSAGE, private static final StanzaFilter MESSAGES_WITH_DELIVERY_RECEIPT = new AndFilter(StanzaTypeFilter.MESSAGE,
new StanzaExtensionFilter(DeliveryReceipt.ELEMENT, DeliveryReceipt.NAMESPACE)); new StanzaExtensionFilter(DeliveryReceipt.ELEMENT, DeliveryReceipt.NAMESPACE));
@ -175,7 +183,7 @@ public final class DeliveryReceiptManager extends Manager {
} }
connection.sendStanza(ack); connection.sendStanza(ack);
} }
}, MESSAGES_WITH_DELIVERY_RECEIPT_REQUEST); }, NON_ERROR_GROUPCHAT_MESSAGES_WITH_DELIVERY_RECEIPT_REQUEST);
} }
/** /**

View file

@ -1,6 +1,6 @@
/** /**
* *
* Copyright 2013-2018 Florian Schmaus * Copyright 2013-2019 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.
@ -18,7 +18,6 @@ package org.jivesoftware.smack.util.dns.javax;
import java.net.InetAddress; import java.net.InetAddress;
import java.util.ArrayList; import java.util.ArrayList;
import java.util.Hashtable;
import java.util.List; import java.util.List;
import java.util.logging.Level; import java.util.logging.Level;
@ -52,11 +51,9 @@ public class JavaxResolver extends DNSResolver implements SmackInitializer {
static { static {
try { try {
Hashtable<String, String> env = new Hashtable<>(); dirContext = new InitialDirContext();
env.put("java.naming.factory.initial", "com.sun.jndi.dns.DnsContextFactory"); } catch (NamingException e) {
dirContext = new InitialDirContext(env); LOGGER.log(Level.SEVERE, "Could not construct InitialDirContext", e);
} catch (Exception e) {
// Ignore.
} }
// Try to set this DNS resolver as primary one // Try to set this DNS resolver as primary one