Mercurial > hg
comparison mcabber/src/roster.c @ 480:882e1acae422
Add /say_to command
author | Mikael Berthe <mikael@lilotux.net> |
---|---|
date | Tue, 04 Oct 2005 19:47:50 +0200 |
parents | a926523d2392 |
children | 4a10c04ac2fb |
comparison
equal
deleted
inserted
replaced
479:b82428ac107d | 480:882e1acae422 |
---|---|
173 /* ### Roster functions ### */ | 173 /* ### Roster functions ### */ |
174 | 174 |
175 // Comparison function used to search in the roster (compares jids and types) | 175 // Comparison function used to search in the roster (compares jids and types) |
176 static gint roster_compare_jid_type(roster *a, roster *b) { | 176 static gint roster_compare_jid_type(roster *a, roster *b) { |
177 if (! (a->type & b->type)) | 177 if (! (a->type & b->type)) |
178 return -1; // arbitrary (but should be != , of course) | 178 return -1; // arbitrary (but should be != 0, of course) |
179 return strcasecmp(a->jid, b->jid); | 179 return strcasecmp(a->jid, b->jid); |
180 } | 180 } |
181 | 181 |
182 // Comparison function used to sort the roster (by name) | 182 // Comparison function used to sort the roster (by name) |
183 static gint roster_compare_name(roster *a, roster *b) { | 183 static gint roster_compare_name(roster *a, roster *b) { |
195 GCompareFunc comp; | 195 GCompareFunc comp; |
196 | 196 |
197 if (!jidname) return NULL; | 197 if (!jidname) return NULL; |
198 | 198 |
199 if (!roster_type) | 199 if (!roster_type) |
200 roster_type = ROSTER_TYPE_USER | ROSTER_TYPE_ROOM | | 200 roster_type = ROSTER_TYPE_USER | ROSTER_TYPE_ROOM | |
201 ROSTER_TYPE_AGENT | ROSTER_TYPE_GROUP; | 201 ROSTER_TYPE_AGENT | ROSTER_TYPE_GROUP; |
202 | 202 |
203 sample.type = roster_type; | 203 sample.type = roster_type; |
204 if (type == jidsearch) { | 204 if (type == jidsearch) { |
205 sample.jid = (gchar*)jidname; | 205 sample.jid = (gchar*)jidname; |
891 { | 891 { |
892 roster *roster_usr = rosterdata; | 892 roster *roster_usr = rosterdata; |
893 return roster_usr->flags; | 893 return roster_usr->flags; |
894 } | 894 } |
895 | 895 |
896 // buddy_search_jid(jid) | |
897 // Look for a buddy with specified jid. | |
898 // Search begins at buddylist; if no match is found in the the buddylist, | |
899 // return NULL; | |
900 GList *buddy_search_jid(char *jid) | |
901 { | |
902 GList *buddy; | |
903 roster *roster_usr; | |
904 | |
905 if (!buddylist) return NULL; | |
906 | |
907 for (buddy = buddylist; buddy; buddy = g_list_next(buddy)) { | |
908 roster_usr = (roster*)buddy->data; | |
909 if (roster_usr->jid && !strcasecmp(roster_usr->jid, jid)) | |
910 return buddy; | |
911 } | |
912 return NULL; | |
913 } | |
914 | |
896 // buddy_search(string) | 915 // buddy_search(string) |
897 // Look for a buddy whose name or jid contains string. | 916 // Look for a buddy whose name or jid contains string. |
898 // Search begins at current_buddy; if no match is found in the the buddylist, | 917 // Search begins at current_buddy; if no match is found in the the buddylist, |
899 // return NULL; | 918 // return NULL; |
900 GList *buddy_search(char *string) | 919 GList *buddy_search(char *string) |