aboutsummaryrefslogtreecommitdiffstats
path: root/src/eu/siacs/conversations/xmpp/jingle/JingleConnection.java
diff options
context:
space:
mode:
authorDaniel Gultsch <daniel.gultsch@rwth-aachen.de>2014-04-11 22:49:26 +0200
committerDaniel Gultsch <daniel.gultsch@rwth-aachen.de>2014-04-11 22:49:26 +0200
commit259bb446cac55ea7367488dfd63eb2b8a3eb6139 (patch)
tree7cbbe509a955bd4b2b1820f33a24d8b8045bd801 /src/eu/siacs/conversations/xmpp/jingle/JingleConnection.java
parentc0e0a7086902a9d5cfbe88c4aa220abdf2ee3dde (diff)
first file transfer between gajim and conversations. still a lot to do though
Diffstat (limited to 'src/eu/siacs/conversations/xmpp/jingle/JingleConnection.java')
-rw-r--r--src/eu/siacs/conversations/xmpp/jingle/JingleConnection.java34
1 files changed, 33 insertions, 1 deletions
diff --git a/src/eu/siacs/conversations/xmpp/jingle/JingleConnection.java b/src/eu/siacs/conversations/xmpp/jingle/JingleConnection.java
index f8083535..a5453443 100644
--- a/src/eu/siacs/conversations/xmpp/jingle/JingleConnection.java
+++ b/src/eu/siacs/conversations/xmpp/jingle/JingleConnection.java
@@ -1,5 +1,6 @@
package eu.siacs.conversations.xmpp.jingle;
+import java.io.File;
import java.util.ArrayList;
import java.util.HashMap;
import java.util.List;
@@ -72,6 +73,8 @@ public class JingleConnection {
status = STATUS_TERMINATED;
} else if (packet.isAction("session-accept")) {
accept(packet);
+ } else if (packet.isAction("transport-info")) {
+ transportInfo(packet);
} else {
Log.d("xmppService","packet arrived in connection. action was "+packet.getAction());
}
@@ -135,11 +138,40 @@ public class JingleConnection {
account.getXmppConnection().sendIqPacket(response, null);
}
+ private void transportInfo(JinglePacket packet) {
+ Content content = packet.getJingleContent();
+ Log.d("xmppService","transport info : "+content.toString());
+ String cid = content.getUsedCandidate();
+ if (cid!=null) {
+ final File file = this.mXmppConnectionService.getFileBackend().getImageFile(this.message);
+ final SocksConnection connection = this.connections.get(cid);
+ if (connection.isProxy()) {
+ 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());
+ Log.d("xmppService","connection is proxy. need to activate "+activation.toString());
+ this.account.getXmppConnection().sendIqPacket(activation, new OnIqPacketReceived() {
+
+ @Override
+ public void onIqPacketReceived(Account account, IqPacket packet) {
+ Log.d("xmppService","activation result: "+packet.toString());
+ connection.send(file);
+ }
+ });
+ } else {
+ connection.send(file);
+ }
+ }
+ }
+
private void connectWithCandidates() {
for(Element canditate : this.candidates) {
String host = canditate.getAttribute("host");
int port = Integer.parseInt(canditate.getAttribute("port"));
- SocksConnection socksConnection = new SocksConnection(this, host, port);
+ String type = canditate.getAttribute("type");
+ String jid = canditate.getAttribute("jid");
+ SocksConnection socksConnection = new SocksConnection(this, host, jid, port,type);
socksConnection.connect();
this.connections.put(canditate.getAttribute("cid"), socksConnection);
}