pidgin: 429108b8: proxy: Fix printing IPv6 addresses

darkrain42 at pidgin.im darkrain42 at pidgin.im
Sun Feb 14 03:11:13 EST 2010


-----------------------------------------------------------------
Revision: 429108b826c513797009a7a9158263cbb2c7bc4a
Ancestor: bcd7ec1024e6dbce54b5cf39553711c9a65dd7bb
Author: darkrain42 at pidgin.im
Date: 2010-02-14T08:05:08
Branch: im.pidgin.pidgin
URL: http://d.pidgin.im/viewmtn/revision/info/429108b826c513797009a7a9158263cbb2c7bc4a

Modified files:
        libpurple/proxy.c

ChangeLog: 

proxy: Fix printing IPv6 addresses

>From "0:0:2001:6f8:999::" (wrong) to "2001:6f8:999::1" (correct).


-------------- next part --------------
============================================================
--- libpurple/proxy.c	9635445cccc76924bbfb3b4cf2934a0ea2425e74
+++ libpurple/proxy.c	34ecb9b890ad66f18ad2dfdfc6690bb96526d6cc
@@ -2100,8 +2100,12 @@ static void try_connect(PurpleProxyConne
 	addr = connect_data->hosts->data;
 	connect_data->hosts = g_slist_remove(connect_data->hosts, connect_data->hosts->data);
 #ifdef HAVE_INET_NTOP
-	inet_ntop(addr->sa_family, &((struct sockaddr_in *)addr)->sin_addr,
-			ipaddr, sizeof(ipaddr));
+	if (addr->sa_family == AF_INET)
+		inet_ntop(addr->sa_family, &((struct sockaddr_in *)addr)->sin_addr,
+				ipaddr, sizeof(ipaddr));
+	else if (addr->sa_family == AF_INET6)
+		inet_ntop(addr->sa_family, &((struct sockaddr_in6 *)addr)->sin6_addr,
+				ipaddr, sizeof(ipaddr));
 #else
 	memcpy(ipaddr, inet_ntoa(((struct sockaddr_in *)addr)->sin_addr),
 			sizeof(ipaddr));


More information about the Commits mailing list