pidgin: fec42813: Gadu-Gadu: synchronize internal libgadu ...

tomkiewicz at cpw.pidgin.im tomkiewicz at cpw.pidgin.im
Fri Oct 21 08:50:46 EDT 2011


----------------------------------------------------------------------
Revision: fec428131bde0ae8247941bd6a3d996c984c9189
Parent:   dd677632a6c070ac73a14724f614d7950b048aae
Author:   tomkiewicz at cpw.pidgin.im
Date:     10/21/11 08:48:30
Branch:   im.pidgin.pidgin
URL: http://d.pidgin.im/viewmtn/revision/info/fec428131bde0ae8247941bd6a3d996c984c9189

Changelog: 

Gadu-Gadu: synchronize internal libgadu with upstream - second encounter. Refs #343

Changes against parent dd677632a6c070ac73a14724f614d7950b048aae

  patched  libpurple/protocols/gg/lib/common.c
  patched  libpurple/protocols/gg/lib/compat.h
  patched  libpurple/protocols/gg/lib/dcc.c
  patched  libpurple/protocols/gg/lib/dcc7.c
  patched  libpurple/protocols/gg/lib/events.c
  patched  libpurple/protocols/gg/lib/handlers.c
  patched  libpurple/protocols/gg/lib/http.c
  patched  libpurple/protocols/gg/lib/libgadu-config.h
  patched  libpurple/protocols/gg/lib/libgadu.c
  patched  libpurple/protocols/gg/lib/libgadu.h
  patched  libpurple/protocols/gg/lib/pubdir.c
  patched  libpurple/protocols/gg/lib/resolver.c
  patched  libpurple/protocols/gg/lib/resolver.h

-------------- next part --------------
============================================================
--- libpurple/protocols/gg/lib/common.c	cfd4c76ed0036e950a506d4b0be092da16bd57df
+++ libpurple/protocols/gg/lib/common.c	0bdf1d4c6353bdf0bb9e328c0dddf92e28ecbf06
@@ -24,13 +24,8 @@
  *
  * \brief Funkcje wykorzystywane przez r??ne modu?y biblioteki
  */
-#ifndef _WIN32
-#  include <sys/types.h>
-#  include <sys/ioctl.h>
-#  include <sys/socket.h>
-#  include <netinet/in.h>
-#  include <arpa/inet.h>
-#endif
+#include "compat.h"
+#include <sys/types.h>
 #ifdef sun
 #  include <sys/filio.h>
 #endif
============================================================
--- libpurple/protocols/gg/lib/compat.h	296e21e553d08f3c02f03d3f68b05fc4e08e519a
+++ libpurple/protocols/gg/lib/compat.h	06c6a58a53a886475f6865a56bd6ee8d8b8aecd1
@@ -28,6 +28,21 @@
 #ifndef __COMPAT_H
 #define __COMPAT_H
 
+#ifdef _WIN32
+#  include <ws2tcpip.h>
+#  include <winsock2.h>
+#  define EINPROGRESS WSAEINPROGRESS
+#  define ETIMEDOUT WSAETIMEDOUT
+#  define ENOTCONN WSAENOTCONN
+#  define ECONNRESET WSAECONNRESET
+#else
+#  include <sys/ioctl.h>
+#  include <sys/socket.h>
+#  include <netinet/in.h>
+#  include <arpa/inet.h>
+#  include <netdb.h>
+#endif
+
 #ifdef sun
 #  define INADDR_NONE   ((in_addr_t) 0xffffffff)
 #endif
============================================================
--- libpurple/protocols/gg/lib/dcc.c	04d74bb413e41c8173aec475717aef35a6e8121c
+++ libpurple/protocols/gg/lib/dcc.c	d42d9518b54f4b04f84a03e85e509f57fb69e840
@@ -26,14 +26,9 @@
  * \brief Obs?uga po??cze? bezpo?rednich do wersji Gadu-Gadu 6.x
  */
 
+#include "compat.h"
 #include <sys/types.h>
 #include <sys/stat.h>
-#ifndef _WIN32
-#  include <sys/ioctl.h>
-#  include <sys/socket.h>
-#  include <netinet/in.h>
-#  include <arpa/inet.h>
-#endif
 #ifdef sun
 #  include <sys/filio.h>
 #endif
============================================================
--- libpurple/protocols/gg/lib/events.c	36878ce8c159214c082df500b9d63cd057b66099
+++ libpurple/protocols/gg/lib/events.c	ddeb1042e5bf21cd3c886d92fbddf4f7e7339dbb
@@ -28,12 +28,6 @@
  */
 
 #include <sys/types.h>
-#ifndef _WIN32
-#  include <sys/ioctl.h>
-#  include <sys/socket.h>
-#  include <netinet/in.h>
-#  include <arpa/inet.h>
-#endif
 #include <ctype.h>
 
 #include "compat.h"
============================================================
--- libpurple/protocols/gg/lib/http.c	0f48c2011c38427acc9893a7fd8f3a2d4066e48b
+++ libpurple/protocols/gg/lib/http.c	b9ef871cde686b481ba6d57d78d05522d6679cfb
@@ -25,11 +25,6 @@
  */
 
 #include <sys/types.h>
-#ifndef _WIN32
-#  include <sys/socket.h>
-#  include <netinet/in.h>
-#  include <arpa/inet.h>
-#endif
 
 #include "compat.h"
 #include "libgadu.h"
@@ -37,9 +32,6 @@
 
 #include <ctype.h>
 #include <errno.h>
-#ifndef _WIN32
-#  include <netdb.h>
-#endif
 #include <signal.h>
 #include <stdarg.h>
 #include <stdio.h>
============================================================
--- libpurple/protocols/gg/lib/libgadu-config.h	fc01ed0333d9efd045d3e9d66e9b86d07b8b4eba
+++ libpurple/protocols/gg/lib/libgadu-config.h	6fd391496e380baa14a305ae20686fa0ff39f83c
@@ -5,14 +5,34 @@
 #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
-#define __GG_LIBGADU_BIGENDIAN
-#endif /* WORDS_BIGENDIAN */
+#  define __GG_LIBGADU_BIGENDIAN
+#endif
 
+/* Defined if this machine has gethostbyname_r(). */
+#undef GG_CONFIG_HAVE_GETHOSTBYNAME_R
+
+/* Defined if this machine has _exit(). */
+#define GG_CONFIG_HAVE__EXIT
+
+/* Defined if libgadu was compiled and linked with fork support. */
+#undef GG_CONFIG_HAVE_FORK
+#ifndef _WIN32
+#  define GG_CONFIG_HAVE_FORK
+#endif
+
+/* Defined if libgadu was compiled and linked with pthread support. */
+/* We don't like pthreads. */
+#undef __GG_LIBGADU_HAVE_PTHREAD
+
+/* Defined if this machine has C99-compiliant vsnprintf(). */
+#undef __GG_LIBGADU_HAVE_C99_VSNPRINTF
+#ifndef _WIN32
+#  define __GG_LIBGADU_HAVE_C99_VSNPRINTF
+#endif
+
 /* Defined if this machine has va_copy(). */
 #define __GG_LIBGADU_HAVE_VA_COPY
 
@@ -22,40 +42,29 @@
 /* Defined if this machine supports long long. */
 #undef __GG_LIBGADU_HAVE_LONG_LONG
 #ifdef HAVE_LONG_LONG
-#define __GG_LIBGADU_HAVE_LONG_LONG
-#endif /* HAVE_LONG_LONG */
+#  define __GG_LIBGADU_HAVE_LONG_LONG
+#endif
 
-/* Defined if libgadu was compiled and linked with pthread support. */
-/* We don't like pthreads. */
-#undef __GG_LIBGADU_HAVE_PTHREAD
-
-/* Defined if libgadu was compiled and linked with GnuTLS encryption support. */
+/* Defined if libgadu was compiled and linked with GnuTLS support. */
+#undef GG_CONFIG_HAVE_GNUTLS
 #ifdef HAVE_GNUTLS
 #  define GG_CONFIG_HAVE_GNUTLS
-#else
-#  undef GG_CONFIG_HAVE_GNUTLS
 #endif
 
-/* Defined if libgadu was compiled and linked with TLS support. */
+/* Defined if libgadu was compiled and linked with OpenSSL support. */
 /* Always undefined in Purple. */
 #undef __GG_LIBGADU_HAVE_OPENSSL
 
-/* Include file containing uintXX_t declarations. */
+/* Defined if libgadu was compiled and linked with zlib support. */
+#undef GG_CONFIG_HAVE_ZLIB
+
+/* Defined if uintX_t types are defined in <stdint.h>. */
+#undef GG_CONFIG_HAVE_STDINT_H
 #if HAVE_STDINT_H
-#include <stdint.h>
+#  define GG_CONFIG_HAVE_STDINT_H
 #endif
 
-/* Defined if this machine has C99-compiliant vsnprintf(). */
-#ifndef _WIN32
-#define __GG_LIBGADU_HAVE_C99_VSNPRINTF
-#else
-#undef __GG_LIBGADU_HAVE_C99_VSNPRINTF
-#endif
 
 #define vnsprintf g_vnsprintf
 
-#ifdef _WIN32
-#define random (long) rand
 #endif
-
-#endif /* __GG_LIBGADU_CONFIG_H */
============================================================
--- libpurple/protocols/gg/lib/libgadu.c	bd660c68f8d209f5fb6cf9308451d09573cb9d91
+++ libpurple/protocols/gg/lib/libgadu.c	8e5f5be394259b7663c0e0dbf55af293b3d5abc2
@@ -29,16 +29,6 @@
  */
 
 #include <sys/types.h>
-#ifdef _WIN32
-#  include <io.h>
-#  include <fcntl.h>
-#  include <errno.h>
-#  define SHUT_RDWR SD_BOTH
-#else
-#  include <sys/socket.h>
-#  include <netinet/in.h>
-#  include <arpa/inet.h>
-#endif
 #ifdef sun
 #  include <sys/filio.h>
 #endif
@@ -54,10 +44,7 @@
 #include "message.h"
 #include "deflate.h"
 
-#ifndef _WIN32
-#  include <errno.h> /* on Win32 this is included above */
-#  include <netdb.h>
-#endif
+#include <errno.h>
 #include <stdarg.h>
 #include <stdio.h>
 #include <stdlib.h>
@@ -73,6 +60,8 @@
 #  include <openssl/rand.h>
 #endif
 
+#define GG_LIBGADU_VERSION "1.11.0"
+
 /**
  * Port gniazda nas?uchuj?cego dla po??cze? bezpo?rednich.
  * 
@@ -1119,7 +1108,6 @@ void gg_logoff(struct gg_session *sess)
 	sess->resolver_cleanup(&sess->resolver, 1);
 
 	if (sess->fd != -1) {
-		shutdown(sess->fd, SHUT_RDWR);
 		close(sess->fd);
 		sess->fd = -1;
 	}
============================================================
--- libpurple/protocols/gg/lib/libgadu.h	93353cf7bf9ad72804a05823752f3516633c6639
+++ libpurple/protocols/gg/lib/libgadu.h	156dccaab9aae4d3f04bd5e002b78f09237e642b
@@ -33,7 +33,7 @@
 #ifndef __GG_LIBGADU_H
 #define __GG_LIBGADU_H
 
-#ifdef _WIN32
+#if defined(__cplusplus) || defined(_WIN32)
 #pragma pack(push, 1)
 #endif
 
@@ -53,6 +53,12 @@ extern "C" {
 /* Defined if this machine has gethostbyname_r(). */
 #undef GG_CONFIG_HAVE_GETHOSTBYNAME_R
 
+/* Defined if this machine has _exit(). */
+#undef GG_CONFIG_HAVE__EXIT
+
+/* Defined if libgadu was compiled and linked with fork support. */
+#undef GG_CONFIG_HAVE_FORK
+
 /* Defined if libgadu was compiled and linked with pthread support. */
 #undef GG_CONFIG_HAVE_PTHREAD
 
@@ -95,11 +101,7 @@ extern "C" {
 /* Defined if uintX_t types are defined in <sys/types.h>. */
 #undef GG_CONFIG_HAVE_SYS_TYPES_H
 
-#ifdef _WIN32
-#  undef GG_CONFIG_HAVE_FORK
-#else
-#  define GG_CONFIG_HAVE_FORK
-#endif
+#include "libgadu-config.h"
 
 #ifdef GG_CONFIG_HAVE_OPENSSL
 #include <openssl/ssl.h>
@@ -121,24 +123,12 @@ extern "C" {
 #        include <sys/types.h>
 #        else
 
-#ifndef __AC_STDINT_H
-#define __AC_STDINT_H
-
 /* ISO C 9X: 7.18 Integer types <stdint.h> */
 
 typedef unsigned char   uint8_t;
 typedef unsigned short uint16_t;
 typedef unsigned int   uint32_t;
 
-#if !defined(__CYGWIN__) && !defined(__SunOS) && !defined(_INCLUDE_HPUX_SOURCE)
-#define __int8_t_defined
-typedef   signed char    int8_t;
-typedef   signed short  int16_t;
-typedef   signed int    int32_t;
-#endif
-
-#endif /* __AC_STDINT_H */
-
 #        endif
 #      endif
 #    endif
@@ -2302,18 +2292,16 @@ struct gg_dcc7_dunno1 {
 #define GG_DCC7_TIMEOUT_FILE_ACK 300	/* 5 minut */
 #define GG_DCC7_TIMEOUT_VOICE_ACK 300	/* 5 minut */
 
-#ifdef _WIN32
-#pragma pack(pop)
+#ifdef __cplusplus
+}
 #endif
 
-#ifdef __cplusplus
-}
+#if defined(__cplusplus) || defined(_WIN32)
+#pragma pack(pop)
 #endif
 
 #endif /* __GG_LIBGADU_H */
 
-#include "libgadu-config.h"
-
 /*
  * Local variables:
  * c-indentation-style: k&r
============================================================
--- libpurple/protocols/gg/lib/pubdir.c	28a76bb68aa2380804d02e89c6c83485eb23d487
+++ libpurple/protocols/gg/lib/pubdir.c	78b3122f5af432bb7df7cb3fd1eb27077abfefd1
@@ -193,7 +193,7 @@ struct gg_http *gg_unregister3(uin_t uin
 		return NULL;
 	}
     
-	__pwd = gg_saprintf("%ld", random());
+	__pwd = gg_saprintf("%d", rand());
 	__fmpwd = gg_urlencode(password);
 	__tokenid = gg_urlencode(tokenid);
 	__tokenval = gg_urlencode(tokenval);
============================================================
--- libpurple/protocols/gg/lib/dcc7.c	90502722cc305a31f8c5538ff2af0e177c6a1a3b
+++ libpurple/protocols/gg/lib/dcc7.c	06f1ac15d74499da48fb2ab0181978c5c45dc16e
@@ -31,12 +31,6 @@
 
 #include <sys/types.h>
 #include <sys/stat.h>
-#ifndef _WIN32
-#  include <sys/ioctl.h>
-#  include <sys/socket.h>
-#  include <netinet/in.h>
-#  include <arpa/inet.h>
-#endif
 #ifdef sun
 #  include <sys/filio.h>
 #endif
============================================================
--- libpurple/protocols/gg/lib/resolver.c	2b503af33c161984d04d0476efb3e03b389dbc7a
+++ libpurple/protocols/gg/lib/resolver.c	1360fbb37c933b5e7d4f9d2707b9af85e409c436
@@ -26,25 +26,21 @@
  * \brief Funkcje rozwi?zywania nazw
  */
 
-#ifndef _WIN32
-#  include <sys/wait.h>
-#  include <netdb.h>
-#endif
 #include <errno.h>
 #include <stdlib.h>
 #include <string.h>
 #include <unistd.h>
-#ifndef _WIN32
-#  include <signal.h>
-#  include <netinet/in.h>
-#  include <arpa/inet.h>
-#endif
 
 #include "libgadu.h"
 #include "resolver.h"
 #include "compat.h"
 #include "session.h"
 
+#ifdef GG_CONFIG_HAVE_FORK
+#include <sys/wait.h>
+#include <signal.h>
+#endif
+
 /** Spos?b rozwi?zywania nazw serwer?w */
 static gg_resolver_t gg_global_resolver_type = GG_RESOLVER_DEFAULT;
 
@@ -249,6 +245,7 @@ int gg_gethostbyname_real(const char *ho
 }
 
 #if defined(GG_CONFIG_HAVE_PTHREAD) || defined(GG_CONFIG_HAVE_FORK)
+
 /**
  * \internal Rozwi?zuje nazw? i zapisuje wynik do podanego desktyptora.
  *
@@ -286,8 +283,9 @@ static int gg_resolver_run(int fd, const
 
 	return res;
 }
-#endif
 
+#endif /* GG_CONFIG_HAVE_PTHREAD || GG_CONFIG_HAVE_FORK */
+
 /**
  * \internal Odpowiednik \c gethostbyname zapewniaj?cy wsp??bie?no??.
  *
@@ -311,6 +309,8 @@ struct in_addr *gg_gethostbyname(const c
 	return result;
 }
 
+#ifdef GG_CONFIG_HAVE_FORK
+
 /**
  * \internal Struktura przekazywana do w?tku rozwi?zuj?cego nazw?.
  */
@@ -318,7 +318,6 @@ struct gg_resolver_fork_data {
 	int pid;		/*< Identyfikator procesu */
 };
 
-#ifdef GG_CONFIG_HAVE_FORK
 /**
  * \internal Rozwi?zuje nazw? serwera w osobnym procesie.
  *
@@ -370,12 +369,17 @@ static int gg_resolver_fork_start(int *f
 	}
 
 	if (data->pid == 0) {
+		int status;
+
 		close(pipes[0]);
 
-		if (gg_resolver_run(pipes[1], hostname) == -1)
-			_exit(1);
-		else
-			_exit(0);
+		status = (gg_resolver_run(pipes[1], hostname) == -1) ? 1 : 0;
+
+#ifdef GG_CONFIG_HAVE__EXIT
+		_exit(status);
+#else
+		exit(status);
+#endif
 	}
 
 	close(pipes[1]);
@@ -424,8 +428,9 @@ static void gg_resolver_fork_cleanup(voi
 
 	free(data);
 }
-#endif
 
+#endif /* GG_CONFIG_HAVE_FORK */
+
 #ifdef GG_CONFIG_HAVE_PTHREAD
 
 /**
@@ -594,10 +599,10 @@ int gg_session_set_resolver(struct gg_se
 			return 0;
 		}
 
-#if !defined(GG_CONFIG_HAVE_PTHREAD) || !defined(GG_CONFIG_PTHREAD_DEFAULT)
-		type = GG_RESOLVER_FORK;
-#else
+#if defined(GG_CONFIG_HAVE_PTHREAD) && defined(GG_CONFIG_PTHREAD_DEFAULT)
 		type = GG_RESOLVER_PTHREAD;
+#elif defined(GG_CONFIG_HAVE_FORK)
+		type = GG_RESOLVER_FORK;
 #endif
 	}
 
@@ -705,10 +710,10 @@ int gg_http_set_resolver(struct gg_http 
 			return 0;
 		}
 
-#if !defined(GG_CONFIG_HAVE_PTHREAD) || !defined(GG_CONFIG_PTHREAD_DEFAULT)
-		type = GG_RESOLVER_FORK;
-#else
+#if defined(GG_CONFIG_HAVE_PTHREAD) && defined(GG_CONFIG_PTHREAD_DEFAULT)
 		type = GG_RESOLVER_PTHREAD;
+#elif defined(GG_CONFIG_HAVE_FORK)
+		type = GG_RESOLVER_FORK;
 #endif
 	}
 
============================================================
--- libpurple/protocols/gg/lib/resolver.h	a411899abe871eacbfff1891ce9baf98dd50fb32
+++ libpurple/protocols/gg/lib/resolver.h	a3add0e0d4866ed7740b605f9bf873e48a3d03b2
@@ -19,9 +19,7 @@
 #ifndef LIBGADU_RESOLVER_H
 #define LIBGADU_RESOLVER_H
 
-#ifndef _WIN32
-#  include <arpa/inet.h>
-#endif
+#include "compat.h"
 
 int gg_gethostbyname_real(const char *hostname, struct in_addr **result, int *count, int pthread);
 
============================================================
--- libpurple/protocols/gg/lib/handlers.c	8f36fdcc32e381bc3ea7b94cf6ecfa1181d60013
+++ libpurple/protocols/gg/lib/handlers.c	3d0c7b4c5928d70f70f5675d6976ed0684189faf
@@ -27,11 +27,6 @@
  */
 
 #include <sys/types.h>
-#ifndef _WIN32
-#  include <sys/socket.h>
-#  include <netinet/in.h>
-#  include <arpa/inet.h>
-#endif
 #include <ctype.h>
 #ifdef sun
 #  include <sys/filio.h>
@@ -48,9 +43,6 @@
 #include "deflate.h"
 
 #include <errno.h>
-#ifndef _WIN32
-#  include <netdb.h>
-#endif
 #include <stdarg.h>
 #include <stdio.h>
 #include <stdlib.h>


More information about the Commits mailing list