From 86f09dd9b9d9788e1b935dbb56fdac44277088f3 Mon Sep 17 00:00:00 2001 From: Daniel Gultsch Date: Thu, 30 Nov 2017 13:21:03 +0100 Subject: [PATCH] PresenceParser: work around for ejabberd not including status code 110 in shut down presence --- .../java/eu/siacs/conversations/parser/PresenceParser.java | 4 +++- .../java/eu/siacs/conversations/ui/ConversationFragment.java | 4 ++-- 2 files changed, 5 insertions(+), 3 deletions(-) diff --git a/src/main/java/eu/siacs/conversations/parser/PresenceParser.java b/src/main/java/eu/siacs/conversations/parser/PresenceParser.java index 972ac5fd3..eec6bd140 100644 --- a/src/main/java/eu/siacs/conversations/parser/PresenceParser.java +++ b/src/main/java/eu/siacs/conversations/parser/PresenceParser.java @@ -115,7 +115,9 @@ public class PresenceParser extends AbstractParser implements } } } else if (type.equals("unavailable")) { - if (codes.contains(MucOptions.STATUS_CODE_SELF_PRESENCE)) { + if (codes.contains(MucOptions.STATUS_CODE_SHUTDOWN) && from.equals(mucOptions.getSelf().getFullJid())) { + mucOptions.setError(MucOptions.Error.SHUTDOWN); + } else if (codes.contains(MucOptions.STATUS_CODE_SELF_PRESENCE)) { if (codes.contains(MucOptions.STATUS_CODE_KICKED)) { mucOptions.setError(MucOptions.Error.KICKED); } else if (codes.contains(MucOptions.STATUS_CODE_BANNED)) { diff --git a/src/main/java/eu/siacs/conversations/ui/ConversationFragment.java b/src/main/java/eu/siacs/conversations/ui/ConversationFragment.java index 5af79557e..4dd7f84b9 100644 --- a/src/main/java/eu/siacs/conversations/ui/ConversationFragment.java +++ b/src/main/java/eu/siacs/conversations/ui/ConversationFragment.java @@ -1107,10 +1107,10 @@ public class ConversationFragment extends Fragment implements EditMessage.Keyboa showSnackbar(R.string.conference_kicked, R.string.join, joinMuc); break; case UNKNOWN: - showSnackbar(R.string.conference_unknown_error, R.string.join, joinMuc); + showSnackbar(R.string.conference_unknown_error, R.string.try_again, joinMuc); break; case SHUTDOWN: - showSnackbar(R.string.conference_shutdown, R.string.join, joinMuc); + showSnackbar(R.string.conference_shutdown, R.string.try_again, joinMuc); break; default: hideSnackbar();