changeset 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 2b7ef605ddc6
files mcabber/src/roster.c
diffstat 1 files changed, 9 insertions(+), 0 deletions(-) [+]
line wrap: on
line diff
--- 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,