const gchar * empathy_account_get_error_message (TpAccount *account, gboolean *user_requested) { const gchar *dbus_error; const gchar *message; const GHashTable *details = NULL; TpConnectionStatusReason reason; dbus_error = tp_account_get_detailed_error (account, &details); if (user_requested != NULL) { if (tp_asv_get_boolean (details, "user-requested", NULL)) *user_requested = TRUE; else *user_requested = FALSE; } message = empathy_dbus_error_name_get_default_message (dbus_error); if (message != NULL) return message; tp_account_get_connection_status (account, &reason); DEBUG ("Don't understand error '%s'; fallback to the status reason (%u)", dbus_error, reason); return empathy_status_reason_get_default_message (reason); }
static void main_window_connection_changed_cb (TpAccount *account, guint old_status, guint current, guint reason, gchar *dbus_error_name, GHashTable *details, EmpathyMainWindow *window) { main_window_update_status (window); if (current == TP_CONNECTION_STATUS_DISCONNECTED && reason != TP_CONNECTION_STATUS_REASON_REQUESTED) { const gchar *message; message = empathy_status_reason_get_default_message (reason); main_window_error_display (window, account, message); } if (current == TP_CONNECTION_STATUS_DISCONNECTED) { empathy_sound_play (GTK_WIDGET (window->window), EMPATHY_SOUND_ACCOUNT_DISCONNECTED); } if (current == TP_CONNECTION_STATUS_CONNECTED) { empathy_sound_play (GTK_WIDGET (window->window), EMPATHY_SOUND_ACCOUNT_CONNECTED); /* Account connected without error, remove error message if any */ main_window_remove_error (window, account); } }