50 |
50 |
51 |
51 |
52 /* ### Roster functions ### */ |
52 /* ### Roster functions ### */ |
53 |
53 |
54 // Comparison function used to search in the roster (compares jids and types) |
54 // Comparison function used to search in the roster (compares jids and types) |
55 gint roster_compare_jid_type(roster *a, roster *b) { |
55 static gint roster_compare_jid_type(roster *a, roster *b) { |
56 if (! (a->type & b->type)) |
56 if (! (a->type & b->type)) |
57 return -1; // arbitrary (but should be != , of course) |
57 return -1; // arbitrary (but should be != , of course) |
58 return strcasecmp(a->jid, b->jid); |
58 return strcasecmp(a->jid, b->jid); |
59 } |
59 } |
60 |
60 |
61 // Comparison function used to sort the roster (by name) |
61 // Comparison function used to sort the roster (by name) |
62 gint roster_compare_name(roster *a, roster *b) { |
62 static gint roster_compare_name(roster *a, roster *b) { |
63 return strcasecmp(a->name, b->name); |
63 return strcasecmp(a->name, b->name); |
64 } |
64 } |
65 |
65 |
66 // Finds a roster element (user, group, agent...), by jid or name |
66 // Finds a roster element (user, group, agent...), by jid or name |
67 // If roster_type is 0, returns match of any type. |
67 // If roster_type is 0, returns match of any type. |