+static char *
+ft_manager_format_error_message (EmpathyFTHandler *handler,
+ const GError *error)
+{
+ const char *contact_name, *filename;
+ EmpathyContact *contact;
+ char *first_line, *message;
+ gboolean incoming;
+
+ contact_name = NULL;
+ incoming = empathy_ft_handler_is_incoming (handler);
+
+ contact = empathy_ft_handler_get_contact (handler);
+ if (contact)
+ contact_name = empathy_contact_get_name (contact);
+
+ filename = empathy_ft_handler_get_filename (handler);
+
+ if (incoming)
+ /* filename/contact_name here are either both NULL or both valid */
+ if (filename && contact_name)
+ /* translators: first %s is filename, second %s
+ * is the contact name */
+ first_line = g_strdup_printf (_("Error receiving \"%s\" from %s"), filename,
+ contact_name);
+ else
+ first_line = g_strdup (_("Error receiving a file"));
+ else
+ /* translators: first %s is filename, second %s
+ * is the contact name */
+ if (filename && contact_name)
+ first_line = g_strdup_printf (_("Error sending \"%s\" to %s"), filename,
+ contact_name);
+ else
+ first_line = g_strdup (_("Error sending a file"));
+
+ message = g_strdup_printf ("%s\n%s", first_line, error->message);
+
+ g_free (first_line);
+
+ return message;
+}
+