From 664c9c434f80ace23a94b8c506b6211a72ec5cce Mon Sep 17 00:00:00 2001 From: iNPUTmice Date: Wed, 3 Sep 2014 14:57:40 +0200 Subject: avoiding resource conflicts --- src/eu/siacs/conversations/xmpp/XmppConnection.java | 9 +++++++-- 1 file changed, 7 insertions(+), 2 deletions(-) (limited to 'src/eu/siacs') 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 { -- cgit v1.2.3