aboutsummaryrefslogtreecommitdiffstats
path: root/src
diff options
context:
space:
mode:
authoriNPUTmice <daniel@gultsch.de>2014-09-03 14:57:40 +0200
committeriNPUTmice <daniel@gultsch.de>2014-09-03 14:57:40 +0200
commit664c9c434f80ace23a94b8c506b6211a72ec5cce (patch)
treee6af38f571ffeefa329f33f83517c7f0561ef333 /src
parent5ae62f18b4202dcb49b19964ade46e203eefc917 (diff)
avoiding resource conflicts
Diffstat (limited to 'src')
-rw-r--r--src/eu/siacs/conversations/xmpp/XmppConnection.java9
1 files changed, 7 insertions, 2 deletions
diff --git a/src/eu/siacs/conversations/xmpp/XmppConnection.java b/src/eu/siacs/conversations/xmpp/XmppConnection.java
index ae6b6f72..36920929 100644
--- a/src/eu/siacs/conversations/xmpp/XmppConnection.java
+++ b/src/eu/siacs/conversations/xmpp/XmppConnection.java
@@ -763,8 +763,13 @@ public class XmppConnection implements Runnable {
});
}
- private void processStreamError(Tag currentTag) {
- Log.d(Config.LOGTAG, "processStreamError");
+ private void processStreamError(Tag currentTag) throws XmlPullParserException, IOException {
+ Element streamError = tagReader.readElement(currentTag);
+ if (streamError!=null && streamError.hasChild("conflict")) {
+ String resource = account.getResource().split("\\.")[0];
+ account.setResource(resource+"."+nextRandomId());
+ Log.d(Config.LOGTAG,account.getJid()+": switching resource due to conflict ("+account.getResource()+")");
+ }
}
private void sendStartStream() throws IOException {