diff options
author | Christian Schneppe <christian@pix-art.de> | 2018-02-26 19:44:18 +0100 |
---|---|---|
committer | Christian Schneppe <christian@pix-art.de> | 2018-02-26 19:44:18 +0100 |
commit | ef5bcf1809cd59520ecd46dc03cb239bca3034f7 (patch) | |
tree | 73452ecee71be096d089d7c0ea4b6e221c5ce967 /src/main/java/de/pixart/messenger/xmpp | |
parent | 06014f81e5e312bf0dec557fb23ba49d37ba3270 (diff) |
added config param to use a random resource at every bind
Diffstat (limited to 'src/main/java/de/pixart/messenger/xmpp')
-rw-r--r-- | src/main/java/de/pixart/messenger/xmpp/XmppConnection.java | 5 |
1 files changed, 3 insertions, 2 deletions
diff --git a/src/main/java/de/pixart/messenger/xmpp/XmppConnection.java b/src/main/java/de/pixart/messenger/xmpp/XmppConnection.java index a64175cb3..6bd4904bf 100644 --- a/src/main/java/de/pixart/messenger/xmpp/XmppConnection.java +++ b/src/main/java/de/pixart/messenger/xmpp/XmppConnection.java @@ -1100,7 +1100,8 @@ public class XmppConnection implements Runnable { } clearIqCallbacks(); final IqPacket iq = new IqPacket(IqPacket.TYPE.SET); - iq.addChild("bind", Namespace.BIND).addChild("resource").setContent(account.getResource()); + final String resource = Config.USE_RANDOM_RESOURCE_ON_EVERY_BIND ? nextRandomId() : account.getResource(); + iq.addChild("bind", Namespace.BIND).addChild("resource").setContent(resource); this.sendUnmodifiedIqPacket(iq, new OnIqPacketReceived() { @Override public void onIqPacketReceived(final Account account, final IqPacket packet) { @@ -1400,7 +1401,7 @@ public class XmppConnection implements Runnable { } private String nextRandomId() { - return CryptoHelper.random(50,mXmppConnectionService.getRNG()); + return CryptoHelper.random(10, mXmppConnectionService.getRNG()); } public String sendIqPacket(final IqPacket packet, final OnIqPacketReceived callback) { |