Mercurial > hg
comparison mcabber/src/roster.c @ 532:2ac8d8e49e81
Send status changes to chatrooms
author | Mikael Berthe <mikael@lilotux.net> |
---|---|
date | Thu, 24 Nov 2005 00:03:37 +0100 |
parents | c60175268eb5 |
children | ffdfddd351b8 |
comparison
equal
deleted
inserted
replaced
531:aee9a279a0f3 | 532:2ac8d8e49e81 |
---|---|
772 | 772 |
773 void buddy_setnickname(gpointer rosterdata, const char *newname) | 773 void buddy_setnickname(gpointer rosterdata, const char *newname) |
774 { | 774 { |
775 roster *roster_usr = rosterdata; | 775 roster *roster_usr = rosterdata; |
776 | 776 |
777 if (!roster_usr->type & ROSTER_TYPE_ROOM) return; | 777 if (!(roster_usr->type & ROSTER_TYPE_ROOM)) return; |
778 | 778 |
779 if (roster_usr->nickname) { | 779 if (roster_usr->nickname) { |
780 g_free((gchar*)roster_usr->nickname); | 780 g_free((gchar*)roster_usr->nickname); |
781 roster_usr->nickname = NULL; | 781 roster_usr->nickname = NULL; |
782 } | 782 } |
959 if (roster_usr->name && strcasestr(roster_usr->name, string)) | 959 if (roster_usr->name && strcasestr(roster_usr->name, string)) |
960 return buddy; | 960 return buddy; |
961 | 961 |
962 if (buddy == current_buddy) | 962 if (buddy == current_buddy) |
963 return NULL; // Back to the beginning, and no match found | 963 return NULL; // Back to the beginning, and no match found |
964 } | |
965 } | |
966 | |
967 // foreach_buddy(roster_type, pfunction, param) | |
968 // Call pfunction(buddy, param) for each buddy from the roster with | |
969 // type matching roster_type. | |
970 void foreach_buddy(guint roster_type, | |
971 void (*pfunc)(gpointer rosterdata, void *param), | |
972 void *param) | |
973 { | |
974 GSList *sl_roster_elt = groups; | |
975 roster *roster_elt; | |
976 GSList *sl_roster_usrelt; | |
977 roster *roster_usrelt; | |
978 | |
979 while (sl_roster_elt) { // group list loop | |
980 roster_elt = (roster*) sl_roster_elt->data; | |
981 sl_roster_usrelt = roster_elt->list; | |
982 while (sl_roster_usrelt) { // user list loop | |
983 roster_usrelt = (roster*) sl_roster_usrelt->data; | |
984 | |
985 if (roster_usrelt->type & roster_type) | |
986 pfunc(roster_usrelt, param); | |
987 | |
988 sl_roster_usrelt = g_slist_next(sl_roster_usrelt); | |
989 } | |
990 sl_roster_elt = g_slist_next(sl_roster_elt); | |
964 } | 991 } |
965 } | 992 } |
966 | 993 |
967 // compl_list(type) | 994 // compl_list(type) |
968 // Returns a list of jid's or groups. (For commands completion) | 995 // Returns a list of jid's or groups. (For commands completion) |
1009 next_unread = g_slist_next(unread); | 1036 next_unread = g_slist_next(unread); |
1010 if (next_unread) return next_unread->data; | 1037 if (next_unread) return next_unread->data; |
1011 | 1038 |
1012 return unread_list->data; | 1039 return unread_list->data; |
1013 } | 1040 } |
1014 |