Mercurial > ~mikael > mcabber > hg
comparison mcabber/src/roster.c @ 783:25022410f80f
Use case sensitive group names
author | Mikael Berthe <mikael@lilotux.net> |
---|---|
date | Sat, 01 Apr 2006 17:33:26 +0200 |
parents | 46304b773a44 |
children | 89ad7b530b3c |
comparison
equal
deleted
inserted
replaced
782:19121d9f4aa2 | 783:25022410f80f |
---|---|
204 | 204 |
205 // Comparison function used to search in the roster (compares names and types) | 205 // Comparison function used to search in the roster (compares names and types) |
206 static gint roster_compare_name_type(roster *a, roster *b) { | 206 static gint roster_compare_name_type(roster *a, roster *b) { |
207 if (! (a->type & b->type)) | 207 if (! (a->type & b->type)) |
208 return -1; // arbitrary (but should be != 0, of course) | 208 return -1; // arbitrary (but should be != 0, of course) |
209 return strcasecmp(a->name, b->name); | 209 return strcmp(a->name, b->name); |
210 } | 210 } |
211 | 211 |
212 // Comparison function used to sort the roster (by name) | 212 // Comparison function used to sort the roster (by name) |
213 static gint roster_compare_name(roster *a, roster *b) { | 213 static gint roster_compare_name(roster *a, roster *b) { |
214 return strcasecmp(a->name, b->name); | 214 return strcmp(a->name, b->name); |
215 } | 215 } |
216 | 216 |
217 // Finds a roster element (user, group, agent...), by jid or name | 217 // Finds a roster element (user, group, agent...), by jid or name |
218 // If roster_type is 0, returns match of any type. | 218 // If roster_type is 0, returns match of any type. |
219 // Returns the roster GSList element, or NULL if jid/name not found | 219 // Returns the roster GSList element, or NULL if jid/name not found |
241 return NULL; // should not happen | 241 return NULL; // should not happen |
242 | 242 |
243 while (sl_roster_elt) { | 243 while (sl_roster_elt) { |
244 roster *roster_elt = (roster*)sl_roster_elt->data; | 244 roster *roster_elt = (roster*)sl_roster_elt->data; |
245 if (roster_type & ROSTER_TYPE_GROUP) { | 245 if (roster_type & ROSTER_TYPE_GROUP) { |
246 if ((type == namesearch) && !strcasecmp(jidname, roster_elt->name)) | 246 if ((type == namesearch) && !strcmp(jidname, roster_elt->name)) |
247 return sl_roster_elt; | 247 return sl_roster_elt; |
248 } | 248 } |
249 res = g_slist_find_custom(roster_elt->list, &sample, comp); | 249 res = g_slist_find_custom(roster_elt->list, &sample, comp); |
250 if (res) return res; | 250 if (res) return res; |
251 sl_roster_elt = g_slist_next(sl_roster_elt); | 251 sl_roster_elt = g_slist_next(sl_roster_elt); |