diff options
Diffstat (limited to '')
-rw-r--r-- | src/main/java/de/pixart/messenger/services/ChannelDiscoveryService.java | 18 | ||||
-rw-r--r-- | src/main/java/de/pixart/messenger/services/XmppConnectionService.java | 7 |
2 files changed, 20 insertions, 5 deletions
diff --git a/src/main/java/de/pixart/messenger/services/ChannelDiscoveryService.java b/src/main/java/de/pixart/messenger/services/ChannelDiscoveryService.java index a0e0a0219..2e376360a 100644 --- a/src/main/java/de/pixart/messenger/services/ChannelDiscoveryService.java +++ b/src/main/java/de/pixart/messenger/services/ChannelDiscoveryService.java @@ -20,6 +20,7 @@ import de.pixart.messenger.http.services.MuclumbusService; import okhttp3.Interceptor; import okhttp3.OkHttpClient; import okhttp3.Request; +import okhttp3.ResponseBody; import retrofit2.Call; import retrofit2.Callback; import retrofit2.Response; @@ -81,8 +82,8 @@ public class ChannelDiscoveryService { public void onResponse(@NonNull Call<MuclumbusService.Rooms> call, @NonNull Response<MuclumbusService.Rooms> response) { final MuclumbusService.Rooms body = response.body(); if (body == null) { - Log.d(Config.LOGTAG, "code from muclumbus=" + response.code()); listener.onChannelSearchResultsFound(Collections.emptyList()); + logError(response); return; } cache.put("", body.items); @@ -108,8 +109,8 @@ public class ChannelDiscoveryService { public void onResponse(@NonNull Call<MuclumbusService.SearchResult> call, @NonNull Response<MuclumbusService.SearchResult> response) { final MuclumbusService.SearchResult body = response.body(); if (body == null) { - Log.d(Config.LOGTAG, "code from muclumbus=" + response.code()); listener.onChannelSearchResultsFound(Collections.emptyList()); + logError(response); return; } cache.put(query, body.result.items); @@ -124,6 +125,19 @@ public class ChannelDiscoveryService { }); } + private static void logError(final Response response) { + final ResponseBody errorBody = response.errorBody(); + Log.d(Config.LOGTAG, "code from muclumbus=" + response.code()); + if (errorBody == null) { + return; + } + try { + Log.d(Config.LOGTAG, "error body=" + errorBody.string()); + } catch (IOException e) { + //ignored + } + } + public interface OnChannelSearchResultsFound { void onChannelSearchResultsFound(List<MuclumbusService.Room> results); } diff --git a/src/main/java/de/pixart/messenger/services/XmppConnectionService.java b/src/main/java/de/pixart/messenger/services/XmppConnectionService.java index a3bd141ac..6d483419d 100644 --- a/src/main/java/de/pixart/messenger/services/XmppConnectionService.java +++ b/src/main/java/de/pixart/messenger/services/XmppConnectionService.java @@ -3236,8 +3236,10 @@ public class XmppConnectionService extends Service { for (Jid invite : jids) { invite(conversation, invite); } - if (account.countPresences() > 1) { - directInvite(conversation, account.getJid().asBareJid()); + for (String resource : account.getSelfContact().getPresences().toResourceArray()) { + Jid other = account.getJid().withResource(resource); + Log.d(Config.LOGTAG, account.getJid().asBareJid() + ": sending direct invite to " + other); + directInvite(conversation, other); } saveConversationAsBookmark(conversation, name); if (callback != null) { @@ -3364,7 +3366,6 @@ public class XmppConnectionService extends Service { if (packet.getType() == IqPacket.TYPE.RESULT) { Data data = Data.parse(packet.query().findChild("x", Namespace.DATA)); data.submit(options); - Log.d(Config.LOGTAG, data.toString()); IqPacket set = new IqPacket(IqPacket.TYPE.SET); set.setTo(conversation.getJid().asBareJid()); set.query("http://jabber.org/protocol/muc#owner").addChild(data); |