# HG changeset patch # User Mikael Berthe # Date 1134774654 -3600 # Node ID f20c1934a8a7d5752bfc6d01438fcd64a160435d # Parent 97dd14e22b2a994e42727550a13fca018baa8261 "/move": remove old group if it is empty diff -r 97dd14e22b2a -r f20c1934a8a7 mcabber/src/roster.c --- a/mcabber/src/roster.c Fri Dec 16 23:48:42 2005 +0100 +++ b/mcabber/src/roster.c Sat Dec 17 00:10:54 2005 +0100 @@ -759,6 +759,15 @@ sl_group = &((roster*)((GSList*)roster_usr->list)->data)->list; *sl_group = g_slist_remove(*sl_group, rosterdata); + // Remove old group if it is empty + if (!*sl_group) { + roster *roster_grp = (roster*)((GSList*)roster_usr->list)->data; + if (roster_grp->jid) g_free((gchar*)roster_grp->jid); + if (roster_grp->name) g_free((gchar*)roster_grp->name); + g_free(roster_grp); + groups = g_slist_remove(groups, roster_grp); + } + // Add the buddy to its new group roster_usr->list = sl_newgroup; // (my_newgroup SList element) my_newgroup->list = g_slist_insert_sorted(my_newgroup->list, roster_usr,