changeset 16851:e17e82f49afb

merge of 'b43df8fea8317fa8538ab5f3ef70d19b207e2046' and 'd83774ccf5f88eb0d21551b71ef56364ee041952'
author Luke Schierer <lschiere@pidgin.im>
date Fri, 04 May 2007 01:56:42 +0000
parents 504613f178a0 (current diff) d61d93f478cc (diff)
children 340fbf90d7ee
files
diffstat 14 files changed, 92 insertions(+), 48 deletions(-) [+]
line wrap: on
line diff
--- a/AUTHORS	Fri May 04 01:46:42 2007 +0000
+++ b/AUTHORS	Fri May 04 01:56:42 2007 +0000
@@ -17,14 +17,15 @@
 	Jabber:  seanegn@jabber.org
 	Gadu-Gadu:  1511497
 
-Daniel 'datallah' Atallah
+Daniel 'datallah' Atallah - Developer
 Ethan 'Paco-Paco' Blanton - Developer
 Thomas Butter - Developer
 Sadrul Habib Chowdhury - Developer
 Mark 'KingAnt' Doliner - Developer
 Christian 'ChipX86' Hammond - Developer & Webmaster
 Gary 'grim' Kramlich - Developer
-Richard 'rlaager' Laager
+Richard 'rlaager' Laager - Developer
+Richard 'wabz' Nelson - Developer
 Christopher 'siege' O'Brien - Developer
 Bartosz Oler - Developer
 Etan 'deryni' Reisner - Developer
@@ -37,9 +38,11 @@
 
 Crazy Patch Writers:
 -------------------
+John 'rekkanoryo' Bailey
 Ka-Hing 'javabsp' Cheung
 Felipe 'shx' Contreras
 Decklin Foster
+Casey Harkins
 Peter 'Bleeter' Lawler
 Robert 'Robot101' McQueen
 Benjamin Miller
--- a/doc/pidgin.1.in	Fri May 04 01:46:42 2007 +0000
+++ b/doc/pidgin.1.in	Fri May 04 01:56:42 2007 +0000
@@ -548,6 +548,8 @@
 .br
  Richard 'rlaager' Laager (developer) <\fIrlaager@pidgin.im\fR>
 .br
+ Richard 'wabz' Nelson (developer)
+.br
  Christopher 'siege' O'Brien (developer)
 .br
  Bartosz Oler (developer)
@@ -574,12 +576,12 @@
 .br
 Ka-Hing 'javabsp' Cheung
 .br
-Sadrul Habib Chowdhury
-.br
 Felipe 'shx' Contreras
 .br
 Decklin Foster
 .br
+Casey Harkins
+.br
 Peter 'Bleeter' Lawler
 .br
 Robert 'Robot101' McQueen
--- a/libpurple/buddyicon.c	Fri May 04 01:46:42 2007 +0000
+++ b/libpurple/buddyicon.c	Fri May 04 01:56:42 2007 +0000
@@ -314,9 +314,6 @@
 	if (icon == NULL)
 		icon = purple_buddy_icon_create(account, username);
 
-	/* Take a reference for the caller of this function. */
-	icon->ref_count = 1;
-
 	/* purple_buddy_icon_set_data() sets img, but it
 	 * references img first, so we need to initialize it */
 	icon->img = NULL;
@@ -519,19 +516,53 @@
                                 void *icon_data, size_t icon_len,
                                 const char *checksum)
 {
-	PurpleBuddyIcon *icon;
+	GHashTable *icon_cache;
+	PurpleBuddyIcon *icon = NULL;
 
 	g_return_if_fail(account  != NULL);
 	g_return_if_fail(username != NULL);
 
-	icon = purple_buddy_icons_find(account, username);
+	icon_cache = g_hash_table_lookup(account_cache, account);
+
+	if (icon_cache != NULL)
+		icon = g_hash_table_lookup(icon_cache, username);
 
 	if (icon != NULL)
 		purple_buddy_icon_set_data(icon, icon_data, icon_len, checksum);
 	else if (icon_data && icon_len > 0)
 	{
-		PurpleBuddyIcon *icon = purple_buddy_icon_new(account, username, icon_data, icon_len, checksum);
-		purple_buddy_icon_unref(icon);
+		if (icon_data != NULL && icon_len > 0)
+		{
+			PurpleBuddyIcon *icon = purple_buddy_icon_new(account, username, icon_data, icon_len, checksum);
+
+			/* purple_buddy_icon_new() calls
+			 * purple_buddy_icon_set_data(), which calls
+			 * purple_buddy_icon_update(), which has the buddy list
+			 * and conversations take references as appropriate.
+			 * This function doesn't return icon, so we can't
+			 * leave a reference dangling. */
+			purple_buddy_icon_unref(icon);
+		}
+		else
+		{
+			/* If the buddy list or a conversation was holding a
+			 * reference, we'd have found the icon in the cache.
+			 * Since we know we're deleting the icon, we only
+			 * need a subset of purple_buddy_icon_update(). */
+
+			GSList *buddies = purple_find_buddies(account, username);
+			while (buddies != NULL)
+			{
+				PurpleBuddy *buddy = (PurpleBuddy *)buddies->data;
+
+				unref_filename(purple_blist_node_get_string((PurpleBlistNode *)buddy, "buddy_icon"));
+				purple_blist_node_remove_setting((PurpleBlistNode *)buddy, "buddy_icon");
+				purple_blist_node_remove_setting((PurpleBlistNode *)buddy, "icon_checksum");
+
+				buddies = g_slist_delete_link(buddies, buddies);
+			}
+
+		}
 	}
 }
 
@@ -633,7 +664,7 @@
 		purple_buddy_icons_set_caching(caching);
 	}
 
-	return icon;
+	return purple_buddy_icon_ref(icon);
 }
 
 gboolean
--- a/libpurple/buddyicon.h	Fri May 04 01:46:42 2007 +0000
+++ b/libpurple/buddyicon.h	Fri May 04 01:56:42 2007 +0000
@@ -54,7 +54,7 @@
  * @param icon_len  The buddy icon length.
  * @param checksum  A protocol checksum from the prpl or @c NULL.
  *
- * @return The buddy icon structure.
+ * @return The buddy icon structure, with a reference for the caller.
  */
 PurpleBuddyIcon *purple_buddy_icon_new(PurpleAccount *account, const char *username,
                                        void *icon_data, size_t icon_len,
@@ -209,7 +209,8 @@
  * @param account  The account the user is on.
  * @param username The username of the user.
  *
- * @return The icon data if found, or @c NULL if not found.
+ * @return The icon (with a reference for the caller) if found, or @c NULL if
+ *         not found.
  */
 PurpleBuddyIcon *
 purple_buddy_icons_find(PurpleAccount *account, const char *username);
--- a/libpurple/conversation.c	Fri May 04 01:46:42 2007 +0000
+++ b/libpurple/conversation.c	Fri May 04 01:56:42 2007 +0000
@@ -279,7 +279,11 @@
 
 		ims = g_list_append(ims, conv);
 		if ((icon = purple_buddy_icons_find(account, name)))
+		{
 			purple_conv_im_set_icon(conv->u.im, icon);
+			/* purple_conv_im_set_icon refs the icon. */
+			purple_buddy_icon_unref(icon);
+		}
 
 		if (purple_prefs_get_bool("/purple/logging/log_ims"))
 		{
--- a/libpurple/gaim-compat.h	Fri May 04 01:46:42 2007 +0000
+++ b/libpurple/gaim-compat.h	Fri May 04 01:56:42 2007 +0000
@@ -354,7 +354,6 @@
 
 #define gaim_buddy_icons_set_for_user(icon, data, len) \
         purple_buddy_icons_set_for_user(icon, g_memdup(data, len), len, NULL)
-#define gaim_buddy_icons_find           purple_buddy_icons_find
 #define gaim_buddy_icons_set_caching    purple_buddy_icons_set_caching
 #define gaim_buddy_icons_is_caching     purple_buddy_icons_is_caching
 #define gaim_buddy_icons_set_cache_dir  purple_buddy_icons_set_cache_dir
--- a/libpurple/plugins/Makefile.am	Fri May 04 01:46:42 2007 +0000
+++ b/libpurple/plugins/Makefile.am	Fri May 04 01:56:42 2007 +0000
@@ -128,7 +128,6 @@
 AM_CPPFLAGS = \
 	-DDATADIR=\"$(datadir)\" \
 	-DVERSION=\"$(VERSION)\" \
-	-I$(top_builddir)/libpurple \
 	-I$(top_srcdir)/libpurple \
 	-I$(top_builddir)/libpurple \
 	$(DEBUG_CFLAGS) \
--- a/libpurple/protocols/irc/msgs.c	Fri May 04 01:46:42 2007 +0000
+++ b/libpurple/protocols/irc/msgs.c	Fri May 04 01:56:42 2007 +0000
@@ -109,7 +109,9 @@
 	if (!strcmp(name, "251")) {
 		/* 251 is required, so we pluck our nick from here */
 		purple_connection_set_display_name(gc, args[0]);
-	} else if (!strcmp(name, "255")) {
+		/* 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 */
--- a/libpurple/protocols/msn/notification.c	Fri May 04 01:46:42 2007 +0000
+++ b/libpurple/protocols/msn/notification.c	Fri May 04 01:56:42 2007 +0000
@@ -947,7 +947,7 @@
 	url = cmd->params[2];
 
 	buf = g_strdup_printf("%s%lu%s",
-			   session->passport_info.mspauth,
+			   session->passport_info.mspauth ? session->passport_info.mspauth : "BOGUS",
 			   time(NULL) - session->passport_info.sl,
 			   purple_connection_get_password(account->gc));
 
@@ -1142,33 +1142,25 @@
 
 	if ((value = msn_message_get_attr(msg, "kv")) != NULL)
 	{
-		if (session->passport_info.kv != NULL)
-			g_free(session->passport_info.kv);
-
+		g_free(session->passport_info.kv);
 		session->passport_info.kv = g_strdup(value);
 	}
 
 	if ((value = msn_message_get_attr(msg, "sid")) != NULL)
 	{
-		if (session->passport_info.sid != NULL)
-			g_free(session->passport_info.sid);
-
+		g_free(session->passport_info.sid);
 		session->passport_info.sid = g_strdup(value);
 	}
 
 	if ((value = msn_message_get_attr(msg, "MSPAuth")) != NULL)
 	{
-		if (session->passport_info.mspauth != NULL)
-			g_free(session->passport_info.mspauth);
-
+		g_free(session->passport_info.mspauth);
 		session->passport_info.mspauth = g_strdup(value);
 	}
 
 	if ((value = msn_message_get_attr(msg, "ClientIP")) != NULL)
 	{
-		if (session->passport_info.client_ip != NULL)
-			g_free(session->passport_info.client_ip);
-
+		g_free(session->passport_info.client_ip);
 		session->passport_info.client_ip = g_strdup(value);
 	}
 
@@ -1279,11 +1271,8 @@
 					  msn_user_get_passport(session->user),
 					  session->passport_info.file, NULL, NULL);
 
-	if (from != NULL)
-		g_free(from);
-
-	if (subject != NULL)
-		g_free(subject);
+	g_free(from);
+	g_free(subject);
 
 	g_hash_table_destroy(table);
 }
--- a/libpurple/protocols/msn/slp.c	Fri May 04 01:46:42 2007 +0000
+++ b/libpurple/protocols/msn/slp.c	Fri May 04 01:56:42 2007 +0000
@@ -955,7 +955,7 @@
 
 	if (obj == NULL)
 	{
-		/* TODO purple_buddy_icons_set_for_user(account, user->passport, NULL, 0, NULL); */
+		purple_buddy_icons_set_for_user(account, user->passport, NULL, 0, NULL);
 		return;
 	}
 
--- a/libpurple/protocols/msn/user.c	Fri May 04 01:46:42 2007 +0000
+++ b/libpurple/protocols/msn/user.c	Fri May 04 01:56:42 2007 +0000
@@ -207,7 +207,7 @@
 		memset(digest, 0, sizeof(digest));
 
 		purple_cipher_context_reset(ctx, NULL);
-		purple_cipher_context_append(ctx, data, strlen((char *)data));
+		purple_cipher_context_append(ctx, (const guchar *)buf, strlen(buf));
 		purple_cipher_context_digest(ctx, sizeof(digest), digest, NULL);
 		purple_cipher_context_destroy(ctx);
 		g_free(buf);
--- a/libpurple/protocols/qq/buddy_info.c	Fri May 04 01:46:42 2007 +0000
+++ b/libpurple/protocols/qq/buddy_info.c	Fri May 04 01:56:42 2007 +0000
@@ -601,11 +601,14 @@
 
 static void _qq_update_buddy_icon(PurpleAccount *account, const gchar *name, gint face)
 {
-	PurpleBuddyIcon *icon = purple_buddy_icons_find(account, name);
+	PurpleBuddy *buddy;
 	gchar *icon_num_str = face_to_icon_str(face);
-	const gchar *old_icon_num = purple_buddy_icon_get_checksum(icon);
+	const gchar *old_icon_num = NULL;
 
-	if (icon == NULL || old_icon_num == NULL ||
+	if ((buddy = purple_find_buddy(account, name)))
+		old_icon_num = purple_buddy_icons_get_checksum_for_user(buddy);
+
+	if (old_icon_num == NULL ||
 	    strcmp(icon_num_str, old_icon_num))
 	{
 		gchar *icon_path;
--- a/pidgin.spec.in	Fri May 04 01:46:42 2007 +0000
+++ b/pidgin.spec.in	Fri May 04 01:56:42 2007 +0000
@@ -6,7 +6,7 @@
 # When not doing betas comment this out
 # NOTE: %defines in spec files are evaluated in comments so the correct
 #       way to comment it out is to replace the % with #
-%define beta 7
+#define beta 7
 
 %if 0%{?beta}
 %define pidginver %(echo "@VERSION@"|sed -e 's/dev.*//; s/beta.*//')
@@ -26,6 +26,10 @@
 
 # Generic build requirements
 BuildRequires: libtool, pkgconfig, intltool, gettext, libxml2-devel
+BuildRequires: gtk2-devel
+
+%{!?_without_startupnotification:BuildRequires: startup-notification-devel}
+%{!?_without_modularx:BuildRequires: libSM-devel, libXScrnSaver-devel}
 %{?_with_avahi:BuildRequires: avahi-compat-howl-devel}
 %{!?_without_gtkspell:BuildRequires: gtkspell-devel}
 %{?_with_howl:BuildRequires: howl-devel}
@@ -49,11 +53,10 @@
 # Mandrake 10.1 and lower || Mandrake 10.2 (and higher?)
 %if "%{_vendor}" == "MandrakeSoft" || "%{_vendor}" == "Mandrakesoft" || "%{_vendor}" == "Mandriva"
 # For Mandrake/Mandriva:
-BuildRequires: libgtk+2.0_0-devel, libnss3-devel, perl-devel
+BuildRequires: libnss3-devel, perl-devel
 Obsoletes:  libgaim-remote0
 %else
 # For SuSE, Red Hat, Fedora and others:
-BuildRequires: gtk2-devel
 %if "%{_vendor}" != "suse"
 # For Red Hat, Fedora and others:
 # let's assume RH & FC1 are the only brain-dead distros missing the
@@ -440,7 +443,14 @@
 %endif
 
 %changelog
-* Tue May  1 2007 Stu Tomlinson <stu@nosnilmot.com>
+* Thu May 3 2007 Stu Tomlinson <stu@nosnilmot.com>
+- Add missing BuildRequires: startup-notification-devel, if you really
+  need to build on a distro without it use --without startupnotification
+- Add BuildRequires: libSM-devel, libXScrnSaver-devel for distros with
+  modular X. For those without, build with --without modularx
+- Change Mandriva BuildRequires to gkt2-devel (reported by Götz Waschk)
+
+* Tue May 1 2007 Stu Tomlinson <stu@nosnilmot.com>
 - Run gtk-update-icon-cache on installation/uninstallation
 - Guard against errors when upgrading from Gaim/Pidgin 1.5.x which had
   no schemas file
--- a/pidgin/gtkblist.c	Fri May 04 01:46:42 2007 +0000
+++ b/pidgin/gtkblist.c	Fri May 04 01:56:42 2007 +0000
@@ -2160,7 +2160,7 @@
 {
 	GdkPixbuf *buf, *ret = NULL;
 	GdkPixbufLoader *loader;
-	PurpleBuddyIcon *icon;
+	PurpleBuddyIcon *icon = NULL;
 	const guchar *data = NULL;
 	gsize len;
 	PurpleBuddy *buddy = NULL;
@@ -2197,9 +2197,9 @@
 	}
 
 	if (data == NULL) {
-		if (!(icon = purple_buddy_get_icon(buddy)))
-			if (!(icon = purple_buddy_icons_find(buddy->account, buddy->name))) /* Not sure I like this...*/
-				return NULL;
+		/* Not sure I like this...*/
+		if (!(icon = purple_buddy_icons_find(buddy->account, buddy->name)))
+			return NULL;
 		data = purple_buddy_icon_get_data(icon, &len);
 
 		if(data == NULL)
@@ -2211,6 +2211,7 @@
 	gdk_pixbuf_loader_close(loader, NULL);
 
 	purple_imgstore_unref(custom_img);
+	purple_buddy_icon_unref(icon);
 
 	buf = gdk_pixbuf_loader_get_pixbuf(loader);
 	if (buf)