Mercurial > ~mikael > mcabber > hg
diff mcabber/src/roster.c @ 468:644b8bf9ca4d
Improve MUC presence messages handling
- Display messages when someone joins, leaves, or changes his nickname
- Update occupants roles and real jid (if available)
- Fix some memory leaks
author | Mikael Berthe <mikael@lilotux.net> |
---|---|
date | Sat, 01 Oct 2005 18:53:14 +0200 |
parents | 03bb57383cea |
children | a926523d2392 |
line wrap: on
line diff
--- a/mcabber/src/roster.c Sat Oct 01 16:00:17 2005 +0200 +++ b/mcabber/src/roster.c Sat Oct 01 18:53:14 2005 +0200 @@ -370,8 +370,11 @@ } } +// roster_setstatus() +// Note: resname, role and realjid are for room members only void roster_setstatus(const char *jid, const char *resname, gchar prio, - enum imstatus bstat, const char *status_msg) + enum imstatus bstat, const char *status_msg, + enum imrole role, const char *realjid) { GSList *sl_user; roster *roster_usr; @@ -403,6 +406,15 @@ } if (status_msg) p_res->status_msg = g_strdup(status_msg); + + p_res->role = role; + + if (p_res->realjid) { + g_free((gchar*)p_res->realjid); + p_res->realjid = NULL; + } + if (realjid) + p_res->realjid = g_strdup(realjid); } // roster_setflags() @@ -835,6 +847,23 @@ return reslist; } +// buddy_resource_setname(roster_data, oldname, newname) +// Useful for nickname change in a MUC room +void buddy_resource_setname(gpointer rosterdata, const char *resname, + const char *newname) +{ + roster *roster_usr = rosterdata; + res *p_res = get_resource(roster_usr, resname); + if (p_res) { + if (p_res->name) { + g_free((gchar*)p_res->name); + p_res->name = NULL; + } + if (newname) + p_res->name = g_strdup(newname); + } +} + // buddy_del_all_resources() // Remove all resources from the specified buddy void buddy_del_all_resources(gpointer rosterdata)