new files
authorNicolas Cornu <nicolas.cornu@ensi-bourges.fr>
Tue, 01 Jun 2010 09:24:02 +0200
changeset 11 5ec956706f0c
parent 10 3ddaf757e36a
child 12 eb167636e5bc
new files
error.c
error.h
jingle_register.h
sessions.c
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/error.c	Tue Jun 01 09:24:02 2010 +0200
@@ -0,0 +1,44 @@
+/**
+ * Reply to a Jingle IQ with an error.
+ */
+void jingle_error_iq(LmMessage *m, const gchar *errtype,
+    const gchar *cond, const gchar *jinglecond)
+{
+  LmMessage *r;
+  LmMessageNode *err, *tmpnode;
+
+  r = lm_message_new_iq_from_query(m, LM_MESSAGE_SUB_TYPE_ERROR);
+  err = lm_message_node_add_child(r->node, "error", NULL);
+  lm_message_node_set_attribute(err, "type", errtype);
+
+  // error condition as defined by RFC 3920bis section 8.3.3
+  tmpnode = lm_message_node_add_child(err, cond, NULL);
+  lm_message_node_set_attribute(tmpnode, "xmlns", NS_XMPP_STANZAS);
+
+  // jingle error condition as defined by XEP-0166 section 10
+  tmpnode = lm_message_node_add_child(err, jinglecond, NULL);
+  lm_message_node_set_attribute(tmpnode, "xmlns", NS_JINGLE_ERRORS);
+
+  lm_connection_send(lconnection, r, NULL);
+  lm_message_unref(r);
+}
+
+/**
+ * Send a bad-request error (really usefull)
+ */
+void jingle_error_bad_request(LmMessage *m)
+{
+  LmMessage *r;
+  LmMessageNode *err, *tmpnode;
+
+  r = lm_message_new_iq_from_query(m, LM_MESSAGE_SUB_TYPE_ERROR);
+  err = lm_message_node_add_child(r->node, "error", NULL);
+  lm_message_node_set_attribute(err, "type", "cancel");
+
+  // error condition as defined by RFC 3920bis section 8.3.3
+  tmpnode = lm_message_node_add_child(err, "bad-request", NULL);
+  lm_message_node_set_attribute(tmpnode, "xmlns", NS_XMPP_STANZAS);
+
+  lm_connection_send(lconnection, r, NULL);
+  lm_message_unref(r);
+}
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/error.h	Tue Jun 01 09:24:02 2010 +0200
@@ -0,0 +1,9 @@
+#ifndef __ERROR_H__
+#define __ERROR_H__
+
+void jingle_error_iq(LmMessage *m, const gchar *errtype,
+    const gchar *cond, const gchar *jinglecond);
+
+void jingle_error_bad_request(LmMessage *m);
+
+#endif
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/jingle_register.h	Tue Jun 01 09:24:02 2010 +0200
@@ -0,0 +1,11 @@
+#ifndef __JINGLE_REGISTER_H__
+#define __JINGLE_REGISTER_H__
+
+gchar* jingle_resigter_apps(const gchar* namespace);
+
+gchar* jingle_register_transports(const gchar* namespace);   
+
+
+
+
+#endif
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/sessions.c	Tue Jun 01 09:24:02 2010 +0200
@@ -0,0 +1,6 @@
+// Session for manipulate sessions
+struct session_info {
+  gchar* initiator;
+
+  gchar* transport_namespace;
+}