changeset 22671:d632ea5dc9e5

merge of '40b061a8675f87ba328a5a07734084fdd7f3006a' and 'd232d797aa7f444c80d47cf543f62a260c2b02b0'
author Evan Schoenberg <evan.s@dreskin.net>
date Tue, 15 Apr 2008 23:46:13 +0000
parents e062a1dfe6ad (current diff) 57f5337a9c28 (diff)
children fa7e07c74a59
files
diffstat 12 files changed, 82 insertions(+), 42 deletions(-) [+]
line wrap: on
line diff
--- a/COPYRIGHT	Tue Apr 15 23:46:03 2008 +0000
+++ b/COPYRIGHT	Tue Apr 15 23:46:13 2008 +0000
@@ -233,6 +233,7 @@
 Matthew Luckie
 Mike Lundy
 Jason Lynch
+Iain MacDonnell
 Lucio Maciel
 Brian Macke
 Paolo Maggi
--- a/finch/gntlog.c	Tue Apr 15 23:46:03 2008 +0000
+++ b/finch/gntlog.c	Tue Apr 15 23:46:13 2008 +0000
@@ -23,7 +23,7 @@
  * along with this program; if not, write to the Free Software
  * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA  02111-1301  USA
  */
-#include "internal.h"
+#include "finch.h"
 
 #include <gnt.h>
 #include <gntbox.h>
--- a/libpurple/conversation.c	Tue Apr 15 23:46:03 2008 +0000
+++ b/libpurple/conversation.c	Tue Apr 15 23:46:13 2008 +0000
@@ -862,7 +862,7 @@
 		gc = purple_account_get_connection(account);
 
 	if (purple_conversation_get_type(conv) == PURPLE_CONV_TYPE_CHAT &&
-		(gc == NULL || !g_slist_find(gc->buddy_chats, conv)))
+		(gc != NULL && !g_slist_find(gc->buddy_chats, conv)))
 		return;
 
 	if (purple_conversation_get_type(conv) == PURPLE_CONV_TYPE_IM &&
--- a/libpurple/protocols/jabber/chat.c	Tue Apr 15 23:46:03 2008 +0000
+++ b/libpurple/protocols/jabber/chat.c	Tue Apr 15 23:46:13 2008 +0000
@@ -137,9 +137,12 @@
 {
 	PurpleAccount *account = purple_conversation_get_account(conv);
 	PurpleConnection *gc = purple_account_get_connection(account);
-	JabberStream *js = gc->proto_data;
-	int id = purple_conv_chat_get_id(PURPLE_CONV_CHAT(conv));
-
+	JabberStream *js;
+	int id;
+	if (!gc)
+		return NULL;
+	js = gc->proto_data;
+	id = purple_conv_chat_get_id(PURPLE_CONV_CHAT(conv));
 	return jabber_chat_find_by_id(js, id);
 }
 
--- a/libpurple/protocols/yahoo/yahoo.c	Tue Apr 15 23:46:03 2008 +0000
+++ b/libpurple/protocols/yahoo/yahoo.c	Tue Apr 15 23:46:13 2008 +0000
@@ -346,7 +346,7 @@
 			break;
 
 		default:
-			purple_debug(PURPLE_DEBUG_ERROR, "yahoo",
+			purple_debug_warning("yahoo",
 					   "Unknown status key %d\n", pair->key);
 			break;
 		}
--- a/libpurple/win32/libc_interface.h	Tue Apr 15 23:46:03 2008 +0000
+++ b/libpurple/win32/libc_interface.h	Tue Apr 15 23:46:13 2008 +0000
@@ -44,8 +44,8 @@
 #endif
 
 /* sys/socket.h */
-#define socket( namespace, style, protocol ) \
-wpurple_socket( namespace, style, protocol )
+#define socket( domain, style, protocol ) \
+wpurple_socket( domain, style, protocol )
 
 #define connect( socket, addr, length ) \
 wpurple_connect( socket, addr, length )
--- a/libpurple/win32/libc_internal.h	Tue Apr 15 23:46:03 2008 +0000
+++ b/libpurple/win32/libc_internal.h	Tue Apr 15 23:46:13 2008 +0000
@@ -30,7 +30,7 @@
 #endif /* __cplusplus */
 
 /* sys/socket.h */
-int wpurple_socket(int namespace, int style, int protocol);
+int wpurple_socket(int domain, int style, int protocol);
 int wpurple_connect(int socket, struct sockaddr *addr, u_long length);
 int wpurple_getsockopt(int socket, int level, int optname, void *optval, socklen_t *optlenptr);
 int wpurple_setsockopt(int socket, int level, int optname, const void *optval, socklen_t optlen);
--- a/libpurple/win32/targets.mak	Tue Apr 15 23:46:03 2008 +0000
+++ b/libpurple/win32/targets.mak	Tue Apr 15 23:46:13 2008 +0000
@@ -12,11 +12,10 @@
 	sed -e 's/@PLUGINS_DEFINE@/#define PURPLE_PLUGINS 1/' $@.in > $@
 
 $(PURPLE_VERSION_H): $(PURPLE_VERSION_H).in $(PIDGIN_TREE_TOP)/configure.ac
-	cp $@.in $@
 	awk 'BEGIN {FS="[\\(\\)\\[\\]]"} \
-	  /^m4_define..purple_major_version/ {system("sed -i -e s/@PURPLE_MAJOR_VERSION@/"$$5"/ $@");} \
-	  /^m4_define..purple_minor_version/ {system("sed -i -e s/@PURPLE_MINOR_VERSION@/"$$5"/ $@");} \
-	  /^m4_define..purple_micro_version/ {system("sed -i -e s/@PURPLE_MICRO_VERSION@/"$$5"/ $@"); exit}' $(PIDGIN_TREE_TOP)/configure.ac
+	  /^m4_define..purple_major_version/ {system("sed -e s/@PURPLE_MAJOR_VERSION@/"$$5"/ $@.in > $@");} \
+	  /^m4_define..purple_minor_version/ {system("sed -e s/@PURPLE_MINOR_VERSION@/"$$5"/ $@ > $@.tmp & mv $@.tmp $@");} \
+	  /^m4_define..purple_micro_version/ {system("sed -e s/@PURPLE_MICRO_VERSION@/"$$5"/ $@ > $@.tmp & mv $@.tmp $@"); exit}' $(PIDGIN_TREE_TOP)/configure.ac
 
 $(PURPLE_DLL) $(PURPLE_DLL).a: $(PURPLE_VERSION_H)
 	$(MAKE) -C $(PURPLE_TOP) -f $(MINGW_MAKEFILE) libpurple.dll
--- a/pidgin/gtkblist.c	Tue Apr 15 23:46:03 2008 +0000
+++ b/pidgin/gtkblist.c	Tue Apr 15 23:46:13 2008 +0000
@@ -1033,6 +1033,7 @@
 		g_free(title);
 
 		purple_blist_node_set_bool(node, "collapsed", FALSE);
+		pidgin_blist_tooltip_destroy();
 	}
 }
 
@@ -1070,7 +1071,7 @@
 				pidgin_blist_update_contact(NULL, cnode);
 			}
 		}
-
+		pidgin_blist_tooltip_destroy();
 	} else if(PURPLE_BLIST_NODE_IS_CONTACT(node)) {
 		pidgin_blist_collapse_contact_cb(NULL, node);
 	}
--- a/pidgin/gtkconv.c	Tue Apr 15 23:46:03 2008 +0000
+++ b/pidgin/gtkconv.c	Tue Apr 15 23:46:13 2008 +0000
@@ -5430,7 +5430,7 @@
 	account = purple_conversation_get_account(conv);
 	g_return_if_fail(account != NULL);
 	gc = purple_account_get_connection(account);
-	g_return_if_fail(gc != NULL);
+	g_return_if_fail(gc != NULL || !(flags & (PURPLE_MESSAGE_SEND | PURPLE_MESSAGE_RECV)));
 
 	/* Make sure URLs are clickable */
 	if(flags & PURPLE_MESSAGE_NO_LINKIFY)
@@ -5463,7 +5463,7 @@
 	}
 
 	win = gtkconv->win;
-	prpl_info = PURPLE_PLUGIN_PROTOCOL_INFO(gc->prpl);
+	prpl_info = gc ? PURPLE_PLUGIN_PROTOCOL_INFO(gc->prpl) : NULL;
 
 	line_count = gtk_text_buffer_get_line_count(
 			gtk_text_view_get_buffer(GTK_TEXT_VIEW(
@@ -5702,7 +5702,7 @@
 		g_free(alias_escaped);
 
 		/* Are we in a chat where we can tell which users are buddies? */
-		if  (!(prpl_info->options & OPT_PROTO_UNIQUE_CHATNAME) &&
+		if  (prpl_info && !(prpl_info->options & OPT_PROTO_UNIQUE_CHATNAME) &&
 		     purple_conversation_get_type(conv) == PURPLE_CONV_TYPE_CHAT) {
 
 			/* Bold buddies to make them stand out from non-buddies. */
--- a/pidgin/gtkimhtml.c	Tue Apr 15 23:46:03 2008 +0000
+++ b/pidgin/gtkimhtml.c	Tue Apr 15 23:46:13 2008 +0000
@@ -359,17 +359,17 @@
 	GtkTextIter iter;
 	gboolean scroll = TRUE;
 
-        gtk_text_buffer_get_end_iter(imhtml->text_buffer, &iter);
+	gtk_text_buffer_get_end_iter(imhtml->text_buffer, &iter);
 
 	gtk_text_view_get_visible_rect(GTK_TEXT_VIEW(widget), &rect);
-        gtk_text_view_get_line_yrange(GTK_TEXT_VIEW(imhtml), &iter, &y, &height);
-
-	if(((y + height) - (rect.y + rect.height)) > height
-           && gtk_text_buffer_get_char_count(imhtml->text_buffer)){
-                scroll = FALSE;
-        }
-
-	if(imhtml->old_rect.width != rect.width || imhtml->old_rect.height != rect.height){
+	gtk_text_view_get_line_yrange(GTK_TEXT_VIEW(imhtml), &iter, &y, &height);
+
+	if (((y + height) - (rect.y + rect.height)) > height &&
+			gtk_text_buffer_get_char_count(imhtml->text_buffer)) {
+		scroll = FALSE;
+	}
+
+	if(imhtml->old_rect.width != rect.width || imhtml->old_rect.height != rect.height) {
 		GList *iter = GTK_IMHTML(widget)->scalables;
 
 		xminus = gtk_text_view_get_left_margin(GTK_TEXT_VIEW(widget)) +
@@ -386,11 +386,11 @@
 
 	imhtml->old_rect = rect;
 	parent_size_allocate(widget, alloc);
-	
+
 	/* Don't scroll here if we're in the middle of a smooth scroll */
 	if (scroll && imhtml->scroll_time == NULL &&
- 	    GTK_WIDGET_REALIZED(imhtml)) 
-		gtk_imhtml_scroll_to_end(imhtml, FALSE);	
+	    GTK_WIDGET_REALIZED(imhtml))
+		gtk_imhtml_scroll_to_end(imhtml, FALSE);
 }
 
 static gint
@@ -576,11 +576,11 @@
 	/* If we don't have a tip from a URL, let's see if we have a tip from a smiley */
 	anchor = gtk_text_iter_get_child_anchor(&iter);
 	if (anchor) {
-		tip = g_object_get_data(G_OBJECT(anchor), "gtkimhtml_plaintext");
+		tip = g_object_get_data(G_OBJECT(anchor), "gtkimhtml_tiptext");
 		hand = FALSE;
 	}
 
-	if (tip){
+	if (tip && *tip) {
 		if (!GTK_IMHTML(imhtml)->editable && hand)
 			gdk_window_set_cursor(win, GTK_IMHTML(imhtml)->hand_cursor);
 		GTK_IMHTML(imhtml)->tip_timer = g_timeout_add (TOOLTIP_TIMEOUT,
@@ -2268,8 +2268,7 @@
 					 GSList *unused)
 {
 	GtkTextIter iter, ins, sel;
-	GdkRectangle rect;
-	int y, height, ins_offset = 0, sel_offset = 0;
+	int ins_offset = 0, sel_offset = 0;
 	gboolean fixins = FALSE, fixsel = FALSE;
 
 	g_return_if_fail (imhtml != NULL);
@@ -2290,13 +2289,17 @@
 		sel_offset = gtk_text_iter_get_offset(&sel);
 	}
 
-	gtk_text_view_get_visible_rect(GTK_TEXT_VIEW(imhtml), &rect);
-	gtk_text_view_get_line_yrange(GTK_TEXT_VIEW(imhtml), &iter, &y, &height);
-
-
-	if(((y + height) - (rect.y + rect.height)) > height
-	   && gtk_text_buffer_get_char_count(imhtml->text_buffer)){
-		options |= GTK_IMHTML_NO_SCROLL;
+	if (!(options & GTK_IMHTML_NO_SCROLL)) {
+		GdkRectangle rect;
+		int y, height;
+
+		gtk_text_view_get_visible_rect(GTK_TEXT_VIEW(imhtml), &rect);
+		gtk_text_view_get_line_yrange(GTK_TEXT_VIEW(imhtml), &iter, &y, &height);
+
+		if (((y + height) - (rect.y + rect.height)) > height &&
+				gtk_text_buffer_get_char_count(imhtml->text_buffer)) {
+			options |= GTK_IMHTML_NO_SCROLL;
+		}
 	}
 
 	gtk_imhtml_insert_html_at_iter(imhtml, text, options, &iter);
@@ -4713,8 +4716,11 @@
 	}
 
 	if (icon) {
+		char *text = g_strdup(unescaped); /* Do not g_free 'text'.
+		                                     It will be destroyed when 'anchor' is destroyed. */
 		anchor = gtk_text_buffer_create_child_anchor(imhtml->text_buffer, iter);
-		g_object_set_data_full(G_OBJECT(anchor), "gtkimhtml_plaintext", g_strdup(unescaped), g_free);
+		g_object_set_data_full(G_OBJECT(anchor), "gtkimhtml_plaintext", text, g_free);
+		g_object_set_data(G_OBJECT(anchor), "gtkimhtml_tiptext", text);
 		g_object_set_data_full(G_OBJECT(anchor), "gtkimhtml_htmltext", g_strdup(smiley), g_free);
 
 		/* This catches the expose events generated by animated
@@ -4732,9 +4738,11 @@
 		imhtml_smiley->anchors = g_slist_append(imhtml_smiley->anchors, anchor);
 		if (ebox) {
 			GtkWidget *img = gtk_image_new_from_stock(GTK_STOCK_MISSING_IMAGE, GTK_ICON_SIZE_MENU);
+			char *text = g_strdup(unescaped);
 			gtk_container_add(GTK_CONTAINER(ebox), img);
 			gtk_widget_show(img);
-			g_object_set_data_full(G_OBJECT(anchor), "gtkimhtml_plaintext", g_strdup(unescaped), g_free);
+			g_object_set_data_full(G_OBJECT(anchor), "gtkimhtml_plaintext", text, g_free);
+			g_object_set_data(G_OBJECT(anchor), "gtkimhtml_tiptext", text);
 			gtk_text_view_add_child_at_anchor(GTK_TEXT_VIEW(imhtml), ebox, anchor);
 		}
 	} else {
--- a/pidgin/plugins/markerline.c	Tue Apr 15 23:46:03 2008 +0000
+++ b/pidgin/plugins/markerline.c	Tue Apr 15 23:46:13 2008 +0000
@@ -216,6 +216,32 @@
 	attach_to_pidgin_window(win, NULL);
 }
 
+static void
+jump_to_markerline(PurpleConversation *conv, gpointer null)
+{
+	PidginConversation *gtkconv = PIDGIN_CONVERSATION(conv);
+	int offset;
+	GtkTextIter iter;
+
+	if (!gtkconv)
+		return;
+
+	offset = GPOINTER_TO_INT(g_object_get_data(G_OBJECT(gtkconv->imhtml), "markerline"));
+	gtk_text_buffer_get_iter_at_offset(GTK_IMHTML(gtkconv->imhtml)->text_buffer, &iter, offset);
+	gtk_text_view_scroll_to_iter(GTK_TEXT_VIEW(gtkconv->imhtml), &iter, 0, TRUE, 0, 0);
+}
+
+static void
+conv_menu_cb(PurpleConversation *conv, GList **list)
+{
+	PurpleConversationType type = purple_conversation_get_type(conv);
+	gboolean enabled = ((type == PURPLE_CONV_TYPE_IM && purple_prefs_get_bool(PREF_IMS)) ||
+		(type == PURPLE_CONV_TYPE_CHAT && purple_prefs_get_bool(PREF_CHATS)));
+	PurpleMenuAction *action = purple_menu_action_new(_("Jump to markerline"),
+			enabled ? PURPLE_CALLBACK(jump_to_markerline) : NULL, NULL, NULL);
+	*list = g_list_append(*list, action);
+}
+
 static gboolean
 plugin_load(PurplePlugin *plugin)
 {
@@ -224,6 +250,8 @@
 	purple_signal_connect(purple_conversations_get_handle(), "conversation-created",
 						plugin, PURPLE_CALLBACK(conv_created), NULL);
 
+	purple_signal_connect(purple_conversations_get_handle(), "conversation-extended-menu",
+						plugin, PURPLE_CALLBACK(conv_menu_cb), NULL);
 	return TRUE;
 }