From 85368eeb1d2d4023f77d1753cced59c802e3c4f0 Mon Sep 17 00:00:00 2001 From: Nicolas Cornu Date: Mon, 7 Jun 2010 23:04:34 +0200 Subject: [PATCH] Fix a few errors in the code. Also add action-handlers.c to the list of files to compile. --- jingle/CMakeLists.txt | 2 +- jingle/action-handlers.c | 2 +- jingle/check.c | 4 ++-- jingle/jingle.c | 10 +++++----- 4 files changed, 9 insertions(+), 9 deletions(-) diff --git a/jingle/CMakeLists.txt b/jingle/CMakeLists.txt index b98bb5d..a756923 100644 --- a/jingle/CMakeLists.txt +++ b/jingle/CMakeLists.txt @@ -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}) diff --git a/jingle/action-handlers.c b/jingle/action-handlers.c index a00e09b..f7c3c8c 100644 --- a/jingle/action-handlers.c +++ b/jingle/action-handlers.c @@ -29,7 +29,7 @@ void handle_session_initiate(LmMessage *m, JingleNode *jn) { // a session-initiate message must contains at least one 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); } } diff --git a/jingle/check.c b/jingle/check.c index 1141185..2e1da93 100644 --- a/jingle/check.c +++ b/jingle/check.c @@ -88,7 +88,7 @@ gboolean check_jingle(LmMessageNode *node, JingleNode *jn, GError **err) 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 @@ JingleContentNode *check_content(LmMessageNode *node, GError **err) 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"); diff --git a/jingle/jingle.c b/jingle/jingle.c index 68398bf..532e542 100644 --- a/jingle/jingle.c +++ b/jingle/jingle.c @@ -96,18 +96,18 @@ LmHandlerResult jingle_handle_iq(LmMessageHandler *handler, 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 element found + if (!jnode) // no 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