]> jfr.im git - irc/rqf/shadowircd.git/blobdiff - modules/core/m_mode.c
Merge.
[irc/rqf/shadowircd.git] / modules / core / m_mode.c
index 737c1bed5abf4cc0fe8a7edd739ea70e8898a42e..fd1b18358b2fc8b837dc8f479828a7aff65d5222 100644 (file)
@@ -44,6 +44,7 @@
 static int m_mode(struct Client *, struct Client *, int, const char **);
 static int ms_mode(struct Client *, struct Client *, int, const char **);
 static int ms_tmode(struct Client *, struct Client *, int, const char **);
+static int ms_mlock(struct Client *, struct Client *, int, const char **);
 static int ms_bmask(struct Client *, struct Client *, int, const char **);
 
 struct Message mode_msgtab = {
@@ -54,12 +55,16 @@ struct Message tmode_msgtab = {
        "TMODE", 0, 0, 0, MFLG_SLOW,
        {mg_ignore, mg_ignore, {ms_tmode, 4}, {ms_tmode, 4}, mg_ignore, mg_ignore}
 };
+struct Message mlock_msgtab = {
+       "MLOCK", 0, 0, 0, MFLG_SLOW,
+       {mg_ignore, mg_ignore, {ms_mlock, 3}, {ms_mlock, 3}, mg_ignore, mg_ignore}
+};
 struct Message bmask_msgtab = {
        "BMASK", 0, 0, 0, MFLG_SLOW,
        {mg_ignore, mg_ignore, mg_ignore, {ms_bmask, 5}, mg_ignore, mg_ignore}
 };
 
-mapi_clist_av1 mode_clist[] = { &mode_msgtab, &tmode_msgtab, &bmask_msgtab, NULL };
+mapi_clist_av1 mode_clist[] = { &mode_msgtab, &tmode_msgtab, &mlock_msgtab, &bmask_msgtab, NULL };
 
 DECLARE_MODULE_AV1(mode, NULL, NULL, mode_clist, NULL, NULL, "$Revision: 1006 $");
 
@@ -203,6 +208,37 @@ ms_tmode(struct Client *client_p, struct Client *source_p, int parc, const char
        return 0;
 }
 
+static int
+ms_mlock(struct Client *client_p, struct Client *source_p, int parc, const char *parv[])
+{
+       struct Channel *chptr = NULL;
+
+       /* Now, try to find the channel in question */
+       if(!IsChanPrefix(parv[2][0]) || !check_channel_name(parv[2]))
+       {
+               sendto_one_numeric(source_p, ERR_BADCHANNAME, form_str(ERR_BADCHANNAME), parv[2]);
+               return 0;
+       }
+
+       chptr = find_channel(parv[2]);
+
+       if(chptr == NULL)
+       {
+               sendto_one_numeric(source_p, ERR_NOSUCHCHANNEL,
+                                  form_str(ERR_NOSUCHCHANNEL), parv[2]);
+               return 0;
+       }
+
+       /* TS is higher, drop it. */
+       if(atol(parv[1]) > chptr->channelts)
+               return 0;
+
+       if(IsServer(source_p))
+               set_channel_mlock(client_p, source_p, chptr, parv[3], TRUE);
+
+       return 0;
+}
+
 static int
 ms_bmask(struct Client *client_p, struct Client *source_p, int parc, const char *parv[])
 {