changeset 27633:f42fb3f1e5ae

disapproval of revision '2737ff4628bd5f26d780a2ccee47e88fe3765947'
author Ka-Hing Cheung <khc@hxbc.us>
date Sun, 19 Jul 2009 22:39:41 +0000
parents 95cc20ede768
children 91333c6c16ef
files libpurple/buddyicon.c libpurple/plugin.c libpurple/plugins/signals-test.c libpurple/protocols/msn/user.c libpurple/status.c libpurple/util.c
diffstat 6 files changed, 8 insertions(+), 87 deletions(-) [+]
line wrap: on
line diff
--- a/libpurple/buddyicon.c	Sun Jul 19 22:29:44 2009 +0000
+++ b/libpurple/buddyicon.c	Sun Jul 19 22:39:41 2009 +0000
@@ -616,7 +616,6 @@
 {
 	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",
--- a/libpurple/plugin.c	Sun Jul 19 22:29:44 2009 +0000
+++ b/libpurple/plugin.c	Sun Jul 19 22:39:41 2009 +0000
@@ -35,8 +35,6 @@
 #include "util.h"
 #include "version.h"
 
-#define g_module_close ((void)0);
-
 typedef struct
 {
 	GHashTable *commands;
--- a/libpurple/plugins/signals-test.c	Sun Jul 19 22:29:44 2009 +0000
+++ b/libpurple/plugins/signals-test.c	Sun Jul 19 22:39:41 2009 +0000
@@ -615,24 +615,10 @@
 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);
-
-	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++) {
+	for(i=0; i<count && i<5; 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]);
 	}
 }
--- a/libpurple/protocols/msn/user.c	Sun Jul 19 22:29:44 2009 +0000
+++ b/libpurple/protocols/msn/user.c	Sun Jul 19 22:39:41 2009 +0000
@@ -114,13 +114,11 @@
 			                            PURPLE_TUNE_ALBUM, user->media.album,
 			                            PURPLE_TUNE_TITLE, user->media.title,
 			                            NULL);
-		} else if (user->media.type == CURRENT_MEDIA_GAMES &&
-			user->media.title && *user->media.title) {
+		} else if (user->media.type == CURRENT_MEDIA_GAMES) {
 			purple_prpl_got_user_status(account, user->passport, "tune",
 			                            "game", user->media.title,
 			                            NULL);
-		} else if (user->media.type == CURRENT_MEDIA_OFFICE &&
-			user->media.title && *user->media.title) {
+		} else if (user->media.type == CURRENT_MEDIA_OFFICE) {
 			purple_prpl_got_user_status(account, user->passport, "tune",
 			                            "office", user->media.title,
 			                            NULL);
--- a/libpurple/status.c	Sun Jul 19 22:29:44 2009 +0000
+++ b/libpurple/status.c	Sun Jul 19 22:39:41 2009 +0000
@@ -101,8 +101,6 @@
 	} u;
 };
 
-#define VALUES_USE_LIST
-
 /**
  * An active status.
  */
@@ -113,7 +111,6 @@
 
 	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
@@ -121,19 +118,8 @@
 	 * 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;
@@ -582,11 +568,9 @@
 	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)
 	{
@@ -594,30 +578,14 @@
 		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?
@@ -627,12 +595,7 @@
 {
 	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);
@@ -1037,35 +1000,13 @@
 			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
@@ -1597,10 +1538,9 @@
 		PurpleStatus *temp_status = l->data;
 		PurpleStatusType *type = purple_status_get_type(temp_status);
 
-		if (purple_status_type_get_primitive(type) == primitive) {
-		    if (purple_status_is_active(temp_status)) return TRUE;
-			break;
-		}
+		if (purple_status_type_get_primitive(type) == primitive &&
+		    purple_status_is_active(temp_status))
+			return TRUE;
 	}
 	return FALSE;
 }
--- a/libpurple/util.c	Sun Jul 19 22:29:44 2009 +0000
+++ b/libpurple/util.c	Sun Jul 19 22:39:41 2009 +0000
@@ -1479,7 +1479,7 @@
 						} \
 						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,