From fde1ddca54a6f94fd4112f9d4e5c49d823ed00a4 Mon Sep 17 00:00:00 2001 From: Guillaume Desmottes Date: Thu, 5 Aug 2010 13:37:35 +0200 Subject: add empathy_account_get_error_message --- libempathy/empathy-utils.c | 21 ++++++++++++++++++++- 1 file changed, 20 insertions(+), 1 deletion(-) (limited to 'libempathy/empathy-utils.c') 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) { -- cgit v1.2.3