rpms/telepathy-salut/OLPC-2 salut-ip46.patch, NONE, 1.1 telepathy-salut.spec, 1.5, 1.6

Daniel Williams (dcbw) fedora-extras-commits at redhat.com
Sat Jul 14 02:33:31 UTC 2007


Author: dcbw

Update of /cvs/extras/rpms/telepathy-salut/OLPC-2
In directory cvs-int.fedora.redhat.com:/tmp/cvs-serv11235

Modified Files:
	telepathy-salut.spec 
Added Files:
	salut-ip46.patch 
Log Message:
* Fri Jul 13 2007 Dan Williams <dcbw at redhat.com> - 0.1.3.1-0.3.20070713darcs.olpc2
- Put IPv4 and IPv6 addresses into buddy properties



salut-ip46.patch:

--- NEW FILE salut-ip46.patch ---
diff -rN -u old-telepathy-salut-olpc-trial2/src/salut-connection.c new-telepathy-salut-olpc-trial2/src/salut-connection.c
--- old-telepathy-salut-olpc-trial2/src/salut-connection.c	2007-07-13 22:03:20.000000000 -0400
+++ new-telepathy-salut-olpc-trial2/src/salut-connection.c	2007-07-13 22:03:20.000000000 -0400
@@ -1096,7 +1096,9 @@
 static GHashTable *
 get_properties_hash (const GArray *key,
                      const gchar *color,
-                     const gchar *jid)
+                     const gchar *jid,
+                     const gchar *ip4,
+                     const gchar *ip6)
 {
   GHashTable *properties;
   GValue *gvalue;
@@ -1124,6 +1126,20 @@
       g_hash_table_insert (properties, "jid", gvalue);
     }
 
+  if (ip4 != NULL)
+    {
+      gvalue = new_gvalue (G_TYPE_STRING);
+      g_value_set_string (gvalue, ip4);
+      g_hash_table_insert (properties, "ip4-address", gvalue);
+    }
+
+  if (ip6 != NULL)
+    {
+      gvalue = new_gvalue (G_TYPE_STRING);
+      g_value_set_string (gvalue, ip6);
+      g_hash_table_insert (properties, "ip6-address", gvalue);
+    }
+
   return properties;
 }
 
@@ -1132,10 +1148,12 @@
                          TpHandle handle,
                          const GArray *key,
                          const gchar *color,
-                         const gchar *jid)
+                         const gchar *jid,
+                         const gchar *ip4,
+                         const gchar *ip6)
 {
   GHashTable *properties;
-  properties = get_properties_hash (key, color, jid);
+  properties = get_properties_hash (key, color, jid, ip4, ip6);
 
   salut_svc_olpc_buddy_info_emit_properties_changed (connection,
       handle, properties);
@@ -1194,7 +1212,7 @@
                                                   TpHandle handle)
 {
   emit_properties_changed (self, handle, contact->olpc_key,
-      contact->olpc_color, contact->jid);
+      contact->olpc_color, contact->jid, contact->olpc_ip4, contact->olpc_ip6);
 }
 
 static void
@@ -1212,7 +1230,7 @@
   if (handle == base->self_handle)
     {
       properties = get_properties_hash (priv->self->olpc_key,
-          priv->self->olpc_color, priv->self->jid);
+          priv->self->olpc_color, priv->self->jid, NULL, NULL);
     }
   else
     {
@@ -1227,7 +1245,7 @@
           return;
         }
       properties = get_properties_hash (contact->olpc_key, contact->olpc_color,
-        contact->jid);
+        contact->jid, contact->olpc_ip4, contact->olpc_ip6);
       g_object_unref (contact);
     }
 
@@ -1910,7 +1928,9 @@
   }
 
 #ifdef ENABLE_OLPC
-  if (changes & SALUT_CONTACT_OLPC_PROPERTIES)
+  if ((changes & SALUT_CONTACT_OLPC_PROPERTIES) ||
+      (changes & SALUT_CONTACT_OLPC_IP4) ||
+      (changes & SALUT_CONTACT_OLPC_IP6))
     _contact_manager_contact_olpc_properties_changed (self, contact, handle);
 
   if (changes & SALUT_CONTACT_OLPC_CURRENT_ACTIVITY)
diff -rN -u old-telepathy-salut-olpc-trial2/src/salut-contact.c new-telepathy-salut-olpc-trial2/src/salut-contact.c
--- old-telepathy-salut-olpc-trial2/src/salut-contact.c	2007-07-13 22:03:20.000000000 -0400
+++ new-telepathy-salut-olpc-trial2/src/salut-contact.c	2007-07-13 22:03:20.000000000 -0400
@@ -131,6 +131,8 @@
   obj->olpc_cur_act_room = 0;
   priv->olpc_activities = g_hash_table_new_full (g_str_hash, g_str_equal,
       (GDestroyNotify) g_free, (GDestroyNotify) activity_free);
+  obj->olpc_ip4 = NULL;
+  obj->olpc_ip6 = NULL;
 #endif
   priv->client = NULL;
   priv->resolvers = NULL;
@@ -246,6 +248,8 @@
     }
   g_free (self->olpc_color);
   g_free (self->olpc_cur_act);
+  g_free (self->olpc_ip4);
+  g_free (self->olpc_ip6);
 #endif
 
   G_OBJECT_CLASS (salut_contact_parent_class)->finalize (object);
@@ -524,7 +528,7 @@
 contact_resolved_cb(SalutAvahiServiceResolver *resolver,
                     AvahiIfIndex interface, AvahiProtocol protocol,
                     gchar *name, gchar *type, gchar *domain, gchar *host_name,
-                    AvahiAddress *a, gint port,
+                    AvahiAddress *address, gint port,
                     AvahiStringList *txt, AvahiLookupResultFlags flags,
                     gpointer userdata) {
   SalutContact *self = SALUT_CONTACT (userdata);
@@ -797,6 +801,32 @@
           g_array_free (new_key, TRUE);
         }
     }
+
+  if (address)
+    {
+      gchar * saddr = g_malloc0 (AVAHI_ADDRESS_STR_MAX + 1);
+
+      if (saddr && avahi_address_snprint (saddr, AVAHI_ADDRESS_STR_MAX, address))
+        {
+          switch (address->proto)
+            {
+              case AVAHI_PROTO_INET:
+                self->olpc_ip4 = saddr;
+                SET_CHANGE (SALUT_CONTACT_OLPC_IP4);
+                break;
+              case AVAHI_PROTO_INET6:
+                self->olpc_ip6 = saddr;
+                SET_CHANGE (SALUT_CONTACT_OLPC_IP6);
+                break;
+              default:
+                g_free (saddr);
+                break;
+            }
+        }
+      else
+        g_free (saddr);
+    }
+
 #endif
 
   if (changes != 0) {
diff -rN -u old-telepathy-salut-olpc-trial2/src/salut-contact.h new-telepathy-salut-olpc-trial2/src/salut-contact.h
--- old-telepathy-salut-olpc-trial2/src/salut-contact.h	2007-07-13 22:03:20.000000000 -0400
+++ new-telepathy-salut-olpc-trial2/src/salut-contact.h	2007-07-13 22:03:20.000000000 -0400
@@ -42,6 +42,8 @@
 #define  SALUT_CONTACT_OLPC_PROPERTIES 0x8
 #define  SALUT_CONTACT_OLPC_CURRENT_ACTIVITY 0x10
 #define  SALUT_CONTACT_OLPC_ACTIVITIES 0x20
+#define  SALUT_CONTACT_OLPC_IP4 0x40
+#define  SALUT_CONTACT_OLPC_IP6 0x80
 #endif /* ENABLE_OLPC */
 
 typedef struct _SalutContact SalutContact;
@@ -63,6 +65,8 @@
     gchar *olpc_color;
     gchar *olpc_cur_act;
     TpHandle olpc_cur_act_room;
+    gchar *olpc_ip4;
+    gchar *olpc_ip6;
 #endif /* ENABLE_OLPC */
 };
 



Index: telepathy-salut.spec
===================================================================
RCS file: /cvs/extras/rpms/telepathy-salut/OLPC-2/telepathy-salut.spec,v
retrieving revision 1.5
retrieving revision 1.6
diff -u -r1.5 -r1.6
--- telepathy-salut.spec	13 Jul 2007 14:27:57 -0000	1.5
+++ telepathy-salut.spec	14 Jul 2007 02:32:58 -0000	1.6
@@ -2,13 +2,14 @@
 
 Name:           telepathy-salut
 Version:        0.1.3.1
-Release:        0.2.%{darcsdate}%{?dist}
+Release:        0.3.%{darcsdate}%{?dist}
 Summary:        Link-local XMPP telepathy connection manager
 
 Group:          Applications/Communications
 License:        LGPL
 URL:            http://telepathy.freedesktop.org/wiki/FrontPage
 Source0:        %{name}-%{version}.%{darcsdate}.tar.gz
+Patch0:			salut-ip46.patch
 BuildRoot:      %{_tmppath}/%{name}-%{version}-%{release}-root-%(%{__id_u} -n)
 
 BuildRequires:  dbus-devel >= 0.61
@@ -33,6 +34,7 @@
 
 %prep
 %setup -q
+%patch0 -p1 -b .ip46
 
 
 %build
@@ -58,6 +60,9 @@
 
 
 %changelog
+* Fri Jul 13 2007 Dan Williams <dcbw at redhat.com> - 0.1.3.1-0.3.20070713darcs.olpc2
+- Put IPv4 and IPv6 addresses into buddy properties
+
 * Fri Jul 13 2007 Dan Williams <dcbw at redhat.com> - 0.1.3.1-0.2.20070713darcs.olpc2
 - Update to trunk of telepathy-salut-olpc-trial2 darcs branch
 - Fixes link-local activity detection and sharing issues




More information about the fedora-extras-commits mailing list