pidgin: 2737ff46: 567c0647 introduced an extra backslash a...

khc at pidgin.im khc at pidgin.im
Sun Jul 19 18:35:40 EDT 2009


-----------------------------------------------------------------
Revision: 2737ff4628bd5f26d780a2ccee47e88fe3765947
Ancestor: 0851f650180caf151401907e04844ba47b5c663e
Author: khc at pidgin.im
Date: 2009-07-19T22:29:44
Branch: im.pidgin.pidgin
URL: http://d.pidgin.im/viewmtn/revision/info/2737ff4628bd5f26d780a2ccee47e88fe3765947

Modified files:
        libpurple/buddyicon.c libpurple/plugin.c
        libpurple/plugins/signals-test.c
        libpurple/protocols/msn/user.c libpurple/status.c
        libpurple/util.c

ChangeLog: 

567c0647 introduced an extra backslash at the end of ALLOW_TAG_ALT


-------------- next part --------------
============================================================
--- libpurple/buddyicon.c	39aeb0d2aa3c945dcc003e043ff7eb4fe77173d4
+++ libpurple/buddyicon.c	1048fe30727e122d346428e6c719b3f0f8014c03
@@ -616,6 +616,7 @@ read_icon_file(const char *path, guchar 
 {
 	GError *err = NULL;
 
+	/* maybe mmap the file instead? On my blist, it's about 150K total */
 	if (!g_file_get_contents(path, (gchar **)data, len, &err))
 	{
 		purple_debug_error("buddyicon", "Error reading %s: %s\n",
============================================================
--- libpurple/plugin.c	fd2ebc352a77045321cda5bb1cdcce1f914becd0
+++ libpurple/plugin.c	9dcbb0754c25c679b5b2c720299d2c4cd25b3445
@@ -35,6 +35,8 @@
 #include "util.h"
 #include "version.h"
 
+#define g_module_close ((void)0);
+
 typedef struct
 {
 	GHashTable *commands;
============================================================
--- libpurple/plugins/signals-test.c	b4552e807a6d52ec1ce60da52f61c7db673ee66e
+++ libpurple/plugins/signals-test.c	37c064d46d70b4e4d55075cd92465d7a3766a556
@@ -615,10 +615,24 @@ notify_emails_cb(char **subjects, char *
 static void
 notify_emails_cb(char **subjects, char **froms, char **tos, char **urls, guint count) {
 	int i;
+	int subjects_len = 0, froms_len = 0, tos_len = 0, urls_len = 0;
 	purple_debug_misc("signals test", "notify emails: count=%d\n", count);
-	for(i=0; i<count && i<5; i++) {
+
+	if (!(subjects && froms && tos && urls)) return;
+
+	subjects_len = g_strv_length(subjects);
+	froms_len = g_strv_length(froms);
+	tos_len = g_strv_length(tos);
+	urls_len = g_strv_length(urls);
+
+	/* make sure all the arrays' lengths are equal, and that if they are
+	   the same as count, probably should move this check to the core */
+	g_return_if_fail((subjects_len & froms_len & tos_len & urls_len) != count);
+
+	for(i = 0; i < count; i++) {
 		if(subjects[i]==NULL || froms[i]==NULL || tos[i]==NULL || urls[i]==NULL) continue;
-		purple_debug_misc("signals test", "notify emails[%d]: subject=%s, from=%s, to=%s, url=%s\n",
+		purple_debug_misc("signals test",
+			"notify emails[%d]: subject=%s, from=%s, to=%s, url=%s\n",
 			i, subjects[i], froms[i], tos[i], urls[i]);
 	}
 }
============================================================
--- libpurple/protocols/msn/user.c	53a3cb07cd6b852d9ffe81f8c46202d94e289c33
+++ libpurple/protocols/msn/user.c	d0d0577b3ecf43331d8d4180055d0fc45c9757fb
@@ -114,11 +114,13 @@ msn_user_update(MsnUser *user)
 			                            PURPLE_TUNE_ALBUM, user->media.album,
 			                            PURPLE_TUNE_TITLE, user->media.title,
 			                            NULL);
-		} else if (user->media.type == CURRENT_MEDIA_GAMES) {
+		} else if (user->media.type == CURRENT_MEDIA_GAMES &&
+			user->media.title && *user->media.title) {
 			purple_prpl_got_user_status(account, user->passport, "tune",
 			                            "game", user->media.title,
 			                            NULL);
-		} else if (user->media.type == CURRENT_MEDIA_OFFICE) {
+		} else if (user->media.type == CURRENT_MEDIA_OFFICE &&
+			user->media.title && *user->media.title) {
 			purple_prpl_got_user_status(account, user->passport, "tune",
 			                            "office", user->media.title,
 			                            NULL);
============================================================
--- libpurple/status.c	8ae07f349706744761f523ed621c0dd0f893b861
+++ libpurple/status.c	0f93cf562ae5f1dc8242c2d28624214cdd98182f
@@ -101,6 +101,8 @@ struct _PurplePresence
 	} u;
 };
 
+#define VALUES_USE_LIST
+
 /**
  * An active status.
  */
@@ -111,6 +113,7 @@ struct _PurpleStatus
 
 	gboolean active;
 
+#ifndef VALUES_USE_LIST
 	/*
 	 * The current values of the attributes for this status.  The
 	 * key is a string containing the name of the attribute.  It is
@@ -118,10 +121,21 @@ struct _PurpleStatus
 	 * PurpleStatusType.  The value is a PurpleValue.
 	 */
 	GHashTable *attr_values;
+#else
+	GSList *attr_values;
+#endif
 };
 
+#ifdef VALUES_USE_LIST
 typedef struct
 {
+	GQuark id;
+	PurpleValue *value;
+} PurpleStatusAttrValue;
+#endif
+
+typedef struct
+{
 	PurpleAccount *account;
 	char *name;
 } PurpleStatusBuddyKey;
@@ -568,9 +582,11 @@ purple_status_new(PurpleStatusType *stat
 	status->type     = status_type;
 	status->presence = presence;
 
+#ifndef VALUES_USE_LIST
 	status->attr_values =
 		g_hash_table_new_full(g_str_hash, g_str_equal, NULL,
 		(GDestroyNotify)purple_value_destroy);
+#endif
 
 	for (l = purple_status_type_get_attrs(status_type); l != NULL; l = l->next)
 	{
@@ -578,14 +594,30 @@ purple_status_new(PurpleStatusType *stat
 		PurpleValue *value = purple_status_attr_get_value(attr);
 		PurpleValue *new_value = purple_value_dup(value);
 
+#ifndef VALUES_USE_LIST
 		g_hash_table_insert(status->attr_values,
 							(char *)purple_status_attr_get_id(attr),
 							new_value);
+#else
+		PurpleStatusAttrValue *val = g_new0(PurpleStatusAttrValue, 1);
+
+		val->id = g_quark_from_string(purple_status_attr_get_id(attr));
+		val->value = new_value;
+
+		status->attr_values = g_slist_prepend(status->attr_values, val);
+#endif
 	}
 
 	return status;
 }
 
+static void
+purple_status_attr_value_free(PurpleStatusAttrValue *value)
+{
+	purple_value_destroy(value->value);
+	g_free(value);
+}
+
 /*
  * TODO: If the PurpleStatus is in a PurplePresence, then
  *       remove it from the PurplePresence?
@@ -595,7 +627,12 @@ purple_status_destroy(PurpleStatus *stat
 {
 	g_return_if_fail(status != NULL);
 
+#ifndef VALUES_USE_LIST
 	g_hash_table_destroy(status->attr_values);
+#else
+	g_slist_foreach(status->attr_values, (GFunc)purple_status_attr_value_free, NULL);
+	g_slist_free(status->attr_values);
+#endif
 
 	PURPLE_DBUS_UNREGISTER_POINTER(status);
 	g_free(status);
@@ -1000,13 +1037,35 @@ purple_status_is_online(const PurpleStat
 			primitive != PURPLE_STATUS_OFFLINE);
 }
 
+static gint
+purple_status_attr_value_compare(const PurpleStatusAttrValue *v,
+	GQuark id)
+{
+	return v->id - id;
+}
+
 PurpleValue *
 purple_status_get_attr_value(const PurpleStatus *status, const char *id)
 {
+#ifdef VALUES_USE_LIST
+	GSList *tmp;
+#endif
+
 	g_return_val_if_fail(status != NULL, NULL);
 	g_return_val_if_fail(id     != NULL, NULL);
 
+#ifndef VALUES_USE_LIST
 	return (PurpleValue *)g_hash_table_lookup(status->attr_values, id);
+#else
+
+	if ((tmp = g_slist_find_custom(status->attr_values,
+				GSIZE_TO_POINTER(g_quark_from_string(id)),
+				(GCompareFunc)purple_status_attr_value_compare))) {
+		PurpleStatusAttrValue *v = tmp->data;
+		return v->value;
+	}
+	return NULL;
+#endif
 }
 
 gboolean
@@ -1538,9 +1597,10 @@ purple_presence_is_status_primitive_acti
 		PurpleStatus *temp_status = l->data;
 		PurpleStatusType *type = purple_status_get_type(temp_status);
 
-		if (purple_status_type_get_primitive(type) == primitive &&
-		    purple_status_is_active(temp_status))
-			return TRUE;
+		if (purple_status_type_get_primitive(type) == primitive) {
+		    if (purple_status_is_active(temp_status)) return TRUE;
+			break;
+		}
 	}
 	return FALSE;
 }
============================================================
--- libpurple/util.c	6be57b7a1d754e29220193f907ba6449100ed933
+++ libpurple/util.c	0cb8e5131b13bdc5144212f69bf12d12d527db47
@@ -1479,7 +1479,7 @@ struct purple_parse_tag {
 						} \
 						c = strchr(c, '>') + 1; \
 						continue; \
-					} \
+					}
 #define ALLOW_TAG(x) ALLOW_TAG_ALT(x, x)
 void
 purple_markup_html_to_xhtml(const char *html, char **xhtml_out,


More information about the Commits mailing list