aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--libempathy/empathy-utils.c21
-rw-r--r--libempathy/empathy-utils.h4
2 files changed, 23 insertions, 2 deletions
diff --git a/libempathy/empathy-utils.c b/libempathy/empathy-utils.c
index f2f1d5458..ee6ad5bd4 100644
--- a/libempathy/empathy-utils.c
+++ b/libempathy/empathy-utils.c
@@ -371,7 +371,7 @@ create_errors_to_message_hash (void)
return errors;
}
-const gchar *
+static const gchar *
empathy_dbus_error_name_get_default_message (const gchar *error)
{
static GHashTable *errors_to_message = NULL;
@@ -386,6 +386,25 @@ empathy_dbus_error_name_get_default_message (const gchar *error)
return g_hash_table_lookup (errors_to_message, error);
}
+const gchar *
+empathy_account_get_error_message (TpAccount *account,
+ TpConnectionStatusReason reason)
+{
+ const gchar *dbus_error;
+ const gchar *message;
+ const GHashTable *details = NULL;
+
+ dbus_error = tp_account_get_detailed_error (account, &details);
+ message = empathy_dbus_error_name_get_default_message (dbus_error);
+ if (message != NULL)
+ return message;
+
+ DEBUG ("Don't understand error '%s'; fallback to the status reason (%u)",
+ dbus_error, reason);
+
+ return empathy_status_reason_get_default_message (reason);
+}
+
gchar *
empathy_file_lookup (const gchar *filename, const gchar *subdir)
{
diff --git a/libempathy/empathy-utils.h b/libempathy/empathy-utils.h
index 6ddf58a85..340705545 100644
--- a/libempathy/empathy-utils.h
+++ b/libempathy/empathy-utils.h
@@ -76,7 +76,9 @@ gboolean empathy_check_available_state (void);
gint empathy_uint_compare (gconstpointer a,
gconstpointer b);
const gchar * empathy_status_reason_get_default_message (TpConnectionStatusReason reason);
-const gchar * empathy_dbus_error_name_get_default_message (const gchar *error);
+
+const gchar * empathy_account_get_error_message (TpAccount *account,
+ TpConnectionStatusReason reason);
gchar *empathy_protocol_icon_name (const gchar *protocol);
const gchar *empathy_protocol_name_to_display_name (const gchar *proto_name);