]> jfr.im git - solanum.git/blobdiff - modules/core/m_mode.c
Remove unused variable cruft.
[solanum.git] / modules / core / m_mode.c
index ac0208010e895d758a86d7cf9d1ab9d76665d943..87be36c93508a70c90c97d932abd6c27b93b430d 100644 (file)
@@ -235,11 +235,40 @@ ms_mlock(struct Client *client_p, struct Client *source_p, int parc, const char
                return 0;
 
        if(IsServer(source_p))
-               set_channel_mlock(client_p, source_p, chptr, parv[3]);
+               set_channel_mlock(client_p, source_p, chptr, parv[3], TRUE);
 
        return 0;
 }
 
+static void
+possibly_remove_lower_forward(struct Client *fakesource_p, int mems,
+               struct Channel *chptr, rb_dlink_list *banlist, int mchar,
+               const char *mask, const char *forward)
+{
+       struct Ban *actualBan;
+       rb_dlink_node *ptr;
+
+       RB_DLINK_FOREACH(ptr, banlist->head)
+       {
+               actualBan = ptr->data;
+               if(!irccmp(actualBan->banstr, mask) &&
+                               (actualBan->forward == NULL ||
+                                irccmp(actualBan->forward, forward) < 0))
+               {
+                       sendto_channel_local(mems, chptr, ":%s MODE %s -%c %s%s%s",
+                                       fakesource_p->name,
+                                       chptr->chname,
+                                       mchar,
+                                       actualBan->banstr,
+                                       actualBan->forward ? "$" : "",
+                                       actualBan->forward ? actualBan->forward : "");
+                       rb_dlinkDelete(&actualBan->node, banlist);
+                       free_ban(actualBan);
+                       return;
+               }
+       }
+}
+
 static int
 ms_bmask(struct Client *client_p, struct Client *source_p, int parc, const char *parv[])
 {
@@ -247,7 +276,7 @@ ms_bmask(struct Client *client_p, struct Client *source_p, int parc, const char
        static char parabuf[BUFSIZE];
        struct Channel *chptr;
        rb_dlink_list *banlist;
-       const char *s;
+       char *s, *forward;
        char *t;
        char *mbuf;
        char *pbuf;
@@ -342,7 +371,16 @@ ms_bmask(struct Client *client_p, struct Client *source_p, int parc, const char
                if(tlen > MODEBUFLEN)
                        break;
 
-               if(add_id(fakesource_p, chptr, s, banlist, mode_type))
+               if((forward = strchr(s+1, '$')) != NULL)
+               {
+                       *forward++ = '\0';
+                       if(*forward == '\0')
+                               tlen--, forward = NULL;
+                       possibly_remove_lower_forward(fakesource_p, mems,
+                                       chptr, banlist, parv[3][0], s, forward);
+               }
+
+               if(add_id(fakesource_p, chptr, s, forward, banlist, mode_type))
                {
                        /* this new one wont fit.. */
                        if(mlen + MAXMODEPARAMS + plen + tlen > BUFSIZE - 5 ||
@@ -351,14 +389,15 @@ ms_bmask(struct Client *client_p, struct Client *source_p, int parc, const char
                                *mbuf = '\0';
                                *(pbuf - 1) = '\0';
                                sendto_channel_local(mems, chptr, "%s %s", modebuf, parabuf);
-                               sendto_server(client_p, chptr, needcap, CAP_TS6,
-                                             "%s %s", modebuf, parabuf);
 
                                mbuf = modebuf + mlen;
                                pbuf = parabuf;
                                plen = modecount = 0;
                        }
 
+                       if (forward != NULL)
+                               forward[-1] = '$';
+
                        *mbuf++ = parv[3][0];
                        arglen = rb_sprintf(pbuf, "%s ", s);
                        pbuf += arglen;
@@ -386,7 +425,6 @@ ms_bmask(struct Client *client_p, struct Client *source_p, int parc, const char
                *mbuf = '\0';
                *(pbuf - 1) = '\0';
                sendto_channel_local(mems, chptr, "%s %s", modebuf, parabuf);
-               sendto_server(client_p, chptr, needcap, CAP_TS6, "%s %s", modebuf, parabuf);
        }
 
        sendto_server(client_p, chptr, CAP_TS6 | needcap, NOCAPS, ":%s BMASK %ld %s %s :%s",