[telepathy-gabble/master] SetAvatar: map XMPP/vCard error to TpError
Will Thompson
will.thompson at collabora.co.uk
Tue Apr 28 06:06:46 PDT 2009
---
src/conn-avatars.c | 14 +++++++++++++-
1 files changed, 13 insertions(+), 1 deletions(-)
diff --git a/src/conn-avatars.c b/src/conn-avatars.c
index 943faba..fc8d48c 100644
--- a/src/conn-avatars.c
+++ b/src/conn-avatars.c
@@ -731,7 +731,19 @@ _set_avatar_cb2 (GabbleVCardManager *manager,
if (NULL == vcard)
{
- dbus_g_method_return_error (ctx->invocation, vcard_error);
+ GError tp_error = { TP_ERRORS, TP_ERROR_NOT_AVAILABLE,
+ vcard_error->message };
+
+ /* Google Talk has been observed to return bad-request when the avatar is
+ * too big. It's not clear what other XMPP errors make sense here, or how
+ * to map them.
+ */
+ if (vcard_error->domain == GABBLE_XMPP_ERROR)
+ if (vcard_error->code == XMPP_ERROR_BAD_REQUEST ||
+ vcard_error->code == XMPP_ERROR_NOT_ACCEPTABLE)
+ tp_error.code = TP_ERROR_INVALID_ARGUMENT;
+
+ dbus_g_method_return_error (ctx->invocation, &tp_error);
}
else
{
--
1.5.6.5
More information about the telepathy-commits
mailing list