# HG changeset patch # User Eric Polino # Date 1179496833 0 # Node ID c5ca1d9b67fad131357faa901b2d041cf7e76ee2 # Parent d761647bc7c4c8a18991df40197296dcf6265417# Parent 7f00fb7f18b58b1a24667e37dcad3ca74d28148d merge of '745cf14dbfb86060ab8826900f365a2f0592747e' and 'a2283b64b34e89187d1eb3015219bafedbdfdae3' diff -r d761647bc7c4 -r c5ca1d9b67fa COPYRIGHT --- a/COPYRIGHT Sun May 13 21:27:13 2007 +0000 +++ b/COPYRIGHT Fri May 18 14:00:33 2007 +0000 @@ -323,6 +323,7 @@ Phil Snowberger Eddie Sohn (tr1sk) Sony Computer Entertainment America, Inc. +Andy Spencer Mark Spencer Lex Spoon Chris Stafford @@ -360,6 +361,7 @@ James Vega David Vermeille Sid Vicious +Jorge VillaseƱor (Masca) Bjoern Voigt Wan Hing Wah Philip Walford diff -r d761647bc7c4 -r c5ca1d9b67fa ChangeLog --- a/ChangeLog Sun May 13 21:27:13 2007 +0000 +++ b/ChangeLog Fri May 18 14:00:33 2007 +0000 @@ -24,9 +24,14 @@ * Identify the account when warning about plaintext auth over an unencrypted channel * Fix XMPP SASL authentication error when using Cyrus and a connect server + * Fix changing tab locations to update properly * Turning off "Show formatting on incoming messages" now ignores formatting in 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) + * 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 @@ -39,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 diff -r d761647bc7c4 -r c5ca1d9b67fa finch/libgnt/gntwm.c --- a/finch/libgnt/gntwm.c Sun May 13 21:27:13 2007 +0000 +++ b/finch/libgnt/gntwm.c Fri May 18 14:00:33 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', "─"}, + {'t', "├"}, + {'u', "┤"}, + {'x', "│"}, + {'-', "↑"}, + {'.', "↓"}, + {'l', "┌"}, + {'k', "┐"}, + {'m', "└"}, + {'j', "┘"}, + {'a', "▒"}, + {'\0', NULL} + }; + fprintf(file, "\n \n\n\n"); fprintf(file, "
");
 	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, "",
 						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, "&");
-			else if (ch == '<')
+			else if (ch[0] == '<')
 				fprintf(file, "<");
-			else if (ch == '>')
+			else if (ch[0] == '>')
 				fprintf(file, ">");
 			else
-				fprintf(file, "%c", ch);
+				fprintf(file, "%s", print);
 			old = now;
 		}
 		fprintf(file, "\n");
 		old = 0;
 	}
-	fprintf(file, "
"); + fprintf(file, "\n"); fclose(file); return TRUE; } diff -r d761647bc7c4 -r c5ca1d9b67fa finch/plugins/gntgf.c --- a/finch/plugins/gntgf.c Sun May 13 21:27:13 2007 +0000 +++ b/finch/plugins/gntgf.c Fri May 18 14:00:33 2007 +0000 @@ -56,7 +56,8 @@ #include #include -#include +#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 diff -r d761647bc7c4 -r c5ca1d9b67fa libpurple/idle.c --- a/libpurple/idle.c Sun May 13 21:27:13 2007 +0000 +++ b/libpurple/idle.c Fri May 18 14:00:33 2007 +0000 @@ -31,7 +31,6 @@ #include "signals.h" #define IDLEMARK 600 /* 10 minutes! */ -#define IDLE_CHECK_INTERVAL 5 /* 5 seconds */ typedef enum { @@ -92,6 +91,8 @@ purple_presence_set_idle(presence, FALSE, 0); } + +static gint time_until_next_idle_event; /* * This function should be called when you think your idle state * may have changed. Maybe you're over the 10-minute mark and @@ -110,14 +111,17 @@ * 2. Set or unset your auto-away message. * 3. Report your current idle time to the IM server. */ -static gint -check_idleness() + +static void +check_idleness(void) { time_t time_idle; gboolean auto_away; const gchar *idle_reporting; gboolean report_idle; GList *l; + gint away_seconds = 0; + static int no_away = 0; purple_signal_emit(purple_blist_get_handle(), "update-idle"); @@ -153,14 +157,24 @@ time_idle = time(NULL) - last_active_time; } - if (auto_away && - (time_idle > (60 * purple_prefs_get_int("/purple/away/mins_before_away")))) + time_until_next_idle_event = IDLEMARK - time_idle; /* reasonable start upperbound */ + + if (auto_away || !no_away) + away_seconds = 60 * purple_prefs_get_int("/purple/away/mins_before_away"); + + if (auto_away && time_idle > away_seconds) { purple_savedstatus_set_idleaway(TRUE); + no_away = 0; + if (time_idle < away_seconds && (away_seconds - time_idle) < time_until_next_idle_event) + time_until_next_idle_event = away_seconds - time_idle; } - else if (time_idle < 60 * purple_prefs_get_int("/purple/away/mins_before_away")) + else if (!no_away && time_idle < away_seconds) { purple_savedstatus_set_idleaway(FALSE); + no_away = 1; + if (time_idle < away_seconds && (away_seconds - time_idle) < time_until_next_idle_event) + time_until_next_idle_event = away_seconds - time_idle; } /* Idle reporting stuff */ @@ -177,8 +191,21 @@ while (idled_accts != NULL) set_account_unidle(idled_accts->data); } + + if (time_until_next_idle_event < 0) + time_until_next_idle_event = IDLEMARK; +} - return TRUE; + +/* + * Check idle and set the timer to fire at the next idle-worth event + */ +static gint +check_idleness_timer() +{ + check_idleness(); + idle_timer = purple_timeout_add(1000 * (time_until_next_idle_event + 1), check_idleness_timer, NULL); + return FALSE; } static void @@ -241,7 +268,7 @@ purple_idle_init() { /* Add the timer to check if we're idle */ - idle_timer = purple_timeout_add(IDLE_CHECK_INTERVAL * 1000, check_idleness, NULL); + idle_timer = purple_timeout_add(1000 * (IDLEMARK + 1), check_idleness_timer, NULL); purple_signal_connect(purple_conversations_get_handle(), "sent-im-msg", purple_idle_get_handle(), diff -r d761647bc7c4 -r c5ca1d9b67fa libpurple/plugins/joinpart.c --- a/libpurple/plugins/joinpart.c Sun May 13 21:27:13 2007 +0000 +++ b/libpurple/plugins/joinpart.c Fri May 18 14:00:33 2007 +0000 @@ -156,7 +156,7 @@ static gboolean check_expire_time(struct joinpart_key *key, time_t *last_said, time_t *limit) { - purple_debug_info("joinpart", "Removing key for %s/%s\n", key->conv->name, key->user); + purple_debug_info("joinpart", "Removing key for %s\n", key->user); return (*last_said < *limit); } diff -r d761647bc7c4 -r c5ca1d9b67fa libpurple/plugins/perl/Makefile.am --- a/libpurple/plugins/perl/Makefile.am Sun May 13 21:27:13 2007 +0000 +++ b/libpurple/plugins/perl/Makefile.am Fri May 18 14:00:33 2007 +0000 @@ -78,7 +78,8 @@ # common/fallback/const-xs.inc perl_scripts = \ - scripts/function_list.pl + scripts/function_list.pl \ + scripts/signals-test.pl EXTRA_DIST = \ Makefile.mingw \ diff -r d761647bc7c4 -r c5ca1d9b67fa libpurple/plugins/perl/scripts/signals-test.pl --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/libpurple/plugins/perl/scripts/signals-test.pl Fri May 18 14:00:33 2007 +0000 @@ -0,0 +1,80 @@ +$MODULE_NAME = "Signals Test Script in Perl"; + +use Purple; + +%PLUGIN_INFO = ( + perl_api_version => 2, + name => "Perl: $MODULE_NAME", + version => "0.1", + summary => "Signals Test plugin for the Perl interpreter.", + description => "Demonstrate the user of purple signals from " . + "a perl plugin.", + author => "Sadrul Habib Chowdhury ", + url => "http://developer.pidgin.im/wiki/sadrul/", + + load => "plugin_load", + unload => "plugin_unload" +); + +# Accounts +sub account_connecting_cb +{ + my $account = shift; + Purple::Debug::misc("signals test in perl", "account-connecting (" . $account->get_username() . ")\n"); +} + +# Buddylist +sub buddy_signed_on +{ + my $buddy = shift; + Purple::Debug::misc("signals test in perl", "buddy-signed-on (" . $buddy->get_name() . ")\n"); +} + +# Connections +sub signed_on +{ + my $conn = shift; + Purple::Debug::misc("signals test in perl", "signed-on (" . $conn->get_account()->get_username() . ")\n"); +} + +# Conversations +sub conv_received_msg +{ + my ($account, $sender, $message, $conv, $flags, $data) = @_; + Purple::Debug::misc("signals test in perl", "$data (" . $account->get_username() . ", $sender, $message, $flags)\n"); +} + +sub plugin_load +{ + my $plugin = shift; + + # Hook to the signals + + # Accounts + $act_handle = Purple::Accounts::get_handle(); + Purple::Signal::connect($act_handle, "account-connecting", $plugin, + \&account_connecting_cb, 0); + + # Buddy List + $blist = Purple::BuddyList::get_handle(); + Purple::Signal::connect($blist, "buddy-signed-on", $plugin, + \&buddy_signed_on, 0); + + # Connections + $conn = Purple::Connections::get_handle(); + Purple::Signal::connect($conn, "signed-on", $plugin, + \&signed_on, 0); + + # Conversations + $conv = Purple::Conversations::get_handle(); + Purple::Signal::connect($conv, "received-im-msg", $plugin, + \&conv_received_msg, "received im message"); + Purple::Signal::connect($conv, "received-chat-msg", $plugin, + \&conv_received_msg, "received chat message"); +} + +sub plugin_unload +{ + # Nothing to do here for this plugin. +} + diff -r d761647bc7c4 -r c5ca1d9b67fa libpurple/protocols/irc/msgs.c --- a/libpurple/protocols/irc/msgs.c Sun May 13 21:27:13 2007 +0000 +++ b/libpurple/protocols/irc/msgs.c Fri May 18 14:00:33 2007 +0000 @@ -35,6 +35,7 @@ static char *irc_mask_userhost(const char *mask); static void irc_chat_remove_buddy(PurpleConversation *convo, char *data[2]); static void irc_buddy_status(char *name, struct irc_buddy *ib, struct irc_conn *irc); +static void irc_connected(struct irc_conn *irc, const char *nick); static void irc_msg_handle_privmsg(struct irc_conn *irc, const char *name, const char *from, const char *to, @@ -70,6 +71,52 @@ g_free(message); } +static void irc_connected(struct irc_conn *irc, const char *nick) +{ + PurpleConnection *gc; + PurpleStatus *status; + PurpleBlistNode *gnode, *cnode, *bnode; + + if ((gc = purple_account_get_connection(irc->account)) == NULL + || PURPLE_CONNECTION_IS_CONNECTED(gc)) + return; + + purple_connection_set_display_name(gc, nick); + purple_connection_set_state(gc, PURPLE_CONNECTED); + + /* If we're away then set our away message */ + status = purple_account_get_active_status(irc->account); + if (!purple_status_get_type(status) != PURPLE_STATUS_AVAILABLE) { + PurplePluginProtocolInfo *prpl_info = PURPLE_PLUGIN_PROTOCOL_INFO(gc->prpl); + prpl_info->set_status(irc->account, status); + } + + /* this used to be in the core, but it's not now */ + for (gnode = purple_get_blist()->root; gnode; gnode = gnode->next) { + if(!PURPLE_BLIST_NODE_IS_GROUP(gnode)) + continue; + for(cnode = gnode->child; cnode; cnode = cnode->next) { + if(!PURPLE_BLIST_NODE_IS_CONTACT(cnode)) + continue; + for(bnode = cnode->child; bnode; bnode = bnode->next) { + PurpleBuddy *b; + if(!PURPLE_BLIST_NODE_IS_BUDDY(bnode)) + continue; + b = (PurpleBuddy *)bnode; + if(b->account == gc->account) { + struct irc_buddy *ib = g_new0(struct irc_buddy, 1); + ib->name = g_strdup(b->name); + g_hash_table_insert(irc->buddies, ib->name, ib); + } + } + } + } + + irc_blist_timeout(irc); + if (!irc->timer) + irc->timer = purple_timeout_add(45000, (GSourceFunc)irc_blist_timeout, (gpointer)irc); +} + void irc_msg_default(struct irc_conn *irc, const char *name, const char *from, char **args) { purple_debug(PURPLE_DEBUG_INFO, "irc", "Unrecognized message: %s\n", args[0]); @@ -95,56 +142,16 @@ void irc_msg_luser(struct irc_conn *irc, const char *name, const char *from, char **args) { - PurpleConnection *gc; - PurpleStatus *status; - PurpleBlistNode *gnode, *cnode, *bnode; - - if (!args || !args[0] || !args[1]) - return; - - gc = purple_account_get_connection(irc->account); - if (!gc) + if (!args || !args[0]) return; if (!strcmp(name, "251")) { - /* 251 is required, so we pluck our nick from here */ - purple_connection_set_display_name(gc, args[0]); + /* 251 is required, so we pluck our nick from here and + * finalize connection */ + irc_connected(irc, args[0]); /* Some IRC servers seem to not send a 255 numeric, so * I guess we can't require it; 251 will do. */ /* } else if (!strcmp(name, "255")) { */ - purple_connection_set_state(gc, PURPLE_CONNECTED); - - /* If we're away then set our away message */ - status = purple_account_get_active_status(irc->account); - if (!purple_status_get_type(status) != PURPLE_STATUS_AVAILABLE) { - PurplePluginProtocolInfo *prpl_info = PURPLE_PLUGIN_PROTOCOL_INFO(gc->prpl); - prpl_info->set_status(irc->account, status); - } - - /* this used to be in the core, but it's not now */ - for (gnode = purple_get_blist()->root; gnode; gnode = gnode->next) { - if(!PURPLE_BLIST_NODE_IS_GROUP(gnode)) - continue; - for(cnode = gnode->child; cnode; cnode = cnode->next) { - if(!PURPLE_BLIST_NODE_IS_CONTACT(cnode)) - continue; - for(bnode = cnode->child; bnode; bnode = bnode->next) { - PurpleBuddy *b; - if(!PURPLE_BLIST_NODE_IS_BUDDY(bnode)) - continue; - b = (PurpleBuddy *)bnode; - if(b->account == gc->account) { - struct irc_buddy *ib = g_new0(struct irc_buddy, 1); - ib->name = g_strdup(b->name); - g_hash_table_insert(irc->buddies, ib->name, ib); - } - } - } - } - - irc_blist_timeout(irc); - if (!irc->timer) - irc->timer = purple_timeout_add(45000, (GSourceFunc)irc_blist_timeout, (gpointer)irc); } } @@ -523,6 +530,9 @@ { char *escaped; + if (!args || !args[0]) + return; + if (!irc->motd) irc->motd = g_string_new(""); @@ -532,7 +542,9 @@ irc->motd = g_string_new(""); return; } else if (!strcmp(name, "376")) { - /* We no longer have to do anything for ENDMOTD */ + /* dircproxy 1.0.5 does not send 251 on reconnection, so + * finalize the connection here if it is not already done. */ + irc_connected(irc, args[0]); return; } @@ -541,6 +553,9 @@ return; } + if (!args[1]) + return; + escaped = g_markup_escape_text(args[1], -1); g_string_append_printf(irc->motd, "%s
", escaped); g_free(escaped); diff -r d761647bc7c4 -r c5ca1d9b67fa libpurple/protocols/irc/parse.c --- a/libpurple/protocols/irc/parse.c Sun May 13 21:27:13 2007 +0000 +++ b/libpurple/protocols/irc/parse.c Fri May 18 14:00:33 2007 +0000 @@ -227,7 +227,7 @@ enclist = purple_account_get_string(irc->account, "encoding", IRC_DEFAULT_CHARSET); encodings = g_strsplit(enclist, ",", 2); - if (encodings[0] == NULL || !strcasecmp("UTF-8", encodings[0])) { + if (encodings[0] == NULL || !g_ascii_strcasecmp("UTF-8", encodings[0])) { g_strfreev(encodings); return g_strdup(string); } diff -r d761647bc7c4 -r c5ca1d9b67fa libpurple/protocols/msn/msn.c --- a/libpurple/protocols/msn/msn.c Sun May 13 21:27:13 2007 +0000 +++ b/libpurple/protocols/msn/msn.c Fri May 18 14:00:33 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"), diff -r d761647bc7c4 -r c5ca1d9b67fa libpurple/protocols/msn/notification.c --- a/libpurple/protocols/msn/notification.c Sun May 13 21:27:13 2007 +0000 +++ b/libpurple/protocols/msn/notification.c Fri May 18 14:00:33 2007 +0000 @@ -982,7 +982,8 @@ } else { - fputs("\n" + fputs("\n" + "\n" "\n" "