diff options
Diffstat (limited to 'src/main/java/de/pixart/messenger/services/XmppConnectionService.java')
-rw-r--r-- | src/main/java/de/pixart/messenger/services/XmppConnectionService.java | 46 |
1 files changed, 32 insertions, 14 deletions
diff --git a/src/main/java/de/pixart/messenger/services/XmppConnectionService.java b/src/main/java/de/pixart/messenger/services/XmppConnectionService.java index 644325e2c..98e330ad0 100644 --- a/src/main/java/de/pixart/messenger/services/XmppConnectionService.java +++ b/src/main/java/de/pixart/messenger/services/XmppConnectionService.java @@ -127,7 +127,6 @@ import de.pixart.messenger.utils.CryptoHelper; import de.pixart.messenger.utils.ExceptionHelper; import de.pixart.messenger.utils.MimeUtils; import de.pixart.messenger.utils.Namespace; -import de.pixart.messenger.utils.OnPhoneContactsLoadedListener; import de.pixart.messenger.utils.PhoneHelper; import de.pixart.messenger.utils.QuickLoader; import de.pixart.messenger.utils.ReplacingSerialSingleThreadExecutor; @@ -894,6 +893,8 @@ public class XmppConnectionService extends Service { return 1920; case "high": return 3840; + case "uncompressed": + return 0; default: return 3840; } @@ -907,6 +908,8 @@ public class XmppConnectionService extends Service { return 524288; // 0.5 * 1024 * 1024 = 524288 (0.5 MiB) case "high": return 1048576; // 1 * 1024 * 1024 = 1048576 (1 MiB) + case "uncompressed": + return 0; default: return 524288; } @@ -920,6 +923,8 @@ public class XmppConnectionService extends Service { return 360; case "high": return 720; + case "uncompressed": + return 0; default: return 360; } @@ -933,6 +938,8 @@ public class XmppConnectionService extends Service { return 500000; case "high": return 2000000; + case "uncompressed": + return 0; default: return 500000; } @@ -1607,6 +1614,7 @@ public class XmppConnectionService extends Service { } public void processBookmarks(Account account, Element storage, final boolean pep) { + final Set<Jid> previousBookmarks = account.getBookmarkedJids(); final HashMap<Jid, Bookmark> bookmarks = new HashMap<>(); final boolean synchronizeWithBookmarks = synchronizeWithBookmarks(); if (storage != null) { @@ -1620,6 +1628,7 @@ public class XmppConnectionService extends Service { if (bookmark.getJid() == null) { continue; } + previousBookmarks.remove(bookmark.getJid().asBareJid()); Conversation conversation = find(bookmark); if (conversation != null) { if (conversation.getMode() != Conversation.MODE_MULTI) { @@ -1636,6 +1645,16 @@ public class XmppConnectionService extends Service { } } } + if (pep && synchronizeWithBookmarks) { + Log.d(Config.LOGTAG, account.getJid().asBareJid() + ": " + previousBookmarks.size() + " bookmarks have been removed"); + for (Jid jid : previousBookmarks) { + final Conversation conversation = find(account, jid); + if (conversation != null && conversation.getMucOptions().getError() == MucOptions.Error.DESTROYED) { + Log.d(Config.LOGTAG, account.getJid().asBareJid() + ": archiving destroyed conference (" + conversation.getJid() + ") after receiving pep"); + archiveConversation(conversation, false); + } + } + } } account.setBookmarks(new CopyOnWriteArrayList<>(bookmarks.values())); } @@ -1673,8 +1692,7 @@ public class XmppConnectionService extends Service { } private void pushNodeAndEnforcePublishOptions(final Account account, final String node, final Element element, final Bundle options, final boolean retry) { - IqPacket packet = mIqGenerator.publishElement(node, element, options); - Log.d(Config.LOGTAG, packet.toString()); + final IqPacket packet = mIqGenerator.publishElement(node, element, options); sendIqPacket(account, packet, (a, response) -> { if (response.getType() == IqPacket.TYPE.RESULT) { return; @@ -3073,29 +3091,29 @@ public class XmppConnectionService extends Service { }); } - public void destroyMuc(final Conversation mSelectedConversation) { - destroyConference(mSelectedConversation, new XmppConnectionService.OnDestroyMuc() { + public void destroyRoom(final Conversation mSelectedConversation) { + destroyRoom(mSelectedConversation, new OnRoomDestroy() { @Override - public void OnDestroyMucSuccessful(int resId) { + public void onRoomDestroySucceeded(int resId) { Log.d(Config.LOGTAG, "Destroy succeed"); showErrorToastInUi(resId); } @Override - public void OnDestroyMucFailed(int resId) { + public void onRoomDestroyFailed(int resId) { Log.d(Config.LOGTAG, "Destroy failed"); showErrorToastInUi(resId); } }); } - public void destroyConference(final Conversation conference, final OnDestroyMuc callback) { - IqPacket request = this.mIqGenerator.destroyConference(conference); + public void destroyRoom(final Conversation conference, final OnRoomDestroy callback) { + IqPacket request = this.mIqGenerator.destroyRoom(conference); sendIqPacket(conference.getAccount(), request, (account, packet) -> { if (packet.getType() == IqPacket.TYPE.RESULT) { - callback.OnDestroyMucSuccessful(R.string.destroy_muc_succeed); + callback.onRoomDestroySucceeded(R.string.destroy_muc_succeed); } else { - callback.OnDestroyMucFailed(R.string.destroy_muc_failed); + callback.onRoomDestroyFailed(R.string.destroy_muc_failed); } }); } @@ -4570,10 +4588,10 @@ public class XmppConnectionService extends Service { void onRoleChangeFailed(String nick, int resid); } - public interface OnDestroyMuc { - void OnDestroyMucSuccessful(int resId); + public interface OnRoomDestroy { + void onRoomDestroySucceeded(int resId); - void OnDestroyMucFailed(int resId); + void onRoomDestroyFailed(int resId); } public interface OnConversationUpdate { |