[telepathy-doc/master] Update gnio-receiver for unbroken tp-salut

Davyd Madeley davyd at madeley.id.au
Sun Apr 26 19:26:42 PDT 2009


---
 docs/examples/glib_salut_ft/gnio-receiver.c |   15 ++++++++++++---
 1 files changed, 12 insertions(+), 3 deletions(-)

diff --git a/docs/examples/glib_salut_ft/gnio-receiver.c b/docs/examples/glib_salut_ft/gnio-receiver.c
index 174d3b0..1223bf7 100644
--- a/docs/examples/glib_salut_ft/gnio-receiver.c
+++ b/docs/examples/glib_salut_ft/gnio-receiver.c
@@ -1,4 +1,5 @@
 #include <unistd.h>
+#include <string.h>
 
 #include <glib.h>
 #include <glib-object.h>
@@ -55,11 +56,19 @@ accept_file_cb (TpChannel	*channel,
 
 	if (G_IS_UNIX_CLIENT (ftstate->client))
 	{
-		const char *address = g_value_get_string (addressv);
-		g_print (" > file_transfer_cb (unix:%s)\n", address);
+		/* old versions of telepathy-salut stored this address as a
+		   string rather than an 'ay'. Those versions of Salut are
+		   broken */
+		GArray *address = g_value_get_boxed (addressv);
+		char path[address->len + 1];
+
+		strncpy (path, address->data, address->len);
+		path[address->len] = '\0';
+
+		g_print (" > file_transfer_cb (unix:%s)\n", path);
 
 		ftstate->address = G_SOCKET_ADDRESS (
-			g_unix_socket_address_new (address));
+			g_unix_socket_address_new (path));
 	}
 	else if (G_IS_TCP_CLIENT (ftstate->client))
 	{
-- 
1.5.6.5




More information about the telepathy-commits mailing list