From 0fa97bdc1160096ea91390de986908c02a5cf3c9 Mon Sep 17 00:00:00 2001 From: Daniel Gultsch Date: Sat, 7 Jul 2018 10:28:31 +0200 Subject: [PATCH] show snackbar for resource constraint in mucs --- src/main/java/eu/siacs/conversations/entities/MucOptions.java | 1 + .../java/eu/siacs/conversations/parser/PresenceParser.java | 2 ++ .../java/eu/siacs/conversations/ui/ConversationFragment.java | 3 +++ src/main/res/values/strings.xml | 1 + 4 files changed, 7 insertions(+) diff --git a/src/main/java/eu/siacs/conversations/entities/MucOptions.java b/src/main/java/eu/siacs/conversations/entities/MucOptions.java index 297c3d0f4..30481b3ee 100644 --- a/src/main/java/eu/siacs/conversations/entities/MucOptions.java +++ b/src/main/java/eu/siacs/conversations/entities/MucOptions.java @@ -139,6 +139,7 @@ public class MucOptions { PASSWORD_REQUIRED, BANNED, MEMBERS_ONLY, + RESOURCE_CONSTRAINT, KICKED, SHUTDOWN, INVALID_NICK, diff --git a/src/main/java/eu/siacs/conversations/parser/PresenceParser.java b/src/main/java/eu/siacs/conversations/parser/PresenceParser.java index 959179099..f9e615787 100644 --- a/src/main/java/eu/siacs/conversations/parser/PresenceParser.java +++ b/src/main/java/eu/siacs/conversations/parser/PresenceParser.java @@ -166,6 +166,8 @@ public class PresenceParser extends AbstractParser implements mucOptions.setError(MucOptions.Error.BANNED); } else if (error.hasChild("registration-required")) { mucOptions.setError(MucOptions.Error.MEMBERS_ONLY); + } else if (error.hasChild("resource-constraint")) { + mucOptions.setError(MucOptions.Error.RESOURCE_CONSTRAINT); } else { final String text = error.findChildContent("text"); if (text != null && text.contains("attribute 'to'")) { diff --git a/src/main/java/eu/siacs/conversations/ui/ConversationFragment.java b/src/main/java/eu/siacs/conversations/ui/ConversationFragment.java index 35509d9b9..ba91f947d 100644 --- a/src/main/java/eu/siacs/conversations/ui/ConversationFragment.java +++ b/src/main/java/eu/siacs/conversations/ui/ConversationFragment.java @@ -2014,6 +2014,9 @@ public class ConversationFragment extends XmppFragment implements EditMessage.Ke case MEMBERS_ONLY: showSnackbar(R.string.conference_members_only, R.string.leave, leaveMuc); break; + case RESOURCE_CONSTRAINT: + showSnackbar(R.string.conference_resource_constraint, R.string.try_again, joinMuc); + break; case KICKED: showSnackbar(R.string.conference_kicked, R.string.join, joinMuc); break; diff --git a/src/main/res/values/strings.xml b/src/main/res/values/strings.xml index a16c26955..8942a7f49 100644 --- a/src/main/res/values/strings.xml +++ b/src/main/res/values/strings.xml @@ -284,6 +284,7 @@ OMEMO fingerprint copied to clipboard! You are banned from this group chat This group chat is members only + Resource constraint You have been kicked from this group chat The group chat was shut down You are no longer in this group chat