diff options
author | Daniel Gultsch <daniel@gultsch.de> | 2022-08-25 18:12:39 +0300 |
---|---|---|
committer | Daniel Gultsch <daniel@gultsch.de> | 2022-08-25 18:12:39 +0300 |
commit | ddd08bfe5fb16125306a5d59f43535af80d96383 (patch) | |
tree | 8b616f2ef6d3dfe5cef5a7d4c73ab74411eb78af /src/main | |
parent | d584ffee7d951212ba379b2425571ec8c398c189 (diff) |
issue self ping + rejoin on muc status code 333
Diffstat (limited to 'src/main')
5 files changed, 23 insertions, 6 deletions
diff --git a/src/main/java/eu/siacs/conversations/entities/MucOptions.java b/src/main/java/eu/siacs/conversations/entities/MucOptions.java index 34f437e1c..060b1b6f6 100644 --- a/src/main/java/eu/siacs/conversations/entities/MucOptions.java +++ b/src/main/java/eu/siacs/conversations/entities/MucOptions.java @@ -725,6 +725,7 @@ public class MucOptions { SHUTDOWN, DESTROYED, INVALID_NICK, + TECHNICAL_PROBLEMS, UNKNOWN, NON_ANONYMOUS } diff --git a/src/main/java/eu/siacs/conversations/generator/IqGenerator.java b/src/main/java/eu/siacs/conversations/generator/IqGenerator.java index 2776aa4f0..6b87cb36d 100644 --- a/src/main/java/eu/siacs/conversations/generator/IqGenerator.java +++ b/src/main/java/eu/siacs/conversations/generator/IqGenerator.java @@ -136,8 +136,8 @@ public class IqGenerator extends AbstractGenerator { return publish(Namespace.NICK, item); } - public IqPacket deleteNode(String node) { - IqPacket packet = new IqPacket(IqPacket.TYPE.SET); + public IqPacket deleteNode(final String node) { + final IqPacket packet = new IqPacket(IqPacket.TYPE.SET); final Element pubsub = packet.addChild("pubsub", Namespace.PUBSUB_OWNER); pubsub.addChild("delete").setAttribute("node", node); return packet; diff --git a/src/main/java/eu/siacs/conversations/parser/PresenceParser.java b/src/main/java/eu/siacs/conversations/parser/PresenceParser.java index 341e8d9a0..8ad582b17 100644 --- a/src/main/java/eu/siacs/conversations/parser/PresenceParser.java +++ b/src/main/java/eu/siacs/conversations/parser/PresenceParser.java @@ -56,7 +56,8 @@ public class PresenceParser extends AbstractParser implements } private void processConferencePresence(PresencePacket packet, Conversation conversation) { - MucOptions mucOptions = conversation.getMucOptions(); + final Account account = conversation.getAccount(); + final MucOptions mucOptions = conversation.getMucOptions(); final Jid jid = conversation.getAccount().getJid(); final Jid from = packet.getFrom(); if (!from.isBareJid()) { @@ -93,7 +94,7 @@ public class PresenceParser extends AbstractParser implements axolotlService.fetchDeviceIds(user.getRealJid()); } if (codes.contains(MucOptions.STATUS_CODE_ROOM_CREATED) && mucOptions.autoPushConfiguration()) { - Log.d(Config.LOGTAG,mucOptions.getAccount().getJid().asBareJid() + Log.d(Config.LOGTAG,account.getJid().asBareJid() +": room '" +mucOptions.getConversation().getJid().asBareJid() +"' created. pushing default configuration"); @@ -138,13 +139,24 @@ public class PresenceParser extends AbstractParser implements 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); + Log.d(Config.LOGTAG, account.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_TECHNICAL_REASONS)) { - mucOptions.setError(MucOptions.Error.UNKNOWN); + final boolean wasOnline = mucOptions.online(); + mucOptions.setError(MucOptions.Error.TECHNICAL_PROBLEMS); + Log.d( + Config.LOGTAG, + account.getJid().asBareJid() + + ": received status code 333 in room " + + mucOptions.getConversation().getJid().asBareJid() + + " online=" + + wasOnline); + if (wasOnline) { + mXmppConnectionService.mucSelfPingAndRejoin(conversation); + } } else 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 0471c014f..3b923adce 100644 --- a/src/main/java/eu/siacs/conversations/ui/ConversationFragment.java +++ b/src/main/java/eu/siacs/conversations/ui/ConversationFragment.java @@ -2721,6 +2721,9 @@ public class ConversationFragment extends XmppFragment case KICKED: showSnackbar(R.string.conference_kicked, R.string.join, joinMuc); break; + case TECHNICAL_PROBLEMS: + showSnackbar(R.string.conference_technical_problems, R.string.try_again, joinMuc); + break; case UNKNOWN: showSnackbar(R.string.conference_unknown_error, R.string.try_again, joinMuc); break; diff --git a/src/main/res/values/strings.xml b/src/main/res/values/strings.xml index d4e2c0d57..299c57b33 100644 --- a/src/main/res/values/strings.xml +++ b/src/main/res/values/strings.xml @@ -301,6 +301,7 @@ <string name="conference_kicked">You have been kicked from this group chat</string> <string name="conference_shutdown">The group chat was shut down</string> <string name="conference_unknown_error">You are no longer in this group chat</string> + <string name="conference_technical_problems">You left this group chat due to technical reasons</string> <string name="using_account">using account %s</string> <string name="hosted_on">hosted on %s</string> <string name="checking_x">Checking %s on HTTP host</string> |