From 0de0cb90a09ca545f7bac5a7859eef417b5eb5d1 Mon Sep 17 00:00:00 2001 From: Daniel Gultsch Date: Wed, 16 Apr 2014 23:11:37 +0200 Subject: fixed destination bug --- .../siacs/conversations/services/XmppConnectionService.java | 4 ++++ src/eu/siacs/conversations/xmpp/jingle/JingleConnection.java | 5 +++-- src/eu/siacs/conversations/xmpp/jingle/SocksConnection.java | 11 ++++++++--- 3 files changed, 15 insertions(+), 5 deletions(-) (limited to 'src/eu') diff --git a/src/eu/siacs/conversations/services/XmppConnectionService.java b/src/eu/siacs/conversations/services/XmppConnectionService.java index 07f5a427..0dea3731 100644 --- a/src/eu/siacs/conversations/services/XmppConnectionService.java +++ b/src/eu/siacs/conversations/services/XmppConnectionService.java @@ -1033,6 +1033,10 @@ public class XmppConnectionService extends Service { this.convChangedListener.onConversationListChanged(); } } + + public void clearConversationHistory(Conversation conversation) { + + } public int getConversationCount() { return this.databaseBackend.getConversationCount(); diff --git a/src/eu/siacs/conversations/xmpp/jingle/JingleConnection.java b/src/eu/siacs/conversations/xmpp/jingle/JingleConnection.java index 4f889c00..75c2c8e0 100644 --- a/src/eu/siacs/conversations/xmpp/jingle/JingleConnection.java +++ b/src/eu/siacs/conversations/xmpp/jingle/JingleConnection.java @@ -261,7 +261,7 @@ public class JingleConnection { IqPacket activation = new IqPacket(IqPacket.TYPE_SET); activation.setTo(connection.getJid()); activation.query("http://jabber.org/protocol/bytestreams").setAttribute("sid", this.getSessionId()); - activation.query().addChild("activate").setContent(this.getResponder()); + activation.query().addChild("activate").setContent(this.getCounterPart()); this.account.getXmppConnection().sendIqPacket(activation, new OnIqPacketReceived() { @Override @@ -322,7 +322,8 @@ public class JingleConnection { } private void connectWithCandidate(Element candidate) { - final SocksConnection socksConnection = new SocksConnection(this,candidate); + boolean initating = candidate.getAttribute("cid").equals(mJingleConnectionManager.getPrimaryCandidateId(account)); + final SocksConnection socksConnection = new SocksConnection(this,candidate,initating); connections.put(socksConnection.getCid(), socksConnection); socksConnection.connect(new OnSocksConnection() { diff --git a/src/eu/siacs/conversations/xmpp/jingle/SocksConnection.java b/src/eu/siacs/conversations/xmpp/jingle/SocksConnection.java index cfa24d50..affbb5f3 100644 --- a/src/eu/siacs/conversations/xmpp/jingle/SocksConnection.java +++ b/src/eu/siacs/conversations/xmpp/jingle/SocksConnection.java @@ -30,7 +30,7 @@ public class SocksConnection { private InputStream inputStream; private boolean isEstablished = false; - public SocksConnection(JingleConnection jingleConnection, Element candidate) { + public SocksConnection(JingleConnection jingleConnection, Element candidate, boolean initating) { this.cid = candidate.getAttribute("cid"); this.host = candidate.getAttribute("host"); this.port = Integer.parseInt(candidate.getAttribute("port")); @@ -41,8 +41,13 @@ public class SocksConnection { MessageDigest mDigest = MessageDigest.getInstance("SHA-1"); StringBuilder destBuilder = new StringBuilder(); destBuilder.append(jingleConnection.getSessionId()); - destBuilder.append(jingleConnection.getInitiator()); - destBuilder.append(jingleConnection.getResponder()); + if (initating) { + destBuilder.append(jingleConnection.getAccountJid()); + destBuilder.append(jingleConnection.getCounterPart()); + } else { + destBuilder.append(jingleConnection.getCounterPart()); + destBuilder.append(jingleConnection.getAccountJid()); + } mDigest.reset(); this.destination = CryptoHelper.bytesToHex(mDigest .digest(destBuilder.toString().getBytes())); -- cgit v1.2.3