From 6e991a9464ce13fb742dcd50a37d5e00084b4233 Mon Sep 17 00:00:00 2001 From: dequis Date: Sun, 16 Oct 2016 03:50:49 -0300 Subject: Turn purple_chatlist_free() into a imcb_chat_list_free() I found myself copypasting this to jabber. Might as well make it part of the API. --- protocols/bee_chat.c | 17 +++++++++++++++++ 1 file changed, 17 insertions(+) (limited to 'protocols/bee_chat.c') diff --git a/protocols/bee_chat.c b/protocols/bee_chat.c index c5f2b262..31b37737 100644 --- a/protocols/bee_chat.c +++ b/protocols/bee_chat.c @@ -284,3 +284,20 @@ void bee_chat_list_finish(struct im_connection *ic) imcb_log(ic, "Warning: using deprecated bee_chat_list_finish. This will be removed in the stable release."); imcb_chat_list_finish(ic); } + +void imcb_chat_list_free(struct im_connection *ic) +{ + bee_chat_info_t *ci; + GSList *l = ic->chatlist; + + while (l) { + ci = l->data; + l = g_slist_delete_link(l, l); + + g_free(ci->title); + g_free(ci->topic); + g_free(ci); + } + + ic->chatlist = NULL; +} -- cgit v1.2.3