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 | 20 |
1 files changed, 13 insertions, 7 deletions
diff --git a/src/main/java/de/pixart/messenger/services/XmppConnectionService.java b/src/main/java/de/pixart/messenger/services/XmppConnectionService.java index bad55aed9..9d9be2a5b 100644 --- a/src/main/java/de/pixart/messenger/services/XmppConnectionService.java +++ b/src/main/java/de/pixart/messenger/services/XmppConnectionService.java @@ -2854,31 +2854,35 @@ public class XmppConnectionService extends Service { } } - private void enableMucPush(final Conversation conversation) { + private void enableDirectMucPush(final Conversation conversation) { final Account account = conversation.getAccount(); final Jid room = conversation.getJid().asBareJid(); final IqPacket enable = mIqGenerator.enablePush(conversation.getAccount().getJid(), conversation.getUuid(), null); enable.setTo(room); sendIqPacket(account, enable, (a, response) -> { if (response.getType() == IqPacket.TYPE.RESULT) { - Log.d(Config.LOGTAG, a.getJid().asBareJid() + ": enabled push for muc " + room); + Log.d(Config.LOGTAG, a.getJid().asBareJid() + ": enabled direct push for muc " + room); } else if (response.getType() == IqPacket.TYPE.ERROR) { - Log.d(Config.LOGTAG, a.getJid().asBareJid() + ": unable to enable push for muc " + room + " " + response.getError()); + Log.d(Config.LOGTAG, a.getJid().asBareJid() + ": unable to enable direct push for muc " + room + " " + response.getError()); } }); + } + private void enableMucPush(final Conversation conversation) { + enableDirectMucPush(conversation); + mPushManagementService.registerPushTokenOnServer(conversation); } - private void disableMucPush(final Conversation conversation) { + private void disableDirectMucPush(final Conversation conversation) { final Account account = conversation.getAccount(); final Jid room = conversation.getJid().asBareJid(); final IqPacket disable = mIqGenerator.disablePush(conversation.getAccount().getJid(), conversation.getUuid()); disable.setTo(room); sendIqPacket(account, disable, (a, response) -> { if (response.getType() == IqPacket.TYPE.RESULT) { - Log.d(Config.LOGTAG, a.getJid().asBareJid() + ": disabled push for muc " + room); + Log.d(Config.LOGTAG, a.getJid().asBareJid() + ": disabled direct push for muc " + room); } else if (response.getType() == IqPacket.TYPE.ERROR) { - Log.d(Config.LOGTAG, a.getJid().asBareJid() + ": unable to disable push for muc " + room + " " + response.getError()); + Log.d(Config.LOGTAG, a.getJid().asBareJid() + ": unable to disable direct push for muc " + room + " " + response.getError()); } }); } @@ -3064,7 +3068,8 @@ public class XmppConnectionService extends Service { account.pendingConferenceLeaves.remove(conversation); if (account.getStatus() == Account.State.ONLINE || now) { if (conversation.getMucOptions().push()) { - disableMucPush(conversation); + disableDirectMucPush(conversation); + mPushManagementService.disablePushOnServer(conversation); } sendPresencePacket(conversation.getAccount(), mPresenceGenerator.leave(conversation.getMucOptions())); conversation.getMucOptions().setOffline(); @@ -4409,6 +4414,7 @@ public class XmppConnectionService extends Service { for (Account account : getAccounts()) { if (account.isOnlineAndConnected() && mPushManagementService.available(account)) { mPushManagementService.registerPushTokenOnServer(account); + //TODO renew mucs } } } |