soc.2009.telepathy: 4e60b0cc: Report Send errors to the user

sttwister at soc.pidgin.im sttwister at soc.pidgin.im
Mon Jun 8 15:30:34 EDT 2009


-----------------------------------------------------------------
Revision: 4e60b0ccf7bd4c103b5043b49fd038b657f0676a
Ancestor: e6652c448065116aafd45019ece2175846328b53
Author: sttwister at soc.pidgin.im
Date: 2009-06-08T19:29:07
Branch: im.pidgin.soc.2009.telepathy
URL: http://d.pidgin.im/viewmtn/revision/info/4e60b0ccf7bd4c103b5043b49fd038b657f0676a

Modified files:
        libpurple/protocols/telepathy/telepathy.c

ChangeLog: 

Report Send errors to the user

-------------- next part --------------
============================================================
--- libpurple/protocols/telepathy/telepathy.c	df9abd4920c56d5039690f2690a0902c6efd8f03
+++ libpurple/protocols/telepathy/telepathy.c	9df1df5123c8906f3e13876de54373bda52ae5bc
@@ -76,7 +76,6 @@ destroy_text_channel(telepathy_text_chan
 static void
 destroy_text_channel(telepathy_text_channel *tp_channel)
 {
-	/* TODO: unref the channel proxy */
 	g_free(tp_channel);
 }
 
@@ -417,7 +416,27 @@ send_cb (TpChannel *proxy,
 {
 	if (error != NULL)
 	{
-		/* TODO: forward the error to the conversation window */
+		PurplePlugin *plugin = user_data;
+		telepathy_data *data = plugin->extra;
+
+		const gchar *who = tp_channel_get_identifier(proxy);
+
+		gchar *error_message = g_strconcat(_("There was an error sending your message to "), who, NULL);
+		gchar *error_message2 = g_strconcat(error_message, ": ", error->message, NULL);
+
+		/* display the error in the conversation */
+		if (!purple_conv_present_error(who, data->acct, error_message2))
+		{
+			/* display as a popup if there is no active conversation with the user */
+			purple_notify_error(purple_connections_get_handle(),
+					_("Error sending message"),
+					error_message,
+					error->message);
+		}
+
+		g_free(error_message2);
+		g_free(error_message);
+			
 		purple_debug_error("telepathy", "Send error: %s\n", error->message);
 	}
 }


More information about the Commits mailing list