changeset 21076:b84655373d7b

propagate from branch 'im.pidgin.pidgin' (head 017296ee954fb91349806c809983c916842603da) to branch 'org.maemo.garage.pidgin.pidgin.dialog-transience' (head ce668a77429a79bf1404086e8f5e7faf7df25856)
author Gabriel Schulhof <nix@go-nix.ca>
date Mon, 08 Oct 2007 16:06:39 +0000
parents 368d79355aba (diff) c14002f7f5ef (current diff)
children 488796f5ba33
files pidgin/gtkblist.c pidgin/gtkconv.c pidgin/gtklog.h
diffstat 17 files changed, 131 insertions(+), 40 deletions(-) [+]
line wrap: on
line diff
--- a/.mtn-ignore	Mon Oct 08 15:36:31 2007 +0000
+++ b/.mtn-ignore	Mon Oct 08 16:06:39 2007 +0000
@@ -21,7 +21,7 @@
 config.status
 config.sub
 configure$
-finch/finch
+finch/finch$
 finch/libgnt/gntmarshal.c
 finch/libgnt/gntmarshal.h
 depcomp
--- a/configure.ac	Mon Oct 08 15:36:31 2007 +0000
+++ b/configure.ac	Mon Oct 08 16:06:39 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
--- a/doc/gtkconv-signals.dox	Mon Oct 08 15:36:31 2007 +0000
+++ b/doc/gtkconv-signals.dox	Mon Oct 08 16:06:39 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
 
--- a/finch/Makefile.am	Mon Oct 08 15:36:31 2007 +0000
+++ b/finch/Makefile.am	Mon Oct 08 16:06:39 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
 
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/finch/finch.pc.in	Mon Oct 08 16:06:39 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
+
--- a/libpurple/certificate.h	Mon Oct 08 15:36:31 2007 +0000
+++ b/libpurple/certificate.h	Mon Oct 08 16:06:39 2007 +0000
@@ -1,6 +1,7 @@
 /**
  * @file certificate.h Public-Key Certificate API
  * @ingroup core
+ * @see @ref certificate-signals
  */
 
 /*
--- a/libpurple/plugins/log_reader.c	Mon Oct 08 15:36:31 2007 +0000
+++ b/libpurple/plugins/log_reader.c	Mon Oct 08 16:06:39 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);
 }
 
--- a/libpurple/protocols/irc/irc.h	Mon Oct 08 15:36:31 2007 +0000
+++ b/libpurple/protocols/irc/irc.h	Mon Oct 08 16:06:39 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);
 
--- a/libpurple/protocols/irc/msgs.c	Mon Oct 08 15:36:31 2007 +0000
+++ b/libpurple/protocols/irc/msgs.c	Mon Oct 08 16:06:39 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);
--- a/libpurple/protocols/irc/parse.c	Mon Oct 08 15:36:31 2007 +0000
+++ b/libpurple/protocols/irc/parse.c	Mon Oct 08 16:06:39 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, "&amp;");
+				break;
+			case '<':
+				g_string_append(str, "&lt;");
+				break;
+			case '>':
+				g_string_append(str, "&gt;");
+				break;
+			case '\'':
+				g_string_append(str, "&apos;");
+				break;
+			case '"':
+				g_string_append(str, "&quot;");
+				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
--- a/pidgin/gtkaccount.h	Mon Oct 08 15:36:31 2007 +0000
+++ b/pidgin/gtkaccount.h	Mon Oct 08 16:06:39 2007 +0000
@@ -1,6 +1,7 @@
 /**
  * @file gtkaccount.h GTK+ Account Editor UI
  * @ingroup pidgin
+ * @see @ref gtkaccount-signals
  */
 
 /* pidgin
--- a/pidgin/gtkblist.c	Mon Oct 08 15:36:31 2007 +0000
+++ b/pidgin/gtkblist.c	Mon Oct 08 16:06:39 2007 +0000
@@ -3070,7 +3070,7 @@
 	{ N_("/Buddies/Get User _Info..."), "<CTL>I", pidgin_dialogs_info, 0, "<StockItem>", PIDGIN_STOCK_TOOLBAR_USER_INFO },
 	{ N_("/Buddies/View User _Log..."), "<CTL>L", pidgin_dialogs_log, 0, "<Item>", NULL },
 	{ "/Buddies/sep1", NULL, NULL, 0, "<Separator>", NULL },
-	{ N_("/Buddies/Show"), NULL, NULL, 0, "<Branch>", NULL},
+	{ N_("/Buddies/Sh_ow"), NULL, NULL, 0, "<Branch>", NULL},
 	{ N_("/Buddies/Show/_Offline Buddies"), NULL, pidgin_blist_edit_mode_cb, 1, "<CheckItem>", NULL },
 	{ N_("/Buddies/Show/_Empty Groups"), NULL, pidgin_blist_show_empty_groups_cb, 1, "<CheckItem>", NULL },
 	{ N_("/Buddies/Show/Buddy _Details"), NULL, pidgin_blist_buddy_details_cb, 1, "<CheckItem>", NULL },
--- a/pidgin/gtkblist.h	Mon Oct 08 15:36:31 2007 +0000
+++ b/pidgin/gtkblist.h	Mon Oct 08 16:06:39 2007 +0000
@@ -1,6 +1,7 @@
 /**
  * @file gtkblist.h GTK+ Buddy List API
  * @ingroup pidgin
+ * @see @ref gtkblist-signals
  */
 
 /* pidgin
--- a/pidgin/gtkconv.c	Mon Oct 08 15:36:31 2007 +0000
+++ b/pidgin/gtkconv.c	Mon Oct 08 16:06:39 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
--- a/pidgin/gtkconv.h	Mon Oct 08 15:36:31 2007 +0000
+++ b/pidgin/gtkconv.h	Mon Oct 08 16:06:39 2007 +0000
@@ -1,6 +1,7 @@
 /**
  * @file gtkconv.h GTK+ Conversation API
  * @ingroup pidgin
+ * @see @ref gtkconv-signals
  */
 
 /* pidgin
--- a/pidgin/gtkimhtml.h	Mon Oct 08 15:36:31 2007 +0000
+++ b/pidgin/gtkimhtml.h	Mon Oct 08 16:06:39 2007 +0000
@@ -1,6 +1,7 @@
 /**
  * @file gtkimhtml.h GTK+ IM/HTML rendering component
  * @ingroup pidgin
+ * @see @ref gtkimhtml-signals
  */
 
 /* Pidgin is the legal property of its developers, whose names are too numerous
--- a/pidgin/gtklog.h	Mon Oct 08 15:36:31 2007 +0000
+++ b/pidgin/gtklog.h	Mon Oct 08 16:06:39 2007 +0000
@@ -1,6 +1,7 @@
 /**
  * @file gtklog.h GTK+ Log viewer
  * @ingroup pidgin
+ * @see @ref gtklog-signals
  */
 
 /* pidgin