jingle/send.c
changeset 26 af14f8f5a2b6
child 27 fb602f55af15
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/jingle/send.c	Sat Jul 03 18:41:36 2010 +0200
@@ -0,0 +1,44 @@
+/*
+ * send.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 <glib.h>
+#include <loudmouth/loudmouth.h>
+
+#include <jingle/send.h>
+
+void jingle_send_session_terminate(const LmMessage *m, const gchar *reason) {
+  LmMessage *r;
+  LmMessageNode *err;
+
+  r = lm_message_new_iq_from_query(m, LM_MESSAGE_SUB_TYPE_SET);
+
+  if(reason != NULL) {  
+    err = lm_message_node_add_child(r->node, "reason", NULL);
+    lm_message_node_add_child(err, reason, NULL);
+  }
+
+  // TODO vérifier que reason est connu
+
+  if (r) {
+	  lm_connection_send(lconnection, r, NULL);
+	  lm_message_unref(r);
+  }
+}