mirror of
https://codeberg.org/Mercury-IM/Smack
synced 2024-11-22 22:32:06 +01:00
Make getMultipleRecipientServiceAddress more robust
to avoid feature-not-implemented at org.jivesoftware.smack.PacketCollector.nextResultOrThrow(PacketCollector.java:182) at org.jivesoftware.smack.PacketCollector.nextResultOrThrow(PacketCollector.java:161) at org.jivesoftware.smackx.disco.ServiceDiscoveryManager.discoverItems(ServiceDiscoveryManager.java:573) at org.jivesoftware.smackx.address.MultipleRecipientManager.getMultipleRecipienServiceAddress(MultipleRecipientManager.java:310) at org.jivesoftware.smackx.address.MultipleRecipientManager.send$7a184d34(MultipleRecipientManager.java:82) for e.g. Google Apps XMPP services. This is not to be merged in master/4.1 branch as it already contains a similar fix.
This commit is contained in:
parent
c3f6c51d0e
commit
0d890623c7
1 changed files with 27 additions and 17 deletions
|
@ -300,14 +300,21 @@ public class MultipleRecipientManager {
|
|||
if (serviceAddress == null) {
|
||||
ServiceDiscoveryManager sdm = ServiceDiscoveryManager.getInstanceFor(connection);
|
||||
// Send the disco packet to the server itself
|
||||
DiscoverInfo info = sdm.discoverInfo(serviceName);
|
||||
DiscoverInfo info = null;
|
||||
try {
|
||||
info = sdm.discoverInfo(serviceName);
|
||||
} catch (XMPPErrorException e) {
|
||||
LOGGER.log(Level.WARNING, "Exception while discovering info of service", e);
|
||||
}
|
||||
// Check if the server supports XEP-33
|
||||
if (info.containsFeature(MultipleAddresses.NAMESPACE)) {
|
||||
if (info != null && info.containsFeature(MultipleAddresses.NAMESPACE)) {
|
||||
serviceAddress = serviceName;
|
||||
}
|
||||
else {
|
||||
// Get the disco items and send the disco packet to each server item
|
||||
DiscoverItems items = sdm.discoverItems(serviceName);
|
||||
DiscoverItems items;
|
||||
try {
|
||||
items = sdm.discoverItems(serviceName);
|
||||
for (DiscoverItems.Item item : items.getItems()) {
|
||||
try {
|
||||
info = sdm.discoverInfo(item.getEntityID(), item.getNode());
|
||||
|
@ -324,6 +331,9 @@ public class MultipleRecipientManager {
|
|||
break;
|
||||
}
|
||||
}
|
||||
} catch (XMPPErrorException e) {
|
||||
LOGGER.log(Level.WARNING, "Exception while disvering items of service", e);
|
||||
}
|
||||
}
|
||||
// Use the empty string to indicate that no service is known for this connection
|
||||
serviceAddress = serviceAddress == null ? "" : serviceAddress;
|
||||
|
|
Loading…
Reference in a new issue