aboutsummaryrefslogtreecommitdiffstats
path: root/src/main/java/de/pixart/messenger/services/XmppConnectionService.java
diff options
context:
space:
mode:
Diffstat (limited to 'src/main/java/de/pixart/messenger/services/XmppConnectionService.java')
-rw-r--r--src/main/java/de/pixart/messenger/services/XmppConnectionService.java35
1 files changed, 35 insertions, 0 deletions
diff --git a/src/main/java/de/pixart/messenger/services/XmppConnectionService.java b/src/main/java/de/pixart/messenger/services/XmppConnectionService.java
index 8ce549e8c..b9945de0a 100644
--- a/src/main/java/de/pixart/messenger/services/XmppConnectionService.java
+++ b/src/main/java/de/pixart/messenger/services/XmppConnectionService.java
@@ -2803,6 +2803,9 @@ public class XmppConnectionService extends Service {
saveConversationAsBookmark(conversation, null);
}
}
+ if (mucOptions.push()) {
+ enableMucPush(conversation);
+ }
synchronized (account.inProgressConferenceJoins) {
account.inProgressConferenceJoins.remove(conversation);
sendUnsentMessages(conversation);
@@ -2845,6 +2848,35 @@ public class XmppConnectionService extends Service {
}
}
+ private void enableMucPush(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);
+ } else if (response.getType() == IqPacket.TYPE.ERROR) {
+ Log.d(Config.LOGTAG, a.getJid().asBareJid() + ": unable to enable push for muc " + room + " " + response.getError());
+ }
+ });
+
+ }
+
+ private void disableMucPush(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);
+ } else if (response.getType() == IqPacket.TYPE.ERROR) {
+ Log.d(Config.LOGTAG, a.getJid().asBareJid() + ": unable to disable push for muc " + room + " " + response.getError());
+ }
+ });
+ }
+
private void fetchConferenceMembers(final Conversation conversation) {
final Account account = conversation.getAccount();
final AxolotlService axolotlService = account.getAxolotlService();
@@ -3025,6 +3057,9 @@ public class XmppConnectionService extends Service {
account.pendingConferenceJoins.remove(conversation);
account.pendingConferenceLeaves.remove(conversation);
if (account.getStatus() == Account.State.ONLINE || now) {
+ if (conversation.getMucOptions().push()) {
+ disableMucPush(conversation);
+ }
sendPresencePacket(conversation.getAccount(), mPresenceGenerator.leave(conversation.getMucOptions()));
conversation.getMucOptions().setOffline();
Bookmark bookmark = conversation.getBookmark();