Mercurial > ~mikael > mcabber > hg
comparison mcabber/src/roster.c @ 621:f20c1934a8a7
"/move": remove old group if it is empty
author | Mikael Berthe <mikael@lilotux.net> |
---|---|
date | Sat, 17 Dec 2005 00:10:54 +0100 |
parents | 97dd14e22b2a |
children | 028c01940490 |
comparison
equal
deleted
inserted
replaced
620:97dd14e22b2a | 621:f20c1934a8a7 |
---|---|
757 | 757 |
758 // Remove the buddy from current group | 758 // Remove the buddy from current group |
759 sl_group = &((roster*)((GSList*)roster_usr->list)->data)->list; | 759 sl_group = &((roster*)((GSList*)roster_usr->list)->data)->list; |
760 *sl_group = g_slist_remove(*sl_group, rosterdata); | 760 *sl_group = g_slist_remove(*sl_group, rosterdata); |
761 | 761 |
762 // Remove old group if it is empty | |
763 if (!*sl_group) { | |
764 roster *roster_grp = (roster*)((GSList*)roster_usr->list)->data; | |
765 if (roster_grp->jid) g_free((gchar*)roster_grp->jid); | |
766 if (roster_grp->name) g_free((gchar*)roster_grp->name); | |
767 g_free(roster_grp); | |
768 groups = g_slist_remove(groups, roster_grp); | |
769 } | |
770 | |
762 // Add the buddy to its new group | 771 // Add the buddy to its new group |
763 roster_usr->list = sl_newgroup; // (my_newgroup SList element) | 772 roster_usr->list = sl_newgroup; // (my_newgroup SList element) |
764 my_newgroup->list = g_slist_insert_sorted(my_newgroup->list, roster_usr, | 773 my_newgroup->list = g_slist_insert_sorted(my_newgroup->list, roster_usr, |
765 (GCompareFunc)&roster_compare_name); | 774 (GCompareFunc)&roster_compare_name); |
766 | 775 |