set autojoin=true after following invite

This commit is contained in:
Daniel Gultsch 2019-10-07 09:51:03 +02:00
parent b96ef1e591
commit 4df8343b05
3 changed files with 2414 additions and 2406 deletions

View File

@ -1661,10 +1661,9 @@ public class XmppConnectionService extends Service {
final XmppConnection connection = account.getXmppConnection();
if (connection.getFeatures().bookmarksConversion()) {
IqPacket request = mIqGenerator.deleteItem(Namespace.BOOKMARKS2, bookmark.getJid().asBareJid().toEscapedString());
sendIqPacket(account, request, new OnIqPacketReceived() {
@Override
public void onIqPacketReceived(Account account, IqPacket packet) {
Log.d(Config.LOGTAG,packet.toString());
sendIqPacket(account, request, (a, response) -> {
if (response.getType() == IqPacket.TYPE.ERROR) {
Log.d(Config.LOGTAG, a.getJid().asBareJid() + ": unable to delete bookmark " + response.getError());
}
});
} else if (connection.getFeatures().bookmarksConversion()) {
@ -2668,10 +2667,19 @@ public class XmppConnectionService extends Service {
}
if (mucOptions.isPrivateAndNonAnonymous()) {
fetchConferenceMembers(conversation);
if (followedInvite && conversation.getBookmark() == null) {
if (followedInvite) {
final Bookmark bookmark = conversation.getBookmark();
if (bookmark != null) {
if (!bookmark.autojoin()) {
bookmark.setAutojoin(true);
createBookmark(account, bookmark);
}
} else {
saveConversationAsBookmark(conversation, null);
}
}
}
if (mucOptions.push()) {
enableMucPush(conversation);
}

View File

@ -225,13 +225,13 @@ public class ChannelDiscoveryActivity extends XmppActivity implements MenuItem.O
final Conversation conversation = xmppConnectionService.findOrCreateConversation(account, result.getRoom(), true, true, true);
Bookmark bookmark = conversation.getBookmark();
if (bookmark != null) {
if (!bookmark.autojoin() && syncAutojoin) {
conversation.getBookmark().setAutojoin(true);
if (!bookmark.autojoin() && syncAutoJoin) {
bookmark.setAutojoin(true);
xmppConnectionService.createBookmark(account, bookmark);
}
} else {
bookmark = new Bookmark(account, conversation.getJid().asBareJid());
bookmark.setAutojoin(syncAutojoin);
bookmark.setAutojoin(syncAutoJoin);
xmppConnectionService.createBookmark(account, bookmark);
}
switchToConversation(conversation);

View File

@ -1880,7 +1880,7 @@ public class XmppConnection implements Runnable {
}
public boolean bookmarks2() {
return Config.USE_BOOKMARKS2 || hasDiscoFeature(account.getJid().asBareJid(), Namespace.BOOKMARKS2_COMPAT);
return Config.USE_BOOKMARKS2 /* || hasDiscoFeature(account.getJid().asBareJid(), Namespace.BOOKMARKS2_COMPAT)*/;
}
}
}