void qq_info_free(QQInfo *info) { if(info == NULL){ return; } qq_buddy_free(info -> me); #define FREE_STR(x) if(info -> x != NULL){g_string_free(info -> x, TRUE);} FREE_STR(vc_type); FREE_STR(vc_image_data); FREE_STR(vc_image_type); FREE_STR(verify_code); FREE_STR(ptvfsession); FREE_STR(version); FREE_STR(ptuserinfo); FREE_STR(ptwebqq); FREE_STR(ptcz); FREE_STR(skey); FREE_STR(cookie); FREE_STR(clientid); FREE_STR(seskey); FREE_STR(cip); FREE_STR(index); FREE_STR(port); FREE_STR(psessionid); FREE_STR(vfwebqq); #undef FREE_STR gint i; for(i = 0; i < info -> buddies -> len; ++i){ qq_buddy_free(info -> buddies -> pdata[i]); } g_ptr_array_free(info -> buddies, TRUE); for(i = 0; i < info -> groups -> len; ++i){ qq_group_free(info -> groups -> pdata[i]); } g_ptr_array_free(info -> groups, TRUE); for(i = 0; i < info -> recentcons -> len; ++i){ qq_recentcon_free(info -> recentcons -> pdata[i]); } g_ptr_array_free(info -> recentcons, TRUE); for(i = 0; i < info -> categories -> len; ++i){ qq_category_free(info -> categories -> pdata[i]); } g_ptr_array_free(info -> categories, TRUE); g_hash_table_unref(info -> buddies_ht); g_hash_table_unref(info -> groups_ht); g_hash_table_unref(info -> buddies_number_ht); g_hash_table_unref(info -> groups_number_ht); g_mutex_free(info -> lock); g_slice_free(QQInfo, info); }
void qq_group_free_all(qq_data *qd) { qq_group *group; gint i; g_return_if_fail(qd != NULL); i = 0; while (qd->groups != NULL) { i++; group = (qq_group *) qd->groups->data; qd->groups = g_list_remove(qd->groups, group); qq_group_free(group); } purple_debug(PURPLE_DEBUG_INFO, "QQ", "%d groups are freed\n", i); }
void qq_group_delete_internal_record(qq_data *qd, guint32 internal_group_id) { qq_group *group; GList *list; list = qd->groups; while (list != NULL) { group = (qq_group *) qd->groups->data; if (internal_group_id == group->internal_group_id) { qd->groups = g_list_remove(qd->groups, group); qq_group_free(group); break; } else { list = list->next; } } }