added get_userlist_if_invisible (WHO only if invisible users COULD be present)
[NeonServV5.git] / src / WHOHandler.c
index 25d2467f8acef2f17e03e369a395597fc2ffeff0..4ee579fc2c1ef39eca71da05634c65ff12c52148 100644 (file)
@@ -109,7 +109,7 @@ void get_userlist(struct ChanNode *chan, userlist_callback_t callback, void *dat
         callback(bot, chan, data);
 }
 
-void get_userlist_with_invisible(struct ChanNode *chan, userlist_callback_t callback, void *data) {
+void _get_userlist_with_invisible(struct ChanNode *chan, userlist_callback_t callback, void *data, int force) {
     struct ClientSocket *bot;
     for(bot = getBots(SOCKET_FLAG_READY, NULL); bot; bot = getBots(SOCKET_FLAG_READY, bot)) {
         if(isUserOnChan(bot->user, chan))
@@ -119,7 +119,7 @@ void get_userlist_with_invisible(struct ChanNode *chan, userlist_callback_t call
     //check if we really need to who the channel
     //invisible users can only be present if chanmode +D or +d is set!
     int do_who = (!(chan->flags & CHANFLAG_RECEIVED_USERLIST))  || (isModeSet(chan->modes, 'd') || isModeSet(chan->modes, 'D'));
-    if(!do_who) {
+    if(!do_who && force) {
         struct ChanUser *chanuser;
         for(chanuser = getChannelUsers(chan, NULL); chanuser; chanuser = getChannelUsers(chan, chanuser)) {
             if(!(chanuser->user->flags & (USERFLAG_ISAUTHED | USERFLAG_ISIRCOP | USERFLAG_ISBOT)) && (time(0) - chanuser->user->last_who) > REWHO_TIMEOUT) {