aboutsummaryrefslogtreecommitdiffstats
path: root/libempathy/empathy-utils.c
diff options
context:
space:
mode:
authorGuillaume Desmottes <guillaume.desmottes@collabora.co.uk>2010-08-05 19:37:35 +0800
committerGuillaume Desmottes <guillaume.desmottes@collabora.co.uk>2010-08-05 19:37:35 +0800
commitfde1ddca54a6f94fd4112f9d4e5c49d823ed00a4 (patch)
tree198f09e95390c6af4212ba24c0593bacd1f52972 /libempathy/empathy-utils.c
parent3486c2525088388b5d1fa39b4099f8b80743fd00 (diff)
downloadgsoc2013-empathy-fde1ddca54a6f94fd4112f9d4e5c49d823ed00a4.tar.gz
gsoc2013-empathy-fde1ddca54a6f94fd4112f9d4e5c49d823ed00a4.tar.zst
gsoc2013-empathy-fde1ddca54a6f94fd4112f9d4e5c49d823ed00a4.zip
add empathy_account_get_error_message
Diffstat (limited to 'libempathy/empathy-utils.c')
-rw-r--r--libempathy/empathy-utils.c21
1 files changed, 20 insertions, 1 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)
{