diff options
author | Danielle Madeley <danielle.madeley@collabora.co.uk> | 2011-04-21 13:03:52 +0800 |
---|---|---|
committer | Danielle Madeley <danielle.madeley@collabora.co.uk> | 2011-05-05 15:23:34 +0800 |
commit | b0aaacf05d0b46ca53f3b6b9f2dd0565cea0f5d0 (patch) | |
tree | 8cfb3398eb3bd95d37a6ef85171103034b1488a5 /libempathy-gtk | |
parent | 0fda59487b536e49bfcec7ab1ee6e9c6d7b6f306 (diff) | |
download | gsoc2013-empathy-b0aaacf05d0b46ca53f3b6b9f2dd0565cea0f5d0.tar gsoc2013-empathy-b0aaacf05d0b46ca53f3b6b9f2dd0565cea0f5d0.tar.gz gsoc2013-empathy-b0aaacf05d0b46ca53f3b6b9f2dd0565cea0f5d0.tar.bz2 gsoc2013-empathy-b0aaacf05d0b46ca53f3b6b9f2dd0565cea0f5d0.tar.lz gsoc2013-empathy-b0aaacf05d0b46ca53f3b6b9f2dd0565cea0f5d0.tar.xz gsoc2013-empathy-b0aaacf05d0b46ca53f3b6b9f2dd0565cea0f5d0.tar.zst gsoc2013-empathy-b0aaacf05d0b46ca53f3b6b9f2dd0565cea0f5d0.zip |
Use dbus-error from delivery report for better errors
Diffstat (limited to 'libempathy-gtk')
-rw-r--r-- | libempathy-gtk/empathy-chat.c | 52 |
1 files changed, 31 insertions, 21 deletions
diff --git a/libempathy-gtk/empathy-chat.c b/libempathy-gtk/empathy-chat.c index 5c8bbce3b..d4e025f8d 100644 --- a/libempathy-gtk/empathy-chat.c +++ b/libempathy-gtk/empathy-chat.c @@ -1282,31 +1282,41 @@ static void chat_send_error_cb (EmpathyTpChat *tp_chat, const gchar *message_body, TpChannelTextSendError error_code, + const gchar *dbus_error, EmpathyChat *chat) { - const gchar *error; + const gchar *error = NULL; gchar *str; - switch (error_code) { - case TP_CHANNEL_TEXT_SEND_ERROR_OFFLINE: - error = _("offline"); - break; - case TP_CHANNEL_TEXT_SEND_ERROR_INVALID_CONTACT: - error = _("invalid contact"); - break; - case TP_CHANNEL_TEXT_SEND_ERROR_PERMISSION_DENIED: - error = _("permission denied"); - break; - case TP_CHANNEL_TEXT_SEND_ERROR_TOO_LONG: - error = _("too long message"); - break; - case TP_CHANNEL_TEXT_SEND_ERROR_NOT_IMPLEMENTED: - error = _("not implemented"); - break; - case TP_CHANNEL_TEXT_SEND_ERROR_UNKNOWN: - default: - error = _("unknown"); - break; + if (!tp_strdiff (dbus_error, TP_ERROR_STR_INSUFFICIENT_BALANCE)) { + error = _("insufficient balance to send message"); + } else if (!tp_strdiff (dbus_error, TP_ERROR_STR_NOT_CAPABLE)) { + error = _("not capable"); + } + + if (error == NULL) { + /* if we didn't find a dbus-error, try the old error */ + switch (error_code) { + case TP_CHANNEL_TEXT_SEND_ERROR_OFFLINE: + error = _("offline"); + break; + case TP_CHANNEL_TEXT_SEND_ERROR_INVALID_CONTACT: + error = _("invalid contact"); + break; + case TP_CHANNEL_TEXT_SEND_ERROR_PERMISSION_DENIED: + error = _("permission denied"); + break; + case TP_CHANNEL_TEXT_SEND_ERROR_TOO_LONG: + error = _("too long message"); + break; + case TP_CHANNEL_TEXT_SEND_ERROR_NOT_IMPLEMENTED: + error = _("not implemented"); + break; + case TP_CHANNEL_TEXT_SEND_ERROR_UNKNOWN: + default: + error = _("unknown"); + break; + } } if (message_body != NULL) { |