changeset 17164:14d10dc7c482

propagate from branch 'im.pidgin.pidgin' (head faebb5b94eeb15c49559aa2b3c3ce87c9a38a763) to branch 'org.maemo.garage.pidgin.pidgin.aop_menu' (head 64262e31f65dd1e8c63341053dc1b4545fb4a5fc)
author Gabriel Schulhof <nix@go-nix.ca>
date Fri, 18 May 2007 22:31:10 +0000
parents 77f8b8adb256 (current diff) 9c8172ddc72d (diff)
children 8978ac3ea0b5 89616d769cd4
files
diffstat 15 files changed, 130 insertions(+), 72 deletions(-) [+]
line wrap: on
line diff
--- a/ChangeLog	Thu May 17 07:28:53 2007 +0000
+++ b/ChangeLog	Fri May 18 22:31:10 2007 +0000
@@ -29,8 +29,9 @@
 	  formatting in <span> tags too
 	* File transfer progress for transfers on MSN is now correctly displayed
 	* You can set/change alias of buddies/chats by double-clicking on the
-	  conversation tabs. (Ma Xuan)
+	  conversation tabs (Ma Xuan)
 	* Fix IRC connection bug with dircproxy (xjoe)
+	* Ctrl+[shift]+tab focuses the next most active tab (William Thompson)
 
 	Finch:
 	* Userlist in chat windows, which can be turned on or off using
@@ -43,6 +44,7 @@
 	* Work around an ncurses bug which appears when half of a multi-cell
 	  character is covered by an upper-level window
 	* New plugins are shown in bold text in the plugin dialog
+	* Nicer HTML screendumps
 
 version 2.0.0 (5/3/2007):
 	* The project has new names - libpurple for the core, Pidgin for the
--- a/finch/libgnt/gntwm.c	Thu May 17 07:28:53 2007 +0000
+++ b/finch/libgnt/gntwm.c	Fri May 18 22:31:10 2007 +0000
@@ -628,14 +628,40 @@
 	int x, y;
 	chtype old = 0, now = 0;
 	FILE *file = fopen("dump.html", "w");
+	struct {
+		char ascii;
+		char *unicode;
+	} unis[] = {
+		{'q', "&#x2500;"},
+		{'t', "&#x251c;"},
+		{'u', "&#x2524;"},
+		{'x', "&#x2502;"},
+		{'-', "&#x2191;"},
+		{'.', "&#x2193;"},
+		{'l', "&#x250c;"},
+		{'k', "&#x2510;"},
+		{'m', "&#x2514;"},
+		{'j', "&#x2518;"},
+		{'a', "&#x2592;"},
+		{'\0', NULL}
+	};
 
+	fprintf(file, "<head>\n  <meta http-equiv='Content-Type' content='text/html; charset=utf-8' />\n</head>\n<body>\n");
 	fprintf(file, "<pre>");
 	for (y = 0; y < getmaxy(stdscr); y++) {
 		for (x = 0; x < getmaxx(stdscr); x++) {
-			char ch;
+			char ch[2] = {0, 0}, *print;
+#ifdef NO_WIDECHAR
 			now = mvwinch(curscr, y, x);
-			ch = now & A_CHARTEXT;
-			now ^= ch;
+			ch[0] = now & A_CHARTEXT;
+			now ^= ch[0];
+#else
+			cchar_t wch;
+			char unicode[12];
+			mvwin_wch(curscr, y, x, &wch);
+			now = wch.attr;
+			ch[0] = (char)(wch.chars[0] & 0xff);
+#endif
 
 #define CHECK(attr, start, end) \
 			do \
@@ -688,48 +714,39 @@
 				fprintf(file, "<span style=\"background:#%02x%02x%02x;color:#%02x%02x%02x\">",
 						bg.r, bg.g, bg.b, fg.r, fg.g, fg.b);
 			}
+			print = ch;
+#ifndef NO_WIDECHAR
+			if (wch.chars[0] > 255) {
+				snprintf(unicode, sizeof(unicode), "&#x%x;", wch.chars[0]);
+				print = unicode;
+			}
+#endif
 			if (now & A_ALTCHARSET)
 			{
-				switch (ch)
-				{
-					case 'q':
-						ch = '-'; break;
-					case 't':
-					case 'u':
-					case 'x':
-						ch = '|'; break;
-					case 'v':
-					case 'w':
-					case 'l':
-					case 'm':
-					case 'k':
-					case 'j':
-					case 'n':
-						ch = '+'; break;
-					case '-':
-						ch = '^'; break;
-					case '.':
-						ch = 'v'; break;
-					case 'a':
-						ch = '#'; break;
-					default:
-						ch = ' '; break;
+				int u;
+				for (u = 0; unis[u].ascii; u++) {
+					if (ch[0] == unis[u].ascii) {
+						print = unis[u].unicode;
+						break;
+					}
 				}
+				if (!unis[u].ascii)
+					print = " ";
 			}
-			if (ch == '&')
+			if (ch[0] == '&')
 				fprintf(file, "&amp;");
-			else if (ch == '<')
+			else if (ch[0] == '<')
 				fprintf(file, "&lt;");
-			else if (ch == '>')
+			else if (ch[0] == '>')
 				fprintf(file, "&gt;");
 			else
-				fprintf(file, "%c", ch);
+				fprintf(file, "%s", print);
 			old = now;
 		}
 		fprintf(file, "</span>\n");
 		old = 0;
 	}
-	fprintf(file, "</pre>");
+	fprintf(file, "</pre>\n</body>");
 	fclose(file);
 	return TRUE;
 }
--- a/finch/plugins/gntgf.c	Thu May 17 07:28:53 2007 +0000
+++ b/finch/plugins/gntgf.c	Fri May 18 22:31:10 2007 +0000
@@ -56,7 +56,8 @@
 #include <gntlabel.h>
 #include <gnttree.h>
 
-#include <gntplugin.h>
+#include "gntplugin.h"
+#include "gntconv.h"
 
 typedef struct
 {
@@ -154,7 +155,7 @@
 #endif
 
 static void
-notify(const char *fmt, ...)
+notify(PurpleConversation *conv, const char *fmt, ...)
 {
 	GntWidget *window;
 	GntToast *toast;
@@ -164,6 +165,13 @@
 
 	if (purple_prefs_get_bool(PREFS_BEEP))
 		beep();
+
+	if (conv != NULL) {
+		FinchConv *fc = conv->ui_data;
+		if (gnt_widget_has_focus(fc->window))
+			return;
+	}
+
 #ifdef HAVE_X11
 	if (purple_prefs_get_bool(PREFS_URGENT))
 		urgent();
@@ -220,14 +228,14 @@
 buddy_signed_on(PurpleBuddy *buddy, gpointer null)
 {
 	if (purple_prefs_get_bool(PREFS_EVENT_SIGNONF))
-		notify(_("%s just signed on"), purple_buddy_get_alias(buddy));
+		notify(NULL, _("%s just signed on"), purple_buddy_get_alias(buddy));
 }
 
 static void
 buddy_signed_off(PurpleBuddy *buddy, gpointer null)
 {
 	if (purple_prefs_get_bool(PREFS_EVENT_SIGNONF))
-		notify(_("%s just signed off"), purple_buddy_get_alias(buddy));
+		notify(NULL, _("%s just signed off"), purple_buddy_get_alias(buddy));
 }
 
 static void
@@ -235,7 +243,7 @@
 		PurpleConversation *conv, PurpleMessageFlags flags, gpointer null)
 {
 	if (purple_prefs_get_bool(PREFS_EVENT_IM_MSG))
-		notify(_("%s sent you a message"), sender);
+		notify(conv, _("%s sent you a message"), sender);
 }
 
 static void
@@ -254,9 +262,9 @@
 
 	if (purple_prefs_get_bool(PREFS_EVENT_CHAT_NICK) &&
 			(purple_utf8_has_word(msg, nick)))
-		notify(_("%s said your nick in %s"), sender, purple_conversation_get_name(conv));
+		notify(conv, _("%s said your nick in %s"), sender, purple_conversation_get_name(conv));
 	else if (purple_prefs_get_bool(PREFS_EVENT_CHAT_MSG))
-		notify(_("%s sent a message in %s"), sender, purple_conversation_get_name(conv));
+		notify(conv, _("%s sent a message in %s"), sender, purple_conversation_get_name(conv));
 }
 
 static gboolean
--- a/libpurple/protocols/msn/msn.c	Thu May 17 07:28:53 2007 +0000
+++ b/libpurple/protocols/msn/msn.c	Fri May 18 22:31:10 2007 +0000
@@ -619,7 +619,7 @@
 	account = purple_connection_get_account(gc);
 	user = msn_normalize(account, purple_account_get_username(account));
 
-	if (strstr(user, "@hotmail.com") != NULL)
+	if (strstr(user, "@hotmail.") != NULL)
 	{
 		m = g_list_append(m, NULL);
 		act = purple_plugin_action_new(_("Open Hotmail Inbox"),
--- a/libpurple/protocols/msn/notification.c	Thu May 17 07:28:53 2007 +0000
+++ b/libpurple/protocols/msn/notification.c	Fri May 18 22:31:10 2007 +0000
@@ -982,7 +982,8 @@
 	}
 	else
 	{
-		fputs("<html>\n"
+		fputs("<!-- saved from url=(0013)about:internet -->\n"
+			  "<html>\n"
 			  "<head>\n"
 			  "<noscript>\n"
 			  "<meta http-equiv=\"Refresh\" content=\"0; "
--- a/libpurple/protocols/msn/slp.c	Thu May 17 07:28:53 2007 +0000
+++ b/libpurple/protocols/msn/slp.c	Fri May 18 22:31:10 2007 +0000
@@ -363,6 +363,8 @@
 			purple_xfer_set_cancel_recv_fnc(xfer, msn_xfer_cancel);
 
 			slpcall->xfer = xfer;
+			purple_xfer_ref(slpcall->xfer);
+
 			xfer->data = slpcall;
 
 			purple_xfer_request(xfer);
--- a/libpurple/protocols/msn/slpcall.c	Thu May 17 07:28:53 2007 +0000
+++ b/libpurple/protocols/msn/slpcall.c	Fri May 18 22:31:10 2007 +0000
@@ -120,6 +120,9 @@
 	if (slpcall->end_cb != NULL)
 		slpcall->end_cb(slpcall, session);
 
+	if (slpcall->xfer != NULL)
+		purple_xfer_unref(slpcall->xfer);
+
 	g_free(slpcall);
 }
 
--- a/libpurple/protocols/msn/slplink.c	Thu May 17 07:28:53 2007 +0000
+++ b/libpurple/protocols/msn/slplink.c	Fri May 18 22:31:10 2007 +0000
@@ -763,6 +763,7 @@
 	slpcall->progress_cb = msn_xfer_progress_cb;
 	slpcall->cb = msn_xfer_completed_cb;
 	slpcall->xfer = xfer;
+	purple_xfer_ref(slpcall->xfer);
 
 	slpcall->pending = TRUE;
 
--- a/libpurple/protocols/oscar/oscar.c	Thu May 17 07:28:53 2007 +0000
+++ b/libpurple/protocols/oscar/oscar.c	Fri May 18 22:31:10 2007 +0000
@@ -4143,6 +4143,7 @@
 			conn->sn, msg->str, &tmp, &tmplen, &charset, &charsubset);
 	g_string_free(msg, TRUE);
 	msg = g_string_new_len(tmp, tmplen);
+	g_free(tmp);
 
 	/* Append any binary data that we may have */
 	if (oscar_id) {
--- a/libpurple/protocols/simple/simple.c	Thu May 17 07:28:53 2007 +0000
+++ b/libpurple/protocols/simple/simple.c	Fri May 18 22:31:10 2007 +0000
@@ -277,18 +277,18 @@
 							auth->nonce, noncecount, NULL, auth->digest_session_key);
 		purple_debug(PURPLE_DEBUG_MISC, "simple", "response %s\n", response);
 
-		ret = g_strdup_printf("Digest username=\"%s\", realm=\"%s\", nonce=\"%s\", uri=\"%s\", nc=\"%s\", response=\"%s\"\r\n", authuser, auth->realm, auth->nonce, target, noncecount, response);
+		ret = g_strdup_printf("Digest username=\"%s\", realm=\"%s\", nonce=\"%s\", uri=\"%s\", nc=\"%s\", response=\"%s\"", authuser, auth->realm, auth->nonce, target, noncecount, response);
 		g_free(response);
 		return ret;
 	} else if(auth->type == 2) { /* NTLM */
 		if(auth->nc == 3 && auth->nonce) {
 			/* TODO: Don't hardcode "purple" as the hostname */
 			ret = purple_ntlm_gen_type3(authuser, sip->password, "purple", authdomain, (const guint8 *)auth->nonce, &auth->flags);
-			tmp = g_strdup_printf("NTLM qop=\"auth\", opaque=\"%s\", realm=\"%s\", targetname=\"%s\", gssapi-data=\"%s\"\r\n", auth->opaque, auth->realm, auth->target, ret);
+			tmp = g_strdup_printf("NTLM qop=\"auth\", opaque=\"%s\", realm=\"%s\", targetname=\"%s\", gssapi-data=\"%s\"", auth->opaque, auth->realm, auth->target, ret);
 			g_free(ret);
 			return tmp;
 		}
-		tmp = g_strdup_printf("NTLM qop=\"auth\", realm=\"%s\", targetname=\"%s\", gssapi-data=\"\"\r\n", auth->realm, auth->target);
+		tmp = g_strdup_printf("NTLM qop=\"auth\", realm=\"%s\", targetname=\"%s\", gssapi-data=\"\"", auth->realm, auth->target);
 		return tmp;
 	}
 
@@ -298,7 +298,7 @@
 						auth->nonce, noncecount, NULL, auth->digest_session_key);
 	purple_debug(PURPLE_DEBUG_MISC, "simple", "response %s\n", response);
 
-	ret = g_strdup_printf("Digest username=\"%s\", realm=\"%s\", nonce=\"%s\", uri=\"%s\", nc=\"%s\", response=\"%s\"\r\n", authuser, auth->realm, auth->nonce, target, noncecount, response);
+	ret = g_strdup_printf("Digest username=\"%s\", realm=\"%s\", nonce=\"%s\", uri=\"%s\", nc=\"%s\", response=\"%s\"", authuser, auth->realm, auth->nonce, target, noncecount, response);
 	g_free(response);
 	return ret;
 }
@@ -630,14 +630,12 @@
 	if(addheaders) addh = addheaders;
 	if(sip->registrar.type && !strcmp(method, "REGISTER")) {
 		buf = auth_header(sip, &sip->registrar, method, url);
-		auth = g_strdup_printf("Authorization: %s", buf);
+		auth = g_strdup_printf("Authorization: %s\r\n", buf);
 		g_free(buf);
 		purple_debug(PURPLE_DEBUG_MISC, "simple", "header %s", auth);
-	}
-
-	if(sip->proxy.type && strcmp(method, "REGISTER")) {
+	} else if(sip->proxy.type && strcmp(method, "REGISTER")) {
 		buf = auth_header(sip, &sip->proxy, method, url);
-		auth = g_strdup_printf("Proxy-Authorization: %s", buf);
+		auth = g_strdup_printf("Proxy-Authorization: %s\r\n", buf);
 		g_free(buf);
 		purple_debug(PURPLE_DEBUG_MISC, "simple", "header %s", auth);
 	}
@@ -984,8 +982,8 @@
 		state = xmlnode_get_child(isc, "state");
 
 		if(!state) {
-			purple_debug_info("simple", "process_incoming_message: no state found\n");
-			xmlnode_free(isc);
+				purple_debug_info("simple", "process_incoming_message: no state found\n");
+				xmlnode_free(isc);
 			return;
 		}
 
--- a/pidgin/gtkblist.c	Thu May 17 07:28:53 2007 +0000
+++ b/pidgin/gtkblist.c	Fri May 18 22:31:10 2007 +0000
@@ -782,7 +782,8 @@
 	gtk_widget_show_all(data->window);
 }
 
-static void gtk_blist_row_expanded_cb(GtkTreeView *tv, GtkTreeIter *iter, GtkTreePath *path, gpointer user_data) {
+static void gtk_blist_row_expanded_cb(GtkTreeView *tv, GtkTreeIter *iter, GtkTreePath *path, gpointer user_data)
+{
 	PurpleBlistNode *node;
 	GValue val;
 
@@ -806,7 +807,8 @@
 	}
 }
 
-static void gtk_blist_row_collapsed_cb(GtkTreeView *tv, GtkTreeIter *iter, GtkTreePath *path, gpointer user_data) {
+static void gtk_blist_row_collapsed_cb(GtkTreeView *tv, GtkTreeIter *iter, GtkTreePath *path, gpointer user_data)
+{
 	PurpleBlistNode *node;
 	GValue val;
 
@@ -817,6 +819,8 @@
 
 	if (PURPLE_BLIST_NODE_IS_GROUP(node)) {
 		char *title;
+		struct _pidgin_blist_node *gtknode;
+		PurpleBlistNode *cnode;
 
 		title = pidgin_get_group_title(node, FALSE);
 
@@ -827,6 +831,17 @@
 		g_free(title);
 
 		purple_blist_node_set_bool(node, "collapsed", TRUE);
+
+		for(cnode = node->child; cnode; cnode = cnode->next) {
+			if (PURPLE_BLIST_NODE_IS_CONTACT(cnode)) {
+				gtknode = cnode->ui_data;
+				if (!gtknode->contact_expanded)
+					continue;
+				gtknode->contact_expanded = FALSE;
+				pidgin_blist_update_contact(NULL, cnode);
+			}
+		}
+
 	} else if(PURPLE_BLIST_NODE_IS_CONTACT(node)) {
 		pidgin_blist_collapse_contact_cb(NULL, node);
 	}
--- a/pidgin/gtkconv.c	Thu May 17 07:28:53 2007 +0000
+++ b/pidgin/gtkconv.c	Fri May 18 22:31:10 2007 +0000
@@ -1755,7 +1755,8 @@
 static void
 move_to_next_unread_tab(PidginConversation *gtkconv, gboolean forward)
 {
-	PidginConversation *next_gtkconv = NULL;
+	PidginConversation *next_gtkconv = NULL, *most_active = NULL;
+	PidginUnseenState unseen_state = PIDGIN_UNSEEN_NONE;
 	PidginWindow *win;
 	int initial, i, total, diff;
 
@@ -1771,17 +1772,21 @@
 
 	for (i = (initial + diff) % total; i != initial; i = (i + diff) % total) {
 		next_gtkconv = pidgin_conv_window_get_gtkconv_at_index(win, i);
-		if (next_gtkconv->unseen_state > 0)
-			break;
-	}
-
-	if (i == initial) { /* no new messages */
+		if (next_gtkconv->unseen_state > unseen_state) {
+			most_active = next_gtkconv;
+			unseen_state = most_active->unseen_state;
+			if(PIDGIN_UNSEEN_NICK == unseen_state) /* highest possible state */
+				break;
+		}
+	}
+
+	if (most_active == NULL) { /* no new messages */
 		i = (i + diff) % total;
-		next_gtkconv = pidgin_conv_window_get_gtkconv_at_index(win, i);
-	}
-
-	if (next_gtkconv != NULL && next_gtkconv != gtkconv)
-		pidgin_conv_window_switch_gtkconv(win, next_gtkconv);
+		most_active = pidgin_conv_window_get_gtkconv_at_index(win, i);
+	}
+
+	if (most_active != NULL && most_active != gtkconv)
+		pidgin_conv_window_switch_gtkconv(win, most_active);
 }
 
 static gboolean
--- a/pidgin/gtkimhtml.c	Thu May 17 07:28:53 2007 +0000
+++ b/pidgin/gtkimhtml.c	Fri May 18 22:31:10 2007 +0000
@@ -4441,7 +4441,7 @@
 		}
 	}
 
-	if (imhtml_smiley->flags & GTK_IMHTML_SMILEY_CUSTOM) {
+	if (imhtml_smiley && imhtml_smiley->flags & GTK_IMHTML_SMILEY_CUSTOM) {
 		ebox = gtk_event_box_new();
 		gtk_event_box_set_visible_window(GTK_EVENT_BOX(ebox), FALSE);
 		gtk_widget_show(ebox);
--- a/pidgin/gtkstatusbox.c	Thu May 17 07:28:53 2007 +0000
+++ b/pidgin/gtkstatusbox.c	Fri May 18 22:31:10 2007 +0000
@@ -2334,11 +2334,16 @@
 
 	buffer = gtk_text_view_get_buffer(GTK_TEXT_VIEW(status_box->imhtml));
 
+	height = 0;
 	wrapped_lines = 1;
 	gtk_text_buffer_get_start_iter(buffer, &iter);
-	gtk_text_view_get_iter_location(GTK_TEXT_VIEW(status_box->imhtml), &iter, &oneline);
-	while (gtk_text_view_forward_display_line(GTK_TEXT_VIEW(status_box->imhtml), &iter))
+	do {
+		gtk_text_view_get_iter_location(GTK_TEXT_VIEW(status_box->imhtml), &iter, &oneline);
+		height += oneline.height;
 		wrapped_lines++;
+		if (wrapped_lines > 4)
+			break;
+	} while (gtk_text_view_forward_display_line(GTK_TEXT_VIEW(status_box->imhtml), &iter));
 
 	lines = gtk_text_buffer_get_line_count(buffer);
 
@@ -2350,8 +2355,8 @@
 	pad_bottom = gtk_text_view_get_pixels_below_lines(GTK_TEXT_VIEW(status_box->imhtml));
 	pad_inside = gtk_text_view_get_pixels_inside_wrap(GTK_TEXT_VIEW(status_box->imhtml));
 
-	height = (oneline.height + pad_top + pad_bottom) * lines;
-	height += (oneline.height + pad_inside) * (wrapped_lines - lines);
+	height += (pad_top + pad_bottom) * lines;
+	height += (pad_inside) * (wrapped_lines - lines);
 
 	gtk_widget_set_size_request(status_box->vbox, -1, height + PIDGIN_HIG_BOX_SPACE);
 }
--- a/pidgin/win32/winpidgin.c	Thu May 17 07:28:53 2007 +0000
+++ b/pidgin/win32/winpidgin.c	Fri May 18 22:31:10 2007 +0000
@@ -145,7 +145,7 @@
 		putenv(settingsdir);
 
 		snprintf(aspelldir, sizeof(aspelldir), "PIDGIN_ASPELL_DIR=%s\\Aspell\\bin", path);
-		printf("%s", aspelldir);
+		printf("%s\n", aspelldir);
 		putenv(aspelldir);
 
 		/* set the GTK+ path to be \\path\to\GTK\bin */