issue self ping + rejoin on muc status code 333

This commit is contained in:
Daniel Gultsch 2022-08-25 17:12:39 +02:00
parent d584ffee7d
commit ddd08bfe5f
5 changed files with 23 additions and 6 deletions

View file

@ -725,6 +725,7 @@ public class MucOptions {
SHUTDOWN,
DESTROYED,
INVALID_NICK,
TECHNICAL_PROBLEMS,
UNKNOWN,
NON_ANONYMOUS
}

View file

@ -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;

View file

@ -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)) {

View file

@ -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;

View file

@ -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>