[telepathy-gabble/master] Map vCard/XMPP error to Tp error from RequestAvatar
Will Thompson
will.thompson at collabora.co.uk
Tue Apr 28 06:06:44 PDT 2009
---
src/conn-avatars.c | 20 +++++++++++++++++++-
1 files changed, 19 insertions(+), 1 deletions(-)
diff --git a/src/conn-avatars.c b/src/conn-avatars.c
index fc8d48c..461a0c6 100644
--- a/src/conn-avatars.c
+++ b/src/conn-avatars.c
@@ -485,7 +485,25 @@ _request_avatar_cb (GabbleVCardManager *self,
if (NULL == vcard)
{
- dbus_g_method_return_error (context, vcard_error);
+ GError tp_error = { TP_ERRORS, TP_ERROR_NOT_AVAILABLE,
+ vcard_error->message };
+
+ if (vcard_error->domain == GABBLE_XMPP_ERROR)
+ {
+ switch (vcard_error->code)
+ {
+ case XMPP_ERROR_NOT_AUTHORIZED:
+ case XMPP_ERROR_FORBIDDEN:
+ tp_error.code = TP_ERROR_PERMISSION_DENIED;
+ break;
+ case XMPP_ERROR_ITEM_NOT_FOUND:
+ tp_error.code = TP_ERROR_DOES_NOT_EXIST;
+ break;
+ }
+ /* what other mappings make sense here? */
+ }
+
+ dbus_g_method_return_error (context, &tp_error);
goto out;
}
--
1.5.6.5
More information about the telepathy-commits
mailing list