2007-01-25 07:40:21 +01:00
|
|
|
/*
|
|
|
|
* ircd-ratbox: A slightly useful ircd.
|
|
|
|
* m_mode.c: Sets a user or channel mode.
|
|
|
|
*
|
|
|
|
* Copyright (C) 1990 Jarkko Oikarinen and University of Oulu, Co Center
|
|
|
|
* Copyright (C) 1996-2002 Hybrid Development Team
|
|
|
|
* Copyright (C) 2002-2005 ircd-ratbox development team
|
|
|
|
*
|
|
|
|
* This program is free software; you can redistribute it and/or modify
|
|
|
|
* it under the terms of the GNU General Public License as published by
|
|
|
|
* the Free Software Foundation; either version 2 of the License, or
|
|
|
|
* (at your option) any later version.
|
|
|
|
*
|
|
|
|
* This program is distributed in the hope that it will be useful,
|
|
|
|
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
|
|
|
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
|
|
|
* GNU General Public License for more details.
|
|
|
|
*
|
|
|
|
* You should have received a copy of the GNU General Public License
|
|
|
|
* along with this program; if not, write to the Free Software
|
|
|
|
* Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307
|
|
|
|
* USA
|
|
|
|
*/
|
|
|
|
|
2016-08-13 05:05:54 +02:00
|
|
|
using namespace ircd;
|
|
|
|
|
2016-03-09 08:29:41 +01:00
|
|
|
static const char mode_desc[] =
|
|
|
|
"Provides the MODE and MLOCK client and server commands, and TS6 server-to-server TMODE and BMASK commands";
|
|
|
|
|
2016-08-23 02:37:07 +02:00
|
|
|
static void m_mode(struct MsgBuf *, client::client &, client::client &, int, const char **);
|
|
|
|
static void ms_mode(struct MsgBuf *, client::client &, client::client &, int, const char **);
|
|
|
|
static void ms_tmode(struct MsgBuf *, client::client &, client::client &, int, const char **);
|
|
|
|
static void ms_mlock(struct MsgBuf *, client::client &, client::client &, int, const char **);
|
|
|
|
static void ms_bmask(struct MsgBuf *, client::client &, client::client &, int, const char **);
|
2007-01-25 07:40:21 +01:00
|
|
|
|
|
|
|
struct Message mode_msgtab = {
|
2016-02-19 23:42:40 +01:00
|
|
|
"MODE", 0, 0, 0, 0,
|
2007-01-25 07:40:21 +01:00
|
|
|
{mg_unreg, {m_mode, 2}, {m_mode, 3}, {ms_mode, 3}, mg_ignore, {m_mode, 2}}
|
|
|
|
};
|
|
|
|
struct Message tmode_msgtab = {
|
2016-02-19 23:42:40 +01:00
|
|
|
"TMODE", 0, 0, 0, 0,
|
2007-01-25 07:40:21 +01:00
|
|
|
{mg_ignore, mg_ignore, {ms_tmode, 4}, {ms_tmode, 4}, mg_ignore, mg_ignore}
|
|
|
|
};
|
2010-03-08 06:13:39 +01:00
|
|
|
struct Message mlock_msgtab = {
|
2016-02-19 23:42:40 +01:00
|
|
|
"MLOCK", 0, 0, 0, 0,
|
2010-05-02 21:42:46 +02:00
|
|
|
{mg_ignore, mg_ignore, {ms_mlock, 3}, {ms_mlock, 3}, mg_ignore, mg_ignore}
|
2010-03-08 06:13:39 +01:00
|
|
|
};
|
2007-01-25 07:40:21 +01:00
|
|
|
struct Message bmask_msgtab = {
|
2016-02-19 23:42:40 +01:00
|
|
|
"BMASK", 0, 0, 0, 0,
|
2007-01-25 07:40:21 +01:00
|
|
|
{mg_ignore, mg_ignore, mg_ignore, {ms_bmask, 5}, mg_ignore, mg_ignore}
|
|
|
|
};
|
|
|
|
|
2010-03-08 06:13:39 +01:00
|
|
|
mapi_clist_av1 mode_clist[] = { &mode_msgtab, &tmode_msgtab, &mlock_msgtab, &bmask_msgtab, NULL };
|
2007-01-25 07:40:21 +01:00
|
|
|
|
2016-03-07 08:16:24 +01:00
|
|
|
DECLARE_MODULE_AV2(mode, NULL, NULL, mode_clist, NULL, NULL, NULL, NULL, mode_desc);
|
2007-01-25 07:40:21 +01:00
|
|
|
|
|
|
|
/*
|
|
|
|
* m_mode - MODE command handler
|
|
|
|
* parv[1] - channel
|
|
|
|
*/
|
2016-03-09 08:37:03 +01:00
|
|
|
static void
|
2016-08-23 02:37:07 +02:00
|
|
|
m_mode(struct MsgBuf *msgbuf_p, client::client &client, client::client &source, int parc, const char *parv[])
|
2007-01-25 07:40:21 +01:00
|
|
|
{
|
2016-08-18 07:33:38 +02:00
|
|
|
chan::chan *chptr = NULL;
|
|
|
|
chan::membership *msptr;
|
2007-01-25 07:40:21 +01:00
|
|
|
int n = 2;
|
|
|
|
const char *dest;
|
|
|
|
int operspy = 0;
|
|
|
|
|
|
|
|
dest = parv[1];
|
|
|
|
|
2016-08-23 02:37:07 +02:00
|
|
|
if(IsOperSpy(&source) && *dest == '!')
|
2007-01-25 07:40:21 +01:00
|
|
|
{
|
|
|
|
dest++;
|
|
|
|
operspy = 1;
|
|
|
|
|
|
|
|
if(EmptyString(dest))
|
|
|
|
{
|
2016-08-23 02:37:07 +02:00
|
|
|
sendto_one(&source, form_str(ERR_NEEDMOREPARAMS),
|
|
|
|
me.name, source.name, "MODE");
|
2016-03-09 08:37:03 +01:00
|
|
|
return;
|
2007-01-25 07:40:21 +01:00
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
/* Now, try to find the channel in question */
|
2016-08-16 11:12:01 +02:00
|
|
|
if(!rfc1459::is_chan_prefix(*dest))
|
2007-01-25 07:40:21 +01:00
|
|
|
{
|
|
|
|
/* if here, it has to be a non-channel name */
|
2016-08-23 02:37:07 +02:00
|
|
|
user_mode(&client, &source, parc, parv);
|
2016-03-09 08:37:03 +01:00
|
|
|
return;
|
2007-01-25 07:40:21 +01:00
|
|
|
}
|
|
|
|
|
2016-08-19 01:53:12 +02:00
|
|
|
if(!chan::valid_name(dest))
|
2007-01-25 07:40:21 +01:00
|
|
|
{
|
2016-08-23 02:37:07 +02:00
|
|
|
sendto_one_numeric(&source, ERR_BADCHANNAME, form_str(ERR_BADCHANNAME), parv[1]);
|
2016-03-09 08:37:03 +01:00
|
|
|
return;
|
2007-01-25 07:40:21 +01:00
|
|
|
}
|
|
|
|
|
2016-08-20 04:51:37 +02:00
|
|
|
chptr = chan::get(dest, std::nothrow);
|
2007-01-25 07:40:21 +01:00
|
|
|
|
|
|
|
if(chptr == NULL)
|
|
|
|
{
|
2016-08-23 02:37:07 +02:00
|
|
|
sendto_one_numeric(&source, ERR_NOSUCHCHANNEL,
|
2007-01-25 07:40:21 +01:00
|
|
|
form_str(ERR_NOSUCHCHANNEL), parv[1]);
|
2016-03-09 08:37:03 +01:00
|
|
|
return;
|
2007-01-25 07:40:21 +01:00
|
|
|
}
|
|
|
|
|
|
|
|
/* Now know the channel exists */
|
|
|
|
if(parc < n + 1)
|
|
|
|
{
|
2016-08-26 06:38:15 +02:00
|
|
|
// if(operspy)
|
|
|
|
// report_operspy(&source, "MODE", chptr->name.c_str());
|
2007-01-25 07:40:21 +01:00
|
|
|
|
2016-08-23 02:37:07 +02:00
|
|
|
sendto_one(&source, form_str(RPL_CHANNELMODEIS),
|
|
|
|
me.name, source.name, parv[1],
|
|
|
|
operspy ? channel_modes(chptr, &me) : channel_modes(chptr, &source));
|
2007-01-25 07:40:21 +01:00
|
|
|
|
2016-08-23 02:37:07 +02:00
|
|
|
sendto_one(&source, form_str(RPL_CREATIONTIME),
|
|
|
|
me.name, source.name, parv[1], chptr->channelts);
|
2007-01-25 07:40:21 +01:00
|
|
|
}
|
|
|
|
else
|
|
|
|
{
|
2016-08-23 02:37:07 +02:00
|
|
|
msptr = get(chptr->members, source, std::nothrow);
|
2007-01-25 07:40:21 +01:00
|
|
|
|
|
|
|
/* Finish the flood grace period... */
|
2016-08-23 04:33:36 +02:00
|
|
|
if(my(source) && !is_flood_done(source))
|
2007-01-25 07:40:21 +01:00
|
|
|
{
|
2015-12-28 07:48:46 +01:00
|
|
|
if(!((parc == 3) && (parv[2][0] == 'b' || parv[2][0] == 'q') && (parv[2][1] == '\0')))
|
2016-08-23 02:37:07 +02:00
|
|
|
flood_endgrace(&source);
|
2007-01-25 07:40:21 +01:00
|
|
|
}
|
|
|
|
|
2016-08-23 02:37:07 +02:00
|
|
|
set_channel_mode(&client, &source, chptr, msptr, parc - n, parv + n);
|
2007-01-25 07:40:21 +01:00
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2016-03-09 08:37:03 +01:00
|
|
|
static void
|
2016-08-23 02:37:07 +02:00
|
|
|
ms_mode(struct MsgBuf *msgbuf_p, client::client &client, client::client &source, int parc, const char *parv[])
|
2007-01-25 07:40:21 +01:00
|
|
|
{
|
2016-08-18 07:33:38 +02:00
|
|
|
chan::chan *chptr;
|
2007-01-25 07:40:21 +01:00
|
|
|
|
2016-08-20 04:51:37 +02:00
|
|
|
chptr = chan::get(parv[1], std::nothrow);
|
2007-01-25 07:40:21 +01:00
|
|
|
|
|
|
|
if(chptr == NULL)
|
|
|
|
{
|
2016-08-23 02:37:07 +02:00
|
|
|
sendto_one_numeric(&source, ERR_NOSUCHCHANNEL,
|
2007-01-25 07:40:21 +01:00
|
|
|
form_str(ERR_NOSUCHCHANNEL), parv[1]);
|
2016-03-09 08:37:03 +01:00
|
|
|
return;
|
2007-01-25 07:40:21 +01:00
|
|
|
}
|
|
|
|
|
2016-08-23 02:37:07 +02:00
|
|
|
set_channel_mode(&client, &source, chptr, NULL, parc - 2, parv + 2);
|
2007-01-25 07:40:21 +01:00
|
|
|
}
|
|
|
|
|
2016-03-09 08:37:03 +01:00
|
|
|
static void
|
2016-08-23 02:37:07 +02:00
|
|
|
ms_tmode(struct MsgBuf *msgbuf_p, client::client &client, client::client &source, int parc, const char *parv[])
|
2007-01-25 07:40:21 +01:00
|
|
|
{
|
2016-08-18 07:33:38 +02:00
|
|
|
chan::chan *chptr = NULL;
|
|
|
|
chan::membership *msptr;
|
2007-01-25 07:40:21 +01:00
|
|
|
|
|
|
|
/* Now, try to find the channel in question */
|
2016-08-19 01:53:12 +02:00
|
|
|
if(!rfc1459::is_chan_prefix(parv[2][0]) || !chan::valid_name(parv[2]))
|
2007-01-25 07:40:21 +01:00
|
|
|
{
|
2016-08-23 02:37:07 +02:00
|
|
|
sendto_one_numeric(&source, ERR_BADCHANNAME, form_str(ERR_BADCHANNAME), parv[2]);
|
2016-03-09 08:37:03 +01:00
|
|
|
return;
|
2007-01-25 07:40:21 +01:00
|
|
|
}
|
|
|
|
|
2016-08-20 04:51:37 +02:00
|
|
|
chptr = chan::get(parv[2], std::nothrow);
|
2007-01-25 07:40:21 +01:00
|
|
|
|
|
|
|
if(chptr == NULL)
|
|
|
|
{
|
2016-08-23 02:37:07 +02:00
|
|
|
sendto_one_numeric(&source, ERR_NOSUCHCHANNEL,
|
2007-01-25 07:40:21 +01:00
|
|
|
form_str(ERR_NOSUCHCHANNEL), parv[2]);
|
2016-03-09 08:37:03 +01:00
|
|
|
return;
|
2007-01-25 07:40:21 +01:00
|
|
|
}
|
|
|
|
|
|
|
|
/* TS is higher, drop it. */
|
|
|
|
if(atol(parv[1]) > chptr->channelts)
|
2016-03-09 08:37:03 +01:00
|
|
|
return;
|
2007-01-25 07:40:21 +01:00
|
|
|
|
2016-08-23 04:33:36 +02:00
|
|
|
if(is_server(source))
|
2007-01-25 07:40:21 +01:00
|
|
|
{
|
2016-08-23 02:37:07 +02:00
|
|
|
set_channel_mode(&client, &source, chptr, NULL, parc - 3, parv + 3);
|
2007-01-25 07:40:21 +01:00
|
|
|
}
|
|
|
|
else
|
|
|
|
{
|
2016-08-23 02:37:07 +02:00
|
|
|
msptr = get(chptr->members, source, std::nothrow);
|
2007-01-25 07:40:21 +01:00
|
|
|
|
2016-08-23 02:37:07 +02:00
|
|
|
set_channel_mode(&client, &source, chptr, msptr, parc - 3, parv + 3);
|
2007-01-25 07:40:21 +01:00
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2016-03-09 08:37:03 +01:00
|
|
|
static void
|
2016-08-23 02:37:07 +02:00
|
|
|
ms_mlock(struct MsgBuf *msgbuf_p, client::client &client, client::client &source, int parc, const char *parv[])
|
2010-03-08 06:13:39 +01:00
|
|
|
{
|
2016-08-18 07:33:38 +02:00
|
|
|
chan::chan *chptr = NULL;
|
2010-03-08 06:13:39 +01:00
|
|
|
|
|
|
|
/* Now, try to find the channel in question */
|
2016-08-19 01:53:12 +02:00
|
|
|
if(!rfc1459::is_chan_prefix(parv[2][0]) || !chan::valid_name(parv[2]))
|
2010-03-08 06:13:39 +01:00
|
|
|
{
|
2016-08-23 02:37:07 +02:00
|
|
|
sendto_one_numeric(&source, ERR_BADCHANNAME, form_str(ERR_BADCHANNAME), parv[2]);
|
2016-03-09 08:37:03 +01:00
|
|
|
return;
|
2010-03-08 06:13:39 +01:00
|
|
|
}
|
|
|
|
|
2016-08-20 04:51:37 +02:00
|
|
|
chptr = chan::get(parv[2], std::nothrow);
|
2010-03-08 06:13:39 +01:00
|
|
|
|
|
|
|
if(chptr == NULL)
|
|
|
|
{
|
2016-08-23 02:37:07 +02:00
|
|
|
sendto_one_numeric(&source, ERR_NOSUCHCHANNEL,
|
2010-03-08 06:13:39 +01:00
|
|
|
form_str(ERR_NOSUCHCHANNEL), parv[2]);
|
2016-03-09 08:37:03 +01:00
|
|
|
return;
|
2010-03-08 06:13:39 +01:00
|
|
|
}
|
|
|
|
|
|
|
|
/* TS is higher, drop it. */
|
|
|
|
if(atol(parv[1]) > chptr->channelts)
|
2016-03-09 08:37:03 +01:00
|
|
|
return;
|
2010-03-08 06:13:39 +01:00
|
|
|
|
2016-08-23 04:33:36 +02:00
|
|
|
if(is_server(source))
|
2016-08-23 02:37:07 +02:00
|
|
|
set_channel_mlock(&client, &source, chptr, parv[3], true);
|
2010-03-08 06:13:39 +01:00
|
|
|
}
|
|
|
|
|
2012-03-03 23:45:52 +01:00
|
|
|
static void
|
2016-08-23 02:37:07 +02:00
|
|
|
possibly_remove_lower_forward(client::client *fakesource,
|
2016-08-19 07:58:17 +02:00
|
|
|
const int &mems,
|
|
|
|
chan::chan &chan,
|
|
|
|
chan::list &list,
|
|
|
|
const int &mchar,
|
2016-08-18 07:33:38 +02:00
|
|
|
const char *mask,
|
|
|
|
const char *forward)
|
2012-03-03 23:45:52 +01:00
|
|
|
{
|
2016-08-19 07:58:17 +02:00
|
|
|
for (auto it(begin(list)); it != end(list); ++it)
|
2012-03-03 23:45:52 +01:00
|
|
|
{
|
2016-08-19 07:58:17 +02:00
|
|
|
const auto &ban(*it);
|
|
|
|
|
|
|
|
if (irccmp(ban.banstr, mask) != 0)
|
|
|
|
continue;
|
|
|
|
|
|
|
|
if (ban.forward.size() && irccmp(ban.forward, forward) >= 0)
|
|
|
|
continue;
|
|
|
|
|
|
|
|
sendto_channel_local(mems, &chan,
|
|
|
|
":%s MODE %s -%c %s%s%s",
|
2016-08-23 02:37:07 +02:00
|
|
|
fakesource->name,
|
2016-08-19 07:58:17 +02:00
|
|
|
chan.name.c_str(),
|
|
|
|
mchar,
|
|
|
|
ban.banstr.c_str(),
|
|
|
|
ban.forward.size()? "$" : "",
|
|
|
|
ban.forward.size()? ban.forward.c_str() : "");
|
|
|
|
list.erase(it);
|
|
|
|
break;
|
2012-03-03 23:45:52 +01:00
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2016-03-09 08:37:03 +01:00
|
|
|
static void
|
2016-08-23 02:37:07 +02:00
|
|
|
ms_bmask(struct MsgBuf *msgbuf_p, client::client &client, client::client &source, int parc, const char *parv[])
|
2007-01-25 07:40:21 +01:00
|
|
|
{
|
|
|
|
static char modebuf[BUFSIZE];
|
|
|
|
static char parabuf[BUFSIZE];
|
2016-08-18 07:33:38 +02:00
|
|
|
chan::chan *chptr;
|
2016-08-19 07:58:17 +02:00
|
|
|
chan::list *list;
|
|
|
|
chan::mode::type mode_type;
|
2011-08-13 02:33:10 +02:00
|
|
|
char *s, *forward;
|
2007-01-25 07:40:21 +01:00
|
|
|
char *t;
|
|
|
|
char *mbuf;
|
|
|
|
char *pbuf;
|
|
|
|
int mlen;
|
|
|
|
int plen = 0;
|
|
|
|
int tlen;
|
|
|
|
int arglen;
|
|
|
|
int modecount = 0;
|
|
|
|
int needcap = NOCAPS;
|
|
|
|
int mems;
|
2016-08-23 02:37:07 +02:00
|
|
|
client::client *fakesource;
|
2007-01-25 07:40:21 +01:00
|
|
|
|
2016-08-19 01:53:12 +02:00
|
|
|
if(!rfc1459::is_chan_prefix(parv[2][0]) || !chan::valid_name(parv[2]))
|
2016-03-09 08:37:03 +01:00
|
|
|
return;
|
2007-01-25 07:40:21 +01:00
|
|
|
|
2016-08-20 04:51:37 +02:00
|
|
|
if((chptr = chan::get(parv[2], std::nothrow)) == NULL)
|
2016-03-09 08:37:03 +01:00
|
|
|
return;
|
2007-01-25 07:40:21 +01:00
|
|
|
|
|
|
|
/* TS is higher, drop it. */
|
|
|
|
if(atol(parv[1]) > chptr->channelts)
|
2016-03-09 08:37:03 +01:00
|
|
|
return;
|
2007-01-25 07:40:21 +01:00
|
|
|
|
|
|
|
switch (parv[3][0])
|
|
|
|
{
|
|
|
|
case 'b':
|
2016-08-18 07:33:38 +02:00
|
|
|
mode_type = chan::mode::BAN;
|
|
|
|
mems = chan::ALL_MEMBERS;
|
2007-01-25 07:40:21 +01:00
|
|
|
break;
|
|
|
|
|
|
|
|
case 'e':
|
2016-08-18 07:33:38 +02:00
|
|
|
mode_type = chan::mode::EXCEPTION;
|
2007-01-25 07:40:21 +01:00
|
|
|
needcap = CAP_EX;
|
2016-08-18 07:33:38 +02:00
|
|
|
mems = chan::ONLY_CHANOPS;
|
2007-01-25 07:40:21 +01:00
|
|
|
break;
|
|
|
|
|
|
|
|
case 'I':
|
2016-08-18 07:33:38 +02:00
|
|
|
mode_type = chan::mode::INVEX;
|
2007-01-25 07:40:21 +01:00
|
|
|
needcap = CAP_IE;
|
2016-08-18 07:33:38 +02:00
|
|
|
mems = chan::ONLY_CHANOPS;
|
2007-01-25 07:40:21 +01:00
|
|
|
break;
|
|
|
|
|
|
|
|
case 'q':
|
2016-08-18 07:33:38 +02:00
|
|
|
mode_type = chan::mode::QUIET;
|
|
|
|
mems = chan::ALL_MEMBERS;
|
2007-01-25 07:40:21 +01:00
|
|
|
break;
|
|
|
|
|
|
|
|
/* maybe we should just blindly propagate this? */
|
|
|
|
default:
|
2016-03-09 08:37:03 +01:00
|
|
|
return;
|
2007-01-25 07:40:21 +01:00
|
|
|
}
|
|
|
|
|
2016-08-19 07:58:17 +02:00
|
|
|
list = &get(*chptr, mode_type);
|
|
|
|
|
2007-01-25 07:40:21 +01:00
|
|
|
parabuf[0] = '\0';
|
|
|
|
s = LOCAL_COPY(parv[4]);
|
|
|
|
|
|
|
|
/* Hide connecting server on netburst -- jilles */
|
2016-08-23 04:33:36 +02:00
|
|
|
if (ConfigServerHide.flatten_links && !has_sent_eob(source))
|
2016-08-23 02:37:07 +02:00
|
|
|
fakesource = &me;
|
2007-01-25 07:40:21 +01:00
|
|
|
else
|
2016-08-23 02:37:07 +02:00
|
|
|
fakesource = &source;
|
|
|
|
mlen = sprintf(modebuf, ":%s MODE %s +", fakesource->name, chptr->name.c_str());
|
2007-01-25 07:40:21 +01:00
|
|
|
mbuf = modebuf + mlen;
|
|
|
|
pbuf = parabuf;
|
|
|
|
|
|
|
|
while(*s == ' ')
|
|
|
|
s++;
|
|
|
|
|
|
|
|
/* next char isnt a space, point t to the next one */
|
|
|
|
if((t = strchr(s, ' ')) != NULL)
|
|
|
|
{
|
|
|
|
*t++ = '\0';
|
|
|
|
|
|
|
|
/* double spaces will break the parser */
|
|
|
|
while(*t == ' ')
|
|
|
|
t++;
|
|
|
|
}
|
|
|
|
|
|
|
|
/* couldve skipped spaces and got nothing.. */
|
|
|
|
while(!EmptyString(s))
|
|
|
|
{
|
|
|
|
/* ban with a leading ':' -- this will break the protocol */
|
|
|
|
if(*s == ':')
|
|
|
|
goto nextban;
|
|
|
|
|
|
|
|
tlen = strlen(s);
|
|
|
|
|
|
|
|
/* I dont even want to begin parsing this.. */
|
2016-08-17 05:01:20 +02:00
|
|
|
if(tlen > chan::mode::BUFLEN)
|
2007-01-25 07:40:21 +01:00
|
|
|
break;
|
|
|
|
|
2011-08-13 02:33:10 +02:00
|
|
|
if((forward = strchr(s+1, '$')) != NULL)
|
|
|
|
{
|
|
|
|
*forward++ = '\0';
|
|
|
|
if(*forward == '\0')
|
2012-02-17 00:09:39 +01:00
|
|
|
tlen--, forward = NULL;
|
2014-03-03 00:01:56 +01:00
|
|
|
else
|
2016-08-23 02:37:07 +02:00
|
|
|
possibly_remove_lower_forward(fakesource,
|
2016-08-19 07:58:17 +02:00
|
|
|
mems, *chptr, *list,
|
2014-03-03 00:01:56 +01:00
|
|
|
parv[3][0], s, forward);
|
2011-08-13 02:33:10 +02:00
|
|
|
}
|
|
|
|
|
2016-08-23 02:37:07 +02:00
|
|
|
if (add(*chptr, mode_type, s, *fakesource, forward))
|
2007-01-25 07:40:21 +01:00
|
|
|
{
|
|
|
|
/* this new one wont fit.. */
|
2016-08-17 05:01:20 +02:00
|
|
|
if(mlen + chan::mode::MAXPARAMS + plen + tlen > BUFSIZE - 5 ||
|
|
|
|
modecount >= chan::mode::MAXPARAMS)
|
2007-01-25 07:40:21 +01:00
|
|
|
{
|
|
|
|
*mbuf = '\0';
|
|
|
|
*(pbuf - 1) = '\0';
|
|
|
|
sendto_channel_local(mems, chptr, "%s %s", modebuf, parabuf);
|
|
|
|
|
|
|
|
mbuf = modebuf + mlen;
|
|
|
|
pbuf = parabuf;
|
|
|
|
plen = modecount = 0;
|
|
|
|
}
|
|
|
|
|
2012-02-17 00:09:39 +01:00
|
|
|
if (forward != NULL)
|
|
|
|
forward[-1] = '$';
|
|
|
|
|
2007-01-25 07:40:21 +01:00
|
|
|
*mbuf++ = parv[3][0];
|
2016-02-10 02:25:32 +01:00
|
|
|
arglen = sprintf(pbuf, "%s ", s);
|
2007-01-25 07:40:21 +01:00
|
|
|
pbuf += arglen;
|
|
|
|
plen += arglen;
|
|
|
|
modecount++;
|
|
|
|
}
|
|
|
|
|
|
|
|
nextban:
|
|
|
|
s = t;
|
|
|
|
|
|
|
|
if(s != NULL)
|
|
|
|
{
|
|
|
|
if((t = strchr(s, ' ')) != NULL)
|
|
|
|
{
|
|
|
|
*t++ = '\0';
|
|
|
|
|
|
|
|
while(*t == ' ')
|
|
|
|
t++;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
if(modecount)
|
|
|
|
{
|
|
|
|
*mbuf = '\0';
|
|
|
|
*(pbuf - 1) = '\0';
|
|
|
|
sendto_channel_local(mems, chptr, "%s %s", modebuf, parabuf);
|
|
|
|
}
|
|
|
|
|
2016-08-23 02:37:07 +02:00
|
|
|
sendto_server(&client, chptr, CAP_TS6 | needcap, NOCAPS, ":%s BMASK %ld %s %s :%s",
|
|
|
|
source.id, (long) chptr->channelts, chptr->name.c_str(), parv[3], parv[4]);
|
2007-01-25 07:40:21 +01:00
|
|
|
}
|