Mercurial > hg
comparison mcabber/src/roster.c @ 209:353a4f8a3f61
[/trunk] Changeset 221 by mikael
* Sort the buddy's group list after rename.
author | mikael |
---|---|
date | Sat, 07 May 2005 21:21:57 +0000 |
parents | 41fafa0ecfd8 |
children | f64818ba3503 |
comparison
equal
deleted
inserted
replaced
208:8b08f34922c5 | 209:353a4f8a3f61 |
---|---|
476 } | 476 } |
477 | 477 |
478 void buddy_setname(gpointer rosterdata, char *newname) | 478 void buddy_setname(gpointer rosterdata, char *newname) |
479 { | 479 { |
480 roster *roster_usr = rosterdata; | 480 roster *roster_usr = rosterdata; |
481 GSList **sl_group; | |
481 | 482 |
482 // TODO For groups, we need to check for unicity | 483 // TODO For groups, we need to check for unicity |
483 // However, renaming a group boils down to moving all its buddies to | 484 // However, renaming a group boils down to moving all its buddies to |
484 // another group, so calling this function is not really necessary... | 485 // another group, so calling this function is not really necessary... |
485 if (roster_usr->type & ROSTER_TYPE_GROUP) return; | 486 if (roster_usr->type & ROSTER_TYPE_GROUP) return; |
488 g_free((gchar*)roster_usr->name); | 489 g_free((gchar*)roster_usr->name); |
489 roster_usr->name = NULL; | 490 roster_usr->name = NULL; |
490 } | 491 } |
491 if (newname) | 492 if (newname) |
492 roster_usr->name = g_strdup(newname); | 493 roster_usr->name = g_strdup(newname); |
494 | |
495 // We need to resort the group list | |
496 sl_group = &((roster*)((GSList*)roster_usr->list)->data)->list; | |
497 *sl_group = g_slist_sort(*sl_group, (GCompareFunc)&roster_compare_name); | |
498 | |
499 buddylist_build(); | |
493 } | 500 } |
494 | 501 |
495 const char *buddy_getname(gpointer rosterdata) | 502 const char *buddy_getname(gpointer rosterdata) |
496 { | 503 { |
497 roster *roster_usr = rosterdata; | 504 roster *roster_usr = rosterdata; |