From 83d8dc9899ea0446d682402d2db6355a12be24bc Mon Sep 17 00:00:00 2001 From: Xavier Claessens Date: Thu, 22 May 2008 12:28:47 +0000 Subject: Emit "send-error" signal if Send() call fails svn path=/trunk/; revision=1118 --- libempathy/empathy-tp-chat.c | 20 ++++++++++++++++++-- 1 file changed, 18 insertions(+), 2 deletions(-) (limited to 'libempathy/empathy-tp-chat.c') diff --git a/libempathy/empathy-tp-chat.c b/libempathy/empathy-tp-chat.c index 286896bbe..5569ce255 100644 --- a/libempathy/empathy-tp-chat.c +++ b/libempathy/empathy-tp-chat.c @@ -446,6 +446,21 @@ tp_chat_send_error_cb (TpChannel *channel, g_object_unref (message); } +static void +tp_chat_send_cb (TpChannel *proxy, + const GError *error, + gpointer user_data, + GObject *chat) +{ + EmpathyMessage *message = EMPATHY_MESSAGE (user_data); + + if (error) { + DEBUG ("Error: %s", error->message); + g_signal_emit (chat, signals[SEND_ERROR], 0, message, + TP_CHANNEL_TEXT_SEND_ERROR_UNKNOWN); + } +} + static void tp_chat_state_changed_cb (TpChannel *channel, guint handle, @@ -1205,8 +1220,9 @@ empathy_tp_chat_send (EmpathyTpChat *chat, tp_cli_channel_type_text_call_send (priv->channel, -1, message_type, message_body, - tp_chat_async_cb, - "sending message", NULL, + tp_chat_send_cb, + g_object_ref (message), + (GDestroyNotify) g_object_unref, G_OBJECT (chat)); } -- cgit v1.2.3