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

View file

@ -1880,7 +1880,7 @@ public class XmppConnection implements Runnable {
} }
public boolean bookmarks2() { 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)*/;
} }
} }
} }