fixed direct invites after adhoc

This commit is contained in:
Daniel Gultsch 2019-09-18 09:55:18 +02:00
parent 4c92d1b755
commit 02351dc0fb
4 changed files with 26 additions and 7 deletions

View file

@ -193,6 +193,10 @@ public class MessageGenerator extends AbstractGenerator {
if (password != null) { if (password != null) {
x.setAttribute("password", password); x.setAttribute("password", password);
} }
if (contact.isFullJid()) {
packet.addChild("no-store", "urn:xmpp:hints");
packet.addChild("no-copy", "urn:xmpp:hints");
}
return packet; return packet;
} }

View file

@ -16,6 +16,7 @@ import eu.siacs.conversations.Config;
import eu.siacs.conversations.http.HttpConnectionManager; import eu.siacs.conversations.http.HttpConnectionManager;
import eu.siacs.conversations.http.services.MuclumbusService; import eu.siacs.conversations.http.services.MuclumbusService;
import okhttp3.OkHttpClient; import okhttp3.OkHttpClient;
import okhttp3.ResponseBody;
import retrofit2.Call; import retrofit2.Call;
import retrofit2.Callback; import retrofit2.Callback;
import retrofit2.Response; import retrofit2.Response;
@ -77,8 +78,8 @@ public class ChannelDiscoveryService {
public void onResponse(@NonNull Call<MuclumbusService.Rooms> call, @NonNull Response<MuclumbusService.Rooms> response) { public void onResponse(@NonNull Call<MuclumbusService.Rooms> call, @NonNull Response<MuclumbusService.Rooms> response) {
final MuclumbusService.Rooms body = response.body(); final MuclumbusService.Rooms body = response.body();
if (body == null) { if (body == null) {
Log.d(Config.LOGTAG, "code from muclumbus=" + response.code());
listener.onChannelSearchResultsFound(Collections.emptyList()); listener.onChannelSearchResultsFound(Collections.emptyList());
logError(response);
return; return;
} }
cache.put("", body.items); cache.put("", body.items);
@ -104,8 +105,8 @@ public class ChannelDiscoveryService {
public void onResponse(@NonNull Call<MuclumbusService.SearchResult> call, @NonNull Response<MuclumbusService.SearchResult> response) { public void onResponse(@NonNull Call<MuclumbusService.SearchResult> call, @NonNull Response<MuclumbusService.SearchResult> response) {
final MuclumbusService.SearchResult body = response.body(); final MuclumbusService.SearchResult body = response.body();
if (body == null) { if (body == null) {
Log.d(Config.LOGTAG, "code from muclumbus=" + response.code());
listener.onChannelSearchResultsFound(Collections.emptyList()); listener.onChannelSearchResultsFound(Collections.emptyList());
logError(response);
return; return;
} }
cache.put(query, body.result.items); cache.put(query, body.result.items);
@ -120,6 +121,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 { public interface OnChannelSearchResultsFound {
void onChannelSearchResultsFound(List<MuclumbusService.Room> results); void onChannelSearchResultsFound(List<MuclumbusService.Room> results);
} }

View file

@ -2947,9 +2947,11 @@ public class XmppConnectionService extends Service {
for (Jid invite : jids) { for (Jid invite : jids) {
invite(conversation, invite); invite(conversation, invite);
} }
if (account.countPresences() > 1) { for(String resource : account.getSelfContact().getPresences().toResourceArray()) {
directInvite(conversation, account.getJid().asBareJid()); Jid other = account.getJid().withResource(resource);
} Log.d(Config.LOGTAG,account.getJid().asBareJid()+": sending direct invite to "+other);
directInvite(conversation, other);
}
saveConversationAsBookmark(conversation, name); saveConversationAsBookmark(conversation, name);
if (callback != null) { if (callback != null) {
callback.success(conversation); callback.success(conversation);
@ -3077,7 +3079,6 @@ public class XmppConnectionService extends Service {
if (packet.getType() == IqPacket.TYPE.RESULT) { if (packet.getType() == IqPacket.TYPE.RESULT) {
Data data = Data.parse(packet.query().findChild("x", Namespace.DATA)); Data data = Data.parse(packet.query().findChild("x", Namespace.DATA));
data.submit(options); data.submit(options);
Log.d(Config.LOGTAG,data.toString());
IqPacket set = new IqPacket(IqPacket.TYPE.SET); IqPacket set = new IqPacket(IqPacket.TYPE.SET);
set.setTo(conversation.getJid().asBareJid()); set.setTo(conversation.getJid().asBareJid());
set.query("http://jabber.org/protocol/muc#owner").addChild(data); set.query("http://jabber.org/protocol/muc#owner").addChild(data);

View file

@ -178,7 +178,7 @@ public final class MucDetailsContextMenuHelper {
return true; return true;
case R.id.invite: case R.id.invite:
if (user.getAffiliation().ranks(MucOptions.Affiliation.MEMBER)) { if (user.getAffiliation().ranks(MucOptions.Affiliation.MEMBER)) {
activity.xmppConnectionService.directInvite(conversation, jid); activity.xmppConnectionService.directInvite(conversation, jid.asBareJid());
} else { } else {
activity.xmppConnectionService.invite(conversation, jid); activity.xmppConnectionService.invite(conversation, jid);
} }