pidgin: cb89d880: Update internal/external libgadu to 1.9...

qulogic at pidgin.im qulogic at pidgin.im
Sun Nov 28 03:25:10 EST 2010


----------------------------------------------------------------------
Revision: cb89d88037865aa2ec058f28dc480e92825cd9f5
Parent:   9150bc33060de0b745c92d457efe1bb135eb1229
Author:   qulogic at pidgin.im
Date:     11/27/10 19:18:31
Branch:   im.pidgin.pidgin
URL: http://d.pidgin.im/viewmtn/revision/info/cb89d88037865aa2ec058f28dc480e92825cd9f5

Changelog: 

Update internal/external libgadu to 1.9.0, except for some superfluous
changes, such as the extra format_ variable in gg_convert_to_html.

Fixes #12789.

Changes against parent 9150bc33060de0b745c92d457efe1bb135eb1229

  patched  ChangeLog
  patched  configure.ac
  patched  libpurple/protocols/gg/lib/dcc7.c
  patched  libpurple/protocols/gg/lib/events.c
  patched  libpurple/protocols/gg/lib/libgadu.c
  patched  libpurple/protocols/gg/lib/libgadu.h

-------------- next part --------------
============================================================
--- ChangeLog	232700dbb7b0252dcf7425af5a255c6b65f2b411
+++ ChangeLog	dd128f7d1bb7f75a5096590665e2c614d9bee8e6
@@ -5,6 +5,10 @@ version 2.7.8 (??/??/????):
 	* Fix the exceptions in purple-remote on Python 2.6+. (Ari Pollak)
 	  (#12151)
 
+	Gadu-Gadu:
+	* Updated our bundled libgadu and minimum requirement for external
+	  libgadu to 1.9.0. (#12789)
+
 	MSN:
 	* Don't show ourselves in the list of endpoints that can be disconnected.
 
============================================================
--- configure.ac	707db0c8fd8a22f7e15f5b7bf594252ed73321fe
+++ configure.ac	5d1cbec01a61c8c444ed131a78085509b0a5f876
@@ -1046,7 +1046,7 @@ if test "x$gadu_manual_check" = "xno"; t
 	gadu_manual_check="no"
 fi
 if test "x$gadu_manual_check" = "xno"; then
-	PKG_CHECK_MODULES(GADU, [libgadu >= 1.9.0-rc2], [
+	PKG_CHECK_MODULES(GADU, [libgadu >= 1.9.0], [
 		gadu_includes="yes"
 		gadu_libs="yes"
 	], [
============================================================
--- libpurple/protocols/gg/lib/events.c	d27f341daad16f2ff60d5389d5f7417839b05e73
+++ libpurple/protocols/gg/lib/events.c	3f3a5185e1aa3d9949d496d301ae2352f8a2e211
@@ -1149,6 +1149,7 @@ static int gg_watch_fd_connected(struct 
 
 			e->type = GG_EVENT_NOTIFY60;
 			e->event.notify60 = malloc(sizeof(*e->event.notify60));
+
 			if (!e->event.notify60) {
 				gg_debug_session(sess, GG_DEBUG_MISC, "// gg_watch_fd_connected() not enough memory for notify data\n");
 				goto fail;
@@ -1159,7 +1160,7 @@ static int gg_watch_fd_connected(struct 
 			while (length >= sizeof(struct gg_notify_reply80)) {
 				uint32_t descr_len;
 				char *tmp;
-				
+
 				e->event.notify60[i].uin	= gg_fix32(n->uin);
 				e->event.notify60[i].status	= gg_fix32(n->status);
 				e->event.notify60[i].remote_ip	= n->remote_ip;
@@ -1169,7 +1170,6 @@ static int gg_watch_fd_connected(struct 
 				e->event.notify60[i].version	= 0x00;	/* not-supported */
 				e->event.notify60[i].time	= 0;	/* not-supported */
 
-				
 				descr_len = gg_fix32(n->descr_len);
 
 				length -= sizeof(struct gg_notify_reply80);
============================================================
--- libpurple/protocols/gg/lib/libgadu.c	8e6e5432c0349e3f498203ce8ddf08588c8696c0
+++ libpurple/protocols/gg/lib/libgadu.c	811ee11e96b6916b8c1ea4e63203684238b64550
@@ -69,7 +69,7 @@
 #  include <openssl/rand.h>
 #endif
 
-#define GG_LIBGADU_VERSION "1.9.0-rc2"
+#define GG_LIBGADU_VERSION "1.9.0"
 
 /**
  * Poziom rejestracji informacji odpluskwiaj?cych. Zmienna jest mask? bitow?
@@ -180,7 +180,7 @@ __attribute__ ((unused))
 #ifdef __GNUC__
 __attribute__ ((unused))
 #endif
-= "$Id: libgadu.c 878 2009-11-16 23:48:19Z wojtekka $";
+= "$Id: libgadu.c 923 2010-03-09 20:03:29Z wojtekka $";
 #endif
 
 #endif /* DOXYGEN */
@@ -1316,41 +1316,65 @@ static void gg_append(char *dst, int *po
  * \internal Zamienia tekst z formatowaniem Gadu-Gadu na HTML.
  *
  * \param dst Bufor wynikowy (mo?e by? \c NULL)
- * \param utf_msg Tekst ?r?d?owy
+ * \param src Tekst ?r?d?owy w UTF-8
  * \param format Atrybuty tekstu ?r?d?owego
  * \param format_len D?ugo?? bloku atrybut?w tekstu ?r?d?owego
  *
+ * \note Wynikowy tekst nie jest idealnym kodem HTML, poniewa? ma jak
+ * dok?adniej odzwierciedla? to, co wygenerowa?by oryginalny klient.
+ *
  * \note Dokleja \c \\0 na ko?cu bufora wynikowego.
  *
  * \return D?ugo?? tekstu wynikowego bez \c \\0 (nawet je?li \c dst to \c NULL).
  */
-static int gg_convert_to_html(char *dst, const char *utf_msg, const unsigned char *format, int format_len)
+static int gg_convert_to_html(char *dst, const char *src, const unsigned char *format, int format_len)
 {
 	const char span_fmt[] = "<span style=\"color:#%02x%02x%02x; font-family:'MS Shell Dlg 2'; font-size:9pt; \">";
 	const int span_len = 75;
-	const char img_fmt[] = "<img src=\"%02x%02x%02x%02x%02x%02x%02x%02x\">";
-	const int img_len = 28;
+	const char img_fmt[] = "<img name=\"%02x%02x%02x%02x%02x%02x%02x%02x\">";
+	const int img_len = 29;
 	int char_pos = 0;
-	int format_idx = 3;
+	int format_idx = 0;
 	unsigned char old_attr = 0;
 	const unsigned char *color = (const unsigned char*) "\x00\x00\x00";
 	int len, i;
 
 	len = 0;
 
-	for (i = 0; utf_msg[i] != 0; i++) {
-		unsigned char attr;
-		int attr_pos;
+	/* Nie mamy atrybut?w dla pierwsze znaku, a tekst nie jest pusty, wi?c
+	 * tak czy inaczej trzeba otworzy? <span>. */
 
-		if (format_idx + 3 <= format_len) {
+	if (src[0] != 0 && (format_idx + 3 > format_len || (format[format_idx] | (format[format_idx + 1] << 8)) != 0)) {
+		if (dst != NULL)
+			sprintf(&dst[len], span_fmt, 0, 0, 0);
+
+		len += span_len;
+	}
+
+	/* P?tla przechodzi te? przez ko?cz?ce \0, ?eby m?c doklei? obrazek
+	 * na ko?cu tekstu. */
+
+	for (i = 0; ; i++) {
+		/* Analizuj atrybuty tak d?ugo jak dotycz? aktualnego znaku. */
+		for (;;) {
+			unsigned char attr;
+			int attr_pos;
+
+			if (format_idx + 3 > format_len)
+				break;
+
 			attr_pos = format[format_idx] | (format[format_idx + 1] << 8);
+
+			if (attr_pos != char_pos)
+				break;
+
 			attr = format[format_idx + 2];
-		} else {
-			attr_pos = -1;
-			attr = 0;
-		}
 
-		if (attr_pos == char_pos) {
+			/* Nie doklejaj atrybut?w na ko?cu, co najwy?ej obrazki. */
+
+			if (src[i] == 0)
+				attr &= ~(GG_FONT_BOLD | GG_FONT_ITALIC | GG_FONT_UNDERLINE | GG_FONT_COLOR);
+
 			format_idx += 3;
 
 			if ((attr & (GG_FONT_BOLD | GG_FONT_ITALIC | GG_FONT_UNDERLINE | GG_FONT_COLOR)) != 0) {
@@ -1377,7 +1401,7 @@ static int gg_convert_to_html(char *dst,
 				if (dst != NULL)
 					sprintf(&dst[len], span_fmt, color[0], color[1], color[2]);
 				len += span_len;
-			} else if (char_pos == 0) {
+			} else if (char_pos == 0 && src[0] != 0) {
 				if (dst != NULL)
 					sprintf(&dst[len], span_fmt, 0, 0, 0);
 				len += span_len;
@@ -1410,14 +1434,11 @@ static int gg_convert_to_html(char *dst,
 			}
 
 			old_attr = attr;
-		} else if (i == 0) {
-			if (dst != NULL)
-				sprintf(&dst[len], span_fmt, 0, 0, 0);
+		}
 
-			len += span_len;
-		}
+		/* Doklej znak zachowuj?c htmlowe escapowanie. */
 
-		switch (utf_msg[i]) {
+		switch (src[i]) {
 			case '&':
 				gg_append(dst, &len, "&amp;", 5);
 				break;
@@ -1437,19 +1458,25 @@ static int gg_convert_to_html(char *dst,
 				gg_append(dst, &len, "<br>", 4);
 				break;
 			case '\r':
+			case 0:
 				break;
 			default:
 				if (dst != NULL)
-					dst[len] = utf_msg[i];
+					dst[len] = src[i];
 				len++;
 		}
 
 		/* Sprawd?, czy bajt nie jest kontynuacj? znaku unikodowego. */
 
-		if ((utf_msg[i] & 0xc0) != 0xc0)
+		if ((src[i] & 0xc0) != 0xc0)
 			char_pos++;
+
+		if (src[i] == 0)
+			break;
 	}
 
+	/* Zamknij tagi. */
+
 	if ((old_attr & GG_FONT_UNDERLINE) != 0)
 		gg_append(dst, &len, "</u>", 4);
 
@@ -1459,17 +1486,9 @@ static int gg_convert_to_html(char *dst,
 	if ((old_attr & GG_FONT_BOLD) != 0)
 		gg_append(dst, &len, "</b>", 4);
 
-	/* Dla pustych tekst?w dodaj pusty <span>. */
+	if (src[0] != 0)
+		gg_append(dst, &len, "</span>", 7);
 
-	if (i == 0) {
-		if (dst != NULL)
-			sprintf(&dst[len], span_fmt, 0, 0, 0);
-
-		len += span_len;
-	}
-
-	gg_append(dst, &len, "</span>", 7);
-
 	if (dst != NULL)
 		dst[len] = 0;
 
@@ -1564,7 +1583,7 @@ int gg_send_message_confer_richtext(stru
 			formatlen = 9;
 		}
 
-		len = gg_convert_to_html(NULL, utf_msg, format, formatlen);
+		len = gg_convert_to_html(NULL, utf_msg, format + 3, formatlen - 3);
 
 		html_msg = malloc(len + 1);
 
@@ -1573,7 +1592,7 @@ int gg_send_message_confer_richtext(stru
 			goto cleanup;
 		}
 
-		gg_convert_to_html(html_msg, utf_msg, format, formatlen);
+		gg_convert_to_html(html_msg, utf_msg, format + 3, formatlen - 3);
 
 		s80.seq = gg_fix32(seq_no);
 		s80.msgclass = gg_fix32(msgclass);
============================================================
--- libpurple/protocols/gg/lib/libgadu.h	57f82cfdc71a0878452d425b688dc2f39bcc5f02
+++ libpurple/protocols/gg/lib/libgadu.h	7cff1d8555c3d2612f4447dcb24b2d757a93f86e
@@ -865,6 +865,13 @@ struct gg_event_dcc7_connected {
 };
 
 /**
+ * Opis zdarzenia \c GG_EVENT_DCC7_PENDING.
+ */
+struct gg_event_dcc7_pending {
+	struct gg_dcc7 *dcc7;	/**< Struktura po??czenia */
+};
+
+/**
  * Opis zdarzenia \c GG_EVENT_DCC7_REJECT.
  */
 struct gg_event_dcc7_reject {
@@ -908,6 +915,7 @@ union gg_event_union {
 	struct gg_dcc7 *dcc7_new;	/**< Nowe po??czenie bezpo?rednie (\c GG_EVENT_DCC7_NEW) */
 	enum gg_error_t dcc7_error;	/**< B??d po??czenia bezpo?redniego (\c GG_EVENT_DCC7_ERROR) */
 	struct gg_event_dcc7_connected dcc7_connected;	/**< Informacja o zestawieniu po??czenia bezpo?redniego (\c GG_EVENT_DCC7_CONNECTED) */
+	struct gg_event_dcc7_pending dcc7_pending;	/**< Trwa pr?ba po??czenia bezpo?redniego (\c GG_EVENT_DCC7_PENDING) */
 	struct gg_event_dcc7_reject dcc7_reject;	/**< Odrzucono po??czenia bezpo?redniego (\c GG_EVENT_DCC7_REJECT) */
 	struct gg_event_dcc7_accept dcc7_accept;	/**< Zaakceptowano po??czenie bezpo?rednie (\c GG_EVENT_DCC7_ACCEPT) */
 };
============================================================
--- libpurple/protocols/gg/lib/dcc7.c	ce8661d817dd5e93633c54b7defee710c5eb5fe6
+++ libpurple/protocols/gg/lib/dcc7.c	2b59a42e1c9b53aefeefe65b7bbc030e6dd1fcd9
@@ -731,6 +731,7 @@ int gg_dcc7_handle_info(struct gg_sessio
 		e->event.dcc7_accept.remote_port = dcc->remote_port;
 	} else {
 		e->type = GG_EVENT_DCC7_PENDING;
+		e->event.dcc7_pending.dcc7 = dcc;
 	}
 
 	if (gg_dcc7_connect(sess, dcc) == -1) {
@@ -1004,6 +1005,7 @@ struct gg_event *gg_dcc7_watch_fd(struct
 
 				if (gg_dcc7_reverse_connect(dcc) != -1) {
 					e->type = GG_EVENT_DCC7_PENDING;
+					e->event.dcc7_pending.dcc7 = dcc;
 				} else {
 					e->type = GG_EVENT_DCC7_ERROR;
 					e->event.dcc_error = GG_ERROR_DCC7_NET;


More information about the Commits mailing list