[gedit-collaboration] Use fake address when bookmark host cannot be resolved



commit e3b5cc501fd729b1819df67cadbee8d974ebe280
Author: Jesse van den Kieboom <jesse vandenkieboom epfl ch>
Date:   Sun Apr 3 17:07:13 2011 +0200

    Use fake address when bookmark host cannot be resolved

 src/gedit-collaboration-window-helper.c |   21 ++++++++++++---------
 1 files changed, 12 insertions(+), 9 deletions(-)
---
diff --git a/src/gedit-collaboration-window-helper.c b/src/gedit-collaboration-window-helper.c
index a4bb9d2..c289c20 100644
--- a/src/gedit-collaboration-window-helper.c
+++ b/src/gedit-collaboration-window-helper.c
@@ -1042,9 +1042,8 @@ bookmark_added (GeditCollaborationWindowHelper *helper,
 	GResolver *resolver = g_resolver_get_default ();
 	GList *addresses;
 	InfTcpConnection *tcp;
-	InfIpAddress *ipaddress;
+	InfIpAddress *ipaddress = NULL;
 	InfXmppConnection *connection;
-	gchar *ipaddr;
 	NameInfo *info;
 	GeditCollaborationUser *user;
 
@@ -1054,16 +1053,20 @@ bookmark_added (GeditCollaborationWindowHelper *helper,
 	                                       NULL,
 	                                       NULL);
 
-	if (!addresses)
+	if (addresses)
 	{
-		return;
-	}
+		gchar *ipaddr;
 
-	ipaddr = g_inet_address_to_string ((GInetAddress *)addresses->data);
-	g_resolver_free_addresses (addresses);
+		ipaddr = g_inet_address_to_string ((GInetAddress *)addresses->data);
+		g_resolver_free_addresses (addresses);
 
-	ipaddress = inf_ip_address_new_from_string (ipaddr);
-	g_free (ipaddr);
+		ipaddress = inf_ip_address_new_from_string (ipaddr);
+		g_free (ipaddr);
+	}
+	else
+	{
+		ipaddress = inf_ip_address_new_loopback4 ();
+	}
 
 	tcp = inf_tcp_connection_new (helper->priv->io,
 	                              ipaddress,



[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]