changeset 32391:b30d7c76db03

propagate from branch 'im.pidgin.pidgin.2.x.y' (head 83dd0d90742e9ccf6890fc21736440df73e48f24) to branch 'im.pidgin.pidgin' (head 31a6cb7c7aaed62b686fa3d4403dbed06d291abd)
author Daniel Atallah <daniel.atallah@gmail.com>
date Tue, 13 Dec 2011 15:33:12 +0000
parents fac08a235b68 (current diff) c0c60e110c82 (diff)
children cad13153ea92
files gaim-uninstalled.pc.in gaim.pc.in libpurple/gaim-compat.h libpurple/protocols/bonjour/jabber.c libpurple/protocols/silc10/Makefile.am libpurple/protocols/silc10/Makefile.mingw libpurple/protocols/silc10/README libpurple/protocols/silc10/TODO libpurple/protocols/silc10/buddy.c libpurple/protocols/silc10/chat.c libpurple/protocols/silc10/ft.c libpurple/protocols/silc10/ops.c libpurple/protocols/silc10/pk.c libpurple/protocols/silc10/silc.c libpurple/protocols/silc10/silcpurple.h libpurple/protocols/silc10/util.c libpurple/protocols/silc10/wb.c libpurple/protocols/silc10/wb.h libpurple/purple-2-uninstalled.pc.in libpurple/purple-2.pc.in libpurple/purple-uninstalled.pc.in libpurple/purple.pc.in libpurple/win32/libc_interface.c libpurple/win32/libc_interface.h libpurple/win32/libc_internal.h pidgin/gtkdocklet-gtk.c pidgin/gtkgaim-compat.h pidgin/pidgin-2-uninstalled.pc.in pidgin/pidgin-2.pc.in pidgin/pidgin-uninstalled.pc.in pidgin/pidgin.pc.in
diffstat 5 files changed, 51 insertions(+), 3 deletions(-) [+]
line wrap: on
line diff
--- a/libpurple/protocols/bonjour/jabber.c	Mon Dec 12 09:01:21 2011 +0000
+++ b/libpurple/protocols/bonjour/jabber.c	Tue Dec 13 15:33:12 2011 +0000
@@ -1455,7 +1455,7 @@
 }
 
 void
-append_iface_if_linklocal(char *ip, uint32_t interface) {
+append_iface_if_linklocal(char *ip, guint32 interface_param) {
 	struct in6_addr in6_addr;
 	int len_remain = INET6_ADDRSTRLEN - strlen(ip);
 
@@ -1467,5 +1467,5 @@
 		return;
 
 	snprintf(ip + strlen(ip), len_remain, "%%%d",
-		 interface);
+		 interface_param);
 }
--- a/libpurple/protocols/bonjour/jabber.h	Mon Dec 12 09:01:21 2011 +0000
+++ b/libpurple/protocols/bonjour/jabber.h	Tue Dec 13 15:33:12 2011 +0000
@@ -111,6 +111,6 @@
 int xep_iq_send_and_free(XepIq *iq);
 GSList * bonjour_jabber_get_local_ips(int fd);
 
-void append_iface_if_linklocal(char *ip, uint32_t interface);
+void append_iface_if_linklocal(char *ip, guint32 interface_param);
 
 #endif /* _BONJOUR_JABBER_H_ */
--- a/libpurple/win32/libc_interface.c	Mon Dec 12 09:01:21 2011 +0000
+++ b/libpurple/win32/libc_interface.c	Tue Dec 13 15:33:12 2011 +0000
@@ -300,6 +300,50 @@
   return (const char *) dst;
 }
 
+int
+wpurple_inet_pton(int af, const char *src, void *dst)
+{
+	/* struct sockaddr can't accomodate struct sockaddr_in6. */
+	union {
+		struct sockaddr_in6 sin6;
+		struct sockaddr_in sin;
+	} sa;
+	size_t srcsize;
+	
+	switch(af)
+	{
+		case AF_INET:
+			sa.sin.sin_family = AF_INET;
+			srcsize = sizeof (sa.sin);
+		break;
+		case AF_INET6:
+			sa.sin6.sin6_family = AF_INET6;
+			srcsize = sizeof (sa.sin6);
+		break;
+		default:
+			errno = WSAEPFNOSUPPORT;
+			return -1;
+	}
+	
+	if (WSAStringToAddress(src, af, NULL, (struct sockaddr *) &sa, &srcsize) != 0)
+	{
+		errno = WSAGetLastError();
+		return -1;
+	}
+	
+	switch(af)
+	{
+		case AF_INET:
+			memcpy(dst, &sa.sin.sin_addr, sizeof(sa.sin.sin_addr));
+		break;
+		case AF_INET6:
+			memcpy(dst, &sa.sin6.sin6_addr, sizeof(sa.sin6.sin6_addr));
+		break;
+	}
+	
+	return 1;
+}
+
 
 /* netdb.h */
 struct hostent* wpurple_gethostbyname(const char *name) {
--- a/libpurple/win32/libc_interface.h	Mon Dec 12 09:01:21 2011 +0000
+++ b/libpurple/win32/libc_interface.h	Tue Dec 13 15:33:12 2011 +0000
@@ -89,6 +89,9 @@
 #define inet_ntop( af, src, dst, cnt ) \
 wpurple_inet_ntop( af, src, dst, cnt )
 
+#define inet_pton( af, src, dst ) \
+wpurple_inet_pton( af, src, dst )
+
 /* netdb.h */
 #define gethostbyname( name ) \
 wpurple_gethostbyname( name )
--- a/libpurple/win32/libc_internal.h	Mon Dec 12 09:01:21 2011 +0000
+++ b/libpurple/win32/libc_internal.h	Tue Dec 13 15:33:12 2011 +0000
@@ -48,6 +48,7 @@
 int wpurple_inet_aton(const char *name, struct in_addr *addr);
 const char *
 wpurple_inet_ntop (int af, const void *src, char *dst, socklen_t cnt);
+int wpurple_inet_pton(int af, const char *src, void *dst);
 
 /* netdb.h */
 struct hostent* wpurple_gethostbyname(const char *name);