avoiding resource conflicts

This commit is contained in:
iNPUTmice 2014-09-03 14:57:40 +02:00
parent 5ae62f18b4
commit 664c9c434f

View File

@ -763,8 +763,13 @@ public class XmppConnection implements Runnable {
}); });
} }
private void processStreamError(Tag currentTag) { private void processStreamError(Tag currentTag) throws XmlPullParserException, IOException {
Log.d(Config.LOGTAG, "processStreamError"); 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 { private void sendStartStream() throws IOException {