changeset 25282:c0255d214741

merge of '8531e88ebf19846bd138013c731b270540572751' and 'e04ac567cd98f01fdd65d9cd54a09c9c6c17908c'
author Etan Reisner <pidgin@unreliablesource.net>
date Wed, 07 Jan 2009 13:29:49 +0000
parents 674b7434788e (current diff) 45375ae20cd6 (diff)
children 06ab3599f0db
files
diffstat 8 files changed, 90 insertions(+), 54 deletions(-) [+]
line wrap: on
line diff
--- a/ChangeLog	Wed Jan 07 11:30:49 2009 +0000
+++ b/ChangeLog	Wed Jan 07 13:29:49 2009 +0000
@@ -15,6 +15,8 @@
 	XMPP:
 	* Support for XEP-0191 blocking.  (Vijay Raghunathan)
 	* Don't put SASL PLAIN or IQ Auth passwords in debug logs. (Paul Aurich)
+	* Fix removal of avatars (both PEP and vCard), we weren't removing
+	  them correctly before. (Paul Aurich)
 
 	Pidgin:
 	* Fix a crash in the Add Account dialog when changing protocols under
--- a/ChangeLog.API	Wed Jan 07 11:30:49 2009 +0000
+++ b/ChangeLog.API	Wed Jan 07 13:29:49 2009 +0000
@@ -1,5 +1,21 @@
 Pidgin and Finch: The Pimpin' Penguin IM Clients That're Good for the Soul
 
+version 2.5.4 (??/??/????):
+	perl:
+		Changed:
+		* Purple::PluginPref->get_bounds no longer takes two integer
+		  arguments it now returns two integers.
+
+		Removed:
+		* Removed a handful of string-related utility functions that
+		  can generally be better handled with perl's built-in string
+		  functions rather than using pidgin's:
+			* Purple::Util::strcasereplace
+			* Purple::Util::strcasestr
+			* Purple::Util::strreplace
+			* Purple::Util::str_strip_char
+			* Purple::Util::chrreplace
+
 version 2.5.3 (12/20/2008):
 	libpurple
 		Changed:
--- a/configure.ac	Wed Jan 07 11:30:49 2009 +0000
+++ b/configure.ac	Wed Jan 07 13:29:49 2009 +0000
@@ -2285,6 +2285,30 @@
         AC_DEFINE(HAVE_TM_GMTOFF, 1, [Define if you have a tm_gmtoff member in struct tm])
 fi
 
+AC_CACHE_CHECK([whether va_lists can be copied by value], ac_cv_va_val_copy,[
+	AC_TRY_RUN([#include <stdarg.h>
+#include <stdlib.h>
+	void f (int i, ...) {
+	va_list args1, args2;
+	va_start (args1, i);
+	args2 = args1;
+	if (va_arg (args2, int) != 42 || va_arg (args1, int) != 42)
+	  exit (1);
+	va_end (args1); va_end (args2);
+	}
+	int main() {
+	  f (0, 42);
+	  return 0;
+	}],
+	[ac_cv_va_val_copy=yes],
+	[ac_cv_va_val_copy=no],
+	[ac_cv_va_val_copy=yes])
+])
+
+if test "x$ac_cv_va_val_copy" = "xno"; then
+	AC_DEFINE(VA_COPY_AS_ARRAY, 1, ['va_lists' cannot be copied as values])
+fi
+
 dnl #######################################################################
 dnl # Check for check
 dnl #######################################################################
--- a/libpurple/plugins/perl/common/PluginPref.xs	Wed Jan 07 11:30:49 2009 +0000
+++ b/libpurple/plugins/perl/common/PluginPref.xs	Wed Jan 07 13:29:49 2009 +0000
@@ -70,10 +70,16 @@
 
 
 void
-purple_plugin_pref_get_bounds(pref, min, max)
+purple_plugin_pref_get_bounds(pref, OUTLIST int min, OUTLIST int max)
 	Purple::PluginPref pref
-	int *min
-	int *max
+	# According to the perlxs manual page we shouldn't need to specify a
+	# prototype here because "[p]arameters preceded by OUTLIST keyword do
+	# not appear in the usage signature of the generated Perl function."
+	# however that appears to only work for the usage error message and
+	# not for the call to newXSproto. Since I can't find any documentation
+	# for newXSproto at the moment I have no idea if that matters so
+	# override the prototype here.
+	PROTOTYPE: $
 
 void
 purple_plugin_pref_get_choices(pref)
--- a/libpurple/plugins/perl/common/Util.xs	Wed Jan 07 11:30:49 2009 +0000
+++ b/libpurple/plugins/perl/common/Util.xs	Wed Jan 07 13:29:49 2009 +0000
@@ -99,27 +99,10 @@
 	const char *program
 
 gchar_own *
-purple_strcasereplace(string, delimiter, replacement)
-	const char *string
-	const char *delimiter
-	const char *replacement
-
-const char *
-purple_strcasestr(haystack, needle)
-	const char *haystack
-	const char *needle
-
-gchar_own *
 purple_strdup_withhtml(src)
 	const gchar *src
 
 gchar_own *
-purple_strreplace(string, delimiter, replacement)
-	const char *string
-	const char *delimiter
-	const char *replacement
-
-gchar_own *
 purple_text_strip_mnemonic(in)
 	const char *in
 
@@ -356,10 +339,6 @@
 purple_str_size_to_units(size)
 	size_t size
 
-void
-purple_str_strip_char(IN_OUT char str, thechar)
-	char thechar
-
 time_t
 purple_str_to_time(timestamp, utc = FALSE, tm = NULL, OUTLIST long tz_off, OUTLIST const char *rest)
 	const char *timestamp
@@ -512,11 +491,6 @@
 	const char *artist
 	const char *album
 
-void
-purple_util_chrreplace(IN_OUT char string, delimiter, replacement)
-	char delimiter
-	char replacement
-
 gchar_own*
 purple_util_format_song_info(title, artist, album, unused)
 	const char* title
--- a/libpurple/plugins/perl/perl-handlers.c	Wed Jan 07 11:30:49 2009 +0000
+++ b/libpurple/plugins/perl/perl-handlers.c	Wed Jan 07 13:29:49 2009 +0000
@@ -289,14 +289,18 @@
 	PUSHMARK(sp);
 
 	purple_signal_get_values(handler->instance, handler->signal,
-	                       &ret_value, &value_count, &values);
+	                         &ret_value, &value_count, &values);
 
 	sv_args   = g_new(SV *,    value_count);
 	copy_args = g_new(void **, value_count);
 
 	for (i = 0; i < value_count; i++) {
 		sv_args[i] = purple_perl_sv_from_vargs(values[i],
+#ifdef VA_COPY_AS_ARRAY
+		                                       args,
+#else
 		                                       (va_list*)&args,
+#endif
 		                                       &copy_args[i]);
 
 		XPUSHs(sv_args[i]);
--- a/libpurple/protocols/jabber/buddy.c	Wed Jan 07 11:30:49 2009 +0000
+++ b/libpurple/protocols/jabber/buddy.c	Wed Jan 07 13:29:49 2009 +0000
@@ -459,7 +459,10 @@
 
 		avatar_data = purple_imgstore_get_data(img);
 		avatar_len = purple_imgstore_get_size(img);
-		/* have to get rid of the old PHOTO if it exists */
+		/* Get rid of an old PHOTO if one exists.
+		 * TODO: This may want to be modified to remove all old PHOTO
+		 * children, at the moment some people have managed to get
+		 * multiple PHOTO entries in their vCard. */
 		if((photo = xmlnode_get_child(vc_node, "PHOTO"))) {
 			xmlnode_free(photo);
 		}
@@ -473,6 +476,12 @@
 
 		xmlnode_insert_data(binval, enc, -1);
 		g_free(enc);
+	} else if (vc_node) {
+		xmlnode *photo;
+		/* TODO: Remove all PHOTO children? (see above note) */
+		if ((photo = xmlnode_get_child(vc_node, "PHOTO"))) {
+			xmlnode_free(photo);
+		}
 	}
 
 	if (vc_node != NULL) {
@@ -578,32 +587,30 @@
 				jabber_pep_publish((JabberStream*)gc->proto_data, publish);
 				
 				g_free(hash);
-			} else { /* if(img) */
-				/* remove the metadata */
-				xmlnode *metadata, *item;
-				xmlnode *publish = xmlnode_new("publish");
-				xmlnode_set_attrib(publish,"node",AVATARNAMESPACEMETA);
-				
-				item = xmlnode_new_child(publish, "item");
-				
-				metadata = xmlnode_new_child(item, "metadata");
-				xmlnode_set_namespace(metadata,AVATARNAMESPACEMETA);
-				
-				xmlnode_new_child(metadata, "stop");
-				
-				/* publish the metadata */
-				jabber_pep_publish((JabberStream*)gc->proto_data, publish);
+			} else {
+				purple_debug_error("jabber", "jabber_set_buddy_icon received non-png data");
 			}
 		} else {
-			purple_debug(PURPLE_DEBUG_ERROR, "jabber",
-						 "jabber_set_buddy_icon received non-png data");
+			/* remove the metadata */
+			xmlnode *metadata, *item;
+			xmlnode *publish = xmlnode_new("publish");
+			xmlnode_set_attrib(publish,"node",AVATARNAMESPACEMETA);
+
+			item = xmlnode_new_child(publish, "item");
+
+			metadata = xmlnode_new_child(item, "metadata");
+			xmlnode_set_namespace(metadata,AVATARNAMESPACEMETA);
+
+			xmlnode_new_child(metadata, "stop");
+
+			/* publish the metadata */
+			jabber_pep_publish((JabberStream*)gc->proto_data, publish);
 		}
 	}
 
-	/* even when the image is not png, we can still publish the vCard, since this
-	   one doesn't require a specific image type */
-
-	/* publish vCard for those poor older clients */
+	/* vCard avatars do not have an image type requirement so update our
+	 * vCard avatar regardless of image type for those poor older clients
+	 */
 	jabber_set_info(gc, purple_account_get_user_info(gc->account));
 
 	gpresence = purple_account_get_presence(gc->account);
--- a/pidgin/plugins/notify.c	Wed Jan 07 11:30:49 2009 +0000
+++ b/pidgin/plugins/notify.c	Wed Jan 07 13:29:49 2009 +0000
@@ -555,9 +555,12 @@
 }
 
 static void
-handle_urgent(PidginWindow *win, gboolean set)
+handle_urgent(PidginWindow *purplewin, gboolean set)
 {
-	pidgin_set_urgent(GTK_WINDOW(win->window), set);
+	g_return_if_fail(purplewin != NULL);
+	g_return_if_fail(purplewin->window != NULL);
+
+	pidgin_set_urgent(GTK_WINDOW(purplewin->window), set);
 }
 
 static void