changeset 18629:7dafe1fafe36

merge of '3b69fa32b6a696df64942119de06c9896ea686fd' and '5c3a62771d95514499159e4aad89386e497bb568'
author Richard Laager <rlaager@wiktel.com>
date Tue, 24 Jul 2007 17:46:48 +0000
parents 1b032e320dbf (diff) 439f35ee87b2 (current diff)
children ffec8cb71858
files
diffstat 5 files changed, 63 insertions(+), 13 deletions(-) [+]
line wrap: on
line diff
--- a/finch/gntblist.c	Mon Jul 23 20:49:01 2007 +0000
+++ b/finch/gntblist.c	Tue Jul 24 17:46:48 2007 +0000
@@ -354,11 +354,13 @@
 	PurpleGroup *grp;
 	GHashTable *hash = NULL;
 	PurpleConnection *gc;
+	gboolean autojoin;
 
 	account = purple_request_fields_get_account(allfields, "account");
 	name = purple_request_fields_get_string(allfields, "name");
 	alias = purple_request_fields_get_string(allfields, "alias");
 	group = purple_request_fields_get_string(allfields, "group");
+	autojoin = purple_request_fields_get_bool(allfields, "autojoin");
 
 	if (!purple_account_is_connected(account) || !name || !*name)
 		return;
@@ -380,6 +382,9 @@
 		}
 		purple_blist_add_chat(chat, grp, NULL);
 		purple_blist_alias_chat(chat, alias);
+		purple_blist_node_set_bool((PurpleBlistNode*)chat, "gnt-autojoin", autojoin);
+		if (autojoin)
+			serv_join_chat(chat->account->gc, chat->components);
 	}
 }
 
@@ -407,6 +412,9 @@
 	field = purple_request_field_string_new("group", _("Group"), grp ? grp->name : NULL, FALSE);
 	purple_request_field_group_add_field(group, field);
 
+	field = purple_request_field_bool_new("autojoin", _("Auto-join"), FALSE);
+	purple_request_field_group_add_field(group, field);
+
 	purple_request_fields(NULL, _("Add Chat"), NULL,
 			_("You can edit more information from the context menu later."),
 			fields, _("Add"), G_CALLBACK(add_chat_cb), _("Cancel"), NULL,
--- a/libpurple/plugin.c	Mon Jul 23 20:49:01 2007 +0000
+++ b/libpurple/plugin.c	Tue Jul 24 17:46:48 2007 +0000
@@ -692,7 +692,10 @@
 
 		dependency = purple_plugins_find_with_id(dep_name);
 
-		dependency->dependent_plugins = g_list_remove(dependency->dependent_plugins, plugin->info->id);
+		if (dependency != NULL)
+			dependency->dependent_plugins = g_list_remove(dependency->dependent_plugins, plugin->info->id);
+		else
+			purple_debug_error("plugins", "Unable to remove from dependency list for %s\n", dep_name);
 	}
 
 	if (plugin->native_plugin) {
--- a/libpurple/protocols/oscar/family_locate.c	Mon Jul 23 20:49:01 2007 +0000
+++ b/libpurple/protocols/oscar/family_locate.c	Tue Jul 24 17:46:48 2007 +0000
@@ -814,13 +814,21 @@
 			 * contain information about the buddy icon the user
 			 * has stored on the server.
 			 */
-			int type2, number, length2;
+			guint16 type2;
+			guint8 number, length2;
+			int endpos2;
 
-			while (byte_stream_curpos(bs) < endpos) {
+			/*
+			 * Continue looping as long as we're able to read type2,
+			 * number, and length2.
+			 */
+			while (byte_stream_curpos(bs) + 4 <= endpos) {
 				type2 = byte_stream_get16(bs);
 				number = byte_stream_get8(bs);
 				length2 = byte_stream_get8(bs);
 
+				endpos2 = byte_stream_curpos(bs) + length2;
+
 				switch (type2) {
 					case 0x0000: { /* This is an official buddy icon? */
 						/* This is always 5 bytes of "0x02 01 d2 04 72"? */
@@ -879,11 +887,10 @@
 							outinfo->itmsurl_encoding = NULL;
 						}
 					} break;
+				}
 
-					default: {
-						byte_stream_advance(bs, length2);
-					} break;
-				}
+				/* Save ourselves. */
+				byte_stream_setpos(bs, endpos2);
 			}
 
 		} else if (type == 0x001e) {
--- a/pidgin/gtkconv.c	Mon Jul 23 20:49:01 2007 +0000
+++ b/pidgin/gtkconv.c	Tue Jul 24 17:46:48 2007 +0000
@@ -8269,8 +8269,8 @@
 		return FALSE; /* carry on normally */
 
         /* store the position */
-        purple_prefs_set_int(PIDGIN_PREFS_ROOT "/conversations/x",      x);
-	purple_prefs_set_int(PIDGIN_PREFS_ROOT "/conversations/y",      y);
+        purple_prefs_set_int(PIDGIN_PREFS_ROOT "/conversations/x", x);
+	purple_prefs_set_int(PIDGIN_PREFS_ROOT "/conversations/y", y);
 	purple_prefs_set_int(PIDGIN_PREFS_ROOT "/conversations/im/width",  event->width);
 	purple_prefs_set_int(PIDGIN_PREFS_ROOT "/conversations/im/height", event->height);
 
@@ -8279,6 +8279,38 @@
 						
 }
 
+static void
+pidgin_conv_restore_position(PidginWindow *win) {
+	int conv_x, conv_y, conv_width, conv_height;
+
+	conv_width = purple_prefs_get_int(PIDGIN_PREFS_ROOT "/conversations/im/width");
+
+	 /* if the window exists, is hidden, we're saving positions, and the
+          * position is sane... */
+        if (win && win->window &&
+                !GTK_WIDGET_VISIBLE(win->window) && conv_width != 0) {
+
+                conv_x      = purple_prefs_get_int(PIDGIN_PREFS_ROOT "/conversations/x");
+                conv_y      = purple_prefs_get_int(PIDGIN_PREFS_ROOT "/conversations/y");
+                conv_height = purple_prefs_get_int(PIDGIN_PREFS_ROOT "/conversations/im/height");
+
+	       /* ...check position is on screen... */
+                if (conv_x >= gdk_screen_width())
+                        conv_x = gdk_screen_width() - 100;
+                else if (conv_x + conv_width < 0)
+                        conv_x = 100;
+
+                if (conv_y >= gdk_screen_height())
+                        conv_y = gdk_screen_height() - 100;
+                else if (conv_y + conv_height < 0)
+                        conv_y = 100;
+
+                /* ...and move it back. */
+                gtk_window_move(GTK_WINDOW(win->window), conv_x, conv_y);
+                gtk_window_resize(GTK_WINDOW(win->window), conv_width, conv_height);
+        }
+}
+
 PidginWindow *
 pidgin_conv_window_new()
 {
@@ -8293,8 +8325,7 @@
 
 	/* Create the window. */
 	win->window = pidgin_create_window(NULL, 0, "conversation", TRUE);
-	gtk_window_set_default_size(GTK_WINDOW(win->window), purple_prefs_get_int(PIDGIN_PREFS_ROOT "/conversations/im/width"),
-							     purple_prefs_get_int(PIDGIN_PREFS_ROOT "/conversations/im/height"));
+	pidgin_conv_restore_position(win);
 
 	if (available_list == NULL) {
 		create_icon_lists(win->window);
--- a/pidgin/plugins/gtkbuddynote.c	Mon Jul 23 20:49:01 2007 +0000
+++ b/pidgin/plugins/gtkbuddynote.c	Tue Jul 24 17:46:48 2007 +0000
@@ -107,8 +107,6 @@
 
 		bninfo->flags = PURPLE_PLUGIN_FLAG_INVISIBLE;
 
-		info.dependencies = g_list_append(info.dependencies,
-		                                  "core-plugin_pack-buddynote");
 
 		/* If non-gtk buddy note plugin is loaded, but we are not, then load
 		 * ourselves, otherwise people upgrading from pre-gtkbuddynote days
@@ -134,6 +132,9 @@
 	/* Use g_idle_add so that the rest of the plugins can get loaded
 	 * before we do our check. */
 	g_idle_add(check_for_buddynote, plugin);
+
+	info.dependencies = g_list_append(info.dependencies,
+	                                  "core-plugin_pack-buddynote");
 }
 
 PURPLE_INIT_PLUGIN(gtkbuddynote, init_plugin, info)