add the start of socks5
authorNicolas Cornu <nicolas.cornu@ensi-bourges.fr>
Sat, 14 Aug 2010 02:17:09 +0200
changeset 114 813867884159
parent 113 cb5adb25ad87
child 115 cae0cb7eff45
add the start of socks5
jingle-filetransfer/filetransfer.c
jingle-ibb/ibb.c
jingle/action-handlers.c
socks5.c
socks5.h
--- a/jingle-filetransfer/filetransfer.c	Sat Aug 14 01:39:05 2010 +0200
+++ b/jingle-filetransfer/filetransfer.c	Sat Aug 14 02:17:09 2010 +0200
@@ -289,8 +289,6 @@
 
     g_free(ressource);
     g_free(sid);
-    //g_io_channel_unref(jft->outfile);
-    //g_io_channel_shutdown(jft->outfile, TRUE, NULL);
   }
 
   free_arg_lst(args);
--- a/jingle-ibb/ibb.c	Sat Aug 14 01:39:05 2010 +0200
+++ b/jingle-ibb/ibb.c	Sat Aug 14 02:17:09 2010 +0200
@@ -1,5 +1,5 @@
 /*
- * filetransfer.c
+ * ibb.c
  *
  * Copyrigth (C) 2010 Nicolas Cornu <nicolas.cornu@ensi-bourges.fr>
  *
--- a/jingle/action-handlers.c	Sat Aug 14 01:39:05 2010 +0200
+++ b/jingle/action-handlers.c	Sat Aug 14 02:17:09 2010 +0200
@@ -437,7 +437,9 @@
   
   for (el = sess->content; el; el = el->next) {
     sc = (SessionContent*)el->data;
-    sc->appfuncs->stop(sc->description);
+    if (!g_strcmp0(lm_message_get_from(jn->message),
+             (sess->origin == JINGLE_SESSION_INCOMING) ? sess->from : sess->to))
+      sc->appfuncs->stop(sc->description);
     session_remove_sessioncontent(sess, sc->name);
   }
   session_delete(sess);
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/socks5.c	Sat Aug 14 02:17:09 2010 +0200
@@ -0,0 +1,89 @@
+/*
+ * socks5.c
+ *
+ * Copyrigth (C) 2010 Nicolas Cornu <nicolas.cornu@ensi-bourges.fr>
+ *
+ * This program is free software; you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation; either version 2 of the License, or (at
+ * your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful, but
+ * WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
+ * General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program; if not, write to the Free Software
+ * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307
+ * USA
+ */
+
+#include "config.h"
+
+#include <glib.h>
+
+#include <mcabber/xmpp.h>
+#include <mcabber/modules.h>
+#include <mcabber/utils.h>
+#include <mcabber/xmpp_helper.h>
+#include <mcabber/logprint.h>
+#include <mcabber/hooks.h>
+
+#include <jingle/jingle.h>
+#include <jingle/check.h>
+#include <jingle/register.h>
+
+#include "socks5.h"
+
+gconstpointer jingle_socks5_check(JingleContent *cn, GError **err);
+gboolean jingle_socks5_cmp(gconstpointer data1, gconstpointer data2);
+void jingle_socks5_tomessage(gconstpointer data, LmMessageNode *node);
+const gchar* jingle_socks5_xmlns(void);
+gconstpointer jingle_socks5_new(void);
+void jingle_socks5_send(session_content *sc, const gchar *to, gconstpointer data, gchar *buf, gsize size);
+
+static void jingle_socks5_init(void);
+static void jingle_socks5_uninit(void);
+
+const gchar *deps[] = { "jingle", NULL };
+
+static JingleTransportFuncs funcs = {
+  jingle_socks5_xmlns,
+  jingle_socks5_check,
+  jingle_socks5_tomessage,
+  jingle_socks5_cmp,
+  jingle_socks5_new,
+  jingle_socks5_send
+};
+
+module_info_t  info_jingle_inbandbytestream = {
+  .branch          = MCABBER_BRANCH,
+  .api             = MCABBER_API_VERSION,
+  .version         = PROJECT_VERSION,
+  .description     = "Jingle In Band Bytestream (XEP-0261)\n",
+  .requires        = deps,
+  .init            = jingle_socks5_init,
+  .uninit          = jingle_socks5_uninit,
+  .next            = NULL,
+};
+
+
+const gchar* jingle_socks5_xmlns(void)
+{
+  return NS_JINGLE_TRANSPORT_SOCKS5;
+}
+
+static void jingle_socks5_init(void)
+{
+  jingle_register_transport(NS_JINGLE_TRANSPORT_SOCKS5, &funcs,
+                            JINGLE_TRANSPORT_STREAMING,
+                            JINGLE_TRANSPORT_MEDIUM);
+  xmpp_add_feature(NS_JINGLE_TRANSPORT_SOCKS5);
+}
+
+static void jingle_socks5_uninit(void)
+{
+  xmpp_del_feature(NS_JINGLE_TRANSPORT_SOCKS5);
+  jingle_unregister_transport(NS_JINGLE_TRANSPORT_SOCKS5);
+}
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/socks5.h	Sat Aug 14 02:17:09 2010 +0200
@@ -0,0 +1,10 @@
+#ifndef __JINGLESOCKS5_H__
+#define __JINGLESOCKS5_H__ 1
+
+#define NS_JINGLE_TRANSPORT_SOCKS5 "urn:xmpp:jingle:transports:s5b:1"
+
+typedef struct {
+  
+} JingleSocks5;
+
+#endif