diff options
author | iNPUTmice <daniel@gultsch.de> | 2014-09-03 14:57:40 +0200 |
---|---|---|
committer | iNPUTmice <daniel@gultsch.de> | 2014-09-03 14:57:40 +0200 |
commit | 664c9c434f80ace23a94b8c506b6211a72ec5cce (patch) | |
tree | e6af38f571ffeefa329f33f83517c7f0561ef333 /src/eu/siacs/conversations | |
parent | 5ae62f18b4202dcb49b19964ade46e203eefc917 (diff) |
avoiding resource conflicts
Diffstat (limited to 'src/eu/siacs/conversations')
-rw-r--r-- | src/eu/siacs/conversations/xmpp/XmppConnection.java | 9 |
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 { |