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) {
x.setAttribute("password", password);
}
if (contact.isFullJid()) {
packet.addChild("no-store", "urn:xmpp:hints");
packet.addChild("no-copy", "urn:xmpp:hints");
}
return packet;
}

View file

@ -16,6 +16,7 @@ import eu.siacs.conversations.Config;
import eu.siacs.conversations.http.HttpConnectionManager;
import eu.siacs.conversations.http.services.MuclumbusService;
import okhttp3.OkHttpClient;
import okhttp3.ResponseBody;
import retrofit2.Call;
import retrofit2.Callback;
import retrofit2.Response;
@ -77,8 +78,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);
@ -104,8 +105,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);
@ -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 {
void onChannelSearchResultsFound(List<MuclumbusService.Room> results);
}

View file

@ -2947,9 +2947,11 @@ 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) {
callback.success(conversation);
@ -3077,7 +3079,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);

View file

@ -178,7 +178,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);
}