aboutsummaryrefslogtreecommitdiffstats
path: root/src
diff options
context:
space:
mode:
Diffstat (limited to 'src')
-rw-r--r--src/main/java/de/pixart/messenger/entities/MucOptions.java1
-rw-r--r--src/main/java/de/pixart/messenger/parser/PresenceParser.java28
-rw-r--r--src/main/java/de/pixart/messenger/ui/ConversationFragment.java5
-rw-r--r--src/main/res/values/strings.xml1
4 files changed, 33 insertions, 2 deletions
diff --git a/src/main/java/de/pixart/messenger/entities/MucOptions.java b/src/main/java/de/pixart/messenger/entities/MucOptions.java
index cf12a9533..774620707 100644
--- a/src/main/java/de/pixart/messenger/entities/MucOptions.java
+++ b/src/main/java/de/pixart/messenger/entities/MucOptions.java
@@ -169,6 +169,7 @@ public class MucOptions {
RESOURCE_CONSTRAINT,
KICKED,
SHUTDOWN,
+ DESTROYED,
INVALID_NICK,
UNKNOWN
}
diff --git a/src/main/java/de/pixart/messenger/parser/PresenceParser.java b/src/main/java/de/pixart/messenger/parser/PresenceParser.java
index 4091e34cd..6602e8aef 100644
--- a/src/main/java/de/pixart/messenger/parser/PresenceParser.java
+++ b/src/main/java/de/pixart/messenger/parser/PresenceParser.java
@@ -18,6 +18,7 @@ import de.pixart.messenger.generator.IqGenerator;
import de.pixart.messenger.generator.PresenceGenerator;
import de.pixart.messenger.services.XmppConnectionService;
import de.pixart.messenger.utils.Namespace;
+import de.pixart.messenger.utils.XmppUri;
import de.pixart.messenger.xml.Element;
import de.pixart.messenger.xmpp.InvalidJid;
import de.pixart.messenger.xmpp.OnPresencePacketReceived;
@@ -121,7 +122,15 @@ public class PresenceParser extends AbstractParser implements
}
}
} else if (type.equals("unavailable")) {
- if (codes.contains(MucOptions.STATUS_CODE_SHUTDOWN) && from.equals(mucOptions.getSelf().getFullJid())) {
+ final boolean fullJidMatches = from.equals(mucOptions.getSelf().getFullJid());
+ if (x.hasChild("destroy") && fullJidMatches) {
+ Element destroy = x.findChild("destroy");
+ final Jid alternate = destroy == null ? null : InvalidJid.getNullForInvalid(destroy.getAttributeAsJid("jid"));
+ mucOptions.setError(MucOptions.Error.DESTROYED);
+ if (alternate != null) {
+ Log.d(Config.LOGTAG, conversation.getAccount().getJid().asBareJid() + ": muc destroyed. alternate location " + alternate);
+ }
+ } else if (codes.contains(MucOptions.STATUS_CODE_SHUTDOWN) && fullJidMatches) {
mucOptions.setError(MucOptions.Error.SHUTDOWN);
} else if (codes.contains(MucOptions.STATUS_CODE_SELF_PRESENCE)) {
if (codes.contains(MucOptions.STATUS_CODE_KICKED)) {
@@ -167,6 +176,23 @@ public class PresenceParser extends AbstractParser implements
mucOptions.setError(MucOptions.Error.MEMBERS_ONLY);
} else if (error.hasChild("resource-constraint")) {
mucOptions.setError(MucOptions.Error.RESOURCE_CONSTRAINT);
+ } else if (error.hasChild("gone")) {
+ final String gone = error.findChildContent("gone");
+ final Jid alternate;
+ if (gone != null) {
+ final XmppUri xmppUri = new XmppUri(gone);
+ if (xmppUri.isJidValid()) {
+ alternate = xmppUri.getJid();
+ } else {
+ alternate = null;
+ }
+ } else {
+ alternate = null;
+ }
+ mucOptions.setError(MucOptions.Error.DESTROYED);
+ if (alternate != null) {
+ Log.d(Config.LOGTAG, conversation.getAccount().getJid().asBareJid() + ": muc destroyed. alternate location " + alternate);
+ }
} else {
final String text = error.findChildContent("text");
if (text != null && text.contains("attribute 'to'")) {
diff --git a/src/main/java/de/pixart/messenger/ui/ConversationFragment.java b/src/main/java/de/pixart/messenger/ui/ConversationFragment.java
index f32aa26ed..bc98e06e3 100644
--- a/src/main/java/de/pixart/messenger/ui/ConversationFragment.java
+++ b/src/main/java/de/pixart/messenger/ui/ConversationFragment.java
@@ -2355,13 +2355,16 @@ public class ConversationFragment extends XmppFragment implements EditMessage.Ke
showSnackbar(R.string.conference_kicked, R.string.join, joinMuc);
break;
case UNKNOWN:
- showSnackbar(R.string.conference_unknown_error, R.string.leave, leaveMuc);
+ showSnackbar(R.string.conference_unknown_error, R.string.leave, joinMuc);
break;
case INVALID_NICK:
showSnackbar(R.string.invalid_muc_nick, R.string.edit, clickToMuc);
case SHUTDOWN:
showSnackbar(R.string.conference_shutdown, R.string.try_again, joinMuc);
break;
+ case DESTROYED:
+ showSnackbar(R.string.conference_destroyed, R.string.leave, leaveMuc);
+ break;
default:
hideSnackbar();
break;
diff --git a/src/main/res/values/strings.xml b/src/main/res/values/strings.xml
index d48801c54..89cecf15f 100644
--- a/src/main/res/values/strings.xml
+++ b/src/main/res/values/strings.xml
@@ -804,4 +804,5 @@
<string name="everyone_has_read_up_to_this_point">Everyone has read up to this point</string>
<string name="conference_resource_constraint">Resource constraint</string>
<string name="delete_message">Delete message</string>
+ <string name="conference_destroyed">This group chat has been destroyed</string>
</resources>