Mercurial > pidgin.yaz
changeset 27708:95cc20ede768
567c0647 introduced an extra backslash at the end of ALLOW_TAG_ALT
author | Ka-Hing Cheung <khc@hxbc.us> |
---|---|
date | Sun, 19 Jul 2009 22:29:44 +0000 |
parents | 6dd89408ded4 |
children | f42fb3f1e5ae |
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, 87 insertions(+), 8 deletions(-) [+] |
line wrap: on
line diff
--- 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",
--- 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;
--- 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; 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]); } }
--- a/libpurple/protocols/msn/user.c Sun Jul 19 20:16:27 2009 +0000 +++ b/libpurple/protocols/msn/user.c Sun Jul 19 22:29:44 2009 +0000 @@ -114,11 +114,13 @@ 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);
--- 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; }