changeset 25537:e9abf085d519

propagate from branch 'im.pidgin.pidgin' (head f4d2e27ee5bc44bb6d4d834730822b698a4dc534) to branch 'im.pidgin.pidgin.yaz' (head 750605db60c18810e0f057e0b541b6f9885dd697)
author Yoshiki Yazawa <yaz@honeyplanet.jp>
date Wed, 25 Jul 2007 04:36:02 +0000
parents 4bd16a73769c (current diff) 3bf2e6cb8e35 (diff)
children 69cb4582b513
files libpurple/protocols/oscar/oscar.c libpurple/protocols/yahoo/yahoo.c pidgin/gtkconv.c pidgin/gtkutils.c
diffstat 9 files changed, 128 insertions(+), 31 deletions(-) [+]
line wrap: on
line diff
--- a/finch/gntblist.c	Tue Jul 24 05:53:46 2007 +0000
+++ b/finch/gntblist.c	Wed Jul 25 04:36:02 2007 +0000
@@ -1325,8 +1325,10 @@
 	strip = purple_markup_strip_html(tmp);
 	g_string_append(str, strip);
 
-	if (purple_presence_is_status_primitive_active(presence, PURPLE_STATUS_MOBILE))
+	if (purple_presence_is_status_primitive_active(presence, PURPLE_STATUS_MOBILE)) {
+		g_string_append(str, "\n");
 		g_string_append(str, _("On Mobile"));
+	}
 
 	g_free(strip);
 	g_free(tmp);
--- a/libpurple/protocols/oscar/family_locate.c	Tue Jul 24 05:53:46 2007 +0000
+++ b/libpurple/protocols/oscar/family_locate.c	Wed Jul 25 04:36:02 2007 +0000
@@ -636,13 +636,15 @@
 	 * Parse out the Type-Length-Value triples as they're found.
 	 */
 	for (curtlv = 0; curtlv < tlvcnt; curtlv++) {
+		guint16 type;
+		guint8 number, length;
 		int endpos;
-		guint16 type, length;
 
 		type = byte_stream_get16(bs);
-		length = byte_stream_get16(bs);
+		number = byte_stream_get8(bs);
+		length = byte_stream_get8(bs);
 
-		endpos = byte_stream_curpos(bs) + length;
+		endpos = byte_stream_curpos(bs) + MIN(length, byte_stream_empty(bs));
 
 		if (type == 0x0001) {
 			/*
@@ -814,27 +816,33 @@
 			 * contain information about the buddy icon the user
 			 * has stored on the server.
 			 */
-			int type2, number, length2;
+			guint16 type2;
+			guint8 number2, length2;
+			int endpos2;
 
-			while (byte_stream_curpos(bs) < endpos) {
+			/*
+			 * Continue looping as long as we're able to read type2,
+			 * number2, and length2.
+			 */
+			while (byte_stream_curpos(bs) + 4 <= endpos) {
 				type2 = byte_stream_get16(bs);
-				number = byte_stream_get8(bs);
+				number2 = byte_stream_get8(bs);
 				length2 = byte_stream_get8(bs);
 
+				endpos2 = byte_stream_curpos(bs) + MIN(length2, byte_stream_empty(bs));
+
 				switch (type2) {
 					case 0x0000: { /* This is an official buddy icon? */
 						/* This is always 5 bytes of "0x02 01 d2 04 72"? */
-						byte_stream_advance(bs, length2);
 					} break;
 
 					case 0x0001: { /* A buddy icon checksum */
-						if ((length2 > 0) && ((number == 0x00) || (number == 0x01))) {
+						if ((length2 > 0) && ((number2 == 0x00) || (number2 == 0x01))) {
 							g_free(outinfo->iconcsum);
-							outinfo->iconcsumtype = number;
+							outinfo->iconcsumtype = number2;
 							outinfo->iconcsum = byte_stream_getraw(bs, length2);
 							outinfo->iconcsumlen = length2;
-						} else
-							byte_stream_advance(bs, length2);
+						}
 					} break;
 
 					case 0x0002: { /* A status/available message */
@@ -879,11 +887,10 @@
 							outinfo->itmsurl_encoding = NULL;
 						}
 					} break;
+				}
 
-					default: {
-						byte_stream_advance(bs, length2);
-					} break;
-				}
+				/* Save ourselves. */
+				byte_stream_setpos(bs, endpos2);
 			}
 
 		} else if (type == 0x001e) {
--- a/libpurple/protocols/oscar/oscar.c	Tue Jul 24 05:53:46 2007 +0000
+++ b/libpurple/protocols/oscar/oscar.c	Wed Jul 25 04:36:02 2007 +0000
@@ -6633,7 +6633,7 @@
 			if (message) {
 				/* Spaces are encoded as '+' */
 				g_strdelimit(message, "+", ' ');
-				purple_conv_im_send(PURPLE_CONV_IM(conv), message);
+				purple_conv_send_confirm(conv, message);
 			}
 		}
 		/*else
--- a/libpurple/protocols/yahoo/yahoo.c	Tue Jul 24 05:53:46 2007 +0000
+++ b/libpurple/protocols/yahoo/yahoo.c	Wed Jul 25 04:36:02 2007 +0000
@@ -3923,7 +3923,7 @@
 			if (message) {
 				/* Spaces are encoded as '+' */
 				g_strdelimit(message, "+", ' ');
-				purple_conv_im_send(PURPLE_CONV_IM(conv), message);
+				purple_conv_send_confirm(conv, message);
 			}
 		}
 		/*else
--- a/pidgin/gtkconv.c	Tue Jul 24 05:53:46 2007 +0000
+++ b/pidgin/gtkconv.c	Wed Jul 25 04:36:02 2007 +0000
@@ -243,7 +243,6 @@
 
 	if (!PIDGIN_IS_PIDGIN_CONVERSATION(conv))
 		return FALSE;
-
 	if (gtkconv->auto_resize) {
 		return FALSE;
 	}
@@ -268,7 +267,6 @@
 		if (w == gtkconv->lower_hbox)
 			purple_prefs_set_int(PIDGIN_PREFS_ROOT "/conversations/chat/entry_height", allocation->height);
 	}
-
 	return FALSE;
 }
 
@@ -4289,12 +4287,12 @@
         height = (oneline.height + pad_top + pad_bottom) * lines;
         height += (oneline.height + pad_inside) * (wrapped_lines - lines);
 
+	gtkconv->auto_resize = TRUE;
+        g_idle_add(reset_auto_resize_cb, gtkconv);
 	gtk_widget_size_request(gtkconv->lower_hbox, &sr);
 	if (sr.height < height + PIDGIN_HIG_BOX_SPACE) {
-		gtkconv->auto_resize = TRUE;
 		gtkconv->entry_growing = TRUE;
-	        gtk_widget_set_size_request(gtkconv->entry, -1, height);
-	        g_idle_add(reset_auto_resize_cb, gtkconv);
+	        gtk_widget_set_size_request(gtkconv->lower_hbox, -1, height + PIDGIN_HIG_BOX_SPACE);
 	}
 }
 
@@ -4441,6 +4439,9 @@
 
 	/* Setup the info pane */
 	event_box = gtk_event_box_new();
+#if GTK_CHECK_VERSION(2,4,0)
+	gtk_event_box_set_visible_window(GTK_EVENT_BOX(event_box), FALSE);
+#endif
 	gtk_widget_show(event_box);
 	gtkconv->infopane_hbox = gtk_hbox_new(FALSE, 0);
 	gtk_box_pack_start(GTK_BOX(vbox), event_box, FALSE, FALSE, 0);
@@ -4576,7 +4577,6 @@
 	default_formatize(gtkconv);
 	g_signal_connect_after(G_OBJECT(gtkconv->entry), "format_function_clear",
 	                       G_CALLBACK(clear_formatting_cb), gtkconv);
-
 	return paned;
 }
 
@@ -6564,7 +6564,6 @@
 	gtk_widget_show(event);
 
 	gtkconv->u.im->icon = gtk_image_new_from_pixbuf(scale);
-	gtkconv->auto_resize = TRUE;
 	gtk_container_add(GTK_CONTAINER(event), gtkconv->u.im->icon);
 	gtk_widget_show(gtkconv->u.im->icon);
 
--- a/pidgin/gtkutils.c	Tue Jul 24 05:53:46 2007 +0000
+++ b/pidgin/gtkutils.c	Wed Jul 25 04:36:02 2007 +0000
@@ -137,6 +137,10 @@
 	wnd = GTK_WINDOW(gtk_window_new(GTK_WINDOW_TOPLEVEL));
 	if (title)
 		gtk_window_set_title(wnd, title);
+#ifdef _WIN32
+	else
+		gtk_window_set_title(wnd, PIDGIN_ALERT_TITLE);
+#endif
 	gtk_container_set_border_width(GTK_CONTAINER(wnd), border_width);
 	if (role)
 		gtk_window_set_role(wnd, role);
--- a/pidgin/plugins/cap/Makefile.am	Tue Jul 24 05:53:46 2007 +0000
+++ b/pidgin/plugins/cap/Makefile.am	Wed Jul 25 04:36:02 2007 +0000
@@ -25,3 +25,5 @@
 	$(DEBUG_CFLAGS) \
 	$(GTK_CFLAGS) \
 	$(SQLITE3_CFLAGS)
+
+EXTRA_DIST = Makefile.mingw
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/pidgin/plugins/cap/Makefile.mingw	Wed Jul 25 04:36:02 2007 +0000
@@ -0,0 +1,82 @@
+#
+# Makefile.mingw
+#
+# Description: Makefile for cap plugin.
+#
+
+PIDGIN_TREE_TOP := ../../..
+include $(PIDGIN_TREE_TOP)/libpurple/win32/global.mak
+
+TARGET = cap
+
+# This is where sqlite3.[ch] from the sqlite "amalgamation" archive were extracted to
+# This is available from http://www.sqlite.org/download.html
+SQLITE_TOP ?= $(WIN32_DEV_TOP)/sqlite-3.4.1
+
+##
+## INCLUDE PATHS
+##
+INCLUDE_PATHS +=	-I. \
+			-I$(SQLITE_TOP) \
+			-I$(GTK_TOP)/include \
+			-I$(GTK_TOP)/include/gtk-2.0 \
+			-I$(GTK_TOP)/include/glib-2.0 \
+			-I$(GTK_TOP)/include/pango-1.0 \
+			-I$(GTK_TOP)/include/atk-1.0 \
+			-I$(GTK_TOP)/include/cairo \
+			-I$(GTK_TOP)/lib/glib-2.0/include \
+			-I$(GTK_TOP)/lib/gtk-2.0/include \
+			-I$(PURPLE_TOP) \
+			-I$(PURPLE_TOP)/win32 \
+			-I$(PIDGIN_TOP) \
+			-I$(PIDGIN_TOP)/win32 \
+			-I$(PIDGIN_TREE_TOP)
+
+LIB_PATHS +=		-L$(GTK_TOP)/lib \
+			-L$(PURPLE_TOP) \
+			-L$(PIDGIN_TOP)
+
+##
+##  SOURCES, OBJECTS
+##
+C_SRC =			cap.c \
+			$(SQLITE_TOP)/sqlite3.c
+
+OBJECTS = $(C_SRC:%.c=%.o)
+
+##
+## LIBRARIES
+##
+LIBS =			-lgtk-win32-2.0 \
+			-lglib-2.0 \
+			-lgdk-win32-2.0 \
+			-lgobject-2.0 \
+			-lintl \
+			-lpurple \
+			-lpidgin
+
+include $(PIDGIN_COMMON_RULES)
+
+##
+## TARGET DEFINITIONS
+##
+.PHONY: all install clean
+
+all: $(TARGET).dll
+
+install: $(PIDGIN_INSTALL_PLUGINS_DIR) all
+	cp $(TARGET).dll $(PIDGIN_INSTALL_PLUGINS_DIR)
+
+$(OBJECTS): $(PIDGIN_CONFIG_H)
+
+$(TARGET).dll: $(PURPLE_DLL).a $(PIDGIN_DLL).a $(OBJECTS)
+	$(CC) -shared $(OBJECTS) $(LIB_PATHS) $(LIBS) $(DLL_LD_FLAGS) -o $(TARGET).dll
+
+##
+## CLEAN RULES
+##
+clean:
+	rm -rf $(OBJECTS)
+	rm -rf $(TARGET).dll
+
+include $(PIDGIN_COMMON_TARGETS)
--- a/pidgin/plugins/cap/cap.c	Tue Jul 24 05:53:46 2007 +0000
+++ b/pidgin/plugins/cap/cap.c	Wed Jul 25 04:36:02 2007 +0000
@@ -107,25 +107,26 @@
 }
 
 static CapStatistics * get_stats_for(PurpleBuddy *buddy) {
-	gchar *buddy_name;
 	CapStatistics *stats;
 
 	g_return_val_if_fail(buddy != NULL, NULL);
 
-	buddy_name = g_strdup(buddy->name);
-	stats = g_hash_table_lookup(_buddy_stats, buddy_name);
+	stats = g_hash_table_lookup(_buddy_stats, buddy->name);
 	if(!stats) {
 		stats = g_malloc(sizeof(CapStatistics));
 		stats->last_message = -1;
 		stats->last_message_status_id = NULL;
 		stats->last_status_id = NULL;
 		stats->prediction = NULL;
-		g_hash_table_insert(_buddy_stats, buddy_name, stats);
 		stats->buddy = buddy;
 		stats->last_seen = -1;
 		stats->last_status_id = "";
+
+		g_hash_table_insert(_buddy_stats, g_strdup(buddy->name), stats);
 	} else {
-		g_free(buddy_name);
+		/* This may actually be a different PurpleBuddy than what is in stats.
+		 * We replace stats->buddy to make sure we're looking at a valid pointer. */
+		stats->buddy = buddy;
 	}
 	generate_prediction(stats);
 	return stats;
@@ -409,7 +410,7 @@
 /* buddy-signed-on */
 static void buddy_signed_on(PurpleBuddy *buddy) {
 	CapStatistics *stats = get_stats_for(buddy);
-	
+
 	/* If the statistic object existed but doesn't have a buddy pointer associated
 	 * with it then reassociate one with it. The pointer being null is a result
 	 * of a buddy with existing stats signing off and Purple sticking around. */