/soc/2013/ankitkv/gobjectification: 37fdcf3855d3: Merged default...

Ankit Vani a at nevitus.org
Sat Feb 15 06:50:15 EST 2014


Changeset: 37fdcf3855d39e3cc21447b3a29f27021e189477
Author:	 Ankit Vani <a at nevitus.org>
Date:	 2014-02-15 17:19 +0530
Branch:	 soc.2013.gobjectification.plugins
URL: https://hg.pidgin.im/soc/2013/ankitkv/gobjectification/rev/37fdcf3855d3

Description:

Merged default branch

diffstat:

 configure.ac                              |    32 +-
 doc/oscar/On_Sending_Files_via_OSCAR.odt  |     0 
 doc/oscar/On_Sending_Files_via_OSCAR.pdf  |     0 
 doc/oscar/Receive_Codepaths.odg           |     0 
 doc/oscar/Send_Codepaths.odg              |     0 
 libpurple/plugins/perl/Makefile.mingw     |     0 
 libpurple/protocols/gg/Makefile.am        |    19 +-
 libpurple/protocols/gg/lib/common.c       |   286 ++-
 libpurple/protocols/gg/lib/compat.h       |    50 -
 libpurple/protocols/gg/lib/config.h       |    14 +-
 libpurple/protocols/gg/lib/dcc.c          |   221 +-
 libpurple/protocols/gg/lib/dcc7.c         |   130 +-
 libpurple/protocols/gg/lib/debug.c        |    37 +-
 libpurple/protocols/gg/lib/debug.h        |     2 -
 libpurple/protocols/gg/lib/encoding.c     |     8 +-
 libpurple/protocols/gg/lib/endian.c       |   110 +
 libpurple/protocols/gg/lib/events.c       |  2302 ++++++++++++++++--------
 libpurple/protocols/gg/lib/fileio.h       |    54 +
 libpurple/protocols/gg/lib/handlers.c     |  1141 ++++++++++-
 libpurple/protocols/gg/lib/http.c         |   105 +-
 libpurple/protocols/gg/lib/internal.h     |    94 +-
 libpurple/protocols/gg/lib/libgadu.c      |  2016 ++++++++++++++-------
 libpurple/protocols/gg/lib/libgadu.h      |   392 +++-
 libpurple/protocols/gg/lib/message.c      |   507 ++++-
 libpurple/protocols/gg/lib/message.h      |     8 +-
 libpurple/protocols/gg/lib/network.c      |   307 +++
 libpurple/protocols/gg/lib/network.h      |    95 +
 libpurple/protocols/gg/lib/obsolete.c     |     9 +-
 libpurple/protocols/gg/lib/packets.pb-c.c |  2370 +++++++++++++++++++++++++
 libpurple/protocols/gg/lib/packets.pb-c.h |   682 +++++++
 libpurple/protocols/gg/lib/protobuf-c.c   |  2673 +++++++++++++++++++++++++++++
 libpurple/protocols/gg/lib/protobuf-c.h   |   552 +++++
 libpurple/protocols/gg/lib/protobuf.c     |   153 +
 libpurple/protocols/gg/lib/protobuf.h     |    70 +
 libpurple/protocols/gg/lib/protocol.h     |    85 +
 libpurple/protocols/gg/lib/pubdir.c       |    23 +-
 libpurple/protocols/gg/lib/pubdir50.c     |    12 +-
 libpurple/protocols/gg/lib/resolver.c     |   350 +++-
 libpurple/protocols/gg/lib/resolver.h     |     5 +-
 libpurple/protocols/gg/lib/session.h      |     3 -
 libpurple/protocols/gg/lib/sha1.c         |   161 +-
 libpurple/protocols/gg/lib/strman.h       |    43 +
 libpurple/protocols/gg/lib/tvbuff.c       |   601 ++++++
 libpurple/protocols/gg/lib/tvbuff.h       |    59 +
 libpurple/protocols/gg/lib/tvbuilder.c    |   424 ++++
 libpurple/protocols/gg/lib/tvbuilder.h    |    50 +
 libpurple/protocols/jabber/jabber.c       |   132 +-
 libpurple/protocols/oscar/family_chat.c   |     2 +-
 pidgin/gtkprefs.c                         |   294 +-
 pidgin/gtkutils.c                         |   118 +-
 50 files changed, 14296 insertions(+), 2505 deletions(-)

diffs (truncated from 20397 to 300 lines):

diff --git a/configure.ac b/configure.ac
--- a/configure.ac
+++ b/configure.ac
@@ -1177,14 +1177,14 @@ AC_ARG_WITH(gadu-includes, [AS_HELP_STRI
 AC_ARG_WITH(gadu-libs, [AS_HELP_STRING([--with-gadu-libs=DIR], [compile the Gadu-Gadu plugin against the libs in DIR])], [ac_gadu_libs="$withval"], [ac_gadu_libs="no"])
 GADU_CFLAGS=""
 GADU_LIBS=""
-GADU_LIBGADU_VERSION=1.11.2
+GADU_LIBGADU_MIN_VERSION=1.11.2
 if test -n "$with_gadu_includes" || test -n "$with_gadu_libs"; then
 	gadu_manual_check="yes"
 else
 	gadu_manual_check="no"
 fi
 if test "x$gadu_manual_check" = "xno"; then
-	PKG_CHECK_MODULES(GADU, [libgadu >= $GADU_LIBGADU_VERSION], [
+	PKG_CHECK_MODULES(GADU, [libgadu >= $GADU_LIBGADU_MIN_VERSION], [
 		gadu_includes="yes"
 		gadu_libs="yes"
 	], [
@@ -1253,7 +1253,7 @@ if test "x$gadu_libs" = "xyes" -a "x$gad
 		AC_MSG_RESULT(no)
 		echo
 		echo "Your supplied copy of libgadu is too old."
-		echo "Install version $GADU_LIBGADU_VERSION or newer."
+		echo "Install version $GADU_LIBGADU_MIN_VERSION or newer."
 		echo "Then rerun this ./configure"
 		echo
 		echo "Falling back to using our own copy of libgadu"
@@ -1275,6 +1275,31 @@ fi
 
 if test "x$gadu_libs" != "xyes"; then
 	AC_DEFINE(USE_INTERNAL_LIBGADU, 1, [Using internal libgadu])
+
+	AC_CHECK_LIB(gnutls, gnutls_certificate_set_x509_system_trust, [gg_have_gnutls_csxst=yes], [gg_have_gnutls_csxst=no])
+
+	gg_gnutls_sts=""
+	if test "x$gg_have_gnutls_csxst" = "xno"; then
+		for i in /etc/ssl/ca-bundle.pem \
+			/etc/ssl/certs/ca-certificates.crt \
+			/etc/pki/tls/cert.pem \
+			/usr/local/share/certs/ca-root-nss.crt \
+			/etc/ssl/cert.pem
+		do
+			if test -e $i; then
+				gg_gnutls_sts="$i"
+				break
+			fi
+		done
+	fi
+
+	if test "x$gg_have_gnutls_csxst" = "xyes"; then
+		AC_DEFINE(HAVE_GNUTLS_CERTIFICATE_SET_X509_SYSTEM_TRUST, 1, [gnutls contains the gnutls_certificate_set_x509_system_trust function])
+	fi
+	if test "x$gg_gnutls_sts" != "x"; then
+		AC_DEFINE_UNQUOTED(GG_CONFIG_GNUTLS_SYSTEM_TRUST_STORE, ["$gg_gnutls_sts"], [use the given file as GnuTLS default trust store])
+	fi
+
 fi
 
 if test "x$gadu_libs" = "x"; then
@@ -1283,7 +1308,6 @@ fi
 
 AC_SUBST(GADU_LIBS)
 AC_SUBST(GADU_CFLAGS)
-AC_SUBST(GADU_LIBGADU_VERSION)
 
 AC_ARG_ENABLE(distrib,,,enable_distrib=no)
 AM_CONDITIONAL(DISTRIB, test "x$enable_distrib" = "xyes")
diff --git a/doc/oscar/On_Sending_Files_via_OSCAR.odt b/doc/oscar/On_Sending_Files_via_OSCAR.odt
old mode 100755
new mode 100644
diff --git a/doc/oscar/On_Sending_Files_via_OSCAR.pdf b/doc/oscar/On_Sending_Files_via_OSCAR.pdf
old mode 100755
new mode 100644
diff --git a/doc/oscar/Receive_Codepaths.odg b/doc/oscar/Receive_Codepaths.odg
old mode 100755
new mode 100644
diff --git a/doc/oscar/Send_Codepaths.odg b/doc/oscar/Send_Codepaths.odg
old mode 100755
new mode 100644
diff --git a/libpurple/plugins/perl/Makefile.mingw b/libpurple/plugins/perl/Makefile.mingw
old mode 100755
new mode 100644
diff --git a/libpurple/protocols/gg/Makefile.am b/libpurple/protocols/gg/Makefile.am
--- a/libpurple/protocols/gg/Makefile.am
+++ b/libpurple/protocols/gg/Makefile.am
@@ -12,7 +12,6 @@ EXTRA_DIST = \
 if USE_INTERNAL_LIBGADU
 INTGGSOURCES = \
 	lib/common.c \
-	lib/compat.h \
 	lib/config.h \
 	lib/dcc.c \
 	lib/dcc7.c \
@@ -22,7 +21,9 @@ INTGGSOURCES = \
 	lib/deflate.h \
 	lib/encoding.c \
 	lib/encoding.h \
+	lib/endian.c \
 	lib/events.c \
+	lib/fileio.h \
 	lib/handlers.c \
 	lib/http.c \
 	lib/internal.h \
@@ -30,14 +31,28 @@ INTGGSOURCES = \
 	lib/libgadu.h \
 	lib/message.c \
 	lib/message.h \
+	lib/network.c \
+	lib/network.h \
 	lib/obsolete.c \
+	lib/packets.pb-c.c \
+	lib/packets.pb-c.h \
+	lib/protobuf-c.c \
+	lib/protobuf-c.h \
+	lib/protobuf.c \
+	lib/protobuf.h \
 	lib/protocol.h \
 	lib/pubdir.c \
 	lib/pubdir50.c \
 	lib/resolver.c \
 	lib/resolver.h \
 	lib/session.h \
-	lib/sha1.c
+	lib/strman.h \
+	lib/sha1.c \
+	lib/tvbuff.c \
+	lib/tvbuff.h \
+	lib/tvbuilder.c \
+	lib/tvbuilder.h
+
 
 INTGG_CFLAGS = -I$(top_srcdir)/libpurple/protocols/gg/lib \
 	$(ZLIB_CFLAGS) \
diff --git a/libpurple/protocols/gg/lib/common.c b/libpurple/protocols/gg/lib/common.c
--- a/libpurple/protocols/gg/lib/common.c
+++ b/libpurple/protocols/gg/lib/common.c
@@ -1,4 +1,4 @@
-/* $Id: common.c 1101 2011-05-05 21:17:28Z wojtekka $ */
+/* $Id$ */
 
 /*
  *  (C) Copyright 2001-2002 Wojtek Kaniewski <wojtekka at irc.pl>
@@ -24,21 +24,34 @@
  *
  * \brief Funkcje wykorzystywane przez różne moduły biblioteki
  */
-#include "compat.h"
-#include <sys/types.h>
+
+#include "network.h"
+#include "strman.h"
 #ifdef sun
 #  include <sys/filio.h>
 #endif
 
 #include <errno.h>
-#include <fcntl.h>
 #include <stdarg.h>
-#include <stdio.h>
 #include <stdlib.h>
 #include <string.h>
-#include <unistd.h>
+#include <ctype.h>
+#include <time.h>
 
+#include "config.h"
 #include "libgadu.h"
+#include "internal.h"
+
+#ifndef GG_CONFIG_HAVE_VA_COPY
+#  ifdef GG_CONFIG_HAVE___VA_COPY
+#    define va_copy(dest, src) __va_copy((dest), (src))
+#  else
+/* Taka wersja va_copy() działa poprawnie tylko na platformach, które
+ * va_copy() de facto wcale nie potrzebujÄ
, np. MSVC. Definicja tylko dla
+ * przejrzystości kodu. */
+#    define va_copy(dest, src) (dest) = (src)
+#  endif
+#endif
 
 /**
  * \internal Odpowiednik funkcji \c vsprintf alokujÄ
cy miejsce na wynik.
@@ -55,59 +68,54 @@
  */
 char *gg_vsaprintf(const char *format, va_list ap)
 {
-	int size = 0;
+	int size;
 	char *buf = NULL;
-
-#ifdef GG_CONFIG_HAVE_VA_COPY
 	va_list aq;
 
-	va_copy(aq, ap);
-#else
-#  ifdef GG_CONFIG_HAVE___VA_COPY
-	va_list aq;
-
-	__va_copy(aq, ap);
-#  endif
-#endif
-
-#ifndef GG_CONFIG_HAVE_C99_VSNPRINTF
+#if !defined(GG_CONFIG_HAVE_C99_VSNPRINTF) && !defined(HAVE__VSCPRINTF)
 	{
-		int res;
+		int res = 0;
 		char *tmp;
 
 		size = 128;
 		do {
-			size *= 2;
-			if (!(tmp = realloc(buf, size + 1))) {
+			if (res > size) {
+				/* Jednak zachowanie zgodne z C99. */
+				size = res + 1;
+			} else {
+				size *= 2;
+			}
+
+			if (!(tmp = realloc(buf, size))) {
 				free(buf);
 				return NULL;
 			}
+
 			buf = tmp;
-			res = vsnprintf(buf, size, format, ap);
-		} while (res >= size - 1 || res == -1);
+			va_copy(aq, ap);
+			res = vsnprintf(buf, size, format, aq);
+			va_end(aq);
+		} while (res >= size || res < 0);
 	}
 #else
+	va_copy(aq, ap);
+
+#  ifdef HAVE__VSCPRINTF
+	size = _vscprintf(format, aq) + 1;
+#  else
 	{
 		char tmp[2];
 
 		/* libce Solarisa przy buforze NULL zawsze zwracajÄ
 -1, więc
 		 * musimy podać coÅ› istniejÄ
cego jako cel printf()owania. */
-		size = vsnprintf(tmp, sizeof(tmp), format, ap);
-		if (!(buf = malloc(size + 1)))
-			return NULL;
+		size = vsnprintf(tmp, sizeof(tmp), format, aq) + 1;
 	}
-#endif
+#  endif
+	va_end(aq);
+	if (!(buf = malloc(size)))
+		return NULL;
 
-#ifdef GG_CONFIG_HAVE_VA_COPY
-	vsnprintf(buf, size + 1, format, aq);
-	va_end(aq);
-#else
-#  ifdef GG_CONFIG_HAVE___VA_COPY
-	vsnprintf(buf, size + 1, format, aq);
-	va_end(aq);
-#  else
-	vsnprintf(buf, size + 1, format, ap);
-#  endif
+	vsnprintf(buf, size, format, ap);
 #endif
 
 	return buf;
@@ -146,6 +154,8 @@ char *gg_saprintf(const char *format, ..
  * \param ptr Wskaźnik do zmiennej, która przechowuje aktualne położenie
  *            w analizowanym buforze
  *
+ * \note Funkcja nie jest już używana. Pozostała dla zachowania ABI.
+ *
  * \return Wskaźnik do kolejnej linii tekstu lub NULL, jeśli to już koniec
  *         bufora.
  */
@@ -180,11 +190,15 @@ char *gg_get_line(char **ptr)
  * Funkcja czyta tekst znak po znaku, więc nie jest efektywna, ale dzięki
  * brakowi buforowania, nie koliduje z innymi funkcjami odczytu.
  *
+ * \note W przypadku zakoÅ„czenia poÅ‚Ä
czenia przez drugÄ
 stronÄ™, ostatnia
+ * linia nie jest zwracana.
+ *
  * \param sock Deskryptor gniazda
  * \param buf Wskaźnik do bufora
  * \param length Długość bufora
  *
- * \return Zwraca \c buf jeśli się powiodło, lub \c NULL w przypadku błędu.
+ * \return Zwraca wskaźnik na koniec odebranej linii jeśli się powiodło,
+ * lub \c NULL w przypadku błędu.
  */
 char *gg_read_line(int sock, char *buf, int length)
 {
@@ -195,7 +209,7 @@ char *gg_read_line(int sock, char *buf, 
 
 	for (; length > 1; buf++, length--) {



More information about the Commits mailing list