From 71feefea6f354637e633e0136aff15b688c6e305 Mon Sep 17 00:00:00 2001 From: Marius Halden Date: Mon, 1 Aug 2016 18:28:59 +0200 Subject: Turn some lists into hashtables --- protocols/twitter/twitter.c | 16 ++++++++-------- 1 file changed, 8 insertions(+), 8 deletions(-) (limited to 'protocols/twitter/twitter.c') diff --git a/protocols/twitter/twitter.c b/protocols/twitter/twitter.c index c1f54681..468f9eaa 100644 --- a/protocols/twitter/twitter.c +++ b/protocols/twitter/twitter.c @@ -350,6 +350,7 @@ void twitter_login_finish(struct im_connection *ic) } else if (!(td->flags & TWITTER_MODE_ONE) && !(td->flags & TWITTER_HAVE_FRIENDS)) { imcb_log(ic, "Getting contact list"); + twitter_get_friends_ids(ic, -1); twitter_get_mutes_ids(ic, -1); twitter_get_blocks_ids(ic, -1); @@ -711,6 +712,10 @@ static void twitter_login(account_t * acc) td->flags |= TWITTER_MODE_CHAT; } + td->mutes_ids = g_hash_table_new_full(g_str_hash, (GEqualFunc)strcmp, (GDestroyNotify)g_free, NULL); + td->blocks_ids = g_hash_table_new_full(g_str_hash, (GEqualFunc)strcmp, (GDestroyNotify)g_free, NULL); + td->noretweets_ids = g_hash_table_new_full(g_str_hash, (GEqualFunc)strcmp, (GDestroyNotify)g_free, NULL); + twitter_login_finish(ic); } @@ -736,14 +741,9 @@ static void twitter_logout(struct im_connection *ic) b_event_remove(td->filter_update_id); } - g_slist_foreach(td->mutes_ids, (GFunc) g_free, NULL); - g_slist_free(td->mutes_ids); - - g_slist_foreach(td->blocks_ids, (GFunc) g_free, NULL); - g_slist_free(td->blocks_ids); - - g_slist_foreach(td->noretweets_ids, (GFunc) g_free, NULL); - g_slist_free(td->noretweets_ids); + g_hash_table_unref(td->mutes_ids); + g_hash_table_unref(td->blocks_ids); + g_hash_table_unref(td->noretweets_ids); http_close(td->stream); twitter_filter_remove_all(ic); -- cgit v1.2.3