aboutsummaryrefslogtreecommitdiffstats
path: root/libempathy
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
parent3486c2525088388b5d1fa39b4099f8b80743fd00 (diff)
downloadgsoc2013-empathy-fde1ddca54a6f94fd4112f9d4e5c49d823ed00a4.tar
gsoc2013-empathy-fde1ddca54a6f94fd4112f9d4e5c49d823ed00a4.tar.gz
gsoc2013-empathy-fde1ddca54a6f94fd4112f9d4e5c49d823ed00a4.tar.bz2
gsoc2013-empathy-fde1ddca54a6f94fd4112f9d4e5c49d823ed00a4.tar.lz
gsoc2013-empathy-fde1ddca54a6f94fd4112f9d4e5c49d823ed00a4.tar.xz
gsoc2013-empathy-fde1ddca54a6f94fd4112f9d4e5c49d823ed00a4.tar.zst
gsoc2013-empathy-fde1ddca54a6f94fd4112f9d4e5c49d823ed00a4.zip
add empathy_account_get_error_message
Diffstat (limited to 'libempathy')
-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);