# HG changeset patch # User Will Thompson # Date 1191784079 0 # Node ID de042c76816956aecd54e5315dd39d5981af74ee # Parent 8e4f7b8925e7dbfba055900d127d005fa6ad2185# Parent e96daf6bc51111f8ce6f7baedefb20ebf69d2b94 merge of '7cc9174ede50bc7d7fdfbb47fbcdee031b053f08' and 'e1ef22c0f8bc82d7c69f7e57052e8a799a7241b7' diff -r e96daf6bc511 -r de042c768169 .mtn-ignore --- a/.mtn-ignore Sun Oct 07 19:07:06 2007 +0000 +++ b/.mtn-ignore Sun Oct 07 19:07:59 2007 +0000 @@ -21,7 +21,7 @@ config.status config.sub configure$ -finch/finch +finch/finch$ finch/libgnt/gntmarshal.c finch/libgnt/gntmarshal.h depcomp diff -r e96daf6bc511 -r de042c768169 configure.ac --- a/configure.ac Sun Oct 07 19:07:06 2007 +0000 +++ b/configure.ac Sun Oct 07 19:07:59 2007 +0000 @@ -2247,6 +2247,7 @@ share/Makefile share/sounds/Makefile share/ca-certs/Makefile + finch/finch.pc finch/Makefile finch/libgnt/Makefile finch/libgnt/gnt.pc diff -r e96daf6bc511 -r de042c768169 doc/gtkconv-signals.dox --- a/doc/gtkconv-signals.dox Sun Oct 07 19:07:06 2007 +0000 +++ b/doc/gtkconv-signals.dox Sun Oct 07 19:07:59 2007 +0000 @@ -134,7 +134,7 @@ void (*conversation_displayed)(PidginConversation *gtkconv); @endsignalproto @signaldesc - Emitted right after the Pidgin UI is reattached to a conversation. + Emitted right after the Pidgin UI is attached to a new or a hidden conversation. @param gtkconv The PidginConversation @endsignaldef diff -r e96daf6bc511 -r de042c768169 finch/Makefile.am --- a/finch/Makefile.am Sun Oct 07 19:07:06 2007 +0000 +++ b/finch/Makefile.am Sun Oct 07 19:07:59 2007 +0000 @@ -1,7 +1,11 @@ EXTRA_DIST = \ getopt.c \ getopt.h \ - getopt1.c + getopt1.c \ + finch.pc.in + +pkgconfigdir = $(libdir)/pkgconfig +pkgconfig_DATA = finch.pc SUBDIRS = libgnt plugins diff -r e96daf6bc511 -r de042c768169 finch/finch.pc.in --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/finch/finch.pc.in Sun Oct 07 19:07:59 2007 +0000 @@ -0,0 +1,13 @@ +prefix=@prefix@ +exec_prefix=@exec_prefix@ +libdir=@libdir@ +includedir=@includedir@ +datadir=@datadir@ +sysconfdir=@sysconfdir@ + +Name: Finch +Description: Finch is an instant messenger application that uses libpurple for protocol support and ncurses (libgnt) for the UI. +Version: @VERSION@ +Requires: gnt purple +Cflags: -I${includedir}/finch + diff -r e96daf6bc511 -r de042c768169 libpurple/plugins/log_reader.c --- a/libpurple/plugins/log_reader.c Sun Oct 07 19:07:06 2007 +0000 +++ b/libpurple/plugins/log_reader.c Sun Oct 07 19:07:59 2007 +0000 @@ -232,7 +232,6 @@ struct adium_logger_data *data; GError *error = NULL; gchar *read = NULL; - gsize length; /* XXX: TODO: We probably want to set PURPLE_LOG_READ_NO_NEWLINE * XXX: TODO: for HTML logs. */ @@ -246,8 +245,9 @@ g_return_val_if_fail(data->path != NULL, g_strdup("")); purple_debug_info("Adium log read", "Reading %s\n", data->path); - if (!g_file_get_contents(data->path, &read, &length, &error)) { - purple_debug_error("Adium log read", "Error reading log\n"); + if (!g_file_get_contents(data->path, &read, NULL, &error)) { + purple_debug_error("Adium log read", "Error reading log: %s\n", + (error && error->message) ? error->message : "Unknown error"); if (error) g_error_free(error); return g_strdup(""); @@ -1808,8 +1808,10 @@ error = NULL; if (!g_file_get_contents(path, &contents, NULL, &error)) { purple_debug_error("QIP logger", - "Couldn't read file %s: %s \n", path, error->message); - g_error_free(error); + "Couldn't read file %s: %s \n", path, + (error && error->message) ? error->message : "Unknown error"); + if (error) + g_error_free(error); g_free(path); return list; } @@ -1955,8 +1957,10 @@ error = NULL; if (!(utf8_string = g_convert(contents, -1, "UTF-8", "Cp1251", NULL, NULL, &error))) { purple_debug_error("QIP logger", - "Couldn't convert file %s to UTF-8: %s\n", data->path, error->message); - g_error_free(error); + "Couldn't convert file %s to UTF-8: %s\n", data->path, + (error && error->message) ? error->message : "Unknown error"); + if (error) + g_error_free(error); g_free(contents); return g_strdup(""); } @@ -2151,18 +2155,18 @@ /* Calculate default Messenger Plus! log directory. */ #ifdef _WIN32 + path = NULL; folder = wpurple_get_special_folder(CSIDL_PERSONAL); if (folder) { path = g_build_filename(folder, "My Chat Logs", NULL); g_free(folder); - } else - path = g_strdup(""); + } #else path = g_build_filename(PURPLE_LOG_READER_WINDOWS_MOUNT_POINT, "Documents and Settings", g_get_user_name(), "My Documents", "My Chat Logs", NULL); #endif - purple_prefs_add_string("/plugins/core/log_reader/messenger_plus/log_directory", path); + purple_prefs_add_string("/plugins/core/log_reader/messenger_plus/log_directory", path ? path : ""); g_free(path); @@ -2171,18 +2175,18 @@ /* Calculate default MSN message history directory. */ #ifdef _WIN32 + path = NULL; folder = wpurple_get_special_folder(CSIDL_PERSONAL); if (folder) { path = g_build_filename(folder, "My Received Files", NULL); g_free(folder); - } else - path = g_strdup(""); + } #else path = g_build_filename(PURPLE_LOG_READER_WINDOWS_MOUNT_POINT, "Documents and Settings", g_get_user_name(), "My Documents", "My Received Files", NULL); #endif - purple_prefs_add_string("/plugins/core/log_reader/msn/log_directory", path); + purple_prefs_add_string("/plugins/core/log_reader/msn/log_directory", path ? path : ""); g_free(path); @@ -2261,22 +2265,22 @@ g_key_file_free(key_file); } #else /* !GLIB_CHECK_VERSION(2,6,0) */ - gsize length; gchar *contents = NULL; purple_debug_info("Trillian talk.ini read", - "Reading %s\n", path); - if (!g_file_get_contents(path, &contents, &length, &error)) { + "Reading %s\n", path); + if (!g_file_get_contents(path, &contents, NULL, &error)) { purple_debug_error("Trillian talk.ini read", - "Error reading talk.ini\n"); + "Error reading talk.ini: %s\n", + (error && error->message) ? error->message : "Unknown error"); if (error) g_error_free(error); - g_free(path); } else { - char *line = contents; - while (*contents) { - if (*contents == '\n') { - *contents = '\0'; + char *cursor, *line; + line = cursor = contents; + while (*cursor) { + if (*cursor == '\n') { + *cursor = '\0'; /* XXX: This assumes the first Directory key is under [Logging]. */ if (purple_str_has_prefix(line, "Directory=")) { @@ -2288,25 +2292,29 @@ found = TRUE; } - contents++; - line = contents; + cursor++; + line = cursor; } else - contents++; + cursor++; } - g_free(path); g_free(contents); } + g_free(path); #endif /* !GTK_CHECK_VERSION(2,6,0) */ } /* path */ if (!found) { + path = NULL; folder = wpurple_get_special_folder(CSIDL_PROGRAM_FILES); if (folder) { path = g_build_filename(folder, "Trillian", "users", "default", "logs", NULL); g_free(folder); - } else - path = g_strdup(""); + } + + purple_prefs_add_string( + "/plugins/core/log_reader/trillian/log_directory", path ? path : ""); + g_free(path); } #else /* !defined(_WIN32) */ /* TODO: At some point, this could attempt to parse talk.ini @@ -2317,28 +2325,27 @@ path = g_build_filename(PURPLE_LOG_READER_WINDOWS_MOUNT_POINT, "Program Files", "Trillian", "users", "default", "logs", NULL); + purple_prefs_add_string( + "/plugins/core/log_reader/trillian/log_directory", path); + g_free(path); #endif - /*XXX: Why do we even bother allocating it ? */ - g_free(path); - - /* Add QIP log directory preference. */ purple_prefs_add_none("/plugins/core/log_reader/qip"); /* Calculate default QIP log directory. */ #ifdef _WIN32 + path = NULL; folder = wpurple_get_special_folder(CSIDL_PROGRAM_FILES); if (folder) { path = g_build_filename(folder, "QIP", "Users", NULL); g_free(folder); - } else - path = g_strdup(""); + } #else path = g_build_filename(PURPLE_LOG_READER_WINDOWS_MOUNT_POINT, "Program Files", "QIP", "Users", NULL); #endif - purple_prefs_add_string("/plugins/core/log_reader/qip/log_directory", path); + purple_prefs_add_string("/plugins/core/log_reader/qip/log_directory", path ? path : ""); g_free(path); } diff -r e96daf6bc511 -r de042c768169 libpurple/protocols/irc/irc.h --- a/libpurple/protocols/irc/irc.h Sun Oct 07 19:07:06 2007 +0000 +++ b/libpurple/protocols/irc/irc.h Sun Oct 07 19:07:59 2007 +0000 @@ -99,6 +99,8 @@ int irc_send(struct irc_conn *irc, const char *buf); gboolean irc_blist_timeout(struct irc_conn *irc); +char *irc_escape_privmsg(const char *text, gssize length); + char *irc_mirc2html(const char *string); char *irc_mirc2txt(const char *string); diff -r e96daf6bc511 -r de042c768169 libpurple/protocols/irc/msgs.c --- a/libpurple/protocols/irc/msgs.c Sun Oct 07 19:07:06 2007 +0000 +++ b/libpurple/protocols/irc/msgs.c Sun Oct 07 19:07:59 2007 +0000 @@ -1066,7 +1066,7 @@ return; } - msg = g_markup_escape_text(tmp, -1); + msg = irc_escape_privmsg(tmp, -1); g_free(tmp); tmp = irc_mirc2html(msg); diff -r e96daf6bc511 -r de042c768169 libpurple/protocols/irc/parse.c --- a/libpurple/protocols/irc/parse.c Sun Oct 07 19:07:06 2007 +0000 +++ b/libpurple/protocols/irc/parse.c Sun Oct 07 19:07:59 2007 +0000 @@ -281,6 +281,61 @@ return purple_utf8_salvage(string); } +/* This function is shamelessly stolen from glib--it is an old version of the + * private function append_escaped_text, used by g_markup_escape_text, whose + * behavior changed in glib 2.12. */ +static void irc_append_escaped_text(GString *str, const char *text, gssize length) +{ + const char *p = text; + const char *end = text + length; + const char *next = NULL; + + while(p != end) { + next = g_utf8_next_char(p); + + switch(*p) { + case '&': + g_string_append(str, "&"); + break; + case '<': + g_string_append(str, "<"); + break; + case '>': + g_string_append(str, ">"); + break; + case '\'': + g_string_append(str, "'"); + break; + case '"': + g_string_append(str, """); + break; + default: + g_string_append_len(str, p, next - p); + break; + } + + p = next; + } +} + +/* This function is shamelessly stolen from glib--it is an old version of the + * function g_markup_escape_text, whose behavior changed in glib 2.12. */ +char *irc_escape_privmsg(const char *text, gssize length) +{ + GString *str; + + g_return_val_if_fail(text != NULL, NULL); + + if(length < 0) + length = strlen(text); + + str = g_string_sized_new(length); + + irc_append_escaped_text(str, text, length); + + return g_string_free(str, FALSE); +} + /* XXX tag closings are not necessarily correctly nested here! If we * get a ^O or reach the end of the string and there are open * tags, they are closed in a fixed order ... this means, for diff -r e96daf6bc511 -r de042c768169 pidgin/gtkblist.c --- a/pidgin/gtkblist.c Sun Oct 07 19:07:06 2007 +0000 +++ b/pidgin/gtkblist.c Sun Oct 07 19:07:59 2007 +0000 @@ -3070,7 +3070,7 @@ { N_("/Buddies/Get User _Info..."), "I", pidgin_dialogs_info, 0, "", PIDGIN_STOCK_TOOLBAR_USER_INFO }, { N_("/Buddies/View User _Log..."), "L", pidgin_dialogs_log, 0, "", NULL }, { "/Buddies/sep1", NULL, NULL, 0, "", NULL }, - { N_("/Buddies/Show"), NULL, NULL, 0, "", NULL}, + { N_("/Buddies/Sh_ow"), NULL, NULL, 0, "", NULL}, { N_("/Buddies/Show/_Offline Buddies"), NULL, pidgin_blist_edit_mode_cb, 1, "", NULL }, { N_("/Buddies/Show/_Empty Groups"), NULL, pidgin_blist_show_empty_groups_cb, 1, "", NULL }, { N_("/Buddies/Show/Buddy _Details"), NULL, pidgin_blist_buddy_details_cb, 1, "", NULL }, diff -r e96daf6bc511 -r de042c768169 pidgin/gtkconv.c --- a/pidgin/gtkconv.c Sun Oct 07 19:07:06 2007 +0000 +++ b/pidgin/gtkconv.c Sun Oct 07 19:07:59 2007 +0000 @@ -5128,6 +5128,9 @@ pidgin_conv_new(PurpleConversation *conv) { private_gtkconv_new(conv, FALSE); + if (PIDGIN_IS_PIDGIN_CONVERSATION(conv)) + purple_signal_emit(pidgin_conversations_get_handle(), + "conversation-displayed", PIDGIN_CONVERSATION(conv)); } static void