diff options
author | Christian Schneppe <christian@pix-art.de> | 2017-05-31 21:24:35 +0200 |
---|---|---|
committer | Christian Schneppe <christian@pix-art.de> | 2017-05-31 21:24:35 +0200 |
commit | df196bf6ff0c6c195ffb16c7fe903ff149c553c4 (patch) | |
tree | d82b6a261e96f3693d8075218ba2dc5de48eb222 /src/main | |
parent | 89655f6233ed4ef41830719bb77b51dc12787cd5 (diff) |
rename resource on bind conflict
Diffstat (limited to 'src/main')
-rw-r--r-- | src/main/java/de/pixart/messenger/xmpp/XmppConnection.java | 8 |
1 files changed, 7 insertions, 1 deletions
diff --git a/src/main/java/de/pixart/messenger/xmpp/XmppConnection.java b/src/main/java/de/pixart/messenger/xmpp/XmppConnection.java index fc157cf4d..09b90b3ba 100644 --- a/src/main/java/de/pixart/messenger/xmpp/XmppConnection.java +++ b/src/main/java/de/pixart/messenger/xmpp/XmppConnection.java @@ -1074,7 +1074,13 @@ public class XmppConnection implements Runnable { } else { Log.d(Config.LOGTAG, account.getJid() + ": disconnecting because of bind failure (" + packet.toString()); } - account.setResource(account.getResource().split("\\.")[0]); + final Element error = packet.findChild("error"); + final String resource = account.getResource().split("\\.")[0]; + if (packet.getType() == IqPacket.TYPE.ERROR && error != null && error.hasChild("conflict")) { + account.setResource(resource + "." + nextRandomId()); + } else { + account.setResource(resource); + } throw new StateChangingError(Account.State.BIND_FAILURE); } }); |