Mercurial > ~mikael > mcabber > hg
comparison mcabber/src/roster.c @ 1092:1ef7572c3096
Sort the resources again when a priority changes
author | Mikael Berthe <mikael@lilotux.net> |
---|---|
date | Fri, 08 Dec 2006 22:32:26 +0100 |
parents | c55b24818546 |
children | 2de8f8ba1f34 |
comparison
equal
deleted
inserted
replaced
1091:10f9d6fcfeab | 1092:1ef7572c3096 |
---|---|
186 | 186 |
187 if (!resname) return NULL; | 187 if (!resname) return NULL; |
188 | 188 |
189 for (p = rost->resource; p; p = g_slist_next(p)) { | 189 for (p = rost->resource; p; p = g_slist_next(p)) { |
190 res *r = p->data; | 190 res *r = p->data; |
191 if (!strcmp(r->name, resname)) | 191 if (!strcmp(r->name, resname)) { |
192 if (prio != r->prio) { | |
193 r->prio = prio; | |
194 rost->resource = g_slist_sort(rost->resource, | |
195 (GCompareFunc)&resource_compare_prio); | |
196 } | |
192 return r; | 197 return r; |
198 } | |
193 } | 199 } |
194 | 200 |
195 // Resource not found | 201 // Resource not found |
196 nres = g_new0(res, 1); | 202 nres = g_new0(res, 1); |
197 nres->name = g_strdup(resname); | 203 nres->name = g_strdup(resname); |
494 | 500 |
495 roster_usr = (roster*)sl_user->data; | 501 roster_usr = (roster*)sl_user->data; |
496 | 502 |
497 // New or updated resource | 503 // New or updated resource |
498 p_res = get_or_add_resource(roster_usr, resname, prio); | 504 p_res = get_or_add_resource(roster_usr, resname, prio); |
499 p_res->prio = prio; | |
500 p_res->status = bstat; | 505 p_res->status = bstat; |
501 if (p_res->status_msg) { | 506 if (p_res->status_msg) { |
502 g_free((gchar*)p_res->status_msg); | 507 g_free((gchar*)p_res->status_msg); |
503 p_res->status_msg = NULL; | 508 p_res->status_msg = NULL; |
504 } | 509 } |