aboutsummaryrefslogtreecommitdiffstats
path: root/src/main/java
diff options
context:
space:
mode:
authorChristian Schneppe <christian@pix-art.de>2019-09-19 11:50:37 +0200
committerChristian Schneppe <christian@pix-art.de>2019-09-19 11:50:37 +0200
commit28a26866206f7121c7730b7e0f28ee30f5ba8c3c (patch)
tree5ab54f24b96cb24e706e1294c17987bd7d032691 /src/main/java
parent701b8617de429313635045ec50f2c14da5e96efb (diff)
fixed direct invites after adhoc
Diffstat (limited to 'src/main/java')
-rw-r--r--src/main/java/de/pixart/messenger/generator/MessageGenerator.java4
-rw-r--r--src/main/java/de/pixart/messenger/services/ChannelDiscoveryService.java18
-rw-r--r--src/main/java/de/pixart/messenger/services/XmppConnectionService.java7
-rw-r--r--src/main/java/de/pixart/messenger/ui/util/MucDetailsContextMenuHelper.java2
4 files changed, 25 insertions, 6 deletions
diff --git a/src/main/java/de/pixart/messenger/generator/MessageGenerator.java b/src/main/java/de/pixart/messenger/generator/MessageGenerator.java
index 623c480ea..ae172bd80 100644
--- a/src/main/java/de/pixart/messenger/generator/MessageGenerator.java
+++ b/src/main/java/de/pixart/messenger/generator/MessageGenerator.java
@@ -228,6 +228,10 @@ public class MessageGenerator extends AbstractGenerator {
if (password != null) {
x.setAttribute("password", password);
}
+ if (contact.isFullJid()) {
+ packet.addChild("no-store", "urn:xmpp:hints");
+ packet.addChild("no-copy", "urn:xmpp:hints");
+ }
return packet;
}
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);
diff --git a/src/main/java/de/pixart/messenger/ui/util/MucDetailsContextMenuHelper.java b/src/main/java/de/pixart/messenger/ui/util/MucDetailsContextMenuHelper.java
index 5d2c47d72..2e01a6f7e 100644
--- a/src/main/java/de/pixart/messenger/ui/util/MucDetailsContextMenuHelper.java
+++ b/src/main/java/de/pixart/messenger/ui/util/MucDetailsContextMenuHelper.java
@@ -181,7 +181,7 @@ public final class MucDetailsContextMenuHelper {
return true;
case R.id.invite:
if (user.getAffiliation().ranks(MucOptions.Affiliation.MEMBER)) {
- activity.xmppConnectionService.directInvite(conversation, jid);
+ activity.xmppConnectionService.directInvite(conversation, jid.asBareJid());
} else {
activity.xmppConnectionService.invite(conversation, jid);
}