Fix a few errors in the code.
Also add action-handlers.c to the list of files to compile.
--- a/jingle/CMakeLists.txt Mon Jun 07 19:15:28 2010 +0200
+++ b/jingle/CMakeLists.txt Mon Jun 07 23:04:34 2010 +0200
@@ -1,4 +1,4 @@
-add_library(jingle MODULE jingle.c check.c register.c)
+add_library(jingle MODULE jingle.c check.c action-handlers.c register.c)
set_target_properties(jingle PROPERTIES COMPILE_FLAGS "-Wall")
include_directories(${LM_INCLUDE_DIRS} ..)
target_link_libraries(jingle ${LM_LIBRARIES})
--- a/jingle/action-handlers.c Mon Jun 07 19:15:28 2010 +0200
+++ b/jingle/action-handlers.c Mon Jun 07 23:04:34 2010 +0200
@@ -29,7 +29,7 @@
{
// a session-initiate message must contains at least one <content> element
if (g_list_length(jn->content) < 1) {
- jingle_send_iq_error(message, "cancel", "bad-request", NULL);
+ jingle_send_iq_error(m, "cancel", "bad-request", NULL);
}
}
--- a/jingle/check.c Mon Jun 07 19:15:28 2010 +0200
+++ b/jingle/check.c Mon Jun 07 23:04:34 2010 +0200
@@ -88,7 +88,7 @@
for (child = node->children; child; child = child->next) {
if (!g_strcmp0(child->name, "content")) {
- cn = check_content(node, err);
+ cn = check_content(child, err);
if(cn == NULL) {
g_assert (*err != NULL);
return FALSE;
@@ -106,7 +106,7 @@
const gchar *creatorstr, *sendersstr;
gint tmp, tmp2;
- creatorstr = lm_message_node_get_attribute(node, "action");
+ creatorstr = lm_message_node_get_attribute(node, "creator");
cn->disposition = lm_message_node_get_attribute(node, "disposition");
cn->name = lm_message_node_get_attribute(node, "name");
sendersstr = lm_message_node_get_attribute(node, "senders");
--- a/jingle/jingle.c Mon Jun 07 19:15:28 2010 +0200
+++ b/jingle/jingle.c Mon Jun 07 23:04:34 2010 +0200
@@ -96,18 +96,18 @@
JingleNode *jn = g_new0(JingleNode, 1);
GError *error = NULL;
- LmMessageNode *root = lm_message_get_node(message)->children;
- LmMessageNode *node = lm_message_node_get_child(root, "jingle");
+ LmMessageNode *root = lm_message_get_node(message);
+ LmMessageNode *jnode = lm_message_node_get_child(root, "jingle");
- if (!node) // no <jingle> element found
+ if (!jnode) // no <jingle> element found
return LM_HANDLER_RESULT_ALLOW_MORE_HANDLERS;
- if (g_strcmp0(lm_message_node_get_attribute(node, "xmlns"), NS_JINGLE)) {
+ if (g_strcmp0(lm_message_node_get_attribute(jnode, "xmlns"), NS_JINGLE)) {
scr_log_print(LPRINT_DEBUG, "jingle: Received a jingle IQ with an invalid namespace");
return LM_HANDLER_RESULT_REMOVE_MESSAGE;
}
- check_jingle(node, jn, &error);
+ check_jingle(jnode, jn, &error);
if (error != NULL) {
if (error->domain == JINGLE_CHECK_ERROR) {
// request malformed, we reply with a bad-request