diff options
author | Nathan Walp <nwalp@pidgin.im> | 2007-05-09 01:50:06 +0000 |
---|---|---|
committer | Nathan Walp <nwalp@pidgin.im> | 2007-05-09 01:50:06 +0000 |
commit | 075debdceeeabe2a92c80bb8e602f4dd73a9d07e (patch) | |
tree | e339c8209e39ae404f0792e5cf5673fa19fd41fa /libpurple/status.c | |
parent | 9a31f64e71783f4477069aa2e3cc8e99d59939bf (diff) | |
download | pidgin-075debdceeeabe2a92c80bb8e602f4dd73a9d07e.tar.gz |
this should fix 647, and a few others
Diffstat (limited to 'libpurple/status.c')
-rw-r--r-- | libpurple/status.c | 77 |
1 files changed, 4 insertions, 73 deletions
diff --git a/libpurple/status.c b/libpurple/status.c index 99e1aa0977..f0783a6ace 100644 --- a/libpurple/status.c +++ b/libpurple/status.c @@ -134,8 +134,6 @@ static int primitive_scores[] = 10 /* Offline messageable */ }; -static GHashTable *buddy_presences = NULL; - #define SCORE_IDLE 8 #define SCORE_IDLE_TIME 9 #define SCORE_OFFLINE_MESSAGE 10 @@ -1118,32 +1116,17 @@ PurplePresence * purple_presence_new_for_buddy(PurpleBuddy *buddy) { PurplePresence *presence; - PurpleStatusBuddyKey *key; PurpleAccount *account; g_return_val_if_fail(buddy != NULL, NULL); account = buddy->account; - key = g_new0(PurpleStatusBuddyKey, 1); - key->account = buddy->account; - key->name = g_strdup(buddy->name); - - presence = g_hash_table_lookup(buddy_presences, key); - if (presence == NULL) - { - presence = purple_presence_new(PURPLE_PRESENCE_CONTEXT_BUDDY); + presence = purple_presence_new(PURPLE_PRESENCE_CONTEXT_BUDDY); - presence->u.buddy.name = g_strdup(buddy->name); - presence->u.buddy.account = buddy->account; - presence->statuses = purple_prpl_get_statuses(buddy->account, presence); + presence->u.buddy.name = g_strdup(buddy->name); + presence->u.buddy.account = buddy->account; + presence->statuses = purple_prpl_get_statuses(buddy->account, presence); - g_hash_table_insert(buddy_presences, key, presence); - } - else - { - g_free(key->name); - g_free(key); - } presence->u.buddy.buddy = buddy; return presence; @@ -1156,13 +1139,6 @@ purple_presence_destroy(PurplePresence *presence) if (purple_presence_get_context(presence) == PURPLE_PRESENCE_CONTEXT_BUDDY) { - PurpleStatusBuddyKey key; - - key.account = presence->u.buddy.account; - key.name = presence->u.buddy.name; - - g_hash_table_remove(buddy_presences, &key); - g_free(presence->u.buddy.name); } else if (purple_presence_get_context(presence) == PURPLE_PRESENCE_CONTEXT_CONV) @@ -1639,41 +1615,6 @@ score_pref_changed_cb(const char *name, PurplePrefType type, primitive_scores[index] = GPOINTER_TO_INT(value); } -static guint -purple_buddy_presences_hash(gconstpointer key) -{ - const PurpleStatusBuddyKey *me = key; - guint ret; - char *str; - - str = g_strdup_printf("%p%s", me->account, me->name); - ret = g_str_hash(str); - g_free(str); - - return ret; -} - -static gboolean -purple_buddy_presences_equal(gconstpointer a, gconstpointer b) -{ - PurpleStatusBuddyKey *key_a = (PurpleStatusBuddyKey *)a; - PurpleStatusBuddyKey *key_b = (PurpleStatusBuddyKey *)b; - - if(key_a->account == key_b->account && - !strcmp(key_a->name, key_b->name)) - return TRUE; - else - return FALSE; -} - -static void -purple_buddy_presences_key_free(gpointer a) -{ - PurpleStatusBuddyKey *key = (PurpleStatusBuddyKey *)a; - g_free(key->name); - g_free(key); -} - void * purple_status_get_handle(void) { static int handle; @@ -1725,19 +1666,9 @@ purple_status_init(void) purple_prefs_connect_callback(handle, "/purple/status/scores/offline_msg", score_pref_changed_cb, GINT_TO_POINTER(SCORE_OFFLINE_MESSAGE)); - - buddy_presences = g_hash_table_new_full(purple_buddy_presences_hash, - purple_buddy_presences_equal, - purple_buddy_presences_key_free, NULL); } void purple_status_uninit(void) { - if (buddy_presences != NULL) - { - g_hash_table_destroy(buddy_presences); - - buddy_presences = NULL; - } } |