summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorAndre Moreira Magalhaes (andrunko) <andrunko@andrunko.cbg.collabora.co.uk>2009-12-09 14:04:42 -0300
committerAndre Moreira Magalhaes (andrunko) <andrunko@andrunko.cbg.collabora.co.uk>2009-12-14 15:02:46 -0300
commite1a05fa9c9bf62624f1803b7be58e1cd5c085d4e (patch)
tree2b3ff560cf9389bde839f54c6d1207a4d63cb2c9
parent4062055dba5efeaca72ccab6b2cc6aa329bd6a9f (diff)
vcard-manager: Do not try to set vcard fields not supported by google servers.
-rw-r--r--src/vcard-manager.c24
1 files changed, 22 insertions, 2 deletions
diff --git a/src/vcard-manager.c b/src/vcard-manager.c
index 28601df69..ee00ce1b7 100644
--- a/src/vcard-manager.c
+++ b/src/vcard-manager.c
@@ -1000,14 +1000,28 @@ vcard_copy (LmMessageNode *parent, LmMessageNode *src)
return new;
}
+typedef struct {
+ GabbleConnection *connection;
+ LmMessageNode *vcard_node;
+} CheckVCardContext;
+
static gboolean
check_vcard_changed (gpointer k, gpointer v, gpointer user_data)
{
const gchar *key = k;
const gchar *value = v;
- LmMessageNode *vcard_node = user_data;
+ CheckVCardContext *check_vcard_ctx = user_data;
+ GabbleConnection *conn = check_vcard_ctx->connection;
+ LmMessageNode *vcard_node = check_vcard_ctx->vcard_node;
LmMessageNode *node;
+ if (conn->features & GABBLE_CONNECTION_FEATURES_GOOGLE_ROSTER &&
+ strcmp (key, "N") != 0 && strcmp (key, "FN") != 0 &&
+ strcmp (key, "PHOTO") != 0)
+ {
+ return FALSE;
+ }
+
node = lm_message_node_get_child (vcard_node, key);
if (node != NULL)
{
@@ -1029,6 +1043,7 @@ manager_patch_vcard (GabbleVCardManager *self,
LmMessage *msg;
LmMessageNode *patched_vcard;
GList *li;
+ CheckVCardContext *check_vcard_ctx;
/* Bail out if we don't have outstanding edits to make, or if we already
* have a set request in progress.
@@ -1036,7 +1051,10 @@ manager_patch_vcard (GabbleVCardManager *self,
if (priv->edits == NULL || priv->edit_pipeline_item != NULL)
return;
- if (g_hash_table_find (priv->edits, check_vcard_changed, vcard_node) == NULL)
+ check_vcard_ctx = g_new (CheckVCardContext, 1);
+ check_vcard_ctx->connection = priv->connection;
+ check_vcard_ctx->vcard_node = vcard_node;
+ if (g_hash_table_find (priv->edits, check_vcard_changed, check_vcard_ctx) == NULL)
{
DEBUG ("nothing changed, not updating vcard");
goto out;
@@ -1064,6 +1082,8 @@ manager_patch_vcard (GabbleVCardManager *self,
lm_message_unref (msg);
out:
+ g_free (check_vcard_ctx);
+
/* We've applied those, forget about them */
g_hash_table_destroy (priv->edits);
priv->edits = NULL;