diff options
author | Will Thompson <will.thompson@collabora.co.uk> | 2011-03-07 14:12:22 +0000 |
---|---|---|
committer | Will Thompson <will.thompson@collabora.co.uk> | 2011-05-03 13:15:26 +0100 |
commit | c1be75d93784a9b1b37b0dd717b1494029a675b8 (patch) | |
tree | 4574a9773e515c020b706865fe07290f223c048f /src/conn-olpc.c | |
parent | ea21cdcd49ba24235f97060c056fe9cd9744e69e (diff) | |
download | telepathy-gabble-c1be75d93784a9b1b37b0dd717b1494029a675b8.tar.gz |
Remove GabbleXmppError.
There is a FIXME buried in here … but the tests pass.
Diffstat (limited to 'src/conn-olpc.c')
-rw-r--r-- | src/conn-olpc.c | 96 |
1 files changed, 34 insertions, 62 deletions
diff --git a/src/conn-olpc.c b/src/conn-olpc.c index f286c4b22..9ab0ddfbb 100644 --- a/src/conn-olpc.c +++ b/src/conn-olpc.c @@ -28,6 +28,8 @@ #define DEBUG_FLAG GABBLE_DEBUG_OLPC +#include <gabble/error.h> + #include "debug.h" #include "connection.h" #include "muc-channel.h" @@ -154,84 +156,54 @@ static gboolean check_publish_reply_msg (LmMessage *reply_msg, DBusGMethodInvocation *context) { - switch (lm_message_get_sub_type (reply_msg)) + GError *error = NULL; + + if (wocky_stanza_extract_errors (reply_msg, NULL, &error, NULL, NULL)) { - case LM_MESSAGE_SUB_TYPE_RESULT: - return TRUE; + GError *tp_error = NULL; - default: - { - WockyNode *error_node; - GError *error = NULL; + gabble_set_tp_error_from_wocky (error, &tp_error); + g_prefix_error (&tp_error, "Failed to publish to the PEP node: "); + DEBUG ("%s", tp_error->message); - error_node = wocky_node_get_child ( - wocky_stanza_get_top_node (reply_msg), "error"); - if (error_node != NULL) - { - GabbleXmppError xmpp_error = gabble_xmpp_error_from_node ( - error_node, NULL); - - error = g_error_new (TP_ERRORS, TP_ERROR_NETWORK_ERROR, - "Failed to publish to the PEP node: %s", - gabble_xmpp_error_description (xmpp_error)); - } - else - { - error = g_error_new (TP_ERRORS, TP_ERROR_NETWORK_ERROR, - "Failed to publish to the PEP node"); - } + if (context != NULL) + dbus_g_method_return_error (context, tp_error); - DEBUG ("%s", error->message); - if (context != NULL) - dbus_g_method_return_error (context, error); - g_error_free (error); - } + g_error_free (tp_error); + g_error_free (error); + return FALSE; + } + else + { + return TRUE; } - - return FALSE; } static gboolean check_query_reply_msg (LmMessage *reply_msg, DBusGMethodInvocation *context) { - switch (lm_message_get_sub_type (reply_msg)) - { - case LM_MESSAGE_SUB_TYPE_RESULT: - return TRUE; - - default: - { - WockyNode *error_node; - GError *error = NULL; - - error_node = wocky_node_get_child ( - wocky_stanza_get_top_node (reply_msg), "error"); - if (error_node != NULL) - { - GabbleXmppError xmpp_error = gabble_xmpp_error_from_node ( - error_node, NULL); + GError *error = NULL; - error = g_error_new (TP_ERRORS, TP_ERROR_NETWORK_ERROR, - "Failed to query the PEP node: %s", - gabble_xmpp_error_description (xmpp_error)); - } - else - { - error = g_error_new (TP_ERRORS, TP_ERROR_NETWORK_ERROR, - "Failed to query the PEP node"); - } + if (wocky_stanza_extract_errors (reply_msg, NULL, &error, NULL, NULL)) + { + GError *tp_error = NULL; - DEBUG ("%s", error->message); + gabble_set_tp_error_from_wocky (error, &tp_error); + g_prefix_error (&tp_error, "Failed to query the PEP node: "); + DEBUG ("%s", tp_error->message); - if (context != NULL) - dbus_g_method_return_error (context, error); + if (context != NULL) + dbus_g_method_return_error (context, tp_error); - g_error_free (error); - } + g_error_free (tp_error); + g_error_free (error); + return FALSE; + } + else + { + return TRUE; } - - return FALSE; } typedef struct |