aboutsummaryrefslogtreecommitdiffstats
path: root/src
diff options
context:
space:
mode:
Diffstat (limited to 'src')
-rw-r--r--src/main/java/de/pixart/messenger/generator/PresenceGenerator.java9
-rw-r--r--src/main/java/de/pixart/messenger/services/XmppConnectionService.java10
2 files changed, 12 insertions, 7 deletions
diff --git a/src/main/java/de/pixart/messenger/generator/PresenceGenerator.java b/src/main/java/de/pixart/messenger/generator/PresenceGenerator.java
index 2234d54e6..a6e46cb76 100644
--- a/src/main/java/de/pixart/messenger/generator/PresenceGenerator.java
+++ b/src/main/java/de/pixart/messenger/generator/PresenceGenerator.java
@@ -2,6 +2,7 @@ package de.pixart.messenger.generator;
import de.pixart.messenger.entities.Account;
import de.pixart.messenger.entities.Contact;
+import de.pixart.messenger.entities.MucOptions;
import de.pixart.messenger.entities.Presence;
import de.pixart.messenger.services.XmppConnectionService;
import de.pixart.messenger.xml.Element;
@@ -62,6 +63,14 @@ public class PresenceGenerator extends AbstractGenerator {
return packet;
}
+ public PresencePacket leave(final MucOptions mucOptions) {
+ PresencePacket presencePacket = new PresencePacket();
+ presencePacket.setTo(mucOptions.getSelf().getFullJid());
+ presencePacket.setFrom(mucOptions.getAccount().getJid());
+ presencePacket.setAttribute("type", "unavailable");
+ return presencePacket;
+ }
+
public PresencePacket sendOfflinePresence(Account account) {
PresencePacket packet = new PresencePacket();
packet.setFrom(account.getJid());
diff --git a/src/main/java/de/pixart/messenger/services/XmppConnectionService.java b/src/main/java/de/pixart/messenger/services/XmppConnectionService.java
index 0fb8a90fd..e7fd076cc 100644
--- a/src/main/java/de/pixart/messenger/services/XmppConnectionService.java
+++ b/src/main/java/de/pixart/messenger/services/XmppConnectionService.java
@@ -2413,6 +2413,7 @@ public class XmppConnectionService extends Service {
account.pendingConferenceJoins.remove(conversation);
account.pendingConferenceLeaves.remove(conversation);
if (account.getStatus() == Account.State.ONLINE) {
+ sendPresencePacket(account, mPresenceGenerator.leave(conversation.getMucOptions()));
conversation.resetMucOptions();
if (onConferenceJoined != null) {
conversation.getMucOptions().flagNoAutoPushConfiguration();
@@ -2618,15 +2619,10 @@ public class XmppConnectionService extends Service {
account.pendingConferenceJoins.remove(conversation);
account.pendingConferenceLeaves.remove(conversation);
if (account.getStatus() == Account.State.ONLINE || now) {
- PresencePacket packet = new PresencePacket();
- packet.setTo(conversation.getMucOptions().getSelf().getFullJid());
- packet.setFrom(conversation.getAccount().getJid());
- packet.setAttribute("type", "unavailable");
- sendPresencePacket(conversation.getAccount(), packet);
+ sendPresencePacket(conversation.getAccount(), mPresenceGenerator.leave(conversation.getMucOptions()));
conversation.getMucOptions().setOffline();
conversation.deregisterWithBookmark();
- Log.d(Config.LOGTAG, conversation.getAccount().getJid().toBareJid()
- + ": leaving muc " + conversation.getJid());
+ Log.d(Config.LOGTAG, conversation.getAccount().getJid().toBareJid() + ": leaving muc " + conversation.getJid());
} else {
account.pendingConferenceLeaves.add(conversation);
}