]> jfr.im git - solanum.git/blobdiff - ircd/chmode.c
Merge pull request #341 from ophion-project/upstream/modularize-regonlymsg
[solanum.git] / ircd / chmode.c
index e203e386c176e7d06583eebd4d15626539cab23f..591843b555de648882b13c02016815f91e102e61 100644 (file)
@@ -253,7 +253,7 @@ add_id(struct Client *source_p, struct Channel *chptr, const char *banid, const
         */
        if(MyClient(source_p))
        {
-               if((rb_dlink_list_length(&chptr->banlist) + rb_dlink_list_length(&chptr->exceptlist) + rb_dlink_list_length(&chptr->invexlist) + rb_dlink_list_length(&chptr->quietlist)) >= (unsigned long)(chptr->mode.mode & MODE_EXLIMIT ? ConfigChannel.max_bans_large : ConfigChannel.max_bans))
+               if((rb_dlink_list_length(&chptr->banlist) + rb_dlink_list_length(&chptr->exceptlist) + rb_dlink_list_length(&chptr->invexlist) + rb_dlink_list_length(&chptr->quietlist)) >= (unsigned long)((chptr->mode.mode & MODE_EXLIMIT) ? ConfigChannel.max_bans_large : ConfigChannel.max_bans))
                {
                        sendto_one(source_p, form_str(ERR_BANLISTFULL),
                                   me.name, source_p->name, chptr->chname, realban);
@@ -291,7 +291,7 @@ add_id(struct Client *source_p, struct Channel *chptr, const char *banid, const
 
        /* invalidate the can_send() cache */
        if(mode_type == CHFL_BAN || mode_type == CHFL_QUIET || mode_type == CHFL_EXCEPTION)
-               chptr->bants++;
+               chptr->bants = rb_current_time();
 
        return true;
 }
@@ -321,7 +321,7 @@ del_id(struct Channel *chptr, const char *banid, rb_dlink_list * list, long mode
 
                        /* invalidate the can_send() cache */
                        if(mode_type == CHFL_BAN || mode_type == CHFL_QUIET || mode_type == CHFL_EXCEPTION)
-                               chptr->bants++;
+                               chptr->bants = rb_current_time();
 
                        return banptr;
                }
@@ -486,31 +486,31 @@ pretty_mask(const char *idmask)
  * output      - true if forwarding should be allowed
  * side effects - numeric sent if not allowed
  */
-static int
+static bool
 check_forward(struct Client *source_p, struct Channel *chptr,
                const char *forward)
 {
-       struct Channel *targptr;
+       struct Channel *targptr = NULL;
        struct membership *msptr;
 
        if(!check_channel_name(forward) ||
                        (MyClient(source_p) && (strlen(forward) > LOC_CHANNELLEN || hash_find_resv(forward))))
        {
                sendto_one_numeric(source_p, ERR_BADCHANNAME, form_str(ERR_BADCHANNAME), forward);
-               return 0;
+               return false;
        }
        /* don't forward to inconsistent target -- jilles */
        if(chptr->chname[0] == '#' && forward[0] == '&')
        {
                sendto_one_numeric(source_p, ERR_BADCHANNAME,
                                   form_str(ERR_BADCHANNAME), forward);
-               return 0;
+               return false;
        }
        if(MyClient(source_p) && (targptr = find_channel(forward)) == NULL)
        {
                sendto_one_numeric(source_p, ERR_NOSUCHCHANNEL,
                                   form_str(ERR_NOSUCHCHANNEL), forward);
-               return 0;
+               return false;
        }
        if(MyClient(source_p) && !(targptr->mode.mode & MODE_FREETARGET))
        {
@@ -519,10 +519,10 @@ check_forward(struct Client *source_p, struct Channel *chptr,
                {
                        sendto_one(source_p, form_str(ERR_CHANOPRIVSNEEDED),
                                   me.name, source_p->name, targptr->chname);
-                       return 0;
+                       return false;
                }
        }
-       return 1;
+       return true;
 }
 
 /* fix_key()
@@ -822,7 +822,6 @@ chm_ban(struct Client *source_p, struct Channel *chptr,
        default:
                sendto_realops_snomask(SNO_GENERAL, L_ALL, "chm_ban() called with unknown type!");
                return;
-               break;
        }
 
        if(dir == 0 || parc <= *parn)
@@ -1779,8 +1778,8 @@ set_channel_mode(struct Client *client_p, struct Client *source_p,
                                *mbuf = '\0';
 
                                if(cur_len > mlen)
-                                       sendto_channel_local(flags, chptr, "%s %s", modebuf,
-                                                            parabuf);
+                                       sendto_channel_local(IsServer(source_p) ? fakesource_p : source_p,
+                                                       flags, chptr, "%s %s", modebuf, parabuf);
                                else
                                        continue;
 
@@ -1816,7 +1815,8 @@ set_channel_mode(struct Client *client_p, struct Client *source_p,
 
                *mbuf = '\0';
                if(cur_len > mlen)
-                       sendto_channel_local(flags, chptr, "%s %s", modebuf, parabuf);
+                       sendto_channel_local(IsServer(source_p) ? fakesource_p : source_p,
+                               flags, chptr, "%s %s", modebuf, parabuf);
        }
 
        /* only propagate modes originating locally, or if we're hubbing */