changeset 32764:ef01f180114b

Gadu-Gadu: synchronize internal libgadu with upstream. Refs #343
author tomkiewicz@cpw.pidgin.im
date Tue, 18 Oct 2011 00:55:59 +0000
parents 326591e64aaa
children 8fb1124b2794
files libpurple/protocols/gg/gg.c libpurple/protocols/gg/gg.h libpurple/protocols/gg/lib/common.c libpurple/protocols/gg/lib/dcc.c libpurple/protocols/gg/lib/dcc7.c libpurple/protocols/gg/lib/events.c libpurple/protocols/gg/lib/handlers.c libpurple/protocols/gg/lib/http.c libpurple/protocols/gg/lib/libgadu-config.h libpurple/protocols/gg/lib/libgadu.c libpurple/protocols/gg/lib/libgadu.h libpurple/protocols/gg/lib/pubdir.c libpurple/protocols/gg/lib/pubdir50.c libpurple/protocols/gg/lib/resolver.c libpurple/protocols/gg/win32-resolver.c
diffstat 15 files changed, 27 insertions(+), 34 deletions(-) [+]
line wrap: on
line diff
--- a/libpurple/protocols/gg/gg.c	Mon Oct 17 21:25:53 2011 +0000
+++ b/libpurple/protocols/gg/gg.c	Tue Oct 18 00:55:59 2011 +0000
@@ -39,8 +39,6 @@
 #include "request.h"
 #include "xmlnode.h"
 
-#include <libgadu.h>
-
 #include "gg.h"
 #include "confer.h"
 #include "search.h"
--- a/libpurple/protocols/gg/gg.h	Mon Oct 17 21:25:53 2011 +0000
+++ b/libpurple/protocols/gg/gg.h	Tue Oct 18 00:55:59 2011 +0000
@@ -24,6 +24,7 @@
 #ifndef _PURPLE_GG_H
 #define _PURPLE_GG_H
 
+#undef printf
 #include <libgadu.h>
 #include "internal.h"
 #include "search.h"
--- a/libpurple/protocols/gg/lib/common.c	Mon Oct 17 21:25:53 2011 +0000
+++ b/libpurple/protocols/gg/lib/common.c	Tue Oct 18 00:55:59 2011 +0000
@@ -30,9 +30,9 @@
 #  include <sys/socket.h>
 #  include <netinet/in.h>
 #  include <arpa/inet.h>
-#  ifdef sun
-#    include <sys/filio.h>
-#  endif
+#endif
+#ifdef sun
+#  include <sys/filio.h>
 #endif
 
 #include <errno.h>
--- a/libpurple/protocols/gg/lib/dcc.c	Mon Oct 17 21:25:53 2011 +0000
+++ b/libpurple/protocols/gg/lib/dcc.c	Tue Oct 18 00:55:59 2011 +0000
@@ -33,9 +33,9 @@
 #  include <sys/socket.h>
 #  include <netinet/in.h>
 #  include <arpa/inet.h>
-#  ifdef sun
-#    include <sys/filio.h>
-#  endif
+#endif
+#ifdef sun
+#  include <sys/filio.h>
 #endif
 
 #include <ctype.h>
--- a/libpurple/protocols/gg/lib/dcc7.c	Mon Oct 17 21:25:53 2011 +0000
+++ b/libpurple/protocols/gg/lib/dcc7.c	Tue Oct 18 00:55:59 2011 +0000
@@ -36,9 +36,9 @@
 #  include <sys/socket.h>
 #  include <netinet/in.h>
 #  include <arpa/inet.h>
-#  ifdef sun
-#    include <sys/filio.h>
-#  endif
+#endif
+#ifdef sun
+#  include <sys/filio.h>
 #endif
 #include <time.h>
 
--- a/libpurple/protocols/gg/lib/events.c	Mon Oct 17 21:25:53 2011 +0000
+++ b/libpurple/protocols/gg/lib/events.c	Tue Oct 18 00:55:59 2011 +0000
@@ -38,7 +38,6 @@
 
 #include "compat.h"
 #include "libgadu.h"
-#include "libgadu-config.h"
 #include "protocol.h"
 #include "libgadu-internal.h"
 #include "encoding.h"
--- a/libpurple/protocols/gg/lib/handlers.c	Mon Oct 17 21:25:53 2011 +0000
+++ b/libpurple/protocols/gg/lib/handlers.c	Tue Oct 18 00:55:59 2011 +0000
@@ -33,15 +33,12 @@
 #  include <arpa/inet.h>
 #endif
 #include <ctype.h>
-#ifndef _WIN32
-#  ifdef sun
-#    include <sys/filio.h>
-#  endif
+#ifdef sun
+#  include <sys/filio.h>
 #endif
 
 #include "compat.h"
 #include "libgadu.h"
-#include "libgadu-config.h"
 #include "resolver.h"
 #include "session.h"
 #include "protocol.h"
--- a/libpurple/protocols/gg/lib/http.c	Mon Oct 17 21:25:53 2011 +0000
+++ b/libpurple/protocols/gg/lib/http.c	Tue Oct 18 00:55:59 2011 +0000
@@ -258,7 +258,7 @@
 	}
 
 	if (h->state == GG_STATE_SENDING_QUERY) {
-		size_t res;
+		ssize_t res;
 
 		if ((res = write(h->fd, h->query, strlen(h->query))) < 1) {
 			gg_debug(GG_DEBUG_MISC, "=> http, write() failed (len=%d, res=%d, errno=%d)\n", strlen(h->query), res, errno);
--- a/libpurple/protocols/gg/lib/libgadu-config.h	Mon Oct 17 21:25:53 2011 +0000
+++ b/libpurple/protocols/gg/lib/libgadu-config.h	Tue Oct 18 00:55:59 2011 +0000
@@ -5,6 +5,8 @@
 #ifndef __GG_LIBGADU_CONFIG_H
 #define __GG_LIBGADU_CONFIG_H
 
+#define GG_LIBGADU_VERSION "1.11.0"
+
 /* Defined if libgadu was compiled for bigendian machine. */
 #undef __GG_LIBGADU_BIGENDIAN
 #ifdef WORDS_BIGENDIAN
--- a/libpurple/protocols/gg/lib/libgadu.c	Mon Oct 17 21:25:53 2011 +0000
+++ b/libpurple/protocols/gg/lib/libgadu.c	Tue Oct 18 00:55:59 2011 +0000
@@ -38,14 +38,13 @@
 #  include <sys/socket.h>
 #  include <netinet/in.h>
 #  include <arpa/inet.h>
-#  ifdef sun
-#    include <sys/filio.h>
-#  endif
+#endif
+#ifdef sun
+#  include <sys/filio.h>
 #endif
 
 #include "compat.h"
 #include "libgadu.h"
-#include "libgadu-config.h"
 #include "protocol.h"
 #include "resolver.h"
 #include "libgadu-internal.h"
@@ -74,8 +73,6 @@
 #  include <openssl/rand.h>
 #endif
 
-#define GG_LIBGADU_VERSION "1.11.0"
-
 /**
  * Port gniazda nasłuchującego dla połączeń bezpośrednich.
  * 
--- a/libpurple/protocols/gg/lib/libgadu.h	Mon Oct 17 21:25:53 2011 +0000
+++ b/libpurple/protocols/gg/lib/libgadu.h	Tue Oct 18 00:55:59 2011 +0000
@@ -1447,7 +1447,6 @@
 
 int gg_file_hash_sha1(int fd, uint8_t *result) GG_DEPRECATED;
 
-#undef printf
 #ifdef __GNUC__
 char *gg_saprintf(const char *format, ...) __attribute__ ((format (printf, 1, 2))) GG_DEPRECATED;
 #else
@@ -2313,6 +2312,8 @@
 
 #endif /* __GG_LIBGADU_H */
 
+#include "libgadu-config.h"
+
 /*
  * Local variables:
  * c-indentation-style: k&r
--- a/libpurple/protocols/gg/lib/pubdir.c	Mon Oct 17 21:25:53 2011 +0000
+++ b/libpurple/protocols/gg/lib/pubdir.c	Tue Oct 18 00:55:59 2011 +0000
@@ -35,7 +35,6 @@
 #include <unistd.h>
 
 #include "libgadu.h"
-#include "libgadu-config.h"
 
 /**
  * Rejestruje nowego użytkownika.
--- a/libpurple/protocols/gg/lib/pubdir50.c	Mon Oct 17 21:25:53 2011 +0000
+++ b/libpurple/protocols/gg/lib/pubdir50.c	Tue Oct 18 00:55:59 2011 +0000
@@ -31,7 +31,6 @@
 #include <time.h>
 
 #include "libgadu.h"
-#include "libgadu-config.h"
 #include "libgadu-internal.h"
 #include "encoding.h"
 
--- a/libpurple/protocols/gg/lib/resolver.c	Mon Oct 17 21:25:53 2011 +0000
+++ b/libpurple/protocols/gg/lib/resolver.c	Tue Oct 18 00:55:59 2011 +0000
@@ -41,7 +41,6 @@
 #endif
 
 #include "libgadu.h"
-#include "libgadu-config.h"
 #include "resolver.h"
 #include "compat.h"
 #include "session.h"
@@ -249,7 +248,7 @@
 #endif /* GG_CONFIG_HAVE_GETHOSTBYNAME_R */
 }
 
-#if defined(GG_CONFIG_HAVE_PTHREAD) || !defined(_WIN32)
+#if defined(GG_CONFIG_HAVE_PTHREAD) || defined(GG_CONFIG_HAVE_FORK)
 /**
  * \internal Rozwiązuje nazwę i zapisuje wynik do podanego desktyptora.
  *
@@ -319,7 +318,7 @@
 	int pid;		/*< Identyfikator procesu */
 };
 
-#ifndef _WIN32
+#ifdef GG_CONFIG_HAVE_FORK
 /**
  * \internal Rozwiązuje nazwę serwera w osobnym procesie.
  *
--- a/libpurple/protocols/gg/win32-resolver.c	Mon Oct 17 21:25:53 2011 +0000
+++ b/libpurple/protocols/gg/win32-resolver.c	Tue Oct 18 00:55:59 2011 +0000
@@ -157,6 +157,9 @@
 	int fd;
 };
 
+/**
+ * Copy-paste from gg_resolver_run().
+ */
 static DWORD WINAPI ggp_resolver_win32thread_thread(LPVOID arg)
 {
 	struct ggp_resolver_win32thread_data *data = arg;
@@ -167,12 +170,10 @@
 		"fd: %i called\n", data->hostname, data->fd);
 
 	if ((addr_ip[0].s_addr = inet_addr(data->hostname)) == INADDR_NONE) {
-		/* W przypadku błędu gg_gethostbyname_real() zwróci -1
-		 * i nie zmieni &addr. Tam jest już INADDR_NONE,
-		 * więc nie musimy robić nic więcej. */
 		if (gg_gethostbyname_real(data->hostname, &addr_list,
 			&addr_count, 0) == -1) {
 			addr_list = addr_ip;
+			/* addr_ip[0] już zawiera INADDR_NONE */
 		}
 	} else {
 		addr_list = addr_ip;
@@ -183,7 +184,7 @@
 	purple_debug_misc("gg", "ggp_resolver_win32thread_thread() "
 		"count = %d\n", addr_count);
 
-	write(data->fd, addr_list, (addr_count+1) * sizeof(struct in_addr));
+	write(data->fd, addr_list, (addr_count + 1) * sizeof(struct in_addr));
 	close(data->fd);
 
 	free(data->hostname);