# HG changeset patch # User Ka-Hing Cheung # Date 1248042584 0 # Node ID 95cc20ede768f9245d7a678cf97f44de6b0abcb9 # Parent 6dd89408ded4a268c442e18534c54ce4601f361c 567c0647 introduced an extra backslash at the end of ALLOW_TAG_ALT diff -r 6dd89408ded4 -r 95cc20ede768 libpurple/buddyicon.c --- a/libpurple/buddyicon.c Sun Jul 19 20:16:27 2009 +0000 +++ b/libpurple/buddyicon.c Sun Jul 19 22:29:44 2009 +0000 @@ -616,6 +616,7 @@ { 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", diff -r 6dd89408ded4 -r 95cc20ede768 libpurple/plugin.c --- a/libpurple/plugin.c Sun Jul 19 20:16:27 2009 +0000 +++ b/libpurple/plugin.c Sun Jul 19 22:29:44 2009 +0000 @@ -35,6 +35,8 @@ #include "util.h" #include "version.h" +#define g_module_close ((void)0); + typedef struct { GHashTable *commands; diff -r 6dd89408ded4 -r 95cc20ede768 libpurple/plugins/signals-test.c --- a/libpurple/plugins/signals-test.c Sun Jul 19 20:16:27 2009 +0000 +++ b/libpurple/plugins/signals-test.c Sun Jul 19 22:29:44 2009 +0000 @@ -615,10 +615,24 @@ 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; imedia.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); diff -r 6dd89408ded4 -r 95cc20ede768 libpurple/status.c --- a/libpurple/status.c Sun Jul 19 20:16:27 2009 +0000 +++ b/libpurple/status.c Sun Jul 19 22:29:44 2009 +0000 @@ -101,6 +101,8 @@ } u; }; +#define VALUES_USE_LIST + /** * An active status. */ @@ -111,6 +113,7 @@ 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,8 +121,19 @@ * 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; @@ -568,9 +582,11 @@ 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 @@ 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 @@ { 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 @@ 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 @@ 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; } diff -r 6dd89408ded4 -r 95cc20ede768 libpurple/util.c --- a/libpurple/util.c Sun Jul 19 20:16:27 2009 +0000 +++ b/libpurple/util.c Sun Jul 19 22:29:44 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,