rpms/telepathy-gabble/devel 0001-fd.o-25341-Always-sets-its-own-vcard-on-login.patch, NONE, 1.1 0001-vcard-manager-Do-not-try-to-set-vcard-fields-not-sup.patch, NONE, 1.1 0001-vcard-manager-Iterate-over-hashtable-instead-of-usin.patch, NONE, 1.1 telepathy-gabble.spec, 1.72, 1.73 proxy.patch, 1.1, NONE

Brian Pepple bpepple at fedoraproject.org
Tue Dec 22 19:26:18 UTC 2009


Author: bpepple

Update of /cvs/pkgs/rpms/telepathy-gabble/devel
In directory cvs1.fedora.phx.redhat.com:/tmp/cvs-serv3084

Modified Files:
	telepathy-gabble.spec 
Added Files:
	0001-fd.o-25341-Always-sets-its-own-vcard-on-login.patch 
	0001-vcard-manager-Do-not-try-to-set-vcard-fields-not-sup.patch 
	0001-vcard-manager-Iterate-over-hashtable-instead-of-usin.patch 
Removed Files:
	proxy.patch 
Log Message:
* Tue Dec 22 2009 Brian Pepple <bpepple at fedoraproject.org> - 0.8.9-2
- Backport some patches to prevent gabble from setting your VCard
  on every login.


0001-fd.o-25341-Always-sets-its-own-vcard-on-login.patch:
 vcard-manager.c |   29 ++++++++++++++++++++++++++++-
 1 file changed, 28 insertions(+), 1 deletion(-)

--- NEW FILE 0001-fd.o-25341-Always-sets-its-own-vcard-on-login.patch ---
>From 4062055dba5efeaca72ccab6b2cc6aa329bd6a9f Mon Sep 17 00:00:00 2001
From: Andre Moreira Magalhaes (andrunko) <andrunko at andrunko.cbg.collabora.co.uk>
Date: Mon, 7 Dec 2009 11:04:16 -0300
Subject: [PATCH] fd.o#25341: Always sets its own vcard on login

Note that gmail only stores vcard fields FN and PHOTO, so when using empathy the
nickname (alias) will be updated on every login.
---
 src/vcard-manager.c |   28 ++++++++++++++++++++++++++++
 1 files changed, 28 insertions(+), 0 deletions(-)

diff --git a/src/vcard-manager.c b/src/vcard-manager.c
index c93332d..28601df 100644
--- a/src/vcard-manager.c
+++ b/src/vcard-manager.c
@@ -1000,6 +1000,27 @@ vcard_copy (LmMessageNode *parent, LmMessageNode *src)
     return new;
 }
 
+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;
+  LmMessageNode *node;
+
+  node = lm_message_node_get_child (vcard_node, key);
+  if (node != NULL)
+    {
+      const gchar *node_value = lm_message_node_get_value (node);
+
+      if (!tp_strdiff (node_value, value))
+        return FALSE;
+    }
+
+  DEBUG ("vcard node %s changed, vcard needs update", key);
+  return TRUE;
+}
+
 static void
 manager_patch_vcard (GabbleVCardManager *self,
                      LmMessageNode *vcard_node)
@@ -1015,6 +1036,12 @@ 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)
+    {
+      DEBUG ("nothing changed, not updating vcard");
+      goto out;
+    }
+
   DEBUG("patching vcard");
 
   msg = lm_message_new_with_sub_type (NULL, LM_MESSAGE_TYPE_IQ,
@@ -1036,6 +1063,7 @@ manager_patch_vcard (GabbleVCardManager *self,
 
   lm_message_unref (msg);
 
+out:
   /* We've applied those, forget about them */
   g_hash_table_destroy (priv->edits);
   priv->edits = NULL;
-- 
1.6.5.2


0001-vcard-manager-Do-not-try-to-set-vcard-fields-not-sup.patch:
 vcard-manager.c |   25 ++++++++++++++++++++++---
 1 file changed, 22 insertions(+), 3 deletions(-)

--- NEW FILE 0001-vcard-manager-Do-not-try-to-set-vcard-fields-not-sup.patch ---
>From e1a05fa9c9bf62624f1803b7be58e1cd5c085d4e Mon Sep 17 00:00:00 2001
From: Andre Moreira Magalhaes (andrunko) <andrunko at andrunko.cbg.collabora.co.uk>
Date: Wed, 9 Dec 2009 14:04:42 -0300
Subject: [PATCH] vcard-manager: Do not try to set vcard fields not supported by google servers.

---
 src/vcard-manager.c |   24 ++++++++++++++++++++++--
 1 files changed, 22 insertions(+), 2 deletions(-)

diff --git a/src/vcard-manager.c b/src/vcard-manager.c
index 28601df..ee00ce1 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;
-- 
1.6.5.2


0001-vcard-manager-Iterate-over-hashtable-instead-of-usin.patch:
 vcard-manager.c |   37 ++++++++++++++++++-------------------
 1 file changed, 18 insertions(+), 19 deletions(-)

--- NEW FILE 0001-vcard-manager-Iterate-over-hashtable-instead-of-usin.patch ---
>From 170601eaec1fbabfe3da509fa7ec95ac3500f04b Mon Sep 17 00:00:00 2001
From: Andre Moreira Magalhaes (andrunko) <andrunko at andrunko.cbg.collabora.co.uk>
Date: Wed, 9 Dec 2009 14:15:48 -0300
Subject: [PATCH] vcard-manager: Iterate over hashtable instead of usin g_hash_table_find to check if vcard changed.

---
 src/vcard-manager.c |   36 ++++++++++++++++++------------------
 1 files changed, 18 insertions(+), 18 deletions(-)

diff --git a/src/vcard-manager.c b/src/vcard-manager.c
index ee00ce1..9ccd633 100644
--- a/src/vcard-manager.c
+++ b/src/vcard-manager.c
@@ -1000,19 +1000,12 @@ 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)
+vcard_node_changed (GabbleConnection *conn,
+                    const gchar *key,
+                    const gchar *value,
+                    LmMessageNode *vcard_node)
 {
-  const gchar *key = k;
-  const gchar *value = v;
-  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 &&
@@ -1043,7 +1036,9 @@ manager_patch_vcard (GabbleVCardManager *self,
   LmMessage *msg;
   LmMessageNode *patched_vcard;
   GList *li;
-  CheckVCardContext *check_vcard_ctx;
+  GHashTableIter iter;
+  gpointer key, value;
+  gboolean vcard_changed = FALSE;
 
   /* Bail out if we don't have outstanding edits to make, or if we already
    * have a set request in progress.
@@ -1051,10 +1046,17 @@ manager_patch_vcard (GabbleVCardManager *self,
   if (priv->edits == NULL || priv->edit_pipeline_item != NULL)
       return;
 
-  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)
+  g_hash_table_iter_init (&iter, priv->edits);
+  while (g_hash_table_iter_next (&iter, &key, &value))
+    {
+      if (vcard_node_changed (priv->connection, key, value, vcard_node))
+        {
+          vcard_changed = TRUE;
+          break;
+        }
+    }
+
+  if (!vcard_changed)
     {
       DEBUG ("nothing changed, not updating vcard");
       goto out;
@@ -1082,8 +1084,6 @@ 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;
-- 
1.6.5.2



Index: telepathy-gabble.spec
===================================================================
RCS file: /cvs/pkgs/rpms/telepathy-gabble/devel/telepathy-gabble.spec,v
retrieving revision 1.72
retrieving revision 1.73
diff -u -p -r1.72 -r1.73
--- telepathy-gabble.spec	8 Dec 2009 02:07:33 -0000	1.72
+++ telepathy-gabble.spec	22 Dec 2009 19:26:18 -0000	1.73
@@ -1,6 +1,6 @@
 Name:           telepathy-gabble
 Version:        0.8.9
-Release:        1%{?dist}
+Release:        2%{?dist}
 Summary:        A Jabber/XMPP connection manager
 
 Group:          Applications/Communications
@@ -8,6 +8,9 @@ Group:          Applications/Communicati
 License:        LGPLv2+ and (BSD)
 URL:            http://telepathy.freedesktop.org/wiki/
 Source0:        http://telepathy.freedesktop.org/releases/%{name}/%{name}-%{version}.tar.gz
+Patch0:		0001-fd.o-25341-Always-sets-its-own-vcard-on-login.patch
+Patch1:		0001-vcard-manager-Do-not-try-to-set-vcard-fields-not-sup.patch
+Patch2:		0001-vcard-manager-Iterate-over-hashtable-instead-of-usin.patch
 BuildRoot:      %{_tmppath}/%{name}-%{version}-%{release}-root-%(%{__id_u} -n)
 
 BuildRequires:  dbus-devel >= 1.1.0
@@ -30,6 +33,9 @@ chats and voice calls.
 
 %prep
 %setup -q
+%patch0 -p1 -b .vcard-origin
+%patch1 -p1 -b .vcard-fields
+%patch2 -p1 -b .vcard-hashtable
 
 
 %build
@@ -59,6 +65,10 @@ rm -rf $RPM_BUILD_ROOT
 
 
 %changelog
+* Tue Dec 22 2009 Brian Pepple <bpepple at fedoraproject.org> - 0.8.9-2
+- Backport some patches to prevent gabble from setting your VCard
+  on every login.
+
 * Mon Dec  7 2009 Brian Pepple <bpepple at fedoraproject.org> - 0.8.9-1
 - Update to 0.8.9.
 - Drop proxy patch.  Fixed upstream.


--- proxy.patch DELETED ---




More information about the scm-commits mailing list