mirror of
https://github.com/matrix-construct/construct
synced 2024-06-02 18:18:56 +02:00
Add channel structure into namespace + remove related rb_banheaps.
This commit is contained in:
parent
03660fc4b0
commit
f5143fbf73
|
@ -36,10 +36,10 @@ static void
|
|||
h_can_join(hook_data_channel *data)
|
||||
{
|
||||
struct Client *source_p = data->client;
|
||||
struct Channel *chptr = data->chptr;
|
||||
const auto &chptr(data->chptr);
|
||||
|
||||
if((chptr->mode.mode & mymode) && !IsAdmin(source_p)) {
|
||||
sendto_one_numeric(source_p, 519, "%s :Cannot join channel (+A) - you are not an IRC server administrator", chptr->chname);
|
||||
sendto_one_numeric(source_p, 519, "%s :Cannot join channel (+A) - you are not an IRC server administrator", chptr->name.c_str());
|
||||
data->approved = chan::mode::ERR_CUSTOM;
|
||||
}
|
||||
}
|
||||
|
|
|
@ -38,11 +38,11 @@ static void
|
|||
h_can_join(hook_data_channel *data)
|
||||
{
|
||||
struct Client *source_p = data->client;
|
||||
struct Channel *chptr = data->chptr;
|
||||
const auto &chptr(data->chptr);
|
||||
|
||||
if(!(chptr->mode.mode & mymode) && !IsSSLClient(source_p)) {
|
||||
/* XXX This is equal to ERR_THROTTLE */
|
||||
sendto_one_numeric(source_p, 480, "%s :Cannot join channel (-U) - SSL/TLS required", chptr->chname);
|
||||
sendto_one_numeric(source_p, 480, "%s :Cannot join channel (-U) - SSL/TLS required", chptr->name.c_str());
|
||||
data->approved = chan::mode::ERR_CUSTOM;
|
||||
}
|
||||
}
|
||||
|
|
|
@ -45,7 +45,7 @@ chm_nonotice_process(hook_data_privmsg_channel *data)
|
|||
/* block all notices except CTCPs; use chm_noctcp to block CTCPs. */
|
||||
if (data->chptr->mode.mode & mode_nonotice && *data->text != '\001')
|
||||
{
|
||||
sendto_one_numeric(data->source_p, ERR_CANNOTSENDTOCHAN, form_str(ERR_CANNOTSENDTOCHAN), data->chptr->chname);
|
||||
sendto_one_numeric(data->source_p, ERR_CANNOTSENDTOCHAN, form_str(ERR_CANNOTSENDTOCHAN), data->chptr->name.c_str());
|
||||
data->approved = ERR_CANNOTSENDTOCHAN;
|
||||
return;
|
||||
}
|
||||
|
|
|
@ -37,10 +37,10 @@ static void
|
|||
h_can_join(hook_data_channel *data)
|
||||
{
|
||||
struct Client *source_p = data->client;
|
||||
struct Channel *chptr = data->chptr;
|
||||
const auto &chptr(data->chptr);
|
||||
|
||||
if((chptr->mode.mode & mymode) && !IsOper(source_p)) {
|
||||
sendto_one_numeric(source_p, 520, "%s :Cannot join channel (+O) - you are not an IRC operator", chptr->chname);
|
||||
sendto_one_numeric(source_p, 520, "%s :Cannot join channel (+O) - you are not an IRC operator", chptr->name.c_str());
|
||||
data->approved = chan::mode::ERR_CUSTOM;
|
||||
}
|
||||
}
|
||||
|
|
|
@ -10,7 +10,7 @@ static const char chm_operonly_compat[] =
|
|||
|
||||
static int _modinit(void);
|
||||
static void _moddeinit(void);
|
||||
static void chm_operonly(struct Client *source_p, struct Channel *chptr,
|
||||
static void chm_operonly(struct Client *source_p, chan::chan *chptr,
|
||||
int alevel, int parc, int *parn,
|
||||
const char **parv, int *errors, int dir, char c, type type);
|
||||
|
||||
|
@ -35,7 +35,7 @@ _moddeinit(void)
|
|||
}
|
||||
|
||||
static void
|
||||
chm_operonly(struct Client *source_p, struct Channel *chptr,
|
||||
chm_operonly(struct Client *source_p, chan::chan *chptr,
|
||||
int alevel, int parc, int *parn,
|
||||
const char **parv, int *errors, int dir, char c, type type)
|
||||
{
|
||||
|
|
|
@ -42,7 +42,7 @@ hdl_can_kick(hook_data_channel_approval *data)
|
|||
{
|
||||
struct Client *source_p = data->client;
|
||||
struct Client *who = data->target;
|
||||
struct Channel *chptr = data->chptr;
|
||||
const auto &chptr(data->chptr);
|
||||
|
||||
if(IsOper(source_p))
|
||||
return;
|
||||
|
@ -50,9 +50,9 @@ hdl_can_kick(hook_data_channel_approval *data)
|
|||
if((chptr->mode.mode & mymode) && IsOper(who))
|
||||
{
|
||||
sendto_realops_snomask(SNO_GENERAL, L_NETWIDE, "%s attempted to kick %s from %s (which is +M)",
|
||||
source_p->name, who->name, chptr->chname);
|
||||
source_p->name, who->name, chptr->name.c_str());
|
||||
sendto_one_numeric(source_p, ERR_ISCHANSERVICE, "%s %s :Cannot kick IRC operators from that channel.",
|
||||
who->name, chptr->chname);
|
||||
who->name, chptr->name.c_str());
|
||||
data->approved = 0;
|
||||
}
|
||||
}
|
||||
|
|
|
@ -3,8 +3,7 @@
|
|||
* -- jilles
|
||||
*/
|
||||
|
||||
namespace chan = ircd::chan;
|
||||
namespace mode = chan::mode;
|
||||
namespace mode = ircd::chan::mode;
|
||||
using namespace mode;
|
||||
using namespace ircd;
|
||||
|
||||
|
@ -13,7 +12,7 @@ static const char chm_quietunreg_compat_desc[] =
|
|||
|
||||
static int _modinit(void);
|
||||
static void _moddeinit(void);
|
||||
static void chm_quietunreg(struct Client *source_p, struct Channel *chptr,
|
||||
static void chm_quietunreg(struct Client *source_p, chan::chan *chptr,
|
||||
int alevel, int parc, int *parn,
|
||||
const char **parv, int *errors, int dir, char c, type type);
|
||||
|
||||
|
@ -38,7 +37,7 @@ _moddeinit(void)
|
|||
}
|
||||
|
||||
static void
|
||||
chm_quietunreg(struct Client *source_p, struct Channel *chptr,
|
||||
chm_quietunreg(struct Client *source_p, chan::chan *chptr,
|
||||
int alevel, int parc, int *parn,
|
||||
const char **parv, int *errors, int dir, char c, type type)
|
||||
{
|
||||
|
|
|
@ -71,7 +71,7 @@ void hook_privmsg_channel(hook_data_privmsg_channel *const hook)
|
|||
hook->source_p->username,
|
||||
hook->source_p->orighost,
|
||||
hook->source_p->servptr->name,
|
||||
hook->chptr->chname,
|
||||
hook->chptr->name.c_str(),
|
||||
hook->reason?: "filter gave no reason");
|
||||
|
||||
hook->reason = reject_reason;
|
||||
|
|
|
@ -36,11 +36,11 @@ static void
|
|||
h_can_join(hook_data_channel *data)
|
||||
{
|
||||
struct Client *source_p = data->client;
|
||||
struct Channel *chptr = data->chptr;
|
||||
const auto &chptr(data->chptr);
|
||||
|
||||
if((chptr->mode.mode & mymode) && !IsSSLClient(source_p)) {
|
||||
/* XXX This is equal to ERR_THROTTLE */
|
||||
sendto_one_numeric(source_p, 480, "%s :Cannot join channel (+S) - SSL/TLS required", chptr->chname);
|
||||
sendto_one_numeric(source_p, 480, "%s :Cannot join channel (+S) - SSL/TLS required", chptr->name.c_str());
|
||||
data->approved = chan::mode::ERR_CUSTOM;
|
||||
}
|
||||
}
|
||||
|
|
|
@ -10,7 +10,7 @@ static const char chm_sslonly_compat_desc[] =
|
|||
|
||||
static int _modinit(void);
|
||||
static void _moddeinit(void);
|
||||
static void chm_sslonly(struct Client *source_p, struct Channel *chptr,
|
||||
static void chm_sslonly(struct Client *source_p, chan::chan *chptr,
|
||||
int alevel, int parc, int *parn,
|
||||
const char **parv, int *errors, int dir, char c, type type);
|
||||
|
||||
|
@ -35,7 +35,7 @@ _moddeinit(void)
|
|||
}
|
||||
|
||||
static void
|
||||
chm_sslonly(struct Client *source_p, struct Channel *chptr,
|
||||
chm_sslonly(struct Client *source_p, chan::chan *chptr,
|
||||
int alevel, int parc, int *parn,
|
||||
const char **parv, int *errors, int dir, char c, type type)
|
||||
{
|
||||
|
|
|
@ -3,8 +3,7 @@
|
|||
* -- jilles
|
||||
*/
|
||||
|
||||
namespace chan = ircd::chan;
|
||||
namespace mode = chan::mode;
|
||||
namespace mode = ircd::chan::mode;
|
||||
namespace ext = mode::ext;
|
||||
using namespace ircd;
|
||||
|
||||
|
@ -12,7 +11,7 @@ static const char extb_desc[] = "Account ($a) extban type";
|
|||
|
||||
static int _modinit(void);
|
||||
static void _moddeinit(void);
|
||||
static int eb_account(const char *data, struct Client *client_p, struct Channel *chptr, mode::type);
|
||||
static int eb_account(const char *data, struct Client *client_p, chan::chan *chptr, mode::type);
|
||||
|
||||
DECLARE_MODULE_AV2(extb_account, _modinit, _moddeinit, NULL, NULL, NULL, NULL, NULL, extb_desc);
|
||||
|
||||
|
@ -31,7 +30,7 @@ _moddeinit(void)
|
|||
}
|
||||
|
||||
static int eb_account(const char *data, struct Client *client_p,
|
||||
struct Channel *chptr, mode::type type)
|
||||
chan::chan *chptr, mode::type type)
|
||||
{
|
||||
using namespace ext;
|
||||
|
||||
|
|
|
@ -4,8 +4,7 @@
|
|||
* -- nenolod/jilles
|
||||
*/
|
||||
|
||||
namespace chan = ircd::chan;
|
||||
namespace mode = chan::mode;
|
||||
namespace mode = ircd::chan::mode;
|
||||
namespace ext = mode::ext;
|
||||
using namespace ircd;
|
||||
|
||||
|
@ -13,7 +12,7 @@ static const char extb_desc[] = "Can join ($j) extban type - matches users who a
|
|||
|
||||
static int _modinit(void);
|
||||
static void _moddeinit(void);
|
||||
static int eb_canjoin(const char *data, struct Client *client_p, struct Channel *chptr, mode::type type);
|
||||
static int eb_canjoin(const char *data, struct Client *client_p, chan::chan *chptr, mode::type type);
|
||||
|
||||
DECLARE_MODULE_AV2(extb_canjoin, _modinit, _moddeinit, NULL, NULL, NULL, NULL, NULL, extb_desc);
|
||||
|
||||
|
@ -31,12 +30,12 @@ _moddeinit(void)
|
|||
ext::table['j'] = NULL;
|
||||
}
|
||||
|
||||
static int eb_canjoin(const char *data, struct Client *client_p,
|
||||
struct Channel *chptr, mode::type type)
|
||||
static int
|
||||
eb_canjoin(const char *data, struct Client *client_p, chan::chan *chptr, mode::type type)
|
||||
{
|
||||
using namespace ext;
|
||||
|
||||
struct Channel *chptr2;
|
||||
chan::chan *chptr2;
|
||||
int ret;
|
||||
static int recurse = 0;
|
||||
|
||||
|
@ -50,7 +49,7 @@ static int eb_canjoin(const char *data, struct Client *client_p,
|
|||
if (chptr2 == NULL || chptr2 == chptr)
|
||||
return INVALID;
|
||||
/* require consistent target */
|
||||
if (chptr->chname[0] == '#' && data[0] == '&')
|
||||
if (chptr->name[0] == '#' && data[0] == '&')
|
||||
return INVALID;
|
||||
/* this allows getting some information about ban exceptions
|
||||
* but +s/+p doesn't seem the right criterion */
|
||||
|
@ -60,7 +59,7 @@ static int eb_canjoin(const char *data, struct Client *client_p,
|
|||
return INVALID;
|
||||
#endif
|
||||
recurse = 1;
|
||||
ret = is_banned(chptr2, client_p, NULL, NULL, NULL, NULL) == CHFL_BAN ? MATCH : NOMATCH;
|
||||
ret = is_banned(chptr2, client_p, NULL, NULL, NULL, NULL) == mode::BAN ? MATCH : NOMATCH;
|
||||
recurse = 0;
|
||||
return ret;
|
||||
}
|
||||
|
|
|
@ -3,8 +3,7 @@
|
|||
* -- jilles
|
||||
*/
|
||||
|
||||
namespace chan = ircd::chan;
|
||||
namespace mode = chan::mode;
|
||||
namespace mode = ircd::chan::mode;
|
||||
namespace ext = mode::ext;
|
||||
using namespace ircd;
|
||||
|
||||
|
@ -12,7 +11,7 @@ static const char extb_desc[] = "Channel ($c) extban type";
|
|||
|
||||
static int _modinit(void);
|
||||
static void _moddeinit(void);
|
||||
static int eb_channel(const char *data, struct Client *client_p, struct Channel *chptr, mode::type type);
|
||||
static int eb_channel(const char *data, struct Client *client_p, chan::chan *chptr, mode::type type);
|
||||
|
||||
DECLARE_MODULE_AV2(extb_channel, _modinit, _moddeinit, NULL, NULL, NULL, NULL, NULL, extb_desc);
|
||||
|
||||
|
@ -31,24 +30,26 @@ _moddeinit(void)
|
|||
}
|
||||
|
||||
static int eb_channel(const char *data, struct Client *client_p,
|
||||
struct Channel *chptr, mode::type type)
|
||||
chan::chan *chptr, mode::type type)
|
||||
{
|
||||
using namespace ext;
|
||||
|
||||
struct Channel *chptr2;
|
||||
chan::chan *chptr2;
|
||||
|
||||
(void)chptr;
|
||||
|
||||
if (data == NULL)
|
||||
return INVALID;
|
||||
|
||||
chptr2 = find_channel(data);
|
||||
if (chptr2 == NULL)
|
||||
return INVALID;
|
||||
/* require consistent target */
|
||||
if (chptr->chname[0] == '#' && data[0] == '&')
|
||||
if (chptr->name[0] == '#' && data[0] == '&')
|
||||
return INVALID;
|
||||
/* privacy! don't allow +s/+p channels to influence another channel */
|
||||
if (!PubChannel(chptr2) && chptr2 != chptr)
|
||||
if (!pub(chptr2) && chptr2 != chptr)
|
||||
return INVALID;
|
||||
return IsMember(client_p, chptr2) ? MATCH : NOMATCH;
|
||||
|
||||
return is_member(chptr2, client_p)? MATCH : NOMATCH;
|
||||
}
|
||||
|
|
|
@ -37,8 +37,7 @@
|
|||
* I suspect it is, but have done no load testing.
|
||||
*/
|
||||
|
||||
namespace chan = ircd::chan;
|
||||
namespace mode = chan::mode;
|
||||
namespace mode = ircd::chan::mode;
|
||||
namespace ext = mode::ext;
|
||||
using namespace ircd;
|
||||
|
||||
|
@ -50,9 +49,9 @@ static const char extb_desc[] = "Combination ($&, $|) extban types";
|
|||
|
||||
static int _modinit(void);
|
||||
static void _moddeinit(void);
|
||||
static int eb_or(const char *data, struct Client *client_p, struct Channel *chptr, mode::type);
|
||||
static int eb_and(const char *data, struct Client *client_p, struct Channel *chptr, mode::type);
|
||||
static int eb_combi(const char *data, struct Client *client_p, struct Channel *chptr, mode::type, bool is_and);
|
||||
static int eb_or(const char *data, struct Client *client_p, chan::chan *chptr, mode::type);
|
||||
static int eb_and(const char *data, struct Client *client_p, chan::chan *chptr, mode::type);
|
||||
static int eb_combi(const char *data, struct Client *client_p, chan::chan *chptr, mode::type, bool is_and);
|
||||
static int recursion_depth = 0;
|
||||
|
||||
DECLARE_MODULE_AV2(extb_extended, _modinit, _moddeinit, NULL, NULL, NULL, NULL, NULL, extb_desc);
|
||||
|
@ -74,19 +73,19 @@ _moddeinit(void)
|
|||
}
|
||||
|
||||
static int eb_or(const char *data, struct Client *client_p,
|
||||
struct Channel *chptr, mode::type type)
|
||||
chan::chan *chptr, mode::type type)
|
||||
{
|
||||
return eb_combi(data, client_p, chptr, type, false);
|
||||
}
|
||||
|
||||
static int eb_and(const char *data, struct Client *client_p,
|
||||
struct Channel *chptr, mode::type type)
|
||||
chan::chan *chptr, mode::type type)
|
||||
{
|
||||
return eb_combi(data, client_p, chptr, type, true);
|
||||
}
|
||||
|
||||
static int eb_combi(const char *data, struct Client *client_p,
|
||||
struct Channel *chptr, mode::type type, bool is_and)
|
||||
chan::chan *chptr, mode::type type, bool is_and)
|
||||
{
|
||||
using namespace ext;
|
||||
|
||||
|
@ -106,7 +105,7 @@ static int eb_combi(const char *data, struct Client *client_p,
|
|||
}
|
||||
|
||||
datalen = strlen(data);
|
||||
if (datalen > BANLEN) {
|
||||
if (datalen > chan::ban::LEN) {
|
||||
/* I'd be sad if this ever happened, but if it does we
|
||||
* could overflow the buffer used below, so...
|
||||
*/
|
||||
|
@ -146,7 +145,7 @@ static int eb_combi(const char *data, struct Client *client_p,
|
|||
|
||||
while (--allowed_nodes) {
|
||||
bool invert = false;
|
||||
char *child_data, child_data_buf[BANLEN];
|
||||
char *child_data, child_data_buf[chan::ban::LEN];
|
||||
ext::func f;
|
||||
|
||||
if (*p == '~') {
|
||||
|
|
|
@ -4,8 +4,7 @@
|
|||
* - nenolod
|
||||
*/
|
||||
|
||||
namespace chan = ircd::chan;
|
||||
namespace mode = chan::mode;
|
||||
namespace mode = ircd::chan::mode;
|
||||
namespace ext = mode::ext;
|
||||
using namespace ircd;
|
||||
|
||||
|
@ -13,7 +12,7 @@ static const char extb_desc[] = "Extended mask ($x) extban type";
|
|||
|
||||
static int _modinit(void);
|
||||
static void _moddeinit(void);
|
||||
static int eb_extended(const char *data, struct Client *client_p, struct Channel *chptr, mode::type);
|
||||
static int eb_extended(const char *data, struct Client *client_p, chan::chan *chptr, mode::type);
|
||||
|
||||
DECLARE_MODULE_AV2(extb_extended, _modinit, _moddeinit, NULL, NULL, NULL, NULL, NULL, extb_desc);
|
||||
|
||||
|
@ -32,7 +31,7 @@ _moddeinit(void)
|
|||
}
|
||||
|
||||
static int eb_extended(const char *data, struct Client *client_p,
|
||||
struct Channel *chptr, mode::type type)
|
||||
chan::chan *chptr, mode::type type)
|
||||
{
|
||||
using namespace ext;
|
||||
|
||||
|
|
|
@ -3,8 +3,7 @@
|
|||
* -- kaniini
|
||||
*/
|
||||
|
||||
namespace chan = ircd::chan;
|
||||
namespace mode = chan::mode;
|
||||
namespace mode = ircd::chan::mode;
|
||||
namespace ext = mode::ext;
|
||||
using namespace ircd;
|
||||
|
||||
|
@ -12,7 +11,7 @@ static const char extb_desc[] = "Hostmask ($m) extban type";
|
|||
|
||||
static int _modinit(void);
|
||||
static void _moddeinit(void);
|
||||
static int eb_hostmask(const char *data, struct Client *client_p, struct Channel *chptr, mode::type);
|
||||
static int eb_hostmask(const char *data, struct Client *client_p, chan::chan *chptr, mode::type);
|
||||
|
||||
DECLARE_MODULE_AV2(extb_hostmask, _modinit, _moddeinit, NULL, NULL, NULL, NULL, NULL, extb_desc);
|
||||
|
||||
|
@ -30,7 +29,7 @@ _moddeinit(void)
|
|||
}
|
||||
|
||||
static int
|
||||
eb_hostmask(const char *banstr, struct Client *client_p, struct Channel *chptr, mode::type type)
|
||||
eb_hostmask(const char *banstr, struct Client *client_p, chan::chan *chptr, mode::type type)
|
||||
{
|
||||
using namespace ext;
|
||||
|
||||
|
|
|
@ -3,8 +3,7 @@
|
|||
* -- jilles
|
||||
*/
|
||||
|
||||
namespace chan = ircd::chan;
|
||||
namespace mode = chan::mode;
|
||||
namespace mode = ircd::chan::mode;
|
||||
namespace ext = mode::ext;
|
||||
using namespace ircd;
|
||||
|
||||
|
@ -12,7 +11,7 @@ static const char extb_desc[] = "Oper ($o) extban type";
|
|||
|
||||
static int _modinit(void);
|
||||
static void _moddeinit(void);
|
||||
static int eb_oper(const char *data, struct Client *client_p, struct Channel *chptr, mode::type);
|
||||
static int eb_oper(const char *data, struct Client *client_p, chan::chan *chptr, mode::type);
|
||||
|
||||
DECLARE_MODULE_AV2(extb_oper, _modinit, _moddeinit, NULL, NULL, NULL, NULL, NULL, extb_desc);
|
||||
|
||||
|
@ -30,13 +29,11 @@ _moddeinit(void)
|
|||
ext::table['o'] = NULL;
|
||||
}
|
||||
|
||||
static int eb_oper(const char *data, struct Client *client_p,
|
||||
struct Channel *chptr, mode::type type)
|
||||
static int
|
||||
eb_oper(const char *data, struct Client *client_p, chan::chan *chptr, mode::type type)
|
||||
{
|
||||
using namespace ext;
|
||||
|
||||
(void)chptr;
|
||||
|
||||
if (data != NULL)
|
||||
{
|
||||
struct PrivilegeSet *set = privilegeset_get(data);
|
||||
|
|
|
@ -3,8 +3,7 @@
|
|||
* -- jilles
|
||||
*/
|
||||
|
||||
namespace chan = ircd::chan;
|
||||
namespace mode = chan::mode;
|
||||
namespace mode = ircd::chan::mode;
|
||||
namespace ext = mode::ext;
|
||||
using namespace ircd;
|
||||
|
||||
|
@ -12,7 +11,7 @@ static const char extb_desc[] = "Realname/GECOS ($r) extban type";
|
|||
|
||||
static int _modinit(void);
|
||||
static void _moddeinit(void);
|
||||
static int eb_realname(const char *data, struct Client *client_p, struct Channel *chptr, mode::type);
|
||||
static int eb_realname(const char *data, struct Client *client_p, chan::chan *chptr, mode::type);
|
||||
|
||||
DECLARE_MODULE_AV2(extb_realname, _modinit, _moddeinit, NULL, NULL, NULL, NULL, NULL, extb_desc);
|
||||
|
||||
|
@ -30,16 +29,18 @@ _moddeinit(void)
|
|||
ext::table['r'] = NULL;
|
||||
}
|
||||
|
||||
static int eb_realname(const char *data, struct Client *client_p,
|
||||
struct Channel *chptr, mode::type type)
|
||||
static int
|
||||
eb_realname(const char *data, struct Client *client_p, chan::chan *chptr, mode::type type)
|
||||
{
|
||||
using namespace ext;
|
||||
using namespace mode;
|
||||
|
||||
(void)chptr;
|
||||
/* This type is not safe for exceptions */
|
||||
if (type == CHFL_EXCEPTION || type == CHFL_INVEX)
|
||||
if (type == EXCEPTION || type == INVEX)
|
||||
return INVALID;
|
||||
|
||||
if (data == NULL)
|
||||
return INVALID;
|
||||
return match(data, client_p->info) ? MATCH : NOMATCH;
|
||||
|
||||
return match(data, client_p->info)? MATCH : NOMATCH;
|
||||
}
|
||||
|
|
|
@ -3,8 +3,7 @@
|
|||
* -- jilles
|
||||
*/
|
||||
|
||||
namespace chan = ircd::chan;
|
||||
namespace mode = chan::mode;
|
||||
namespace mode = ircd::chan::mode;
|
||||
namespace ext = mode::ext;
|
||||
using namespace ircd;
|
||||
|
||||
|
@ -12,7 +11,7 @@ static const char extb_desc[] = "Server ($s) extban type";
|
|||
|
||||
static int _modinit(void);
|
||||
static void _moddeinit(void);
|
||||
static int eb_server(const char *data, struct Client *client_p, struct Channel *chptr, mode::type);
|
||||
static int eb_server(const char *data, struct Client *client_p, chan::chan *chptr, mode::type);
|
||||
|
||||
DECLARE_MODULE_AV2(extb_server, _modinit, _moddeinit, NULL, NULL, NULL, NULL, NULL, extb_desc);
|
||||
|
||||
|
@ -30,16 +29,18 @@ _moddeinit(void)
|
|||
ext::table['s'] = NULL;
|
||||
}
|
||||
|
||||
static int eb_server(const char *data, struct Client *client_p,
|
||||
struct Channel *chptr, mode::type type)
|
||||
static int
|
||||
eb_server(const char *data, struct Client *client_p, chan::chan *chptr, mode::type type)
|
||||
{
|
||||
using namespace ext;
|
||||
using namespace mode;
|
||||
|
||||
(void)chptr;
|
||||
/* This type is not safe for exceptions */
|
||||
if (type == CHFL_EXCEPTION || type == CHFL_INVEX)
|
||||
if (type == EXCEPTION || type == INVEX)
|
||||
return INVALID;
|
||||
|
||||
if (data == NULL)
|
||||
return INVALID;
|
||||
return match(data, me.name) ? MATCH : NOMATCH;
|
||||
|
||||
return match(data, me.name)? MATCH : NOMATCH;
|
||||
}
|
||||
|
|
|
@ -1,7 +1,6 @@
|
|||
/* SSL extban type: matches ssl users */
|
||||
|
||||
namespace chan = ircd::chan;
|
||||
namespace mode = chan::mode;
|
||||
namespace mode = ircd::chan::mode;
|
||||
namespace ext = mode::ext;
|
||||
using namespace ircd;
|
||||
|
||||
|
@ -9,7 +8,7 @@ static const char extb_desc[] = "SSL/TLS ($z) extban type";
|
|||
|
||||
static int _modinit(void);
|
||||
static void _moddeinit(void);
|
||||
static int eb_ssl(const char *data, struct Client *client_p, struct Channel *chptr, mode::type);
|
||||
static int eb_ssl(const char *data, struct Client *client_p, chan::chan *chptr, mode::type);
|
||||
|
||||
DECLARE_MODULE_AV2(extb_ssl, _modinit, _moddeinit, NULL, NULL, NULL, NULL, NULL, extb_desc);
|
||||
|
||||
|
@ -28,7 +27,7 @@ _moddeinit(void)
|
|||
}
|
||||
|
||||
static int eb_ssl(const char *data, struct Client *client_p,
|
||||
struct Channel *chptr, mode::type type)
|
||||
chan::chan *chptr, mode::type type)
|
||||
{
|
||||
using namespace ext;
|
||||
|
||||
|
|
|
@ -3,8 +3,7 @@
|
|||
* -- nenolod
|
||||
*/
|
||||
|
||||
namespace chan = ircd::chan;
|
||||
namespace mode = chan::mode;
|
||||
namespace mode = ircd::chan::mode;
|
||||
namespace ext = mode::ext;
|
||||
using namespace ircd;
|
||||
|
||||
|
@ -12,7 +11,7 @@ static const char extb_desc[] = "Usermode ($m) extban type";
|
|||
|
||||
static int _modinit(void);
|
||||
static void _moddeinit(void);
|
||||
static int eb_usermode(const char *data, struct Client *client_p, struct Channel *chptr, mode::type);
|
||||
static int eb_usermode(const char *data, struct Client *client_p, chan::chan *chptr, mode::type);
|
||||
|
||||
DECLARE_MODULE_AV2(extb_usermode, _modinit, _moddeinit, NULL, NULL, NULL, NULL, NULL, extb_desc);
|
||||
|
||||
|
@ -31,7 +30,7 @@ _moddeinit(void)
|
|||
}
|
||||
|
||||
static int eb_usermode(const char *data, struct Client *client_p,
|
||||
struct Channel *chptr, mode::type type)
|
||||
chan::chan *chptr, mode::type type)
|
||||
{
|
||||
using namespace ext;
|
||||
|
||||
|
|
|
@ -19,5 +19,5 @@ DECLARE_MODULE_AV2(hide_uncommon_channels, NULL, NULL, NULL, NULL, huc_hfnlist,
|
|||
static void
|
||||
h_huc_doing_whois_channel_visibility(hook_data_client *hdata)
|
||||
{
|
||||
hdata->approved = ((PubChannel(hdata->chptr) && !IsInvisible(hdata->target)) || IsMember((hdata->client), (hdata->chptr)));
|
||||
hdata->approved = (pub(hdata->chptr) && !IsInvisible(hdata->target)) || is_member(hdata->chptr, hdata->client);
|
||||
}
|
||||
|
|
|
@ -42,8 +42,8 @@ static void
|
|||
m_findforwards(struct MsgBuf *msgbuf_p, struct Client *client_p, struct Client *source_p, int parc, const char *parv[])
|
||||
{
|
||||
static time_t last_used = 0;
|
||||
struct Channel *chptr;
|
||||
struct membership *msptr;
|
||||
chan::chan *chptr;
|
||||
chan::membership *msptr;
|
||||
rb_dlink_node *ptr;
|
||||
char buf[414];
|
||||
char *p = buf, *end = buf + sizeof buf - 1;
|
||||
|
@ -76,19 +76,19 @@ m_findforwards(struct MsgBuf *msgbuf_p, struct Client *client_p, struct Client *
|
|||
last_used = rb_current_time();
|
||||
}
|
||||
|
||||
RB_DLINK_FOREACH(ptr, global_channel_list.head)
|
||||
RB_DLINK_FOREACH(ptr, chan::global_channel_list.head)
|
||||
{
|
||||
chptr = (Channel *)ptr->data;
|
||||
chptr = (chan::chan *)ptr->data;
|
||||
if(!irccmp(chptr->mode.forward, parv[1]))
|
||||
{
|
||||
if(p + strlen(chptr->chname) >= end - 13)
|
||||
if(p + chptr->name.size() >= end - 13)
|
||||
{
|
||||
strcpy(p, "<truncated> ");
|
||||
p += 12;
|
||||
break;
|
||||
}
|
||||
strcpy(p, chptr->chname);
|
||||
p += strlen(chptr->chname);
|
||||
strcpy(p, chptr->name.c_str());
|
||||
p += chptr->name.size();
|
||||
*p++ = ' ';
|
||||
}
|
||||
}
|
||||
|
|
|
@ -39,7 +39,7 @@ DECLARE_MODULE_AV2(ojoin, NULL, NULL, ojoin_clist, NULL, NULL, NULL, NULL, ojoin
|
|||
static void
|
||||
mo_ojoin(struct MsgBuf *msgbuf_p, struct Client *client_p, struct Client *source_p, int parc, const char *parv[])
|
||||
{
|
||||
struct Channel *chptr;
|
||||
chan::chan *chptr;
|
||||
int move_me = 0;
|
||||
|
||||
/* admins only */
|
||||
|
@ -62,7 +62,7 @@ mo_ojoin(struct MsgBuf *msgbuf_p, struct Client *client_p, struct Client *source
|
|||
return;
|
||||
}
|
||||
|
||||
if(IsMember(source_p, chptr))
|
||||
if(is_member(chptr, source_p))
|
||||
{
|
||||
sendto_one_notice(source_p, ":Please part %s before using OJOIN", parv[1]);
|
||||
return;
|
||||
|
@ -84,41 +84,41 @@ mo_ojoin(struct MsgBuf *msgbuf_p, struct Client *client_p, struct Client *source
|
|||
|
||||
if(*parv[1] == '@')
|
||||
{
|
||||
add_user_to_channel(chptr, source_p, CHFL_CHANOP);
|
||||
add_user_to_channel(chptr, source_p, chan::CHANOP);
|
||||
sendto_server(client_p, chptr, CAP_TS6, NOCAPS,
|
||||
":%s SJOIN %ld %s + :@%s",
|
||||
me.id, (long) chptr->channelts, chptr->chname, source_p->id);
|
||||
send_channel_join(chptr, source_p);
|
||||
sendto_channel_local(ALL_MEMBERS, chptr, ":%s MODE %s +o %s",
|
||||
me.name, chptr->chname, source_p->name);
|
||||
me.id, (long) chptr->channelts, chptr->name.c_str(), source_p->id);
|
||||
send_join(*chptr, *source_p);
|
||||
sendto_channel_local(chan::ALL_MEMBERS, chptr, ":%s MODE %s +o %s",
|
||||
me.name, chptr->name.c_str(), source_p->name);
|
||||
|
||||
}
|
||||
else if(*parv[1] == '+')
|
||||
{
|
||||
add_user_to_channel(chptr, source_p, CHFL_VOICE);
|
||||
add_user_to_channel(chptr, source_p, chan::VOICE);
|
||||
sendto_server(client_p, chptr, CAP_TS6, NOCAPS,
|
||||
":%s SJOIN %ld %s + :+%s",
|
||||
me.id, (long) chptr->channelts, chptr->chname, source_p->id);
|
||||
send_channel_join(chptr, source_p);
|
||||
sendto_channel_local(ALL_MEMBERS, chptr, ":%s MODE %s +v %s",
|
||||
me.name, chptr->chname, source_p->name);
|
||||
me.id, (long) chptr->channelts, chptr->name.c_str(), source_p->id);
|
||||
send_join(*chptr, *source_p);
|
||||
sendto_channel_local(chan::ALL_MEMBERS, chptr, ":%s MODE %s +v %s",
|
||||
me.name, chptr->name.c_str(), source_p->name);
|
||||
}
|
||||
else
|
||||
{
|
||||
add_user_to_channel(chptr, source_p, CHFL_PEON);
|
||||
add_user_to_channel(chptr, source_p, chan::PEON);
|
||||
sendto_server(client_p, chptr, CAP_TS6, NOCAPS,
|
||||
":%s JOIN %ld %s +",
|
||||
source_p->id, (long) chptr->channelts, chptr->chname);
|
||||
send_channel_join(chptr, source_p);
|
||||
source_p->id, (long) chptr->channelts, chptr->name.c_str());
|
||||
send_join(*chptr, *source_p);
|
||||
}
|
||||
|
||||
/* send the topic... */
|
||||
if(chptr->topic != NULL)
|
||||
if(chptr->topic)
|
||||
{
|
||||
sendto_one(source_p, form_str(RPL_TOPIC), me.name,
|
||||
source_p->name, chptr->chname, chptr->topic);
|
||||
source_p->name, chptr->name.c_str(), chptr->topic.text.c_str());
|
||||
sendto_one(source_p, form_str(RPL_TOPICWHOTIME), me.name,
|
||||
source_p->name, chptr->chname, chptr->topic_info, chptr->topic_time);
|
||||
source_p->name, chptr->name.c_str(), chptr->topic.info.c_str(), chptr->topic.time);
|
||||
}
|
||||
|
||||
source_p->localClient->last_join_time = rb_current_time();
|
||||
|
|
|
@ -47,8 +47,8 @@ mo_okick(struct MsgBuf *msgbuf_p, struct Client *client_p, struct Client *source
|
|||
{
|
||||
struct Client *who;
|
||||
struct Client *target_p;
|
||||
struct Channel *chptr;
|
||||
struct membership *msptr;
|
||||
chan::chan *chptr;
|
||||
chan::membership *msptr;
|
||||
int chasing = 0;
|
||||
char *comment;
|
||||
char *name;
|
||||
|
@ -105,20 +105,20 @@ mo_okick(struct MsgBuf *msgbuf_p, struct Client *client_p, struct Client *source
|
|||
|
||||
sendto_wallops_flags(UMODE_WALLOP, &me,
|
||||
"OKICK called for %s %s by %s!%s@%s",
|
||||
chptr->chname, target_p->name,
|
||||
chptr->name.c_str(), target_p->name,
|
||||
source_p->name, source_p->username, source_p->host);
|
||||
ilog(L_MAIN, "OKICK called for %s %s by %s",
|
||||
chptr->chname, target_p->name,
|
||||
chptr->name.c_str(), target_p->name,
|
||||
get_oper_name(source_p));
|
||||
/* only sends stuff for #channels remotely */
|
||||
sendto_server(NULL, chptr, NOCAPS, NOCAPS,
|
||||
":%s WALLOPS :OKICK called for %s %s by %s!%s@%s",
|
||||
me.name, chptr->chname, target_p->name,
|
||||
me.name, chptr->name.c_str(), target_p->name,
|
||||
source_p->name, source_p->username, source_p->host);
|
||||
|
||||
sendto_channel_local(ALL_MEMBERS, chptr, ":%s KICK %s %s :%s",
|
||||
me.name, chptr->chname, who->name, comment);
|
||||
sendto_channel_local(chan::ALL_MEMBERS, chptr, ":%s KICK %s %s :%s",
|
||||
me.name, chptr->name.c_str(), who->name, comment);
|
||||
sendto_server(&me, chptr, CAP_TS6, NOCAPS,
|
||||
":%s KICK %s %s :%s", me.id, chptr->chname, who->id, comment);
|
||||
":%s KICK %s %s :%s", me.id, chptr->name.c_str(), who->id, comment);
|
||||
remove_user_from_channel(msptr);
|
||||
}
|
||||
|
|
|
@ -45,8 +45,8 @@ DECLARE_MODULE_AV2(omode, NULL, NULL, omode_clist, NULL, NULL, NULL, NULL, omode
|
|||
static void
|
||||
mo_omode(struct MsgBuf *msgbuf_p, struct Client *client_p, struct Client *source_p, int parc, const char *parv[])
|
||||
{
|
||||
struct Channel *chptr = NULL;
|
||||
struct membership *msptr;
|
||||
chan::chan *chptr = NULL;
|
||||
chan::membership *msptr;
|
||||
char params[512];
|
||||
int i;
|
||||
int wasonchannel;
|
||||
|
@ -59,7 +59,7 @@ mo_omode(struct MsgBuf *msgbuf_p, struct Client *client_p, struct Client *source
|
|||
}
|
||||
|
||||
/* Now, try to find the channel in question */
|
||||
if(!rfc1459::is_chan_prefix(parv[1][0]) || !check_channel_name(parv[1]))
|
||||
if(!rfc1459::is_chan_prefix(parv[1][0]) || !chan::check_channel_name(parv[1]))
|
||||
{
|
||||
sendto_one_numeric(source_p, ERR_BADCHANNAME,
|
||||
form_str(ERR_BADCHANNAME), parv[1]);
|
||||
|
@ -99,7 +99,7 @@ mo_omode(struct MsgBuf *msgbuf_p, struct Client *client_p, struct Client *source
|
|||
ilog(L_MAIN, "OMODE called for [%s] [%s] by %s",
|
||||
parv[1], params, get_oper_name(source_p));
|
||||
|
||||
if(*chptr->chname != '&')
|
||||
if(chptr->name[0] != '&')
|
||||
sendto_server(NULL, NULL, NOCAPS, NOCAPS,
|
||||
":%s WALLOPS :OMODE called for [%s] [%s] by %s!%s@%s",
|
||||
me.name, parv[1], params, source_p->name, source_p->username,
|
||||
|
@ -115,25 +115,25 @@ mo_omode(struct MsgBuf *msgbuf_p, struct Client *client_p, struct Client *source
|
|||
if (!wasonchannel)
|
||||
{
|
||||
sendto_one_numeric(source_p, ERR_USERNOTINCHANNEL,
|
||||
form_str(ERR_USERNOTINCHANNEL), parv[3], chptr->chname);
|
||||
form_str(ERR_USERNOTINCHANNEL), parv[3], chptr->name.c_str());
|
||||
return;
|
||||
}
|
||||
sendto_channel_local(ALL_MEMBERS, chptr, ":%s MODE %s +o %s",
|
||||
sendto_channel_local(chan::ALL_MEMBERS, chptr, ":%s MODE %s +o %s",
|
||||
me.name, parv[1], source_p->name);
|
||||
sendto_server(NULL, chptr, CAP_TS6, NOCAPS,
|
||||
":%s TMODE %ld %s +o %s",
|
||||
me.id, (long) chptr->channelts, parv[1],
|
||||
source_p->id);
|
||||
msptr->flags |= CHFL_CHANOP;
|
||||
msptr->flags |= chan::CHANOP;
|
||||
}
|
||||
else
|
||||
{
|
||||
/* Hack it so set_channel_mode() will accept */
|
||||
if (wasonchannel)
|
||||
msptr->flags |= CHFL_CHANOP;
|
||||
msptr->flags |= chan::CHANOP;
|
||||
else
|
||||
{
|
||||
add_user_to_channel(chptr, source_p, CHFL_CHANOP);
|
||||
add_user_to_channel(chptr, source_p, chan::CHANOP);
|
||||
msptr = find_channel_membership(chptr, source_p);
|
||||
}
|
||||
set_channel_mode(client_p, source_p, chptr, msptr,
|
||||
|
@ -142,7 +142,7 @@ mo_omode(struct MsgBuf *msgbuf_p, struct Client *client_p, struct Client *source
|
|||
* themselves as set_channel_mode() does not allow that
|
||||
* -- jilles */
|
||||
if (wasonchannel)
|
||||
msptr->flags &= ~CHFL_CHANOP;
|
||||
msptr->flags &= ~chan::CHANOP;
|
||||
else
|
||||
remove_user_from_channel(msptr);
|
||||
}
|
||||
|
|
|
@ -39,8 +39,8 @@ DECLARE_MODULE_AV2(opme, NULL, NULL, opme_clist, NULL, NULL, NULL, NULL, opme_de
|
|||
static void
|
||||
mo_opme(struct MsgBuf *msgbuf_p, struct Client *client_p, struct Client *source_p, int parc, const char *parv[])
|
||||
{
|
||||
struct Channel *chptr;
|
||||
struct membership *msptr;
|
||||
chan::chan *chptr;
|
||||
chan::membership *msptr;
|
||||
rb_dlink_node *ptr;
|
||||
|
||||
/* admins only */
|
||||
|
@ -59,7 +59,7 @@ mo_opme(struct MsgBuf *msgbuf_p, struct Client *client_p, struct Client *source_
|
|||
|
||||
RB_DLINK_FOREACH(ptr, chptr->members.head)
|
||||
{
|
||||
msptr = (membership *)ptr->data;
|
||||
msptr = (chan::membership *)ptr->data;
|
||||
|
||||
if(is_chanop(msptr))
|
||||
{
|
||||
|
@ -73,7 +73,7 @@ mo_opme(struct MsgBuf *msgbuf_p, struct Client *client_p, struct Client *source_
|
|||
if(msptr == NULL)
|
||||
return;
|
||||
|
||||
msptr->flags |= CHFL_CHANOP;
|
||||
msptr->flags |= chan::CHANOP;
|
||||
|
||||
sendto_wallops_flags(UMODE_WALLOP, &me,
|
||||
"OPME called for [%s] by %s!%s@%s",
|
||||
|
@ -82,7 +82,7 @@ mo_opme(struct MsgBuf *msgbuf_p, struct Client *client_p, struct Client *source_
|
|||
parv[1], get_oper_name(source_p));
|
||||
|
||||
/* dont send stuff for local channels remotely. */
|
||||
if(*chptr->chname != '&')
|
||||
if(chptr->name[0] != '&')
|
||||
{
|
||||
sendto_server(NULL, NULL, NOCAPS, NOCAPS,
|
||||
":%s WALLOPS :OPME called for [%s] by %s!%s@%s",
|
||||
|
@ -93,6 +93,6 @@ mo_opme(struct MsgBuf *msgbuf_p, struct Client *client_p, struct Client *source_
|
|||
me.id, (long) chptr->channelts, parv[1], source_p->id);
|
||||
}
|
||||
|
||||
sendto_channel_local(ALL_MEMBERS, chptr,
|
||||
sendto_channel_local(chan::ALL_MEMBERS, chptr,
|
||||
":%s MODE %s +o %s", me.name, parv[1], source_p->name);
|
||||
}
|
||||
|
|
|
@ -52,9 +52,9 @@ DECLARE_MODULE_AV2(remove, NULL, NULL, remove_clist, NULL, remove_hfnlist, remov
|
|||
static void
|
||||
m_remove(struct MsgBuf *msgbuf_p, struct Client *client_p, struct Client *source_p, int parc, const char *parv[])
|
||||
{
|
||||
struct membership *msptr;
|
||||
chan::membership *msptr;
|
||||
struct Client *who;
|
||||
struct Channel *chptr;
|
||||
chan::chan *chptr;
|
||||
int chasing = 0;
|
||||
char *comment;
|
||||
const char *name;
|
||||
|
@ -89,7 +89,7 @@ m_remove(struct MsgBuf *msgbuf_p, struct Client *client_p, struct Client *source
|
|||
return;
|
||||
}
|
||||
|
||||
if(get_channel_access(source_p, chptr, msptr, MODE_ADD, NULL) < CHFL_CHANOP)
|
||||
if(get_channel_access(source_p, chptr, msptr, MODE_ADD, NULL) < chan::CHANOP)
|
||||
{
|
||||
if(MyConnect(source_p))
|
||||
{
|
||||
|
@ -146,7 +146,7 @@ m_remove(struct MsgBuf *msgbuf_p, struct Client *client_p, struct Client *source
|
|||
if(MyClient(source_p) && IsService(who))
|
||||
{
|
||||
sendto_one(source_p, form_str(ERR_ISCHANSERVICE),
|
||||
me.name, source_p->name, who->name, chptr->chname);
|
||||
me.name, source_p->name, who->name, chptr->name.c_str());
|
||||
return;
|
||||
}
|
||||
|
||||
|
@ -178,17 +178,17 @@ m_remove(struct MsgBuf *msgbuf_p, struct Client *client_p, struct Client *source
|
|||
* - Personally, flame and I believe that server kicks shouldn't
|
||||
* be sent anyways. Just waiting for some oper to abuse it...
|
||||
*/
|
||||
sendto_channel_local(ALL_MEMBERS, chptr,
|
||||
sendto_channel_local(chan::ALL_MEMBERS, chptr,
|
||||
":%s!%s@%s PART %s :requested by %s (%s)",
|
||||
who->name, who->username,
|
||||
who->host, name, source_p->name, comment);
|
||||
|
||||
sendto_server(client_p, chptr, CAP_REMOVE, NOCAPS,
|
||||
":%s REMOVE %s %s :%s",
|
||||
use_id(source_p), chptr->chname, use_id(who), comment);
|
||||
use_id(source_p), chptr->name.c_str(), use_id(who), comment);
|
||||
sendto_server(client_p, chptr, NOCAPS, CAP_REMOVE,
|
||||
":%s KICK %s %s :%s",
|
||||
use_id(source_p), chptr->chname, use_id(who), comment);
|
||||
use_id(source_p), chptr->name.c_str(), use_id(who), comment);
|
||||
|
||||
remove_user_from_channel(msptr);
|
||||
}
|
||||
|
|
|
@ -121,8 +121,8 @@ m_npca(struct MsgBuf *msgbuf_p, struct Client *client_p, struct Client *source_p
|
|||
static void
|
||||
m_displaymsg(struct MsgBuf *msgbuf_p, struct Client *source_p, const char *channel, int underline, int action, const char *nick, const char *text)
|
||||
{
|
||||
struct Channel *chptr;
|
||||
struct membership *msptr;
|
||||
chan::chan *chptr;
|
||||
chan::membership *msptr;
|
||||
char nick2[NICKLEN+1];
|
||||
char nick3[NICKLEN+1];
|
||||
char text3[BUFSIZE];
|
||||
|
@ -143,31 +143,31 @@ m_displaymsg(struct MsgBuf *msgbuf_p, struct Client *source_p, const char *chann
|
|||
if(!(msptr = find_channel_membership(chptr, source_p)))
|
||||
{
|
||||
sendto_one_numeric(source_p, ERR_NOTONCHANNEL,
|
||||
form_str(ERR_NOTONCHANNEL), chptr->chname);
|
||||
form_str(ERR_NOTONCHANNEL), chptr->name.c_str());
|
||||
return;
|
||||
}
|
||||
|
||||
if(!(chptr->mode.mode & chan::mode::table['N'].type))
|
||||
{
|
||||
sendto_one_numeric(source_p, 573, "%s :Roleplay commands are not enabled on this channel.", chptr->chname);
|
||||
sendto_one_numeric(source_p, 573, "%s :Roleplay commands are not enabled on this channel.", chptr->name.c_str());
|
||||
return;
|
||||
}
|
||||
|
||||
if(!can_send(chptr, source_p, msptr))
|
||||
{
|
||||
sendto_one_numeric(source_p, 573, "%s :Cannot send to channel.", chptr->chname);
|
||||
sendto_one_numeric(source_p, 573, "%s :Cannot send to channel.", chptr->name.c_str());
|
||||
return;
|
||||
}
|
||||
|
||||
/* enforce flood stuff on roleplay commands */
|
||||
if(flood_attack_channel(0, source_p, chptr, chptr->chname))
|
||||
if(flood_attack_channel(0, source_p, chptr))
|
||||
return;
|
||||
|
||||
/* enforce target change on roleplay commands */
|
||||
if(!is_chanop_voiced(msptr) && !IsOper(source_p) && !add_channel_target(source_p, chptr))
|
||||
{
|
||||
sendto_one(source_p, form_str(ERR_TARGCHANGE),
|
||||
me.name, source_p->name, chptr->chname);
|
||||
me.name, source_p->name, chptr->name.c_str());
|
||||
return;
|
||||
}
|
||||
|
||||
|
@ -180,7 +180,7 @@ m_displaymsg(struct MsgBuf *msgbuf_p, struct Client *source_p, const char *chann
|
|||
* this prevents nastiness like fake factions, etc. */
|
||||
if(EmptyString(nick3))
|
||||
{
|
||||
sendto_one_numeric(source_p, 573, "%s :No visible non-stripped characters in nick.", chptr->chname);
|
||||
sendto_one_numeric(source_p, 573, "%s :No visible non-stripped characters in nick.", chptr->name.c_str());
|
||||
return;
|
||||
}
|
||||
|
||||
|
@ -191,7 +191,7 @@ m_displaymsg(struct MsgBuf *msgbuf_p, struct Client *source_p, const char *chann
|
|||
else
|
||||
snprintf(text2, sizeof(text2), "%s", text3);
|
||||
|
||||
sendto_channel_local(ALL_MEMBERS, chptr, ":%s!%s@npc.fakeuser.invalid PRIVMSG %s :%s", nick2, source_p->name, channel, text2);
|
||||
sendto_channel_local(chan::ALL_MEMBERS, chptr, ":%s!%s@npc.fakeuser.invalid PRIVMSG %s :%s", nick2, source_p->name, channel, text2);
|
||||
sendto_match_servs(source_p, "*", CAP_ENCAP, NOCAPS, "ENCAP * ROLEPLAY %s %s :%s",
|
||||
channel, nick2, text2);
|
||||
}
|
||||
|
@ -199,12 +199,12 @@ m_displaymsg(struct MsgBuf *msgbuf_p, struct Client *source_p, const char *chann
|
|||
static void
|
||||
me_roleplay(struct MsgBuf *msgbuf_p, struct Client *client_p, struct Client *source_p, int parc, const char *parv[])
|
||||
{
|
||||
struct Channel *chptr;
|
||||
chan::chan *chptr;
|
||||
|
||||
/* Don't segfault if we get ROLEPLAY with an invalid channel.
|
||||
* This shouldn't happen but it's best to be on the safe side. */
|
||||
if((chptr = find_channel(parv[1])) == NULL)
|
||||
return;
|
||||
|
||||
sendto_channel_local(ALL_MEMBERS, chptr, ":%s!%s@npc.fakeuser.invalid PRIVMSG %s :%s", parv[2], source_p->name, parv[1], parv[3]);
|
||||
sendto_channel_local(chan::ALL_MEMBERS, chptr, ":%s!%s@npc.fakeuser.invalid PRIVMSG %s :%s", parv[2], source_p->name, parv[1], parv[3]);
|
||||
}
|
||||
|
|
|
@ -150,7 +150,7 @@ hack_channel_access(void *vdata)
|
|||
if (data->dir == MODE_QUERY)
|
||||
return;
|
||||
|
||||
if (data->approved == CHFL_CHANOP)
|
||||
if (data->approved == chan::CHANOP)
|
||||
return;
|
||||
|
||||
if (data->client->umodes & user_modes['p'])
|
||||
|
@ -161,7 +161,7 @@ hack_channel_access(void *vdata)
|
|||
/* we only want to report modehacks, which are always non-NULL */
|
||||
if (data->modestr)
|
||||
sendto_realops_snomask(SNO_GENERAL, L_NETWIDE, "%s is using oper-override on %s (modehacking: %s)",
|
||||
get_oper_name(data->client), data->chptr->chname, data->modestr);
|
||||
get_oper_name(data->client), data->chptr->name.c_str(), data->modestr);
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -179,7 +179,7 @@ hack_can_join(void *vdata)
|
|||
data->approved = 0;
|
||||
|
||||
sendto_realops_snomask(SNO_GENERAL, L_NETWIDE, "%s is using oper-override on %s (banwalking)",
|
||||
get_oper_name(data->client), data->chptr->chname);
|
||||
get_oper_name(data->client), data->chptr->name.c_str());
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -197,7 +197,7 @@ hack_can_kick(void *vdata)
|
|||
{
|
||||
update_session_deadline(data->client, NULL);
|
||||
sendto_realops_snomask(SNO_GENERAL, L_NETWIDE, "%s is using oper-override on %s (KICK %s)",
|
||||
get_oper_name(data->client), data->chptr->chname, data->target->name);
|
||||
get_oper_name(data->client), data->chptr->name.c_str(), data->target->name);
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -209,18 +209,18 @@ hack_can_send(void *vdata)
|
|||
if (data->dir == MODE_QUERY)
|
||||
return;
|
||||
|
||||
if (data->approved == CAN_SEND_NONOP || data->approved == CAN_SEND_OPV)
|
||||
if (data->approved == chan::CAN_SEND_NONOP || data->approved == chan::CAN_SEND_OPV)
|
||||
return;
|
||||
|
||||
if (data->client->umodes & user_modes['p'])
|
||||
{
|
||||
data->approved = CAN_SEND_NONOP;
|
||||
data->approved = chan::CAN_SEND_NONOP;
|
||||
|
||||
if (MyClient(data->client))
|
||||
{
|
||||
update_session_deadline(data->client, NULL);
|
||||
sendto_realops_snomask(SNO_GENERAL, L_NETWIDE, "%s is using oper-override on %s (forcing message)",
|
||||
get_oper_name(data->client), data->chptr->chname);
|
||||
get_oper_name(data->client), data->chptr->name.c_str());
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
@ -39,13 +39,13 @@ static void
|
|||
h_scc_channel_join(void *vdata)
|
||||
{
|
||||
hook_data_channel_activity *data = (hook_data_channel_activity *)vdata;
|
||||
struct Channel *chptr = data->chptr;
|
||||
const auto chptr(data->chptr);
|
||||
struct Client *source_p = data->client;
|
||||
|
||||
/* If they just joined a channel, and it only has one member, then they just created it. */
|
||||
if(rb_dlink_list_length(&chptr->members) == 1 && is_chanop(find_channel_membership(chptr, source_p)))
|
||||
{
|
||||
sendto_realops_snomask(snomask_modes['l'], L_NETWIDE, "%s is creating new channel %s",
|
||||
source_p->name, chptr->chname);
|
||||
source_p->name, chptr->name.c_str());
|
||||
}
|
||||
}
|
||||
|
|
|
@ -32,6 +32,8 @@
|
|||
#include "spamfilter.h"
|
||||
|
||||
using namespace ircd;
|
||||
using chan::membership;
|
||||
using chan::chan;
|
||||
|
||||
|
||||
/* Conf items & defaults */
|
||||
|
@ -152,22 +154,22 @@ int bloom_test_str(const char *const str)
|
|||
|
||||
|
||||
static
|
||||
int chans_has(const struct Channel *const chptr)
|
||||
int chans_has(const struct chan *const chptr)
|
||||
{
|
||||
return rb_radixtree_retrieve(chans, chptr->chname) != NULL;
|
||||
return rb_radixtree_retrieve(chans, chptr->name.c_str()) != NULL;
|
||||
}
|
||||
|
||||
static
|
||||
int chans_add(struct Channel *const chptr)
|
||||
int chans_add(struct chan *const chan)
|
||||
{
|
||||
if(!rb_radixtree_add(chans, chptr->chname, chptr))
|
||||
if(!rb_radixtree_add(chans, chan->name.c_str(), chan))
|
||||
return 0;
|
||||
|
||||
rb_dlink_node *ptr;
|
||||
RB_DLINK_FOREACH(ptr, chptr->members.head)
|
||||
RB_DLINK_FOREACH(ptr, chan->members.head)
|
||||
{
|
||||
const auto msptr(reinterpret_cast<membership *>(ptr->data));
|
||||
bloom_add_str(msptr->client_p->name);
|
||||
bloom_add_str(msptr->client->name);
|
||||
}
|
||||
|
||||
return 1;
|
||||
|
@ -210,10 +212,10 @@ int prob_test_token(const char *const token)
|
|||
|
||||
static
|
||||
int real_test_token(const char *const token,
|
||||
struct Channel *const chptr)
|
||||
struct chan *const chan)
|
||||
{
|
||||
struct Client *const client = find_named_client(token);
|
||||
return client && IsMember(client, chptr);
|
||||
return client && is_member(chan, client);
|
||||
}
|
||||
|
||||
|
||||
|
@ -286,7 +288,7 @@ int is_delim(const uint8_t *const ptr,
|
|||
|
||||
static unsigned int
|
||||
count_nicks(const char *const text,
|
||||
struct Channel *const chptr)
|
||||
struct chan *const chan)
|
||||
{
|
||||
unsigned int ret = 0;
|
||||
const size_t len = strlen(text);
|
||||
|
@ -305,7 +307,7 @@ count_nicks(const char *const text,
|
|||
rb_strlcpy(token, text+i-j, j+1);
|
||||
if(prob_test_token(token))
|
||||
{
|
||||
if(rb_likely(real_test_token(token, chptr)))
|
||||
if(rb_likely(real_test_token(token, chan)))
|
||||
ret++;
|
||||
else
|
||||
false_positive_message();
|
||||
|
@ -344,7 +346,9 @@ void hook_spamfilter_query(hook_data_privmsg_channel *const hook)
|
|||
static
|
||||
void hook_channel_join(hook_data_channel_approval *const data)
|
||||
{
|
||||
if(~data->chptr->mode.mode & chan::mode::table[uint8_t(MODE_SPAMFILTER)].type)
|
||||
namespace mode = ircd::chan::mode;
|
||||
|
||||
if(~data->chptr->mode.mode & mode::table[uint8_t(MODE_SPAMFILTER)].type)
|
||||
return;
|
||||
|
||||
if(!bloom[0])
|
||||
|
|
|
@ -27,76 +27,56 @@
|
|||
|
||||
#ifdef __cplusplus
|
||||
namespace ircd {
|
||||
namespace chan {
|
||||
|
||||
/* channel status flags */
|
||||
#define CHFL_PEON 0x0000 /* normal member of channel */
|
||||
#define CHFL_VOICE 0x0001 /* the power to speak */
|
||||
#define CHFL_CHANOP 0x0002 /* Channel operator */
|
||||
#define CHFL_BANNED 0x0008 /* cached as banned */
|
||||
#define CHFL_QUIETED 0x0010 /* cached as being +q victim */
|
||||
#define ONLY_SERVERS 0x0020
|
||||
#define ONLY_OPERS 0x0040
|
||||
#define ALL_MEMBERS CHFL_PEON
|
||||
#define ONLY_CHANOPS CHFL_CHANOP
|
||||
#define ONLY_CHANOPSVOICED (CHFL_CHANOP|CHFL_VOICE)
|
||||
|
||||
//TODO: will rm
|
||||
#define CHFL_BAN 0x10000000 /* ban channel flag */
|
||||
#define CHFL_EXCEPTION 0x20000000 /* exception to ban channel flag */
|
||||
#define CHFL_INVEX 0x40000000
|
||||
#define CHFL_QUIET 0x80000000
|
||||
|
||||
// mode structure for channels
|
||||
struct Mode
|
||||
enum status
|
||||
{
|
||||
static constexpr size_t KEYLEN
|
||||
{
|
||||
24 // 23+1 for \0
|
||||
};
|
||||
|
||||
unsigned int mode;
|
||||
int limit;
|
||||
char key[KEYLEN];
|
||||
unsigned int join_num;
|
||||
unsigned int join_time;
|
||||
char forward[LOC_CHANNELLEN + 1];
|
||||
PEON = 0x0000, // normal member of channel
|
||||
VOICE = 0x0001, // the power to speak
|
||||
CHANOP = 0x0002, // Channel operator
|
||||
BANNED = 0x0008, // cached as banned
|
||||
QUIETED = 0x0010, // cached as being +q victim
|
||||
ONLY_OPERS = 0x0020,
|
||||
ONLY_SERVERS = 0x0040,
|
||||
ONLY_CHANOPS = CHANOP,
|
||||
ONLY_CHANOPSVOICED = CHANOP | VOICE,
|
||||
ALL_MEMBERS = PEON,
|
||||
};
|
||||
|
||||
/* channel structure */
|
||||
struct Channel
|
||||
struct topic
|
||||
{
|
||||
rb_dlink_node node;
|
||||
Mode mode;
|
||||
char *mode_lock;
|
||||
char *topic;
|
||||
char *topic_info;
|
||||
time_t topic_time;
|
||||
time_t last_knock; /* don't allow knock to flood */
|
||||
std::string text;
|
||||
std::string info;
|
||||
time_t time = 0;
|
||||
|
||||
rb_dlink_list members; /* channel members */
|
||||
rb_dlink_list locmembers; /* local channel members */
|
||||
operator bool() const;
|
||||
};
|
||||
|
||||
rb_dlink_list invites;
|
||||
rb_dlink_list banlist;
|
||||
rb_dlink_list exceptlist;
|
||||
rb_dlink_list invexlist;
|
||||
rb_dlink_list quietlist;
|
||||
struct ban
|
||||
{
|
||||
static constexpr auto LEN = 195;
|
||||
|
||||
time_t first_received_message_time; /* channel flood control */
|
||||
int received_number_of_privmsgs;
|
||||
int flood_noticed;
|
||||
std::string banstr;
|
||||
std::string who;
|
||||
std::string forward;
|
||||
time_t when;
|
||||
rb_dlink_node node = {0};
|
||||
|
||||
unsigned int join_count; /* joins within delta */
|
||||
unsigned int join_delta; /* last ts of join */
|
||||
ban(const std::string &banstr, const std::string &who, const std::string &forward);
|
||||
};
|
||||
|
||||
time_t bants;
|
||||
time_t channelts;
|
||||
char *chname;
|
||||
struct modes
|
||||
{
|
||||
static constexpr size_t KEYLEN = 24; // 23+1 for \0
|
||||
|
||||
struct Client *last_checked_client;
|
||||
time_t last_checked_ts;
|
||||
unsigned int last_checked_type;
|
||||
int last_checked_result;
|
||||
uint mode;
|
||||
int limit;
|
||||
char key[KEYLEN];
|
||||
uint join_num;
|
||||
uint join_time;
|
||||
char forward[LOC_CHANNELLEN + 1];
|
||||
|
||||
modes();
|
||||
};
|
||||
|
||||
struct membership
|
||||
|
@ -105,127 +85,249 @@ struct membership
|
|||
rb_dlink_node locchannode;
|
||||
rb_dlink_node usernode;
|
||||
|
||||
struct Channel *chptr;
|
||||
struct Client *client_p;
|
||||
struct chan *chan;
|
||||
Client *client;
|
||||
unsigned int flags;
|
||||
|
||||
time_t bants;
|
||||
|
||||
membership();
|
||||
~membership() noexcept;
|
||||
};
|
||||
|
||||
#define BANLEN 195
|
||||
struct Ban
|
||||
bool is_chanop(const membership &);
|
||||
bool is_chanop(const membership *const &);
|
||||
bool is_voiced(const membership &);
|
||||
bool is_voiced(const membership *const &);
|
||||
bool is_chanop_voiced(const membership &);
|
||||
bool is_chanop_voiced(const membership *const &);
|
||||
bool can_send_banned(const membership &);
|
||||
bool can_send_banned(const membership *const &);
|
||||
const char *find_status(const membership *const &msptr, const int &combine);
|
||||
|
||||
struct chan
|
||||
{
|
||||
char *banstr;
|
||||
char *who;
|
||||
time_t when;
|
||||
char *forward;
|
||||
rb_dlink_node node;
|
||||
std::string name;
|
||||
struct modes mode;
|
||||
std::string mode_lock;
|
||||
struct topic topic;
|
||||
|
||||
rb_dlink_list members;
|
||||
rb_dlink_list locmembers;
|
||||
|
||||
rb_dlink_list invites;
|
||||
rb_dlink_list banlist;
|
||||
rb_dlink_list exceptlist;
|
||||
rb_dlink_list invexlist;
|
||||
rb_dlink_list quietlist;
|
||||
|
||||
uint join_count; // joins within delta
|
||||
uint join_delta; // last ts of join
|
||||
uint flood_noticed;
|
||||
int received_number_of_privmsgs;
|
||||
time_t first_received_message_time; // channel flood control
|
||||
time_t last_knock; // don't allow knock to flood
|
||||
time_t bants;
|
||||
time_t channelts;
|
||||
time_t last_checked_ts;
|
||||
client *last_checked_client;
|
||||
uint last_checked_type;
|
||||
int last_checked_result;
|
||||
|
||||
rb_dlink_node node = {0};
|
||||
|
||||
chan(const std::string &name);
|
||||
~chan() noexcept;
|
||||
};
|
||||
|
||||
/* can_send results */
|
||||
#define CAN_SEND_NO 0
|
||||
#define CAN_SEND_NONOP 1
|
||||
#define CAN_SEND_OPV 2
|
||||
bool secret(const chan &);
|
||||
bool secret(const chan *const &);
|
||||
bool hidden(const chan &);
|
||||
bool hidden(const chan *const &);
|
||||
bool pub(const chan &);
|
||||
bool pub(const chan *const &);
|
||||
bool can_show(const chan &, const client &);
|
||||
bool can_show(const chan *const &, const client *const &);
|
||||
bool is_member(const chan &c, const client &);
|
||||
bool is_member(const chan *const &, const client *const &);
|
||||
bool is_name(const char *const &name);
|
||||
|
||||
#define is_chanop(x) ((x) && (x)->flags & CHFL_CHANOP)
|
||||
#define is_voiced(x) ((x) && (x)->flags & CHFL_VOICE)
|
||||
#define is_chanop_voiced(x) ((x) && (x)->flags & (CHFL_CHANOP|CHFL_VOICE))
|
||||
#define can_send_banned(x) ((x) && (x)->flags & (CHFL_BANNED|CHFL_QUIETED))
|
||||
|
||||
/* mode flags for direction indication */
|
||||
#define MODE_QUERY 0
|
||||
#define MODE_ADD 1
|
||||
#define MODE_DEL -1
|
||||
|
||||
//TODO: will inline
|
||||
#define SecretChannel(x) ((x) && ((x)->mode.mode & ircd::chan::mode::SECRET))
|
||||
#define HiddenChannel(x) ((x) && ((x)->mode.mode & ircd::chan::mode::PRIVATE))
|
||||
#define PubChannel(x) ((!x) || ((x)->mode.mode &\
|
||||
(ircd::chan::mode::PRIVATE | ircd::chan::mode::SECRET)) == 0)
|
||||
|
||||
/* channel visible */
|
||||
#define ShowChannel(v,c) (PubChannel(c) || IsMember((v),(c)))
|
||||
|
||||
#define IsMember(who, chan) ((who && who->user && \
|
||||
find_channel_membership(chan, who)) ? 1 : 0)
|
||||
|
||||
#define IsChannelName(name) ((name) && (*(name) == '#' || *(name) == '&'))
|
||||
|
||||
extern rb_dlink_list global_channel_list;
|
||||
void init_channels(void);
|
||||
|
||||
struct Channel *allocate_channel(const char *chname);
|
||||
void free_channel(struct Channel *chptr);
|
||||
struct Ban *allocate_ban(const char *, const char *, const char *);
|
||||
void free_ban(struct Ban *bptr);
|
||||
|
||||
|
||||
extern void destroy_channel(struct Channel *);
|
||||
|
||||
extern int can_send(struct Channel *chptr, struct Client *who,
|
||||
struct membership *);
|
||||
extern bool flood_attack_channel(int p_or_n, struct Client *source_p,
|
||||
struct Channel *chptr, char *chname);
|
||||
extern int is_banned(struct Channel *chptr, struct Client *who,
|
||||
struct membership *msptr, const char *, const char *, const char **);
|
||||
extern int is_quieted(struct Channel *chptr, struct Client *who,
|
||||
struct membership *msptr, const char *, const char *);
|
||||
extern int can_join(struct Client *source_p, struct Channel *chptr,
|
||||
const char *key, const char **forward);
|
||||
|
||||
extern struct membership *find_channel_membership(struct Channel *, struct Client *);
|
||||
extern const char *find_channel_status(struct membership *msptr, int combine);
|
||||
extern void add_user_to_channel(struct Channel *, struct Client *, int flags);
|
||||
extern void remove_user_from_channel(struct membership *);
|
||||
extern void remove_user_from_channels(struct Client *);
|
||||
extern void invalidate_bancache_user(struct Client *);
|
||||
|
||||
extern void free_channel_list(rb_dlink_list *);
|
||||
|
||||
extern bool check_channel_name(const char *name);
|
||||
|
||||
extern void channel_member_names(struct Channel *chptr, struct Client *,
|
||||
int show_eon);
|
||||
|
||||
extern void del_invite(struct Channel *chptr, struct Client *who);
|
||||
|
||||
const char *channel_modes(struct Channel *chptr, struct Client *who);
|
||||
|
||||
extern struct Channel *find_bannickchange_channel(struct Client *client_p);
|
||||
|
||||
extern void check_spambot_warning(struct Client *source_p, const char *name);
|
||||
|
||||
extern void check_splitmode(void *);
|
||||
|
||||
void set_channel_topic(struct Channel *chptr, const char *topic,
|
||||
const char *topic_info, time_t topicts);
|
||||
|
||||
extern void init_chcap_usage_counts(void);
|
||||
extern void set_chcap_usage_counts(struct Client *serv_p);
|
||||
extern void unset_chcap_usage_counts(struct Client *serv_p);
|
||||
extern void send_cap_mode_changes(struct Client *client_p, struct Client *source_p,
|
||||
struct Channel *chptr, chan::mode::change foo[], int);
|
||||
enum : int
|
||||
{
|
||||
CAN_SEND_NO = 0,
|
||||
CAN_SEND_NONOP = 1,
|
||||
CAN_SEND_OPV = 2,
|
||||
};
|
||||
int can_send(chan *, client *, membership *);
|
||||
|
||||
bool flood_attack_channel(int p_or_n, client *source, chan *);
|
||||
int is_banned(chan *, client *who, membership *, const char *, const char *, const char **);
|
||||
int is_quieted(chan *, client *who, membership *, const char *, const char *);
|
||||
int can_join(client *source, chan *, const char *key, const char **forward);
|
||||
void add_user_to_channel(chan *, client *, int flags);
|
||||
void remove_user_from_channel(membership *);
|
||||
void remove_user_from_channels(client *);
|
||||
void invalidate_bancache_user(client *);
|
||||
void free_channel_list(rb_dlink_list *);
|
||||
bool check_channel_name(const char *name);
|
||||
void channel_member_names(chan *, client *, int show_eon);
|
||||
void del_invite(chan *, client *who);
|
||||
const char *channel_modes(chan *, client *who);
|
||||
chan *find_bannickchange_channel(client *);
|
||||
void check_spambot_warning(client *source, const char *name);
|
||||
void check_splitmode(void *);
|
||||
void set_channel_topic(chan *, const char *topic, const char *topic_info, time_t topicts);
|
||||
void init_chcap_usage_counts(void);
|
||||
void set_chcap_usage_counts(client *serv_p);
|
||||
void unset_chcap_usage_counts(client *serv_p);
|
||||
void send_cap_mode_changes(client *, client *source, chan *, mode::change foo[], int);
|
||||
void resv_chan_forcepart(const char *name, const char *reason, int temp_time);
|
||||
|
||||
extern void set_channel_mode(struct Client *client_p, struct Client *source_p,
|
||||
struct Channel *chptr, struct membership *msptr, int parc, const char *parv[]);
|
||||
extern void set_channel_mlock(struct Client *client_p, struct Client *source_p,
|
||||
struct Channel *chptr, const char *newmlock, bool propagate);
|
||||
|
||||
extern bool add_id(struct Client *source_p, struct Channel *chptr, const char *banid,
|
||||
const char *forward, rb_dlink_list * list, long mode_type);
|
||||
|
||||
extern struct Ban * del_id(struct Channel *chptr, const char *banid, rb_dlink_list * list,
|
||||
long mode_type);
|
||||
|
||||
extern int match_extban(const char *banstr, struct Client *client_p, struct Channel *chptr, long mode_type);
|
||||
extern int valid_extban(const char *banstr, struct Client *client_p, struct Channel *chptr, long mode_type);
|
||||
void set_channel_mode(client *, client *source, chan *, membership *, int parc, const char *parv[]);
|
||||
void set_channel_mlock(client *, client *source, chan *, const char *newmlock, bool propagate);
|
||||
bool add_id(client *source, chan *, const char *banid, const char *forward, rb_dlink_list * list, long mode_type);
|
||||
ban *del_id(chan *, const char *banid, rb_dlink_list * list, long mode_type);
|
||||
int match_extban(const char *banstr, client *, chan *, long mode_type);
|
||||
int valid_extban(const char *banstr, client *, chan *, long mode_type);
|
||||
const char * get_extban_string(void);
|
||||
int get_channel_access(client *source, chan *, membership *, int dir, const char *modestr);
|
||||
membership *find_channel_membership(chan *chptr, client *client_p);
|
||||
void send_join(chan &, client &);
|
||||
|
||||
extern int get_channel_access(struct Client *source_p, struct Channel *chptr, struct membership *msptr, int dir, const char *modestr);
|
||||
//extern std::map<std::string, std::unique_ptr<chan>> chans;
|
||||
extern rb_dlink_list global_channel_list;
|
||||
|
||||
extern void send_channel_join(struct Channel *chptr, struct Client *client_p);
|
||||
|
||||
void init();
|
||||
|
||||
|
||||
inline bool
|
||||
secret(const chan &c)
|
||||
{
|
||||
return c.mode.mode & mode::SECRET;
|
||||
}
|
||||
|
||||
inline bool
|
||||
secret(const chan *const &c)
|
||||
{
|
||||
return c && secret(*c);
|
||||
}
|
||||
|
||||
inline bool
|
||||
hidden(const chan &c)
|
||||
{
|
||||
return c.mode.mode & mode::PRIVATE;
|
||||
}
|
||||
|
||||
inline bool
|
||||
hidden(const chan *const &c)
|
||||
{
|
||||
return c && hidden(*c);
|
||||
}
|
||||
|
||||
inline bool
|
||||
pub(const chan &c)
|
||||
{
|
||||
return ~c.mode.mode & (mode::PRIVATE | mode::SECRET);
|
||||
}
|
||||
|
||||
inline bool
|
||||
pub(const chan *const &c)
|
||||
{
|
||||
return !c || pub(*c);
|
||||
}
|
||||
|
||||
inline bool
|
||||
is_member(const chan &c, const client &client)
|
||||
{
|
||||
//return client.user && get(c, client, std::nothrow) != nullptr;
|
||||
return find_channel_membership(const_cast<struct chan *>(&c), const_cast<Client *>(&client)) != nullptr;
|
||||
}
|
||||
|
||||
inline bool
|
||||
is_member(const chan *const &c, const client *const &client)
|
||||
{
|
||||
return c && client && is_member(*c, *client);
|
||||
}
|
||||
|
||||
inline bool
|
||||
can_show(const chan &c, const client &client)
|
||||
{
|
||||
return pub(c) || is_member(c, client);
|
||||
}
|
||||
|
||||
inline bool
|
||||
can_show(const chan *const &c, const client *const &client)
|
||||
{
|
||||
return pub(c) || is_member(c, client);
|
||||
}
|
||||
|
||||
inline bool
|
||||
is_name(const char *const &name)
|
||||
{
|
||||
return name && (*name == '#' || *name == '&');
|
||||
}
|
||||
|
||||
inline bool
|
||||
is_chanop(const membership &m)
|
||||
{
|
||||
return m.flags & CHANOP;
|
||||
}
|
||||
|
||||
inline bool
|
||||
is_chanop(const membership *const &m)
|
||||
{
|
||||
return m && is_chanop(*m);
|
||||
}
|
||||
|
||||
inline bool
|
||||
is_voiced(const membership &m)
|
||||
{
|
||||
return m.flags & VOICE;
|
||||
}
|
||||
|
||||
inline bool
|
||||
is_voiced(const membership *const &m)
|
||||
{
|
||||
return m && is_voiced(*m);
|
||||
}
|
||||
|
||||
inline bool
|
||||
is_chanop_voiced(const membership &m)
|
||||
{
|
||||
return m.flags & (VOICE | CHANOP);
|
||||
}
|
||||
|
||||
inline bool
|
||||
is_chanop_voiced(const membership *const &m)
|
||||
{
|
||||
return m && is_chanop_voiced(*m);
|
||||
}
|
||||
|
||||
inline bool
|
||||
can_send_banned(const membership &m)
|
||||
{
|
||||
return m.flags & (BANNED | QUIETED);
|
||||
}
|
||||
|
||||
inline bool
|
||||
can_send_banned(const membership *const &m)
|
||||
{
|
||||
return m && can_send_banned(*m);
|
||||
}
|
||||
|
||||
inline bool
|
||||
operator!(const topic &topic)
|
||||
{
|
||||
return !bool(topic);
|
||||
}
|
||||
|
||||
inline
|
||||
topic::operator bool()
|
||||
const
|
||||
{
|
||||
return !text.empty();
|
||||
}
|
||||
|
||||
} // namespace chan
|
||||
} // namespace ircd
|
||||
#endif // __cplusplus
|
||||
|
|
|
@ -29,10 +29,19 @@
|
|||
#ifdef __cplusplus
|
||||
namespace ircd {
|
||||
|
||||
struct Channel;
|
||||
struct Client;
|
||||
//TODO: XXX: is actually used for umode and chmode etc
|
||||
enum : int
|
||||
{
|
||||
MODE_DEL = -1,
|
||||
MODE_QUERY = 0,
|
||||
MODE_ADD = 1,
|
||||
};
|
||||
|
||||
namespace chan {
|
||||
|
||||
struct chan;
|
||||
using client = Client; //TODO: XXX: temp
|
||||
|
||||
namespace mode {
|
||||
|
||||
// Maximum mode changes allowed per client, per server is different
|
||||
|
@ -75,20 +84,20 @@ enum type : uint
|
|||
|
||||
struct letter
|
||||
{
|
||||
enum type type;
|
||||
char letter;
|
||||
enum type type = (enum type)0;
|
||||
char letter = '\0';
|
||||
};
|
||||
|
||||
struct change
|
||||
{
|
||||
char letter;
|
||||
const char *arg;
|
||||
const char *id;
|
||||
int dir;
|
||||
int mems;
|
||||
char letter = '\0';
|
||||
const char *arg = nullptr;
|
||||
const char *id = nullptr;
|
||||
int dir = 0;
|
||||
int mems = 0;
|
||||
};
|
||||
|
||||
using func = void (*)(Client *, Channel *, int alevel, int parc, int *parn, const char **parv, int *errors, int dir, char c, type type);
|
||||
using func = void (*)(client *, struct chan *, int alevel, int parc, int *parn, const char **parv, int *errors, int dir, char c, type type);
|
||||
|
||||
struct mode
|
||||
{
|
||||
|
@ -111,12 +120,12 @@ namespace ext
|
|||
MATCH = 1, // matches
|
||||
};
|
||||
|
||||
using func = int (*)(const char *data, Client *, Channel *, type type);
|
||||
using func = int (*)(const char *data, client *, chan *, type type);
|
||||
extern func table[256];
|
||||
}
|
||||
|
||||
#define CHM_FUNCTION(_NAME_) \
|
||||
void _NAME_(Client *source_p, Channel *chptr, \
|
||||
void _NAME_(client *source_p, chan *chptr, \
|
||||
int alevel, int parc, int *parn, const char **parv, \
|
||||
int *errors, int dir, char c, type type);
|
||||
|
||||
|
|
|
@ -60,7 +60,6 @@ extern rb_radixtree *channel_tree;
|
|||
#define HASH_WALK_END }
|
||||
|
||||
struct Client;
|
||||
struct Channel;
|
||||
struct ConfItem;
|
||||
struct nd_entry;
|
||||
|
||||
|
@ -81,9 +80,9 @@ extern void add_to_id_hash(const char *, struct Client *);
|
|||
extern void del_from_id_hash(const char *name, struct Client *client);
|
||||
extern struct Client *find_id(const char *name);
|
||||
|
||||
extern struct Channel *get_or_create_channel(struct Client *client_p, const char *chname, bool *isnew);
|
||||
extern void del_from_channel_hash(const char *name, struct Channel *chan);
|
||||
extern struct Channel *find_channel(const char *name);
|
||||
extern chan::chan *get_or_create_channel(struct Client *client_p, const char *chname, bool *isnew);
|
||||
extern void del_from_channel_hash(const char *name, chan::chan *chan);
|
||||
extern chan::chan *find_channel(const char *name);
|
||||
|
||||
extern void add_to_hostname_hash(const char *, struct Client *);
|
||||
extern void del_from_hostname_hash(const char *, struct Client *);
|
||||
|
|
|
@ -71,29 +71,29 @@ typedef struct
|
|||
{
|
||||
struct Client *client;
|
||||
struct Client *target;
|
||||
struct Channel *chptr;
|
||||
chan::chan *chptr;
|
||||
int approved;
|
||||
} hook_data_client;
|
||||
|
||||
typedef struct
|
||||
{
|
||||
struct Client *client;
|
||||
struct Channel *chptr;
|
||||
chan::chan *chptr;
|
||||
int approved;
|
||||
} hook_data_channel;
|
||||
|
||||
typedef struct
|
||||
{
|
||||
struct Client *client;
|
||||
struct Channel *chptr;
|
||||
chan::chan *chptr;
|
||||
char *key;
|
||||
} hook_data_channel_activity;
|
||||
|
||||
typedef struct
|
||||
{
|
||||
struct Client *client;
|
||||
struct Channel *chptr;
|
||||
struct membership *msptr;
|
||||
chan::chan *chptr;
|
||||
chan::membership *msptr;
|
||||
struct Client *target;
|
||||
int approved;
|
||||
int dir;
|
||||
|
@ -133,7 +133,7 @@ typedef struct
|
|||
{
|
||||
enum message_type msgtype;
|
||||
struct Client *source_p;
|
||||
struct Channel *chptr;
|
||||
chan::chan *chptr;
|
||||
const char *text;
|
||||
int approved;
|
||||
const char *reason;
|
||||
|
|
|
@ -42,7 +42,6 @@
|
|||
namespace ircd {
|
||||
|
||||
struct server_conf;
|
||||
struct Channel;
|
||||
|
||||
/* Capabilities */
|
||||
extern ircd::capability::index serv_capindex; //TODO: namespace
|
||||
|
|
|
@ -29,7 +29,6 @@
|
|||
namespace ircd {
|
||||
|
||||
struct Client;
|
||||
struct Channel;
|
||||
struct monitor;
|
||||
|
||||
/* The nasty global also used in s_serv.c for server bursts */
|
||||
|
@ -48,21 +47,21 @@ extern void sendto_one_prefix(struct Client *target_p, struct Client *source_p,
|
|||
extern void sendto_one_numeric(struct Client *target_p,
|
||||
int numeric, const char *, ...) AFP(3, 4);
|
||||
|
||||
extern void sendto_server(struct Client *one, struct Channel *chptr,
|
||||
extern void sendto_server(struct Client *one, chan::chan *chptr,
|
||||
unsigned long caps, unsigned long nocaps,
|
||||
const char *format, ...) AFP(5, 6);
|
||||
|
||||
extern void sendto_channel_flags(struct Client *one, int type, struct Client *source_p,
|
||||
struct Channel *chptr, const char *, ...) AFP(5, 6);
|
||||
chan::chan *chptr, const char *, ...) AFP(5, 6);
|
||||
extern void sendto_channel_opmod(struct Client *one, struct Client *source_p,
|
||||
struct Channel *chptr, const char *command,
|
||||
chan::chan *chptr, const char *command,
|
||||
const char *text);
|
||||
|
||||
extern void sendto_channel_local(int type, struct Channel *, const char *, ...) AFP(3, 4);
|
||||
extern void sendto_channel_local_butone(struct Client *, int type, struct Channel *, const char *, ...) AFP(4, 5);
|
||||
extern void sendto_channel_local(int type, chan::chan *, const char *, ...) AFP(3, 4);
|
||||
extern void sendto_channel_local_butone(struct Client *, int type, chan::chan *, const char *, ...) AFP(4, 5);
|
||||
|
||||
extern void sendto_channel_local_with_capability(int type, int caps, int negcaps, struct Channel *, const char *, ...) AFP(5, 6);
|
||||
extern void sendto_channel_local_with_capability_butone(struct Client *, int type, int caps, int negcaps, struct Channel *,
|
||||
extern void sendto_channel_local_with_capability(int type, int caps, int negcaps, chan::chan *, const char *, ...) AFP(5, 6);
|
||||
extern void sendto_channel_local_with_capability_butone(struct Client *, int type, int caps, int negcaps, chan::chan *,
|
||||
const char *, ...) AFP(6, 7);
|
||||
|
||||
extern void sendto_common_channels_local(struct Client *, int cap, int negcap, const char *, ...) AFP(4, 5);
|
||||
|
|
|
@ -28,11 +28,11 @@
|
|||
namespace ircd {
|
||||
|
||||
/* finds a channel where source_p has op or voice and target_p is a member */
|
||||
struct Channel *find_allowing_channel(struct Client *source_p, struct Client *target_p);
|
||||
chan::chan *find_allowing_channel(struct Client *source_p, struct Client *target_p);
|
||||
/* checks if source_p is allowed to send to target_p */
|
||||
int add_target(struct Client *source_p, struct Client *target_p);
|
||||
/* checks if source_p is allowed to send to chptr */
|
||||
int add_channel_target(struct Client *source_p, struct Channel *chptr);
|
||||
int add_channel_target(struct Client *source_p, chan::chan *chptr);
|
||||
/* allows source_p to send to target_p */
|
||||
void add_reply_target(struct Client *source_p, struct Client *target_p);
|
||||
|
||||
|
|
|
@ -182,7 +182,7 @@ bandb_handle_ban(char *parv[], int parc)
|
|||
break;
|
||||
|
||||
case 'R':
|
||||
if(IsChannelName(aconf->host))
|
||||
if(chan::is_name(aconf->host))
|
||||
aconf->status = CONF_RESV_CHANNEL;
|
||||
else
|
||||
aconf->status = CONF_RESV_NICK;
|
||||
|
|
552
ircd/channel.cc
552
ircd/channel.cc
File diff suppressed because it is too large
Load diff
183
ircd/chmode.cc
183
ircd/chmode.cc
|
@ -196,18 +196,18 @@ mode::orphan(const uint8_t &c)
|
|||
namespace ircd {
|
||||
|
||||
int
|
||||
get_channel_access(struct Client *source_p, struct Channel *chptr, struct membership *msptr, int dir, const char *modestr)
|
||||
chan::get_channel_access(client *source_p, chan *chptr, membership *msptr, int dir, const char *modestr)
|
||||
{
|
||||
hook_data_channel_approval moduledata;
|
||||
|
||||
if(!MyClient(source_p))
|
||||
return CHFL_CHANOP;
|
||||
return CHANOP;
|
||||
|
||||
moduledata.client = source_p;
|
||||
moduledata.chptr = chptr;
|
||||
moduledata.msptr = msptr;
|
||||
moduledata.target = NULL;
|
||||
moduledata.approved = (msptr != NULL && is_chanop(msptr)) ? CHFL_CHANOP : CHFL_PEON;
|
||||
moduledata.approved = (msptr != NULL && is_chanop(msptr)) ? CHANOP : PEON;
|
||||
moduledata.dir = dir;
|
||||
moduledata.modestr = modestr;
|
||||
|
||||
|
@ -225,27 +225,27 @@ get_channel_access(struct Client *source_p, struct Channel *chptr, struct member
|
|||
* side effects - error message sent on failure
|
||||
*/
|
||||
static bool
|
||||
allow_mode_change(struct Client *source_p, struct Channel *chptr, int alevel,
|
||||
allow_mode_change(struct Client *source_p, chan::chan *chptr, int alevel,
|
||||
int *errors, char c)
|
||||
{
|
||||
/* If this mode char is locked, don't allow local users to change it. */
|
||||
if (MyClient(source_p) && chptr->mode_lock && strchr(chptr->mode_lock, c))
|
||||
if (MyClient(source_p) && !chptr->mode_lock.empty() && strchr(chptr->mode_lock.c_str(), c))
|
||||
{
|
||||
if (!(*errors & SM_ERR_MLOCK))
|
||||
sendto_one_numeric(source_p,
|
||||
ERR_MLOCKRESTRICTED,
|
||||
form_str(ERR_MLOCKRESTRICTED),
|
||||
chptr->chname,
|
||||
chptr->name.c_str(),
|
||||
c,
|
||||
chptr->mode_lock);
|
||||
chptr->mode_lock.c_str());
|
||||
*errors |= SM_ERR_MLOCK;
|
||||
return false;
|
||||
}
|
||||
if(alevel < CHFL_CHANOP)
|
||||
if(alevel < chan::CHANOP)
|
||||
{
|
||||
if(!(*errors & SM_ERR_NOOPS))
|
||||
sendto_one(source_p, form_str(ERR_CHANOPRIVSNEEDED),
|
||||
me.name, source_p->name, chptr->chname);
|
||||
me.name, source_p->name, chptr->name.c_str());
|
||||
*errors |= SM_ERR_NOOPS;
|
||||
return false;
|
||||
}
|
||||
|
@ -259,10 +259,10 @@ allow_mode_change(struct Client *source_p, struct Channel *chptr, int alevel,
|
|||
* side effects - given id is added to the appropriate list
|
||||
*/
|
||||
bool
|
||||
add_id(struct Client *source_p, struct Channel *chptr, const char *banid, const char *forward,
|
||||
chan::add_id(client *source_p, chan *chptr, const char *banid, const char *forward,
|
||||
rb_dlink_list * list, long mode_type)
|
||||
{
|
||||
struct Ban *actualBan;
|
||||
ban *actualBan;
|
||||
static char who[USERHOST_REPLYLEN];
|
||||
char *realban = LOCAL_COPY(banid);
|
||||
rb_dlink_node *ptr;
|
||||
|
@ -275,14 +275,14 @@ add_id(struct Client *source_p, struct Channel *chptr, const char *banid, const
|
|||
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);
|
||||
me.name, source_p->name, chptr->name.c_str(), realban);
|
||||
return false;
|
||||
}
|
||||
|
||||
RB_DLINK_FOREACH(ptr, list->head)
|
||||
{
|
||||
actualBan = (Ban *)ptr->data;
|
||||
if(mask_match(actualBan->banstr, realban))
|
||||
actualBan = (ban *)ptr->data;
|
||||
if(mask_match(actualBan->banstr.c_str(), realban))
|
||||
return false;
|
||||
}
|
||||
}
|
||||
|
@ -291,8 +291,8 @@ add_id(struct Client *source_p, struct Channel *chptr, const char *banid, const
|
|||
{
|
||||
RB_DLINK_FOREACH(ptr, list->head)
|
||||
{
|
||||
actualBan = (Ban *)ptr->data;
|
||||
if(!irccmp(actualBan->banstr, realban))
|
||||
actualBan = (ban *)ptr->data;
|
||||
if(!irccmp(actualBan->banstr.c_str(), realban))
|
||||
return false;
|
||||
}
|
||||
}
|
||||
|
@ -303,7 +303,7 @@ add_id(struct Client *source_p, struct Channel *chptr, const char *banid, const
|
|||
else
|
||||
rb_strlcpy(who, source_p->name, sizeof(who));
|
||||
|
||||
actualBan = allocate_ban(realban, who, forward);
|
||||
actualBan = new ban(realban, who, forward?: std::string{});
|
||||
actualBan->when = rb_current_time();
|
||||
|
||||
rb_dlinkAdd(actualBan, &actualBan->node, list);
|
||||
|
@ -321,20 +321,19 @@ add_id(struct Client *source_p, struct Channel *chptr, const char *banid, const
|
|||
* outputs - pointer to ban that was removed, if any
|
||||
* side effects - given id is removed from the appropriate list and returned
|
||||
*/
|
||||
struct Ban *
|
||||
del_id(struct Channel *chptr, const char *banid, rb_dlink_list * list, long mode_type)
|
||||
chan::ban *
|
||||
chan::del_id(chan *chptr, const char *banid, rb_dlink_list * list, long mode_type)
|
||||
{
|
||||
rb_dlink_node *ptr;
|
||||
struct Ban *banptr;
|
||||
|
||||
if(EmptyString(banid))
|
||||
return NULL;
|
||||
|
||||
RB_DLINK_FOREACH(ptr, list->head)
|
||||
{
|
||||
banptr = (Ban *)ptr->data;
|
||||
auto *const banptr(reinterpret_cast<ban *>(ptr->data));
|
||||
|
||||
if(irccmp(banid, banptr->banstr) == 0)
|
||||
if(irccmp(banid, banptr->banstr.c_str()) == 0)
|
||||
{
|
||||
rb_dlinkDelete(&banptr->node, list);
|
||||
|
||||
|
@ -506,20 +505,20 @@ pretty_mask(const char *idmask)
|
|||
* side effects - numeric sent if not allowed
|
||||
*/
|
||||
static bool
|
||||
check_forward(struct Client *source_p, struct Channel *chptr,
|
||||
check_forward(struct Client *source_p, chan::chan *chptr,
|
||||
const char *forward)
|
||||
{
|
||||
struct Channel *targptr = NULL;
|
||||
struct membership *msptr;
|
||||
chan::chan *targptr = NULL;
|
||||
chan::membership *msptr;
|
||||
|
||||
if(!check_channel_name(forward) ||
|
||||
if(!chan::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 false;
|
||||
}
|
||||
/* don't forward to inconsistent target -- jilles */
|
||||
if(chptr->chname[0] == '#' && forward[0] == '&')
|
||||
if(chptr->name[0] == '#' && forward[0] == '&')
|
||||
{
|
||||
sendto_one_numeric(source_p, ERR_BADCHANNAME,
|
||||
form_str(ERR_BADCHANNAME), forward);
|
||||
|
@ -534,10 +533,10 @@ check_forward(struct Client *source_p, struct Channel *chptr,
|
|||
if(MyClient(source_p) && !(targptr->mode.mode & mode::FREETARGET))
|
||||
{
|
||||
if((msptr = find_channel_membership(targptr, source_p)) == NULL ||
|
||||
get_channel_access(source_p, targptr, msptr, MODE_QUERY, NULL) < CHFL_CHANOP)
|
||||
chan::get_channel_access(source_p, targptr, msptr, MODE_QUERY, NULL) < chan::CHANOP)
|
||||
{
|
||||
sendto_one(source_p, form_str(ERR_CHANOPRIVSNEEDED),
|
||||
me.name, source_p->name, targptr->chname);
|
||||
me.name, source_p->name, targptr->name.c_str());
|
||||
return false;
|
||||
}
|
||||
}
|
||||
|
@ -595,7 +594,7 @@ fix_key_remote(char *arg)
|
|||
* The handlers for each specific mode.
|
||||
*/
|
||||
void
|
||||
mode::functor::nosuch(struct Client *source_p, struct Channel *chptr,
|
||||
mode::functor::nosuch(struct Client *source_p, chan *chptr,
|
||||
int alevel, int parc, int *parn,
|
||||
const char **parv, int *errors, int dir, char c, type mode_type)
|
||||
{
|
||||
|
@ -606,7 +605,7 @@ mode::functor::nosuch(struct Client *source_p, struct Channel *chptr,
|
|||
}
|
||||
|
||||
void
|
||||
mode::functor::simple(struct Client *source_p, struct Channel *chptr,
|
||||
mode::functor::simple(struct Client *source_p, chan *chptr,
|
||||
int alevel, int parc, int *parn,
|
||||
const char **parv, int *errors, int dir, char c, type mode_type)
|
||||
{
|
||||
|
@ -645,7 +644,7 @@ mode::functor::simple(struct Client *source_p, struct Channel *chptr,
|
|||
}
|
||||
|
||||
void
|
||||
mode::functor::orphaned(struct Client *source_p, struct Channel *chptr,
|
||||
mode::functor::orphaned(struct Client *source_p, chan *chptr,
|
||||
int alevel, int parc, int *parn,
|
||||
const char **parv, int *errors, int dir, char c, type mode_type)
|
||||
{
|
||||
|
@ -675,7 +674,7 @@ mode::functor::orphaned(struct Client *source_p, struct Channel *chptr,
|
|||
}
|
||||
|
||||
void
|
||||
mode::functor::hidden(struct Client *source_p, struct Channel *chptr,
|
||||
mode::functor::hidden(struct Client *source_p, chan *chptr,
|
||||
int alevel, int parc, int *parn,
|
||||
const char **parv, int *errors, int dir, char c, type mode_type)
|
||||
{
|
||||
|
@ -722,7 +721,7 @@ mode::functor::hidden(struct Client *source_p, struct Channel *chptr,
|
|||
}
|
||||
|
||||
void
|
||||
mode::functor::staff(struct Client *source_p, struct Channel *chptr,
|
||||
mode::functor::staff(struct Client *source_p, chan *chptr,
|
||||
int alevel, int parc, int *parn,
|
||||
const char **parv, int *errors, int dir, char c, type mode_type)
|
||||
{
|
||||
|
@ -742,7 +741,7 @@ mode::functor::staff(struct Client *source_p, struct Channel *chptr,
|
|||
return;
|
||||
}
|
||||
|
||||
if(!allow_mode_change(source_p, chptr, CHFL_CHANOP, errors, c))
|
||||
if(!allow_mode_change(source_p, chptr, CHANOP, errors, c))
|
||||
return;
|
||||
|
||||
if(MyClient(source_p) && (++mode_limit_simple > MAXMODES_SIMPLE))
|
||||
|
@ -772,7 +771,7 @@ mode::functor::staff(struct Client *source_p, struct Channel *chptr,
|
|||
}
|
||||
|
||||
void
|
||||
mode::functor::ban(struct Client *source_p, struct Channel *chptr,
|
||||
mode::functor::ban(client *source_p, chan *chptr,
|
||||
int alevel, int parc, int *parn,
|
||||
const char **parv, int *errors, int dir, char c, type mode_type)
|
||||
{
|
||||
|
@ -780,7 +779,6 @@ mode::functor::ban(struct Client *source_p, struct Channel *chptr,
|
|||
char *forward;
|
||||
rb_dlink_list *list;
|
||||
rb_dlink_node *ptr;
|
||||
struct Ban *banptr;
|
||||
int errorval;
|
||||
const char *rpl_list_p;
|
||||
const char *rpl_endlist_p;
|
||||
|
@ -788,7 +786,7 @@ mode::functor::ban(struct Client *source_p, struct Channel *chptr,
|
|||
|
||||
switch (mode_type)
|
||||
{
|
||||
case CHFL_BAN:
|
||||
case BAN:
|
||||
list = &chptr->banlist;
|
||||
errorval = SM_ERR_RPL_B;
|
||||
rpl_list_p = form_str(RPL_BANLIST);
|
||||
|
@ -796,7 +794,7 @@ mode::functor::ban(struct Client *source_p, struct Channel *chptr,
|
|||
mems = ALL_MEMBERS;
|
||||
break;
|
||||
|
||||
case CHFL_EXCEPTION:
|
||||
case EXCEPTION:
|
||||
/* if +e is disabled, allow all but +e locally */
|
||||
if(!ConfigChannel.use_except && MyClient(source_p) &&
|
||||
((dir == MODE_ADD) && (parc > *parn)))
|
||||
|
@ -813,7 +811,7 @@ mode::functor::ban(struct Client *source_p, struct Channel *chptr,
|
|||
mems = ONLY_SERVERS;
|
||||
break;
|
||||
|
||||
case CHFL_INVEX:
|
||||
case INVEX:
|
||||
/* if +I is disabled, allow all but +I locally */
|
||||
if(!ConfigChannel.use_invex && MyClient(source_p) &&
|
||||
(dir == MODE_ADD) && (parc > *parn))
|
||||
|
@ -830,7 +828,7 @@ mode::functor::ban(struct Client *source_p, struct Channel *chptr,
|
|||
mems = ONLY_SERVERS;
|
||||
break;
|
||||
|
||||
case CHFL_QUIET:
|
||||
case QUIET:
|
||||
list = &chptr->quietlist;
|
||||
errorval = SM_ERR_RPL_Q;
|
||||
rpl_list_p = form_str(RPL_QUIETLIST);
|
||||
|
@ -851,30 +849,30 @@ mode::functor::ban(struct Client *source_p, struct Channel *chptr,
|
|||
|
||||
/* non-ops cant see +eI lists.. */
|
||||
/* note that this is still permitted if +e/+I are mlocked. */
|
||||
if(alevel < CHFL_CHANOP && mode_type != BAN &&
|
||||
if(alevel < CHANOP && mode_type != BAN &&
|
||||
mode_type != QUIET)
|
||||
{
|
||||
if(!(*errors & SM_ERR_NOOPS))
|
||||
sendto_one(source_p, form_str(ERR_CHANOPRIVSNEEDED),
|
||||
me.name, source_p->name, chptr->chname);
|
||||
me.name, source_p->name, chptr->name.c_str());
|
||||
*errors |= SM_ERR_NOOPS;
|
||||
return;
|
||||
}
|
||||
|
||||
RB_DLINK_FOREACH(ptr, list->head)
|
||||
{
|
||||
char buf[BANLEN];
|
||||
banptr = (Ban *)ptr->data;
|
||||
if(banptr->forward)
|
||||
snprintf(buf, sizeof(buf), "%s$%s", banptr->banstr, banptr->forward);
|
||||
char buf[ban::LEN];
|
||||
auto *const banptr(reinterpret_cast<struct ban *>(ptr->data));
|
||||
if(!banptr->forward.empty())
|
||||
snprintf(buf, sizeof(buf), "%s$%s", banptr->banstr.c_str(), banptr->forward.c_str());
|
||||
else
|
||||
rb_strlcpy(buf, banptr->banstr, sizeof(buf));
|
||||
rb_strlcpy(buf, banptr->banstr.c_str(), sizeof(buf));
|
||||
|
||||
sendto_one(source_p, rpl_list_p,
|
||||
me.name, source_p->name, chptr->chname,
|
||||
buf, banptr->who, banptr->when);
|
||||
me.name, source_p->name, chptr->name.c_str(),
|
||||
buf, banptr->who.c_str(), banptr->when);
|
||||
}
|
||||
sendto_one(source_p, rpl_endlist_p, me.name, source_p->name, chptr->chname);
|
||||
sendto_one(source_p, rpl_endlist_p, me.name, source_p->name, chptr->name.c_str());
|
||||
return;
|
||||
}
|
||||
|
||||
|
@ -906,11 +904,11 @@ mode::functor::ban(struct Client *source_p, struct Channel *chptr,
|
|||
* also make sure it will always fit on a line with channel
|
||||
* name etc.
|
||||
*/
|
||||
if(strlen(mask) > MIN(BANLEN, BUFLEN - 5))
|
||||
if(strlen(mask) > MIN(ban::LEN, BUFLEN - 5))
|
||||
{
|
||||
sendto_one_numeric(source_p, ERR_INVALIDBAN,
|
||||
form_str(ERR_INVALIDBAN),
|
||||
chptr->chname, c, raw_mask);
|
||||
chptr->name.c_str(), c, raw_mask);
|
||||
return;
|
||||
}
|
||||
|
||||
|
@ -934,7 +932,7 @@ mode::functor::ban(struct Client *source_p, struct Channel *chptr,
|
|||
{
|
||||
sendto_one_numeric(source_p, ERR_INVALIDBAN,
|
||||
form_str(ERR_INVALIDBAN),
|
||||
chptr->chname, c, raw_mask);
|
||||
chptr->name.c_str(), c, raw_mask);
|
||||
return;
|
||||
}
|
||||
}
|
||||
|
@ -952,18 +950,18 @@ mode::functor::ban(struct Client *source_p, struct Channel *chptr,
|
|||
{
|
||||
sendto_one_numeric(source_p, ERR_INVALIDBAN,
|
||||
form_str(ERR_INVALIDBAN),
|
||||
chptr->chname, c, raw_mask);
|
||||
chptr->name.c_str(), c, raw_mask);
|
||||
return;
|
||||
}
|
||||
/* check_forward() sends its own error message */
|
||||
if(!check_forward(source_p, chptr, forward))
|
||||
return;
|
||||
/* Forwards only make sense for bans. */
|
||||
if(mode_type != CHFL_BAN)
|
||||
if(mode_type != BAN)
|
||||
{
|
||||
sendto_one_numeric(source_p, ERR_INVALIDBAN,
|
||||
form_str(ERR_INVALIDBAN),
|
||||
chptr->chname, c, raw_mask);
|
||||
chptr->name.c_str(), c, raw_mask);
|
||||
return;
|
||||
}
|
||||
}
|
||||
|
@ -985,8 +983,8 @@ mode::functor::ban(struct Client *source_p, struct Channel *chptr,
|
|||
}
|
||||
else if(dir == MODE_DEL)
|
||||
{
|
||||
struct Ban *removed;
|
||||
static char buf[BANLEN * MAXPARAMS];
|
||||
struct ban *removed;
|
||||
static char buf[ban::LEN * MAXPARAMS];
|
||||
int old_removed_mask_pos = removed_mask_pos;
|
||||
if((removed = del_id(chptr, mask, list, mode_type)) == NULL)
|
||||
{
|
||||
|
@ -995,13 +993,13 @@ mode::functor::ban(struct Client *source_p, struct Channel *chptr,
|
|||
mask = raw_mask;
|
||||
}
|
||||
|
||||
if(removed && removed->forward)
|
||||
removed_mask_pos += snprintf(buf + old_removed_mask_pos, sizeof(buf), "%s$%s", removed->banstr, removed->forward) + 1;
|
||||
if(removed && !removed->forward.empty())
|
||||
removed_mask_pos += snprintf(buf + old_removed_mask_pos, sizeof(buf), "%s$%s", removed->banstr.c_str(), removed->forward.c_str()) + 1;
|
||||
else
|
||||
removed_mask_pos += rb_strlcpy(buf + old_removed_mask_pos, mask, sizeof(buf)) + 1;
|
||||
if(removed)
|
||||
{
|
||||
free_ban(removed);
|
||||
delete removed;
|
||||
removed = NULL;
|
||||
}
|
||||
|
||||
|
@ -1014,13 +1012,13 @@ mode::functor::ban(struct Client *source_p, struct Channel *chptr,
|
|||
}
|
||||
|
||||
void
|
||||
mode::functor::op(struct Client *source_p, struct Channel *chptr,
|
||||
mode::functor::op(client *source_p, chan *chptr,
|
||||
int alevel, int parc, int *parn,
|
||||
const char **parv, int *errors, int dir, char c, type mode_type)
|
||||
{
|
||||
struct membership *mstptr;
|
||||
membership *mstptr;
|
||||
const char *opnick;
|
||||
struct Client *targ_p;
|
||||
client *targ_p;
|
||||
|
||||
if(!allow_mode_change(source_p, chptr, alevel, errors, c))
|
||||
return;
|
||||
|
@ -1049,7 +1047,7 @@ mode::functor::op(struct Client *source_p, struct Channel *chptr,
|
|||
{
|
||||
if(!(*errors & SM_ERR_NOTONCHANNEL) && MyClient(source_p))
|
||||
sendto_one_numeric(source_p, ERR_USERNOTINCHANNEL,
|
||||
form_str(ERR_USERNOTINCHANNEL), opnick, chptr->chname);
|
||||
form_str(ERR_USERNOTINCHANNEL), opnick, chptr->name.c_str());
|
||||
*errors |= SM_ERR_NOTONCHANNEL;
|
||||
return;
|
||||
}
|
||||
|
@ -1059,7 +1057,7 @@ mode::functor::op(struct Client *source_p, struct Channel *chptr,
|
|||
|
||||
if(dir == MODE_ADD)
|
||||
{
|
||||
if(targ_p == source_p && mstptr->flags & CHFL_CHANOP)
|
||||
if(targ_p == source_p && mstptr->flags & CHANOP)
|
||||
return;
|
||||
|
||||
mode_changes[mode_count].letter = c;
|
||||
|
@ -1068,14 +1066,14 @@ mode::functor::op(struct Client *source_p, struct Channel *chptr,
|
|||
mode_changes[mode_count].id = targ_p->id;
|
||||
mode_changes[mode_count++].arg = targ_p->name;
|
||||
|
||||
mstptr->flags |= CHFL_CHANOP;
|
||||
mstptr->flags |= CHANOP;
|
||||
}
|
||||
else
|
||||
{
|
||||
if(MyClient(source_p) && IsService(targ_p))
|
||||
{
|
||||
sendto_one(source_p, form_str(ERR_ISCHANSERVICE),
|
||||
me.name, source_p->name, targ_p->name, chptr->chname);
|
||||
me.name, source_p->name, targ_p->name, chptr->name.c_str());
|
||||
return;
|
||||
}
|
||||
|
||||
|
@ -1085,18 +1083,18 @@ mode::functor::op(struct Client *source_p, struct Channel *chptr,
|
|||
mode_changes[mode_count].id = targ_p->id;
|
||||
mode_changes[mode_count++].arg = targ_p->name;
|
||||
|
||||
mstptr->flags &= ~CHFL_CHANOP;
|
||||
mstptr->flags &= ~CHANOP;
|
||||
}
|
||||
}
|
||||
|
||||
void
|
||||
mode::functor::voice(struct Client *source_p, struct Channel *chptr,
|
||||
mode::functor::voice(client *source_p, chan *chptr,
|
||||
int alevel, int parc, int *parn,
|
||||
const char **parv, int *errors, int dir, char c, type mode_type)
|
||||
{
|
||||
struct membership *mstptr;
|
||||
membership *mstptr;
|
||||
const char *opnick;
|
||||
struct Client *targ_p;
|
||||
client *targ_p;
|
||||
|
||||
if(!allow_mode_change(source_p, chptr, alevel, errors, c))
|
||||
return;
|
||||
|
@ -1125,7 +1123,7 @@ mode::functor::voice(struct Client *source_p, struct Channel *chptr,
|
|||
{
|
||||
if(!(*errors & SM_ERR_NOTONCHANNEL) && MyClient(source_p))
|
||||
sendto_one_numeric(source_p, ERR_USERNOTINCHANNEL,
|
||||
form_str(ERR_USERNOTINCHANNEL), opnick, chptr->chname);
|
||||
form_str(ERR_USERNOTINCHANNEL), opnick, chptr->name.c_str());
|
||||
*errors |= SM_ERR_NOTONCHANNEL;
|
||||
return;
|
||||
}
|
||||
|
@ -1141,7 +1139,7 @@ mode::functor::voice(struct Client *source_p, struct Channel *chptr,
|
|||
mode_changes[mode_count].id = targ_p->id;
|
||||
mode_changes[mode_count++].arg = targ_p->name;
|
||||
|
||||
mstptr->flags |= CHFL_VOICE;
|
||||
mstptr->flags |= VOICE;
|
||||
}
|
||||
else
|
||||
{
|
||||
|
@ -1151,12 +1149,12 @@ mode::functor::voice(struct Client *source_p, struct Channel *chptr,
|
|||
mode_changes[mode_count].id = targ_p->id;
|
||||
mode_changes[mode_count++].arg = targ_p->name;
|
||||
|
||||
mstptr->flags &= ~CHFL_VOICE;
|
||||
mstptr->flags &= ~VOICE;
|
||||
}
|
||||
}
|
||||
|
||||
void
|
||||
mode::functor::limit(struct Client *source_p, struct Channel *chptr,
|
||||
mode::functor::limit(client *source_p, chan *chptr,
|
||||
int alevel, int parc, int *parn,
|
||||
const char **parv, int *errors, int dir, char c, type mode_type)
|
||||
{
|
||||
|
@ -1207,7 +1205,7 @@ mode::functor::limit(struct Client *source_p, struct Channel *chptr,
|
|||
}
|
||||
|
||||
void
|
||||
mode::functor::throttle(struct Client *source_p, struct Channel *chptr,
|
||||
mode::functor::throttle(client *source_p, chan *chptr,
|
||||
int alevel, int parc, int *parn,
|
||||
const char **parv, int *errors, int dir, char c, type mode_type)
|
||||
{
|
||||
|
@ -1260,7 +1258,7 @@ mode::functor::throttle(struct Client *source_p, struct Channel *chptr,
|
|||
}
|
||||
|
||||
void
|
||||
mode::functor::forward(struct Client *source_p, struct Channel *chptr,
|
||||
mode::functor::forward(client *source_p, chan *chptr,
|
||||
int alevel, int parc, int *parn,
|
||||
const char **parv, int *errors, int dir, char c, type mode_type)
|
||||
{
|
||||
|
@ -1276,9 +1274,9 @@ mode::functor::forward(struct Client *source_p, struct Channel *chptr,
|
|||
if (!(*errors & SM_ERR_RPL_F))
|
||||
{
|
||||
if (*chptr->mode.forward == '\0')
|
||||
sendto_one_notice(source_p, ":%s has no forward channel", chptr->chname);
|
||||
sendto_one_notice(source_p, ":%s has no forward channel", chptr->name.c_str());
|
||||
else
|
||||
sendto_one_notice(source_p, ":%s forward channel is %s", chptr->chname, chptr->mode.forward);
|
||||
sendto_one_notice(source_p, ":%s forward channel is %s", chptr->name.c_str(), chptr->mode.forward);
|
||||
*errors |= SM_ERR_RPL_F;
|
||||
}
|
||||
return;
|
||||
|
@ -1336,7 +1334,7 @@ mode::functor::forward(struct Client *source_p, struct Channel *chptr,
|
|||
}
|
||||
|
||||
void
|
||||
mode::functor::key(struct Client *source_p, struct Channel *chptr,
|
||||
mode::functor::key(client *source_p, chan *chptr,
|
||||
int alevel, int parc, int *parn,
|
||||
const char **parv, int *errors, int dir, char c, type mode_type)
|
||||
{
|
||||
|
@ -1413,8 +1411,8 @@ mode::functor::key(struct Client *source_p, struct Channel *chptr,
|
|||
* Extensively modified to be hotpluggable, 03/09/06 -- nenolod
|
||||
*/
|
||||
void
|
||||
set_channel_mode(Client *client_p, Client *source_p,
|
||||
Channel *chptr, membership *msptr, int parc, const char *parv[])
|
||||
chan::set_channel_mode(client *client_p, client *source_p,
|
||||
chan *chptr, membership *msptr, int parc, const char *parv[])
|
||||
{
|
||||
static char modebuf[BUFSIZE];
|
||||
static char parabuf[BUFSIZE];
|
||||
|
@ -1428,7 +1426,7 @@ set_channel_mode(Client *client_p, Client *source_p,
|
|||
int alevel;
|
||||
const char *ml = parv[0];
|
||||
char c;
|
||||
Client *fakesource_p;
|
||||
client *fakesource_p;
|
||||
int reauthorized = 0; /* if we change from MODE_QUERY to MODE_ADD/MODE_DEL, then reauth once, ugly but it works */
|
||||
int flags_list[3] = { ALL_MEMBERS, ONLY_CHANOPS, ONLY_OPERS };
|
||||
|
||||
|
@ -1480,11 +1478,11 @@ set_channel_mode(Client *client_p, Client *source_p,
|
|||
return;
|
||||
|
||||
if(IsServer(source_p))
|
||||
mlen = sprintf(modebuf, ":%s MODE %s ", fakesource_p->name, chptr->chname);
|
||||
mlen = sprintf(modebuf, ":%s MODE %s ", fakesource_p->name, chptr->name.c_str());
|
||||
else
|
||||
mlen = sprintf(modebuf, ":%s!%s@%s MODE %s ",
|
||||
source_p->name, source_p->username,
|
||||
source_p->host, chptr->chname);
|
||||
source_p->host, chptr->name.c_str());
|
||||
|
||||
for(j = 0; j < 3; j++)
|
||||
{
|
||||
|
@ -1573,17 +1571,16 @@ set_channel_mode(Client *client_p, Client *source_p,
|
|||
* side effects - channel mlock is changed / MLOCK is propagated
|
||||
*/
|
||||
void
|
||||
set_channel_mlock(struct Client *client_p, struct Client *source_p,
|
||||
struct Channel *chptr, const char *newmlock, bool propagate)
|
||||
chan::set_channel_mlock(client *client_p, client *source_p,
|
||||
chan *chptr, const char *newmlock, bool propagate)
|
||||
{
|
||||
rb_free(chptr->mode_lock);
|
||||
chptr->mode_lock = newmlock ? rb_strdup(newmlock) : NULL;
|
||||
chptr->mode_lock = newmlock?: std::string{};
|
||||
|
||||
if (propagate)
|
||||
{
|
||||
sendto_server(client_p, NULL, CAP_TS6 | CAP_MLOCK, NOCAPS, ":%s MLOCK %ld %s :%s",
|
||||
source_p->id, (long) chptr->channelts, chptr->chname,
|
||||
chptr->mode_lock ? chptr->mode_lock : "");
|
||||
source_p->id, (long) chptr->channelts, chptr->name.c_str(),
|
||||
chptr->mode_lock.c_str());
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
@ -705,7 +705,7 @@ resv_nick_fnc(const char *mask, const char *reason, int temp_time)
|
|||
|
||||
monitor_signoff(client_p);
|
||||
|
||||
invalidate_bancache_user(client_p);
|
||||
chan::invalidate_bancache_user(client_p);
|
||||
|
||||
sendto_common_channels_local(client_p, NOCAPS, NOCAPS, ":%s!%s@%s NICK :%s",
|
||||
client_p->name, client_p->username, client_p->host, nick);
|
||||
|
@ -759,7 +759,7 @@ update_client_exit_stats(struct Client *client_p)
|
|||
}
|
||||
|
||||
if(splitchecking && !splitmode)
|
||||
check_splitmode(NULL);
|
||||
chan::check_splitmode(NULL);
|
||||
}
|
||||
|
||||
/*
|
||||
|
@ -1261,7 +1261,7 @@ exit_generic_client(struct Client *client_p, struct Client *source_p, struct Cli
|
|||
source_p->name,
|
||||
source_p->username, source_p->host, comment);
|
||||
|
||||
remove_user_from_channels(source_p);
|
||||
chan::remove_user_from_channels(source_p);
|
||||
|
||||
/* Should not be in any channels now */
|
||||
s_assert(source_p->user->channel.head == NULL);
|
||||
|
@ -1269,7 +1269,7 @@ exit_generic_client(struct Client *client_p, struct Client *source_p, struct Cli
|
|||
/* Clean up invitefield */
|
||||
RB_DLINK_FOREACH_SAFE(ptr, next_ptr, source_p->user->invited.head)
|
||||
{
|
||||
del_invite(reinterpret_cast<Channel *>(ptr->data), source_p);
|
||||
del_invite(reinterpret_cast<chan::chan *>(ptr->data), source_p);
|
||||
}
|
||||
|
||||
/* Clean up allow lists */
|
||||
|
|
|
@ -28,7 +28,7 @@ using namespace ext;
|
|||
ext::func ext::table[256] = { NULL };
|
||||
|
||||
int
|
||||
ircd::match_extban(const char *banstr, struct Client *client_p, struct Channel *chptr, long mode_type)
|
||||
chan::match_extban(const char *banstr, client *client_p, chan *chptr, long mode_type)
|
||||
{
|
||||
const char *p;
|
||||
int invert(0), result(INVALID);
|
||||
|
@ -63,7 +63,7 @@ ircd::match_extban(const char *banstr, struct Client *client_p, struct Channel *
|
|||
}
|
||||
|
||||
int
|
||||
ircd::valid_extban(const char *banstr, struct Client *client_p, struct Channel *chptr, long mode_type)
|
||||
chan::valid_extban(const char *banstr, client *client_p, chan *chptr, long mode_type)
|
||||
{
|
||||
const char *p;
|
||||
int result(INVALID);
|
||||
|
@ -92,7 +92,7 @@ ircd::valid_extban(const char *banstr, struct Client *client_p, struct Channel *
|
|||
}
|
||||
|
||||
const char *
|
||||
ircd::get_extban_string(void)
|
||||
chan::get_extban_string(void)
|
||||
{
|
||||
static char e[256];
|
||||
int i, j;
|
||||
|
|
18
ircd/hash.cc
18
ircd/hash.cc
|
@ -218,7 +218,7 @@ del_from_client_hash(const char *name, struct Client *client_p)
|
|||
* removes a channel from the channel hash table
|
||||
*/
|
||||
void
|
||||
del_from_channel_hash(const char *name, struct Channel *chptr)
|
||||
del_from_channel_hash(const char *name, chan::chan *chptr)
|
||||
{
|
||||
s_assert(name != NULL);
|
||||
s_assert(chptr != NULL);
|
||||
|
@ -368,14 +368,14 @@ find_hostname(const char *hostname)
|
|||
*
|
||||
* finds a channel from the channel hash table
|
||||
*/
|
||||
struct Channel *
|
||||
chan::chan *
|
||||
find_channel(const char *name)
|
||||
{
|
||||
s_assert(name != NULL);
|
||||
if(EmptyString(name))
|
||||
return NULL;
|
||||
|
||||
return (Channel *)rb_radixtree_retrieve(channel_tree, name);
|
||||
return (chan::chan *)rb_radixtree_retrieve(channel_tree, name);
|
||||
}
|
||||
|
||||
/*
|
||||
|
@ -389,10 +389,10 @@ find_channel(const char *name)
|
|||
* Get Channel block for chname (and allocate a new channel
|
||||
* block, if it didn't exist before).
|
||||
*/
|
||||
struct Channel *
|
||||
chan::chan *
|
||||
get_or_create_channel(struct Client *client_p, const char *chname, bool *isnew)
|
||||
{
|
||||
struct Channel *chptr;
|
||||
chan::chan *chptr;
|
||||
int len;
|
||||
const char *s = chname;
|
||||
|
||||
|
@ -415,7 +415,7 @@ get_or_create_channel(struct Client *client_p, const char *chname, bool *isnew)
|
|||
s = t;
|
||||
}
|
||||
|
||||
chptr = (Channel *)rb_radixtree_retrieve(channel_tree, s);
|
||||
chptr = (chan::chan *)rb_radixtree_retrieve(channel_tree, s);
|
||||
if (chptr != NULL)
|
||||
{
|
||||
if (isnew != NULL)
|
||||
|
@ -426,11 +426,11 @@ get_or_create_channel(struct Client *client_p, const char *chname, bool *isnew)
|
|||
if(isnew != NULL)
|
||||
*isnew = true;
|
||||
|
||||
chptr = allocate_channel(s);
|
||||
chptr = new chan::chan(s);
|
||||
chptr->channelts = rb_current_time(); /* doesn't hurt to set it here */
|
||||
|
||||
rb_dlinkAdd(chptr, &chptr->node, &global_channel_list);
|
||||
rb_radixtree_add(channel_tree, chptr->chname, chptr);
|
||||
rb_dlinkAdd(chptr, &chptr->node, &chan::global_channel_list);
|
||||
rb_radixtree_add(channel_tree, chptr->name.c_str(), chptr);
|
||||
|
||||
return chptr;
|
||||
}
|
||||
|
|
|
@ -629,7 +629,7 @@ charybdis_main(int argc, char * const argv[])
|
|||
init_host_hash();
|
||||
init_client();
|
||||
init_hook();
|
||||
init_channels();
|
||||
chan::init();
|
||||
initclass();
|
||||
whowas_init();
|
||||
init_reject();
|
||||
|
@ -735,7 +735,7 @@ charybdis_main(int argc, char * const argv[])
|
|||
rb_event_addish("reseed_srand", seed_random, NULL, 300); /* reseed every 10 minutes */
|
||||
|
||||
if(splitmode)
|
||||
check_splitmode_ev = rb_event_add("check_splitmode", check_splitmode, NULL, 5);
|
||||
check_splitmode_ev = rb_event_add("check_splitmode", chan::check_splitmode, NULL, 5);
|
||||
|
||||
print_startup(getpid());
|
||||
|
||||
|
|
|
@ -392,7 +392,7 @@ static void
|
|||
do_numeric(int numeric, struct Client *client_p, struct Client *source_p, int parc, const char *parv[])
|
||||
{
|
||||
struct Client *target_p;
|
||||
struct Channel *chptr;
|
||||
chan::chan *chptr;
|
||||
|
||||
if(parc < 2 || !IsServer(source_p))
|
||||
return;
|
||||
|
@ -473,9 +473,9 @@ do_numeric(int numeric, struct Client *client_p, struct Client *source_p, int pa
|
|||
return;
|
||||
}
|
||||
else if((chptr = find_channel(parv[1])) != NULL)
|
||||
sendto_channel_flags(client_p, ALL_MEMBERS, source_p, chptr,
|
||||
sendto_channel_flags(client_p, chan::ALL_MEMBERS, source_p, chptr,
|
||||
"%03d %s%s",
|
||||
numeric, chptr->chname, buffer);
|
||||
numeric, chptr->name.c_str(), buffer);
|
||||
}
|
||||
|
||||
void
|
||||
|
|
|
@ -504,25 +504,24 @@ burst_ban(struct Client *client_p)
|
|||
* side effects - client is sent a list of +b, +e, or +I modes
|
||||
*/
|
||||
static void
|
||||
burst_modes_TS6(struct Client *client_p, struct Channel *chptr,
|
||||
burst_modes_TS6(struct Client *client_p, chan::chan *chptr,
|
||||
rb_dlink_list *list, char flag)
|
||||
{
|
||||
rb_dlink_node *ptr;
|
||||
struct Ban *banptr;
|
||||
char *t;
|
||||
int tlen;
|
||||
int mlen;
|
||||
int cur_len;
|
||||
|
||||
cur_len = mlen = sprintf(buf, ":%s BMASK %ld %s %c :",
|
||||
me.id, (long) chptr->channelts, chptr->chname, flag);
|
||||
me.id, (long) chptr->channelts, chptr->name.c_str(), flag);
|
||||
t = buf + mlen;
|
||||
|
||||
RB_DLINK_FOREACH(ptr, list->head)
|
||||
{
|
||||
banptr = (Ban *)ptr->data;
|
||||
auto *const banptr(reinterpret_cast<chan::ban *>(ptr->data));
|
||||
|
||||
tlen = strlen(banptr->banstr) + (banptr->forward ? strlen(banptr->forward) + 1 : 0) + 1;
|
||||
tlen = banptr->banstr.size() + (banptr->forward.size() ? strlen(banptr->forward.c_str()) + 1 : 0) + 1;
|
||||
|
||||
/* uh oh */
|
||||
if(cur_len + tlen > BUFSIZE - 3)
|
||||
|
@ -541,10 +540,10 @@ burst_modes_TS6(struct Client *client_p, struct Channel *chptr,
|
|||
t = buf + mlen;
|
||||
}
|
||||
|
||||
if (banptr->forward)
|
||||
sprintf(t, "%s$%s ", banptr->banstr, banptr->forward);
|
||||
if (banptr->forward.size())
|
||||
sprintf(t, "%s$%s ", banptr->banstr.c_str(), banptr->forward.c_str());
|
||||
else
|
||||
sprintf(t, "%s ", banptr->banstr);
|
||||
sprintf(t, "%s ", banptr->banstr.c_str());
|
||||
t += tlen;
|
||||
cur_len += tlen;
|
||||
}
|
||||
|
@ -569,8 +568,8 @@ burst_TS6(struct Client *client_p)
|
|||
{
|
||||
char ubuf[BUFSIZE];
|
||||
struct Client *target_p;
|
||||
struct Channel *chptr;
|
||||
struct membership *msptr;
|
||||
chan::chan *chptr;
|
||||
chan::membership *msptr;
|
||||
hook_data_client hclientinfo;
|
||||
hook_data_channel hchaninfo;
|
||||
rb_dlink_node *ptr;
|
||||
|
@ -638,24 +637,24 @@ burst_TS6(struct Client *client_p)
|
|||
call_hook(h_burst_client, &hclientinfo);
|
||||
}
|
||||
|
||||
RB_DLINK_FOREACH(ptr, global_channel_list.head)
|
||||
RB_DLINK_FOREACH(ptr, chan::global_channel_list.head)
|
||||
{
|
||||
chptr = (Channel *)ptr->data;
|
||||
chptr = (chan::chan *)ptr->data;
|
||||
|
||||
if(*chptr->chname != '#')
|
||||
if(chptr->name[0] != '#')
|
||||
continue;
|
||||
|
||||
cur_len = mlen = sprintf(buf, ":%s SJOIN %ld %s %s :", me.id,
|
||||
(long) chptr->channelts, chptr->chname,
|
||||
(long) chptr->channelts, chptr->name.c_str(),
|
||||
channel_modes(chptr, client_p));
|
||||
|
||||
t = buf + mlen;
|
||||
|
||||
RB_DLINK_FOREACH(uptr, chptr->members.head)
|
||||
{
|
||||
msptr = (membership *)uptr->data;
|
||||
msptr = (chan::membership *)uptr->data;
|
||||
|
||||
tlen = strlen(use_id(msptr->client_p)) + 1;
|
||||
tlen = strlen(use_id(msptr->client)) + 1;
|
||||
if(is_chanop(msptr))
|
||||
tlen++;
|
||||
if(is_voiced(msptr))
|
||||
|
@ -669,8 +668,7 @@ burst_TS6(struct Client *client_p)
|
|||
t = buf + mlen;
|
||||
}
|
||||
|
||||
sprintf(t, "%s%s ", find_channel_status(msptr, 1),
|
||||
use_id(msptr->client_p));
|
||||
sprintf(t, "%s%s ", chan::find_status(msptr, 1), use_id(msptr->client));
|
||||
|
||||
cur_len += tlen;
|
||||
t += tlen;
|
||||
|
@ -697,17 +695,19 @@ burst_TS6(struct Client *client_p)
|
|||
if(rb_dlink_list_length(&chptr->quietlist) > 0)
|
||||
burst_modes_TS6(client_p, chptr, &chptr->quietlist, 'q');
|
||||
|
||||
if(IsCapable(client_p, CAP_TB) && chptr->topic != NULL)
|
||||
if(IsCapable(client_p, CAP_TB) && chptr->topic)
|
||||
sendto_one(client_p, ":%s TB %s %ld %s%s:%s",
|
||||
me.id, chptr->chname, (long) chptr->topic_time,
|
||||
ConfigChannel.burst_topicwho ? chptr->topic_info : "",
|
||||
ConfigChannel.burst_topicwho ? " " : "",
|
||||
chptr->topic);
|
||||
me.id,
|
||||
chptr->name.c_str(),
|
||||
long(chptr->topic.time),
|
||||
ConfigChannel.burst_topicwho? chptr->topic.info.c_str() : "",
|
||||
ConfigChannel.burst_topicwho? " " : "",
|
||||
chptr->topic.text.c_str());
|
||||
|
||||
if(IsCapable(client_p, CAP_MLOCK))
|
||||
sendto_one(client_p, ":%s MLOCK %ld %s :%s",
|
||||
me.id, (long) chptr->channelts, chptr->chname,
|
||||
EmptyString(chptr->mode_lock) ? "" : chptr->mode_lock);
|
||||
me.id, (long) chptr->channelts, chptr->name.c_str(),
|
||||
chptr->mode_lock.c_str());
|
||||
|
||||
hchaninfo.chptr = chptr;
|
||||
call_hook(h_burst_channel, &hchaninfo);
|
||||
|
|
|
@ -134,10 +134,10 @@ show_lusers(struct Client *source_p)
|
|||
form_str(RPL_LUSERUNKNOWN),
|
||||
(int)rb_dlink_list_length(&unknown_list));
|
||||
|
||||
if(rb_dlink_list_length(&global_channel_list) > 0)
|
||||
if(rb_dlink_list_length(&chan::global_channel_list) > 0)
|
||||
sendto_one_numeric(source_p, RPL_LUSERCHANNELS,
|
||||
form_str(RPL_LUSERCHANNELS),
|
||||
rb_dlink_list_length(&global_channel_list));
|
||||
rb_dlink_list_length(&chan::global_channel_list));
|
||||
|
||||
sendto_one_numeric(source_p, RPL_LUSERME, form_str(RPL_LUSERME),
|
||||
(int)rb_dlink_list_length(&lclient_list),
|
||||
|
@ -1472,8 +1472,8 @@ change_nick_user_host(struct Client *target_p, const char *nick, const char *use
|
|||
const char *host, int newts, const char *format, ...)
|
||||
{
|
||||
rb_dlink_node *ptr;
|
||||
struct Channel *chptr;
|
||||
struct membership *mscptr;
|
||||
chan::chan *chptr;
|
||||
chan::membership *mscptr;
|
||||
int changed = irccmp(target_p->name, nick);
|
||||
int changed_case = strcmp(target_p->name, nick);
|
||||
int do_qjm = irccmp(target_p->username, user) || irccmp(target_p->host, host);
|
||||
|
@ -1487,7 +1487,7 @@ change_nick_user_host(struct Client *target_p, const char *nick, const char *use
|
|||
target_p->tsinfo = newts;
|
||||
monitor_signoff(target_p);
|
||||
}
|
||||
invalidate_bancache_user(target_p);
|
||||
chan::invalidate_bancache_user(target_p);
|
||||
|
||||
if(do_qjm)
|
||||
{
|
||||
|
@ -1501,8 +1501,8 @@ change_nick_user_host(struct Client *target_p, const char *nick, const char *use
|
|||
|
||||
RB_DLINK_FOREACH(ptr, target_p->user->channel.head)
|
||||
{
|
||||
mscptr = (membership *)ptr->data;
|
||||
chptr = mscptr->chptr;
|
||||
mscptr = (chan::membership *)ptr->data;
|
||||
chptr = mscptr->chan;
|
||||
mptr = mode;
|
||||
|
||||
if(is_chanop(mscptr))
|
||||
|
@ -1520,16 +1520,16 @@ change_nick_user_host(struct Client *target_p, const char *nick, const char *use
|
|||
|
||||
*mptr = '\0';
|
||||
|
||||
sendto_channel_local_with_capability_butone(target_p, ALL_MEMBERS, NOCAPS, CLICAP_EXTENDED_JOIN | CLICAP_CHGHOST, chptr,
|
||||
":%s!%s@%s JOIN %s", nick, user, host, chptr->chname);
|
||||
sendto_channel_local_with_capability_butone(target_p, ALL_MEMBERS, CLICAP_EXTENDED_JOIN, CLICAP_CHGHOST, chptr,
|
||||
":%s!%s@%s JOIN %s %s :%s", nick, user, host, chptr->chname,
|
||||
sendto_channel_local_with_capability_butone(target_p, chan::ALL_MEMBERS, NOCAPS, CLICAP_EXTENDED_JOIN | CLICAP_CHGHOST, chptr,
|
||||
":%s!%s@%s JOIN %s", nick, user, host, chptr->name.c_str());
|
||||
sendto_channel_local_with_capability_butone(target_p, chan::ALL_MEMBERS, CLICAP_EXTENDED_JOIN, CLICAP_CHGHOST, chptr,
|
||||
":%s!%s@%s JOIN %s %s :%s", nick, user, host, chptr->name.c_str(),
|
||||
EmptyString(target_p->user->suser) ? "*" : target_p->user->suser,
|
||||
target_p->info);
|
||||
|
||||
if(*mode)
|
||||
sendto_channel_local_with_capability_butone(target_p, ALL_MEMBERS, NOCAPS, CLICAP_CHGHOST, chptr,
|
||||
":%s MODE %s +%s %s", target_p->servptr->name, chptr->chname, mode, modeval);
|
||||
sendto_channel_local_with_capability_butone(target_p, chan::ALL_MEMBERS, NOCAPS, CLICAP_CHGHOST, chptr,
|
||||
":%s MODE %s +%s %s", target_p->servptr->name, chptr->name.c_str(), mode, modeval);
|
||||
|
||||
*modeval = '\0';
|
||||
}
|
||||
|
|
90
ircd/send.cc
90
ircd/send.cc
|
@ -428,7 +428,7 @@ sendto_one_numeric(struct Client *target_p, int numeric, const char *pattern, ..
|
|||
* -davidt
|
||||
*/
|
||||
void
|
||||
sendto_server(struct Client *one, struct Channel *chptr, unsigned long caps,
|
||||
sendto_server(struct Client *one, chan::chan *chptr, unsigned long caps,
|
||||
unsigned long nocaps, const char *format, ...)
|
||||
{
|
||||
va_list args;
|
||||
|
@ -441,7 +441,7 @@ sendto_server(struct Client *one, struct Channel *chptr, unsigned long caps,
|
|||
if(rb_dlink_list_length(&serv_list) == 0)
|
||||
return;
|
||||
|
||||
if(chptr != NULL && *chptr->chname != '#')
|
||||
if(chptr != NULL && chptr->name[0] != '#')
|
||||
return;
|
||||
|
||||
rb_linebuf_newbuf(&linebuf);
|
||||
|
@ -479,14 +479,14 @@ sendto_server(struct Client *one, struct Channel *chptr, unsigned long caps,
|
|||
*/
|
||||
void
|
||||
sendto_channel_flags(struct Client *one, int type, struct Client *source_p,
|
||||
struct Channel *chptr, const char *pattern, ...)
|
||||
chan::chan *chptr, const char *pattern, ...)
|
||||
{
|
||||
char buf[BUFSIZE];
|
||||
va_list args;
|
||||
buf_head_t rb_linebuf_local;
|
||||
buf_head_t rb_linebuf_id;
|
||||
struct Client *target_p;
|
||||
struct membership *msptr;
|
||||
chan::membership *msptr;
|
||||
rb_dlink_node *ptr;
|
||||
rb_dlink_node *next_ptr;
|
||||
int current_capmask = 0;
|
||||
|
@ -508,8 +508,8 @@ sendto_channel_flags(struct Client *one, int type, struct Client *source_p,
|
|||
|
||||
RB_DLINK_FOREACH_SAFE(ptr, next_ptr, chptr->members.head)
|
||||
{
|
||||
msptr = (membership *)ptr->data;
|
||||
target_p = msptr->client_p;
|
||||
msptr = (chan::membership *)ptr->data;
|
||||
target_p = msptr->client;
|
||||
|
||||
if(!MyClient(source_p) && (IsIOError(target_p->from) || target_p->from == one))
|
||||
continue;
|
||||
|
@ -566,14 +566,14 @@ sendto_channel_flags(struct Client *one, int type, struct Client *source_p,
|
|||
*/
|
||||
void
|
||||
sendto_channel_opmod(struct Client *one, struct Client *source_p,
|
||||
struct Channel *chptr, const char *command,
|
||||
chan::chan *chptr, const char *command,
|
||||
const char *text)
|
||||
{
|
||||
buf_head_t rb_linebuf_local;
|
||||
buf_head_t rb_linebuf_old;
|
||||
buf_head_t rb_linebuf_new;
|
||||
struct Client *target_p;
|
||||
struct membership *msptr;
|
||||
chan::membership *msptr;
|
||||
rb_dlink_node *ptr;
|
||||
rb_dlink_node *next_ptr;
|
||||
|
||||
|
@ -586,30 +586,30 @@ sendto_channel_opmod(struct Client *one, struct Client *source_p,
|
|||
if(IsServer(source_p))
|
||||
rb_linebuf_putmsg(&rb_linebuf_local, NULL, NULL,
|
||||
":%s %s %s :%s",
|
||||
source_p->name, command, chptr->chname, text);
|
||||
source_p->name, command, chptr->name.c_str(), text);
|
||||
else
|
||||
rb_linebuf_putmsg(&rb_linebuf_local, NULL, NULL,
|
||||
":%s!%s@%s %s %s :%s",
|
||||
source_p->name, source_p->username,
|
||||
source_p->host, command, chptr->chname, text);
|
||||
source_p->host, command, chptr->name.c_str(), text);
|
||||
|
||||
if (chptr->mode.mode & chan::mode::MODERATED)
|
||||
rb_linebuf_putmsg(&rb_linebuf_old, NULL, NULL,
|
||||
":%s %s %s :%s",
|
||||
use_id(source_p), command, chptr->chname, text);
|
||||
use_id(source_p), command, chptr->name.c_str(), text);
|
||||
else
|
||||
rb_linebuf_putmsg(&rb_linebuf_old, NULL, NULL,
|
||||
":%s NOTICE @%s :<%s:%s> %s",
|
||||
use_id(source_p->servptr), chptr->chname,
|
||||
source_p->name, chptr->chname, text);
|
||||
use_id(source_p->servptr), chptr->name.c_str(),
|
||||
source_p->name, chptr->name.c_str(), text);
|
||||
rb_linebuf_putmsg(&rb_linebuf_new, NULL, NULL,
|
||||
":%s %s =%s :%s",
|
||||
use_id(source_p), command, chptr->chname, text);
|
||||
use_id(source_p), command, chptr->name.c_str(), text);
|
||||
|
||||
RB_DLINK_FOREACH_SAFE(ptr, next_ptr, chptr->members.head)
|
||||
{
|
||||
msptr = (membership *)ptr->data;
|
||||
target_p = msptr->client_p;
|
||||
msptr = (chan::membership *)ptr->data;
|
||||
target_p = msptr->client;
|
||||
|
||||
if(!MyClient(source_p) && (IsIOError(target_p->from) || target_p->from == one))
|
||||
continue;
|
||||
|
@ -617,7 +617,7 @@ sendto_channel_opmod(struct Client *one, struct Client *source_p,
|
|||
if(MyClient(source_p) && !IsCapable(source_p, CLICAP_ECHO_MESSAGE) && target_p == one)
|
||||
continue;
|
||||
|
||||
if((msptr->flags & CHFL_CHANOP) == 0)
|
||||
if((msptr->flags & chan::CHANOP) == 0)
|
||||
continue;
|
||||
|
||||
if(IsDeaf(target_p))
|
||||
|
@ -656,11 +656,11 @@ sendto_channel_opmod(struct Client *one, struct Client *source_p,
|
|||
* side effects -
|
||||
*/
|
||||
void
|
||||
sendto_channel_local(int type, struct Channel *chptr, const char *pattern, ...)
|
||||
sendto_channel_local(int type, chan::chan *chptr, const char *pattern, ...)
|
||||
{
|
||||
va_list args;
|
||||
buf_head_t linebuf;
|
||||
struct membership *msptr;
|
||||
chan::membership *msptr;
|
||||
struct Client *target_p;
|
||||
rb_dlink_node *ptr;
|
||||
rb_dlink_node *next_ptr;
|
||||
|
@ -673,13 +673,13 @@ sendto_channel_local(int type, struct Channel *chptr, const char *pattern, ...)
|
|||
|
||||
RB_DLINK_FOREACH_SAFE(ptr, next_ptr, chptr->locmembers.head)
|
||||
{
|
||||
msptr = (membership *)ptr->data;
|
||||
target_p = msptr->client_p;
|
||||
msptr = (chan::membership *)ptr->data;
|
||||
target_p = msptr->client;
|
||||
|
||||
if(IsIOError(target_p))
|
||||
continue;
|
||||
|
||||
if(type == ONLY_OPERS)
|
||||
if(type == chan::ONLY_OPERS)
|
||||
{
|
||||
if (!IsOper(target_p))
|
||||
continue;
|
||||
|
@ -699,11 +699,11 @@ sendto_channel_local(int type, struct Channel *chptr, const char *pattern, ...)
|
|||
* Shared implementation of sendto_channel_local_with_capability and sendto_channel_local_with_capability_butone
|
||||
*/
|
||||
static void
|
||||
_sendto_channel_local_with_capability_butone(struct Client *one, int type, int caps, int negcaps, struct Channel *chptr,
|
||||
_sendto_channel_local_with_capability_butone(struct Client *one, int type, int caps, int negcaps, chan::chan *chptr,
|
||||
const char *pattern, va_list * args)
|
||||
{
|
||||
buf_head_t linebuf;
|
||||
struct membership *msptr;
|
||||
chan::membership *msptr;
|
||||
struct Client *target_p;
|
||||
rb_dlink_node *ptr;
|
||||
rb_dlink_node *next_ptr;
|
||||
|
@ -713,8 +713,8 @@ _sendto_channel_local_with_capability_butone(struct Client *one, int type, int c
|
|||
|
||||
RB_DLINK_FOREACH_SAFE(ptr, next_ptr, chptr->locmembers.head)
|
||||
{
|
||||
msptr = (membership *)ptr->data;
|
||||
target_p = msptr->client_p;
|
||||
msptr = (chan::membership *)ptr->data;
|
||||
target_p = msptr->client;
|
||||
|
||||
if (target_p == one)
|
||||
continue;
|
||||
|
@ -740,7 +740,7 @@ _sendto_channel_local_with_capability_butone(struct Client *one, int type, int c
|
|||
* side effects -
|
||||
*/
|
||||
void
|
||||
sendto_channel_local_with_capability(int type, int caps, int negcaps, struct Channel *chptr, const char *pattern, ...)
|
||||
sendto_channel_local_with_capability(int type, int caps, int negcaps, chan::chan *chptr, const char *pattern, ...)
|
||||
{
|
||||
va_list args;
|
||||
|
||||
|
@ -757,7 +757,7 @@ sendto_channel_local_with_capability(int type, int caps, int negcaps, struct Cha
|
|||
* side effects -
|
||||
*/
|
||||
void
|
||||
sendto_channel_local_with_capability_butone(struct Client *one, int type, int caps, int negcaps, struct Channel *chptr,
|
||||
sendto_channel_local_with_capability_butone(struct Client *one, int type, int caps, int negcaps, chan::chan *chptr,
|
||||
const char *pattern, ...)
|
||||
{
|
||||
va_list args;
|
||||
|
@ -776,11 +776,11 @@ sendto_channel_local_with_capability_butone(struct Client *one, int type, int ca
|
|||
* side effects -
|
||||
*/
|
||||
void
|
||||
sendto_channel_local_butone(struct Client *one, int type, struct Channel *chptr, const char *pattern, ...)
|
||||
sendto_channel_local_butone(struct Client *one, int type, chan::chan *chptr, const char *pattern, ...)
|
||||
{
|
||||
va_list args;
|
||||
buf_head_t linebuf;
|
||||
struct membership *msptr;
|
||||
chan::membership *msptr;
|
||||
struct Client *target_p;
|
||||
struct MsgBuf msgbuf;
|
||||
rb_dlink_node *ptr;
|
||||
|
@ -796,8 +796,8 @@ sendto_channel_local_butone(struct Client *one, int type, struct Channel *chptr,
|
|||
|
||||
RB_DLINK_FOREACH_SAFE(ptr, next_ptr, chptr->locmembers.head)
|
||||
{
|
||||
msptr = (membership *)ptr->data;
|
||||
target_p = msptr->client_p;
|
||||
msptr = (chan::membership *)ptr->data;
|
||||
target_p = msptr->client;
|
||||
|
||||
if(target_p == one)
|
||||
continue;
|
||||
|
@ -835,10 +835,10 @@ sendto_common_channels_local(struct Client *user, int cap, int negcap, const cha
|
|||
rb_dlink_node *next_ptr;
|
||||
rb_dlink_node *uptr;
|
||||
rb_dlink_node *next_uptr;
|
||||
struct Channel *chptr;
|
||||
chan::chan *chptr;
|
||||
struct Client *target_p;
|
||||
struct membership *msptr;
|
||||
struct membership *mscptr;
|
||||
chan::membership *msptr;
|
||||
chan::membership *mscptr;
|
||||
buf_head_t linebuf;
|
||||
|
||||
rb_linebuf_newbuf(&linebuf);
|
||||
|
@ -850,13 +850,13 @@ sendto_common_channels_local(struct Client *user, int cap, int negcap, const cha
|
|||
|
||||
RB_DLINK_FOREACH_SAFE(ptr, next_ptr, user->user->channel.head)
|
||||
{
|
||||
mscptr = (membership *)ptr->data;
|
||||
chptr = mscptr->chptr;
|
||||
mscptr = (chan::membership *)ptr->data;
|
||||
chptr = mscptr->chan;
|
||||
|
||||
RB_DLINK_FOREACH_SAFE(uptr, next_uptr, chptr->locmembers.head)
|
||||
{
|
||||
msptr = (membership *)uptr->data;
|
||||
target_p = msptr->client_p;
|
||||
msptr = (chan::membership *)uptr->data;
|
||||
target_p = msptr->client;
|
||||
|
||||
if(IsIOError(target_p) ||
|
||||
target_p->serial == current_serial ||
|
||||
|
@ -892,15 +892,17 @@ sendto_common_channels_local(struct Client *user, int cap, int negcap, const cha
|
|||
void
|
||||
sendto_common_channels_local_butone(struct Client *user, int cap, int negcap, const char *pattern, ...)
|
||||
{
|
||||
using chan::membership;
|
||||
|
||||
va_list args;
|
||||
rb_dlink_node *ptr;
|
||||
rb_dlink_node *next_ptr;
|
||||
rb_dlink_node *uptr;
|
||||
rb_dlink_node *next_uptr;
|
||||
struct Channel *chptr;
|
||||
chan::chan *chptr;
|
||||
struct Client *target_p;
|
||||
struct membership *msptr;
|
||||
struct membership *mscptr;
|
||||
membership *msptr;
|
||||
membership *mscptr;
|
||||
buf_head_t linebuf;
|
||||
|
||||
rb_linebuf_newbuf(&linebuf);
|
||||
|
@ -916,12 +918,12 @@ sendto_common_channels_local_butone(struct Client *user, int cap, int negcap, co
|
|||
RB_DLINK_FOREACH_SAFE(ptr, next_ptr, user->user->channel.head)
|
||||
{
|
||||
mscptr = (membership *)ptr->data;
|
||||
chptr = mscptr->chptr;
|
||||
chptr = mscptr->chan;
|
||||
|
||||
RB_DLINK_FOREACH_SAFE(uptr, next_uptr, chptr->locmembers.head)
|
||||
{
|
||||
msptr = (membership *)uptr->data;
|
||||
target_p = msptr->client_p;
|
||||
target_p = msptr->client;
|
||||
|
||||
if(IsIOError(target_p) ||
|
||||
target_p->serial == current_serial ||
|
||||
|
|
|
@ -285,7 +285,7 @@ isupport_extban(const void *ptr)
|
|||
const char *p;
|
||||
static char result[200];
|
||||
|
||||
p = get_extban_string();
|
||||
p = chan::get_extban_string();
|
||||
if (EmptyString(p))
|
||||
return NULL;
|
||||
snprintf(result, sizeof result, "$,%s", p);
|
||||
|
|
|
@ -26,17 +26,17 @@ namespace ircd {
|
|||
|
||||
static int add_hashed_target(struct Client *source_p, uint32_t hashv);
|
||||
|
||||
struct Channel *
|
||||
chan::chan *
|
||||
find_allowing_channel(struct Client *source_p, struct Client *target_p)
|
||||
{
|
||||
rb_dlink_node *ptr;
|
||||
struct membership *msptr;
|
||||
chan::membership *msptr;
|
||||
|
||||
RB_DLINK_FOREACH(ptr, source_p->user->channel.head)
|
||||
{
|
||||
msptr = (membership *)ptr->data;
|
||||
if (is_chanop_voiced(msptr) && IsMember(target_p, msptr->chptr))
|
||||
return msptr->chptr;
|
||||
msptr = (chan::membership *)ptr->data;
|
||||
if (is_chanop_voiced(msptr) && is_member(msptr->chan, target_p))
|
||||
return msptr->chan;
|
||||
}
|
||||
return NULL;
|
||||
}
|
||||
|
@ -63,14 +63,14 @@ add_target(struct Client *source_p, struct Client *target_p)
|
|||
}
|
||||
|
||||
int
|
||||
add_channel_target(struct Client *source_p, struct Channel *chptr)
|
||||
add_channel_target(struct Client *source_p, chan::chan *chptr)
|
||||
{
|
||||
uint32_t hashv;
|
||||
|
||||
if(!ConfigChannel.channel_target_change)
|
||||
return 1;
|
||||
|
||||
hashv = fnv_hash_upper((const unsigned char *)chptr->chname, 32);
|
||||
hashv = fnv_hash_upper((const unsigned char *)chptr->name.c_str(), 32);
|
||||
return add_hashed_target(source_p, hashv);
|
||||
}
|
||||
|
||||
|
|
|
@ -44,7 +44,7 @@ chm_noctcp_process(hook_data_privmsg_channel *data)
|
|||
|
||||
if (*data->text == '\001' && rb_strncasecmp(data->text + 1, "ACTION ", 7) && data->chptr->mode.mode & mode_noctcp)
|
||||
{
|
||||
sendto_one_numeric(data->source_p, ERR_CANNOTSENDTOCHAN, form_str(ERR_CANNOTSENDTOCHAN), data->chptr->chname);
|
||||
sendto_one_numeric(data->source_p, ERR_CANNOTSENDTOCHAN, form_str(ERR_CANNOTSENDTOCHAN), data->chptr->name.c_str());
|
||||
data->approved = ERR_CANNOTSENDTOCHAN;
|
||||
return;
|
||||
}
|
||||
|
|
|
@ -94,7 +94,7 @@ ms_ban(struct MsgBuf *msgbuf_p, struct Client *client_p, struct Client *source_p
|
|||
stype = "X-Line";
|
||||
break;
|
||||
case 'R':
|
||||
ntype = IsChannelName(parv[3]) ? CONF_RESV_CHANNEL :
|
||||
ntype = chan::is_name(parv[3]) ? CONF_RESV_CHANNEL :
|
||||
CONF_RESV_NICK;
|
||||
stype = "RESV";
|
||||
break;
|
||||
|
@ -299,7 +299,7 @@ ms_ban(struct MsgBuf *msgbuf_p, struct Client *client_p, struct Client *source_p
|
|||
if (!(aconf->status & CONF_ILLEGAL))
|
||||
{
|
||||
add_to_resv_hash(aconf->host, aconf);
|
||||
resv_chan_forcepart(aconf->host, aconf->passwd, hold - now);
|
||||
chan::resv_chan_forcepart(aconf->host, aconf->passwd, hold - now);
|
||||
}
|
||||
break;
|
||||
case CONF_RESV_NICK:
|
||||
|
|
|
@ -57,11 +57,9 @@ static void do_join_0(struct Client *client_p, struct Client *source_p);
|
|||
static bool check_channel_name_loc(struct Client *source_p, const char *name);
|
||||
static void send_join_error(struct Client *source_p, int numeric, const char *name);
|
||||
|
||||
static void set_final_mode(struct Mode *mode, struct Mode *oldmode);
|
||||
static void remove_our_modes(struct Channel *chptr, struct Client *source_p);
|
||||
|
||||
static void remove_ban_list(struct Channel *chptr, struct Client *source_p,
|
||||
rb_dlink_list * list, char c, int mems);
|
||||
static void set_final_mode(chan::modes *mode, chan::modes *oldmode);
|
||||
static void remove_our_modes(chan::chan *chptr, struct Client *source_p);
|
||||
static void remove_ban_list(chan::chan *chptr, struct Client *source_p, rb_dlink_list * list, char c, int mems);
|
||||
|
||||
static char modebuf[chan::mode::BUFLEN];
|
||||
static char parabuf[chan::mode::BUFLEN];
|
||||
|
@ -72,8 +70,8 @@ static int pargs;
|
|||
/* Check what we will forward to, without sending any notices to the user
|
||||
* -- jilles
|
||||
*/
|
||||
static struct Channel *
|
||||
check_forward(struct Client *source_p, struct Channel *chptr,
|
||||
static chan::chan *
|
||||
check_forward(struct Client *source_p, chan::chan *chptr,
|
||||
char *key, int *err)
|
||||
{
|
||||
int depth = 0, i;
|
||||
|
@ -103,13 +101,13 @@ check_forward(struct Client *source_p, struct Channel *chptr,
|
|||
* on the channel, and it looks hostile otherwise.
|
||||
* --Elizafox
|
||||
*/
|
||||
if (IsMember(source_p, chptr))
|
||||
if (is_member(chptr, source_p))
|
||||
{
|
||||
*err = ERR_USERONCHANNEL; /* I'm borrowing this for now. --Elizafox */
|
||||
return NULL;
|
||||
}
|
||||
/* Juped. Sending a warning notice would be unfair */
|
||||
if (hash_find_resv(chptr->chname))
|
||||
if (hash_find_resv(chptr->name.c_str()))
|
||||
return NULL;
|
||||
/* Don't forward to +Q channel */
|
||||
if (chptr->mode.mode & chan::mode::DISFORWARD)
|
||||
|
@ -133,7 +131,7 @@ static void
|
|||
m_join(struct MsgBuf *msgbuf_p, struct Client *client_p, struct Client *source_p, int parc, const char *parv[])
|
||||
{
|
||||
static char jbuf[BUFSIZE];
|
||||
struct Channel *chptr = NULL, *chptr2 = NULL;
|
||||
chan::chan *chptr = NULL, *chptr2 = NULL;
|
||||
struct ConfItem *aconf;
|
||||
char *name;
|
||||
char *key = NULL;
|
||||
|
@ -167,7 +165,7 @@ m_join(struct MsgBuf *msgbuf_p, struct Client *client_p, struct Client *source_p
|
|||
}
|
||||
|
||||
/* check it begins with # or &, and local chans are disabled */
|
||||
else if(!IsChannelName(name) ||
|
||||
else if(!chan::is_name(name) ||
|
||||
( ConfigChannel.disable_local_channels && name[0] == '&'))
|
||||
{
|
||||
sendto_one_numeric(source_p, ERR_NOSUCHCHANNEL,
|
||||
|
@ -233,7 +231,7 @@ m_join(struct MsgBuf *msgbuf_p, struct Client *client_p, struct Client *source_p
|
|||
/* look for the channel */
|
||||
if((chptr = find_channel(name)) != NULL)
|
||||
{
|
||||
if(IsMember(source_p, chptr))
|
||||
if(is_member(chptr, source_p))
|
||||
continue;
|
||||
|
||||
flags = 0;
|
||||
|
@ -264,7 +262,7 @@ m_join(struct MsgBuf *msgbuf_p, struct Client *client_p, struct Client *source_p
|
|||
continue;
|
||||
}
|
||||
|
||||
flags = CHFL_CHANOP;
|
||||
flags = chan::CHANOP;
|
||||
}
|
||||
|
||||
if((rb_dlink_list_length(&source_p->user->channel) >=
|
||||
|
@ -302,13 +300,13 @@ m_join(struct MsgBuf *msgbuf_p, struct Client *client_p, struct Client *source_p
|
|||
continue;
|
||||
}
|
||||
else if(chptr != chptr2)
|
||||
sendto_one_numeric(source_p, ERR_LINKCHANNEL, form_str(ERR_LINKCHANNEL), name, chptr2->chname);
|
||||
sendto_one_numeric(source_p, ERR_LINKCHANNEL, form_str(ERR_LINKCHANNEL), name, chptr2->name.c_str());
|
||||
|
||||
chptr = chptr2;
|
||||
|
||||
if(flags == 0 &&
|
||||
!IsOper(source_p) && !IsExemptSpambot(source_p))
|
||||
check_spambot_warning(source_p, name);
|
||||
chan::check_spambot_warning(source_p, name);
|
||||
|
||||
/* add the user to the channel */
|
||||
add_user_to_channel(chptr, source_p, flags);
|
||||
|
@ -326,42 +324,47 @@ m_join(struct MsgBuf *msgbuf_p, struct Client *client_p, struct Client *source_p
|
|||
/* we send the user their join here, because we could have to
|
||||
* send a mode out next.
|
||||
*/
|
||||
send_channel_join(chptr, source_p);
|
||||
chan::send_join(*chptr, *source_p);
|
||||
|
||||
/* its a new channel, set +nt and burst. */
|
||||
if(flags & CHFL_CHANOP)
|
||||
if(flags & chan::CHANOP)
|
||||
{
|
||||
chptr->channelts = rb_current_time();
|
||||
chptr->mode.mode |= ConfigChannel.autochanmodes;
|
||||
modes = channel_modes(chptr, &me);
|
||||
|
||||
sendto_channel_local(ONLY_CHANOPS, chptr, ":%s MODE %s %s",
|
||||
me.name, chptr->chname, modes);
|
||||
sendto_channel_local(chan::ONLY_CHANOPS, chptr, ":%s MODE %s %s",
|
||||
me.name, chptr->name.c_str(), modes);
|
||||
|
||||
sendto_server(client_p, chptr, CAP_TS6, NOCAPS,
|
||||
":%s SJOIN %ld %s %s :@%s",
|
||||
me.id, (long) chptr->channelts,
|
||||
chptr->chname, modes, source_p->id);
|
||||
chptr->name.c_str(), modes, source_p->id);
|
||||
}
|
||||
else
|
||||
{
|
||||
sendto_server(client_p, chptr, CAP_TS6, NOCAPS,
|
||||
":%s JOIN %ld %s +",
|
||||
use_id(source_p), (long) chptr->channelts,
|
||||
chptr->chname);
|
||||
chptr->name.c_str());
|
||||
}
|
||||
|
||||
del_invite(chptr, source_p);
|
||||
|
||||
if(chptr->topic != NULL)
|
||||
if(chptr->topic)
|
||||
{
|
||||
sendto_one(source_p, form_str(RPL_TOPIC), me.name,
|
||||
source_p->name, chptr->chname, chptr->topic);
|
||||
sendto_one(source_p, form_str(RPL_TOPIC),
|
||||
me.name,
|
||||
source_p->name,
|
||||
chptr->name.c_str(),
|
||||
chptr->topic.text.c_str());
|
||||
|
||||
sendto_one(source_p, form_str(RPL_TOPICWHOTIME),
|
||||
me.name, source_p->name, chptr->chname,
|
||||
chptr->topic_info,
|
||||
(unsigned long)chptr->topic_time);
|
||||
me.name,
|
||||
source_p->name,
|
||||
chptr->name.c_str(),
|
||||
chptr->topic.info.c_str(),
|
||||
ulong(chptr->topic.time));
|
||||
}
|
||||
|
||||
channel_member_names(chptr, source_p, 1);
|
||||
|
@ -383,8 +386,8 @@ m_join(struct MsgBuf *msgbuf_p, struct Client *client_p, struct Client *source_p
|
|||
static void
|
||||
ms_join(struct MsgBuf *msgbuf_p, struct Client *client_p, struct Client *source_p, int parc, const char *parv[])
|
||||
{
|
||||
struct Channel *chptr;
|
||||
static struct Mode mode;
|
||||
chan::chan *chptr;
|
||||
static chan::modes mode;
|
||||
time_t oldts;
|
||||
time_t newts;
|
||||
bool isnew;
|
||||
|
@ -401,7 +404,7 @@ ms_join(struct MsgBuf *msgbuf_p, struct Client *client_p, struct Client *source_
|
|||
if(parc < 4)
|
||||
return;
|
||||
|
||||
if(!IsChannelName(parv[2]) || !check_channel_name(parv[2]))
|
||||
if(!chan::is_name(parv[2]) || !chan::check_channel_name(parv[2]))
|
||||
return;
|
||||
|
||||
/* joins for local channels cant happen. */
|
||||
|
@ -421,12 +424,12 @@ ms_join(struct MsgBuf *msgbuf_p, struct Client *client_p, struct Client *source_
|
|||
/* making a channel TS0 */
|
||||
if(!isnew && !newts && oldts)
|
||||
{
|
||||
sendto_channel_local(ALL_MEMBERS, chptr,
|
||||
sendto_channel_local(chan::ALL_MEMBERS, chptr,
|
||||
":%s NOTICE %s :*** Notice -- TS for %s changed from %ld to 0",
|
||||
me.name, chptr->chname, chptr->chname, (long) oldts);
|
||||
me.name, chptr->name.c_str(), chptr->name.c_str(), (long) oldts);
|
||||
sendto_realops_snomask(SNO_GENERAL, L_ALL,
|
||||
"Server %s changing TS on %s from %ld to 0",
|
||||
source_p->name, chptr->chname, (long) oldts);
|
||||
source_p->name, chptr->name.c_str(), (long) oldts);
|
||||
}
|
||||
|
||||
if(isnew)
|
||||
|
@ -448,32 +451,39 @@ ms_join(struct MsgBuf *msgbuf_p, struct Client *client_p, struct Client *source_
|
|||
chptr->mode = mode;
|
||||
remove_our_modes(chptr, source_p);
|
||||
RB_DLINK_FOREACH_SAFE(ptr, next_ptr, chptr->invites.head)
|
||||
{
|
||||
del_invite(chptr, (Client *)ptr->data);
|
||||
}
|
||||
|
||||
/* If setting -j, clear join throttle state -- jilles */
|
||||
chptr->join_count = chptr->join_delta = 0;
|
||||
sendto_channel_local(ALL_MEMBERS, chptr,
|
||||
":%s NOTICE %s :*** Notice -- TS for %s changed from %ld to %ld",
|
||||
me.name, chptr->chname, chptr->chname,
|
||||
(long) oldts, (long) newts);
|
||||
sendto_channel_local(chan::ALL_MEMBERS, chptr,
|
||||
":%s NOTICE %s :*** Notice -- TS for %s changed from %ld to %ld",
|
||||
me.name,
|
||||
chptr->name.c_str(),
|
||||
chptr->name.c_str(),
|
||||
long(oldts),
|
||||
long(newts));
|
||||
|
||||
/* Update capitalization in channel name, this makes the
|
||||
* capitalization timestamped like modes are -- jilles */
|
||||
strcpy(chptr->chname, parv[2]);
|
||||
chptr->name = parv[2];
|
||||
|
||||
if(*modebuf != '\0')
|
||||
sendto_channel_local(ALL_MEMBERS, chptr,
|
||||
":%s MODE %s %s %s",
|
||||
source_p->servptr->name,
|
||||
chptr->chname, modebuf, parabuf);
|
||||
sendto_channel_local(chan::ALL_MEMBERS, chptr,
|
||||
":%s MODE %s %s %s",
|
||||
source_p->servptr->name,
|
||||
chptr->name.c_str(),
|
||||
modebuf,
|
||||
parabuf);
|
||||
|
||||
*modebuf = *parabuf = '\0';
|
||||
|
||||
/* since we're dropping our modes, we want to clear the mlock as well. --nenolod */
|
||||
set_channel_mlock(client_p, source_p, chptr, NULL, false);
|
||||
}
|
||||
|
||||
if(!IsMember(source_p, chptr))
|
||||
if(!is_member(chptr, source_p))
|
||||
{
|
||||
add_user_to_channel(chptr, source_p, CHFL_PEON);
|
||||
add_user_to_channel(chptr, source_p, chan::PEON);
|
||||
if (chptr->mode.join_num &&
|
||||
rb_current_time() - chptr->join_delta >= chptr->mode.join_time)
|
||||
{
|
||||
|
@ -481,12 +491,12 @@ ms_join(struct MsgBuf *msgbuf_p, struct Client *client_p, struct Client *source_
|
|||
chptr->join_delta = rb_current_time();
|
||||
}
|
||||
chptr->join_count++;
|
||||
send_channel_join(chptr, source_p);
|
||||
send_join(*chptr, *source_p);
|
||||
}
|
||||
|
||||
sendto_server(client_p, chptr, CAP_TS6, NOCAPS,
|
||||
":%s JOIN %ld %s +",
|
||||
source_p->id, (long) chptr->channelts, chptr->chname);
|
||||
source_p->id, (long) chptr->channelts, chptr->name.c_str());
|
||||
}
|
||||
|
||||
static void
|
||||
|
@ -494,11 +504,11 @@ ms_sjoin(struct MsgBuf *msgbuf_p, struct Client *client_p, struct Client *source
|
|||
{
|
||||
static char buf_uid[BUFSIZE];
|
||||
static const char empty_modes[] = "0";
|
||||
struct Channel *chptr;
|
||||
chan::chan *chptr;
|
||||
struct Client *target_p, *fakesource_p;
|
||||
time_t newts;
|
||||
time_t oldts;
|
||||
static struct Mode mode, *oldmode;
|
||||
static chan::modes mode, *oldmode;
|
||||
const char *modes;
|
||||
int args = 0;
|
||||
bool keep_our_modes = true;
|
||||
|
@ -519,7 +529,7 @@ ms_sjoin(struct MsgBuf *msgbuf_p, struct Client *client_p, struct Client *source
|
|||
if(parc < 5)
|
||||
return;
|
||||
|
||||
if(!IsChannelName(parv[2]) || !check_channel_name(parv[2]))
|
||||
if(!chan::is_name(parv[2]) || !chan::check_channel_name(parv[2]))
|
||||
return;
|
||||
|
||||
/* SJOIN's for local channels can't happen. */
|
||||
|
@ -595,13 +605,13 @@ ms_sjoin(struct MsgBuf *msgbuf_p, struct Client *client_p, struct Client *source
|
|||
|
||||
if(!isnew && !newts && oldts)
|
||||
{
|
||||
sendto_channel_local(ALL_MEMBERS, chptr,
|
||||
sendto_channel_local(chan::ALL_MEMBERS, chptr,
|
||||
":%s NOTICE %s :*** Notice -- TS for %s "
|
||||
"changed from %ld to 0",
|
||||
me.name, chptr->chname, chptr->chname, (long) oldts);
|
||||
me.name, chptr->name.c_str(), chptr->name.c_str(), (long) oldts);
|
||||
sendto_realops_snomask(SNO_GENERAL, L_ALL,
|
||||
"Server %s changing TS on %s from %ld to 0",
|
||||
source_p->name, chptr->chname, (long) oldts);
|
||||
source_p->name, chptr->name.c_str(), (long) oldts);
|
||||
}
|
||||
|
||||
if(isnew)
|
||||
|
@ -626,20 +636,20 @@ ms_sjoin(struct MsgBuf *msgbuf_p, struct Client *client_p, struct Client *source
|
|||
mode.mode & chan::mode::INVITEONLY) ||
|
||||
(mode.key[0] != 0 && irccmp(mode.key, oldmode->key) != 0)))
|
||||
{
|
||||
struct membership *msptr;
|
||||
chan::membership *msptr;
|
||||
struct Client *who;
|
||||
int l = rb_dlink_list_length(&chptr->members);
|
||||
|
||||
RB_DLINK_FOREACH_SAFE(ptr, next_ptr, chptr->locmembers.head)
|
||||
{
|
||||
msptr = (membership *)ptr->data;
|
||||
who = msptr->client_p;
|
||||
msptr = (chan::membership *)ptr->data;
|
||||
who = msptr->client;
|
||||
sendto_one(who, ":%s KICK %s %s :Net Rider",
|
||||
me.name, chptr->chname, who->name);
|
||||
me.name, chptr->name.c_str(), who->name);
|
||||
|
||||
sendto_server(NULL, chptr, CAP_TS6, NOCAPS,
|
||||
":%s KICK %s %s :Net Rider",
|
||||
me.id, chptr->chname,
|
||||
me.id, chptr->name.c_str(),
|
||||
who->id);
|
||||
remove_user_from_channel(msptr);
|
||||
if (--l == 0)
|
||||
|
@ -699,33 +709,33 @@ ms_sjoin(struct MsgBuf *msgbuf_p, struct Client *client_p, struct Client *source
|
|||
}
|
||||
|
||||
if(rb_dlink_list_length(&chptr->banlist) > 0)
|
||||
remove_ban_list(chptr, fakesource_p, &chptr->banlist, 'b', ALL_MEMBERS);
|
||||
remove_ban_list(chptr, fakesource_p, &chptr->banlist, 'b', chan::ALL_MEMBERS);
|
||||
if(rb_dlink_list_length(&chptr->exceptlist) > 0)
|
||||
remove_ban_list(chptr, fakesource_p, &chptr->exceptlist,
|
||||
'e', ONLY_CHANOPS);
|
||||
'e', chan::ONLY_CHANOPS);
|
||||
if(rb_dlink_list_length(&chptr->invexlist) > 0)
|
||||
remove_ban_list(chptr, fakesource_p, &chptr->invexlist,
|
||||
'I', ONLY_CHANOPS);
|
||||
'I', chan::ONLY_CHANOPS);
|
||||
if(rb_dlink_list_length(&chptr->quietlist) > 0)
|
||||
remove_ban_list(chptr, fakesource_p, &chptr->quietlist,
|
||||
'q', ALL_MEMBERS);
|
||||
'q', chan::ALL_MEMBERS);
|
||||
chptr->bants++;
|
||||
|
||||
sendto_channel_local(ALL_MEMBERS, chptr,
|
||||
sendto_channel_local(chan::ALL_MEMBERS, chptr,
|
||||
":%s NOTICE %s :*** Notice -- TS for %s changed from %ld to %ld",
|
||||
me.name, chptr->chname, chptr->chname,
|
||||
me.name, chptr->name.c_str(), chptr->name.c_str(),
|
||||
(long) oldts, (long) newts);
|
||||
/* Update capitalization in channel name, this makes the
|
||||
* capitalization timestamped like modes are -- jilles */
|
||||
strcpy(chptr->chname, parv[2]);
|
||||
chptr->name = parv[2];
|
||||
|
||||
/* since we're dropping our modes, we want to clear the mlock as well. --nenolod */
|
||||
set_channel_mlock(client_p, source_p, chptr, NULL, false);
|
||||
}
|
||||
|
||||
if(*modebuf != '\0')
|
||||
sendto_channel_local(ALL_MEMBERS, chptr, ":%s MODE %s %s %s",
|
||||
fakesource_p->name, chptr->chname, modebuf, parabuf);
|
||||
sendto_channel_local(chan::ALL_MEMBERS, chptr, ":%s MODE %s %s %s",
|
||||
fakesource_p->name, chptr->name.c_str(), modebuf, parabuf);
|
||||
|
||||
*modebuf = *parabuf = '\0';
|
||||
|
||||
|
@ -762,12 +772,12 @@ ms_sjoin(struct MsgBuf *msgbuf_p, struct Client *client_p, struct Client *source
|
|||
{
|
||||
if(*s == '@')
|
||||
{
|
||||
fl |= CHFL_CHANOP;
|
||||
fl |= chan::CHANOP;
|
||||
s++;
|
||||
}
|
||||
else if(*s == '+')
|
||||
{
|
||||
fl |= CHFL_VOICE;
|
||||
fl |= chan::VOICE;
|
||||
s++;
|
||||
}
|
||||
}
|
||||
|
@ -790,12 +800,12 @@ ms_sjoin(struct MsgBuf *msgbuf_p, struct Client *client_p, struct Client *source
|
|||
|
||||
if(keep_new_modes)
|
||||
{
|
||||
if(fl & CHFL_CHANOP)
|
||||
if(fl & chan::CHANOP)
|
||||
{
|
||||
*ptr_uid++ = '@';
|
||||
len_uid++;
|
||||
}
|
||||
if(fl & CHFL_VOICE)
|
||||
if(fl & chan::VOICE)
|
||||
{
|
||||
*ptr_uid++ = '+';
|
||||
len_uid++;
|
||||
|
@ -810,20 +820,20 @@ ms_sjoin(struct MsgBuf *msgbuf_p, struct Client *client_p, struct Client *source
|
|||
if(!keep_new_modes)
|
||||
fl = 0;
|
||||
|
||||
if(!IsMember(target_p, chptr))
|
||||
if(!is_member(chptr, target_p))
|
||||
{
|
||||
add_user_to_channel(chptr, target_p, fl);
|
||||
send_channel_join(chptr, target_p);
|
||||
send_join(*chptr, *target_p);
|
||||
joins++;
|
||||
}
|
||||
|
||||
if(fl & CHFL_CHANOP)
|
||||
if(fl & chan::CHANOP)
|
||||
{
|
||||
*mbuf++ = 'o';
|
||||
para[pargs++] = target_p->name;
|
||||
|
||||
/* a +ov user.. bleh */
|
||||
if(fl & CHFL_VOICE)
|
||||
if(fl & chan::VOICE)
|
||||
{
|
||||
/* its possible the +o has filled up chan::mode::MAXPARAMS, if so, start
|
||||
* a new buffer
|
||||
|
@ -831,9 +841,9 @@ ms_sjoin(struct MsgBuf *msgbuf_p, struct Client *client_p, struct Client *source
|
|||
if(pargs >= chan::mode::MAXPARAMS)
|
||||
{
|
||||
*mbuf = '\0';
|
||||
sendto_channel_local(ALL_MEMBERS, chptr,
|
||||
sendto_channel_local(chan::ALL_MEMBERS, chptr,
|
||||
":%s MODE %s %s %s %s %s %s",
|
||||
fakesource_p->name, chptr->chname,
|
||||
fakesource_p->name, chptr->name.c_str(),
|
||||
modebuf,
|
||||
para[0], para[1], para[2], para[3]);
|
||||
mbuf = modebuf;
|
||||
|
@ -846,7 +856,7 @@ ms_sjoin(struct MsgBuf *msgbuf_p, struct Client *client_p, struct Client *source
|
|||
para[pargs++] = target_p->name;
|
||||
}
|
||||
}
|
||||
else if(fl & CHFL_VOICE)
|
||||
else if(fl & chan::VOICE)
|
||||
{
|
||||
*mbuf++ = 'v';
|
||||
para[pargs++] = target_p->name;
|
||||
|
@ -855,10 +865,10 @@ ms_sjoin(struct MsgBuf *msgbuf_p, struct Client *client_p, struct Client *source
|
|||
if(pargs >= chan::mode::MAXPARAMS)
|
||||
{
|
||||
*mbuf = '\0';
|
||||
sendto_channel_local(ALL_MEMBERS, chptr,
|
||||
sendto_channel_local(chan::ALL_MEMBERS, chptr,
|
||||
":%s MODE %s %s %s %s %s %s",
|
||||
fakesource_p->name,
|
||||
chptr->chname,
|
||||
chptr->name.c_str(),
|
||||
modebuf, para[0], para[1], para[2], para[3]);
|
||||
mbuf = modebuf;
|
||||
*mbuf++ = '+';
|
||||
|
@ -890,17 +900,16 @@ ms_sjoin(struct MsgBuf *msgbuf_p, struct Client *client_p, struct Client *source
|
|||
*mbuf = '\0';
|
||||
if(pargs)
|
||||
{
|
||||
sendto_channel_local(ALL_MEMBERS, chptr,
|
||||
sendto_channel_local(chan::ALL_MEMBERS, chptr,
|
||||
":%s MODE %s %s %s %s %s %s",
|
||||
fakesource_p->name, chptr->chname, modebuf,
|
||||
fakesource_p->name, chptr->name.c_str(), modebuf,
|
||||
para[0], CheckEmpty(para[1]),
|
||||
CheckEmpty(para[2]), CheckEmpty(para[3]));
|
||||
}
|
||||
|
||||
if(!joins && !(chptr->mode.mode & chan::mode::PERMANENT) && isnew)
|
||||
{
|
||||
destroy_channel(chptr);
|
||||
|
||||
delete chptr;
|
||||
return;
|
||||
}
|
||||
|
||||
|
@ -924,8 +933,8 @@ ms_sjoin(struct MsgBuf *msgbuf_p, struct Client *client_p, struct Client *source
|
|||
static void
|
||||
do_join_0(struct Client *client_p, struct Client *source_p)
|
||||
{
|
||||
struct membership *msptr;
|
||||
struct Channel *chptr = NULL;
|
||||
chan::membership *msptr;
|
||||
chan::chan *chptr = NULL;
|
||||
rb_dlink_node *ptr;
|
||||
|
||||
/* Finish the flood grace period... */
|
||||
|
@ -938,13 +947,13 @@ do_join_0(struct Client *client_p, struct Client *source_p)
|
|||
{
|
||||
if(MyConnect(source_p) &&
|
||||
!IsOper(source_p) && !IsExemptSpambot(source_p))
|
||||
check_spambot_warning(source_p, NULL);
|
||||
chan::check_spambot_warning(source_p, NULL);
|
||||
|
||||
msptr = (membership *)ptr->data;
|
||||
chptr = msptr->chptr;
|
||||
sendto_channel_local(ALL_MEMBERS, chptr, ":%s!%s@%s PART %s",
|
||||
msptr = (chan::membership *)ptr->data;
|
||||
chptr = msptr->chan;
|
||||
sendto_channel_local(chan::ALL_MEMBERS, chptr, ":%s!%s@%s PART %s",
|
||||
source_p->name,
|
||||
source_p->username, source_p->host, chptr->chname);
|
||||
source_p->username, source_p->host, chptr->name.c_str());
|
||||
remove_user_from_channel(msptr);
|
||||
}
|
||||
}
|
||||
|
@ -1012,7 +1021,7 @@ send_join_error(struct Client *source_p, int numeric, const char *name)
|
|||
}
|
||||
|
||||
static void
|
||||
set_final_mode(struct Mode *mode, struct Mode *oldmode)
|
||||
set_final_mode(chan::modes *mode, chan::modes *oldmode)
|
||||
{
|
||||
int dir = MODE_QUERY;
|
||||
char *pbuf = parabuf;
|
||||
|
@ -1141,9 +1150,9 @@ set_final_mode(struct Mode *mode, struct Mode *oldmode)
|
|||
* side effects -
|
||||
*/
|
||||
static void
|
||||
remove_our_modes(struct Channel *chptr, struct Client *source_p)
|
||||
remove_our_modes(chan::chan *chptr, struct Client *source_p)
|
||||
{
|
||||
struct membership *msptr;
|
||||
chan::membership *msptr;
|
||||
rb_dlink_node *ptr;
|
||||
char lmodebuf[chan::mode::BUFLEN];
|
||||
char *lpara[chan::mode::MAXPARAMS];
|
||||
|
@ -1158,12 +1167,12 @@ remove_our_modes(struct Channel *chptr, struct Client *source_p)
|
|||
|
||||
RB_DLINK_FOREACH(ptr, chptr->members.head)
|
||||
{
|
||||
msptr = (membership *)ptr->data;
|
||||
msptr = (chan::membership *)ptr->data;
|
||||
|
||||
if(is_chanop(msptr))
|
||||
{
|
||||
msptr->flags &= ~CHFL_CHANOP;
|
||||
lpara[count++] = msptr->client_p->name;
|
||||
msptr->flags &= ~chan::CHANOP;
|
||||
lpara[count++] = msptr->client->name;
|
||||
*mbuf++ = 'o';
|
||||
|
||||
/* +ov, might not fit so check. */
|
||||
|
@ -1172,9 +1181,9 @@ remove_our_modes(struct Channel *chptr, struct Client *source_p)
|
|||
if(count >= chan::mode::MAXPARAMS)
|
||||
{
|
||||
*mbuf = '\0';
|
||||
sendto_channel_local(ALL_MEMBERS, chptr,
|
||||
sendto_channel_local(chan::ALL_MEMBERS, chptr,
|
||||
":%s MODE %s %s %s %s %s %s",
|
||||
source_p->name, chptr->chname,
|
||||
source_p->name, chptr->name.c_str(),
|
||||
lmodebuf, lpara[0], lpara[1],
|
||||
lpara[2], lpara[3]);
|
||||
|
||||
|
@ -1187,15 +1196,15 @@ remove_our_modes(struct Channel *chptr, struct Client *source_p)
|
|||
lpara[i] = NULL;
|
||||
}
|
||||
|
||||
msptr->flags &= ~CHFL_VOICE;
|
||||
lpara[count++] = msptr->client_p->name;
|
||||
msptr->flags &= ~chan::VOICE;
|
||||
lpara[count++] = msptr->client->name;
|
||||
*mbuf++ = 'v';
|
||||
}
|
||||
}
|
||||
else if(is_voiced(msptr))
|
||||
{
|
||||
msptr->flags &= ~CHFL_VOICE;
|
||||
lpara[count++] = msptr->client_p->name;
|
||||
msptr->flags &= ~chan::VOICE;
|
||||
lpara[count++] = msptr->client->name;
|
||||
*mbuf++ = 'v';
|
||||
}
|
||||
else
|
||||
|
@ -1204,9 +1213,9 @@ remove_our_modes(struct Channel *chptr, struct Client *source_p)
|
|||
if(count >= chan::mode::MAXPARAMS)
|
||||
{
|
||||
*mbuf = '\0';
|
||||
sendto_channel_local(ALL_MEMBERS, chptr,
|
||||
sendto_channel_local(chan::ALL_MEMBERS, chptr,
|
||||
":%s MODE %s %s %s %s %s %s",
|
||||
source_p->name, chptr->chname, lmodebuf,
|
||||
source_p->name, chptr->name.c_str(), lmodebuf,
|
||||
lpara[0], lpara[1], lpara[2], lpara[3]);
|
||||
mbuf = lmodebuf;
|
||||
*mbuf++ = '-';
|
||||
|
@ -1220,9 +1229,9 @@ remove_our_modes(struct Channel *chptr, struct Client *source_p)
|
|||
if(count != 0)
|
||||
{
|
||||
*mbuf = '\0';
|
||||
sendto_channel_local(ALL_MEMBERS, chptr,
|
||||
sendto_channel_local(chan::ALL_MEMBERS, chptr,
|
||||
":%s MODE %s %s %s %s %s %s",
|
||||
source_p->name, chptr->chname, lmodebuf,
|
||||
source_p->name, chptr->name.c_str(), lmodebuf,
|
||||
EmptyString(lpara[0]) ? "" : lpara[0],
|
||||
EmptyString(lpara[1]) ? "" : lpara[1],
|
||||
EmptyString(lpara[2]) ? "" : lpara[2],
|
||||
|
@ -1238,12 +1247,11 @@ remove_our_modes(struct Channel *chptr, struct Client *source_p)
|
|||
* side effects - given list is removed, with modes issued to local clients
|
||||
*/
|
||||
static void
|
||||
remove_ban_list(struct Channel *chptr, struct Client *source_p,
|
||||
remove_ban_list(chan::chan *chptr, struct Client *source_p,
|
||||
rb_dlink_list * list, char c, int mems)
|
||||
{
|
||||
static char lmodebuf[BUFSIZE];
|
||||
static char lparabuf[BUFSIZE];
|
||||
struct Ban *banptr;
|
||||
rb_dlink_node *ptr;
|
||||
rb_dlink_node *next_ptr;
|
||||
char *pbuf;
|
||||
|
@ -1252,16 +1260,15 @@ remove_ban_list(struct Channel *chptr, struct Client *source_p,
|
|||
|
||||
pbuf = lparabuf;
|
||||
|
||||
cur_len = mlen = sprintf(lmodebuf, ":%s MODE %s -", source_p->name, chptr->chname);
|
||||
cur_len = mlen = sprintf(lmodebuf, ":%s MODE %s -", source_p->name, chptr->name.c_str());
|
||||
mbuf = lmodebuf + mlen;
|
||||
|
||||
RB_DLINK_FOREACH_SAFE(ptr, next_ptr, list->head)
|
||||
{
|
||||
banptr = (Ban *)ptr->data;
|
||||
const auto banptr((chan::ban *)ptr->data);
|
||||
|
||||
/* trailing space, and the mode letter itself */
|
||||
plen = strlen(banptr->banstr) +
|
||||
(banptr->forward ? strlen(banptr->forward) + 1 : 0) + 2;
|
||||
plen = banptr->banstr.size() + (!banptr->forward.empty()? banptr->forward.size() + 1 : 0) + 2;
|
||||
|
||||
if(count >= chan::mode::MAXPARAMS || (cur_len + plen) > BUFSIZE - 4)
|
||||
{
|
||||
|
@ -1279,13 +1286,13 @@ remove_ban_list(struct Channel *chptr, struct Client *source_p,
|
|||
|
||||
*mbuf++ = c;
|
||||
cur_len += plen;
|
||||
if (banptr->forward)
|
||||
pbuf += sprintf(pbuf, "%s$%s ", banptr->banstr, banptr->forward);
|
||||
if (!banptr->forward.empty())
|
||||
pbuf += sprintf(pbuf, "%s$%s ", banptr->banstr.c_str(), banptr->forward.c_str());
|
||||
else
|
||||
pbuf += sprintf(pbuf, "%s ", banptr->banstr);
|
||||
pbuf += sprintf(pbuf, "%s ", banptr->banstr.c_str());
|
||||
count++;
|
||||
|
||||
free_ban(banptr);
|
||||
delete banptr;
|
||||
}
|
||||
|
||||
*mbuf = '\0';
|
||||
|
|
|
@ -47,9 +47,9 @@ DECLARE_MODULE_AV2(kick, NULL, NULL, kick_clist, NULL, NULL, NULL, NULL, kick_de
|
|||
static void
|
||||
m_kick(struct MsgBuf *msgbuf_p, struct Client *client_p, struct Client *source_p, int parc, const char *parv[])
|
||||
{
|
||||
struct membership *msptr;
|
||||
chan::membership *msptr;
|
||||
struct Client *who;
|
||||
struct Channel *chptr;
|
||||
chan::chan *chptr;
|
||||
int chasing = 0;
|
||||
char *comment;
|
||||
const char *name;
|
||||
|
@ -84,7 +84,7 @@ m_kick(struct MsgBuf *msgbuf_p, struct Client *client_p, struct Client *source_p
|
|||
return;
|
||||
}
|
||||
|
||||
if(get_channel_access(source_p, chptr, msptr, MODE_ADD, NULL) < CHFL_CHANOP)
|
||||
if(get_channel_access(source_p, chptr, msptr, MODE_ADD, NULL) < chan::CHANOP)
|
||||
{
|
||||
if(MyConnect(source_p))
|
||||
{
|
||||
|
@ -121,7 +121,10 @@ m_kick(struct MsgBuf *msgbuf_p, struct Client *client_p, struct Client *source_p
|
|||
if(MyClient(source_p) && IsService(who))
|
||||
{
|
||||
sendto_one(source_p, form_str(ERR_ISCHANSERVICE),
|
||||
me.name, source_p->name, who->name, chptr->chname);
|
||||
me.name,
|
||||
source_p->name,
|
||||
who->name,
|
||||
chptr->name.c_str());
|
||||
return;
|
||||
}
|
||||
|
||||
|
@ -154,17 +157,17 @@ m_kick(struct MsgBuf *msgbuf_p, struct Client *client_p, struct Client *source_p
|
|||
* be sent anyways. Just waiting for some oper to abuse it...
|
||||
*/
|
||||
if(IsServer(source_p))
|
||||
sendto_channel_local(ALL_MEMBERS, chptr, ":%s KICK %s %s :%s",
|
||||
sendto_channel_local(chan::ALL_MEMBERS, chptr, ":%s KICK %s %s :%s",
|
||||
source_p->name, name, who->name, comment);
|
||||
else
|
||||
sendto_channel_local(ALL_MEMBERS, chptr,
|
||||
sendto_channel_local(chan::ALL_MEMBERS, chptr,
|
||||
":%s!%s@%s KICK %s %s :%s",
|
||||
source_p->name, source_p->username,
|
||||
source_p->host, name, who->name, comment);
|
||||
|
||||
sendto_server(client_p, chptr, CAP_TS6, NOCAPS,
|
||||
":%s KICK %s %s :%s",
|
||||
use_id(source_p), chptr->chname, use_id(who), comment);
|
||||
use_id(source_p), chptr->name.c_str(), use_id(who), comment);
|
||||
remove_user_from_channel(msptr);
|
||||
}
|
||||
else if (MyClient(source_p))
|
||||
|
|
|
@ -90,17 +90,17 @@ static bool duplicate_ptr(void *);
|
|||
|
||||
static void msg_channel(enum message_type msgtype,
|
||||
struct Client *client_p,
|
||||
struct Client *source_p, struct Channel *chptr, const char *text);
|
||||
struct Client *source_p, chan::chan *chptr, const char *text);
|
||||
|
||||
static void msg_channel_opmod(enum message_type msgtype,
|
||||
struct Client *client_p,
|
||||
struct Client *source_p, struct Channel *chptr,
|
||||
struct Client *source_p, chan::chan *chptr,
|
||||
const char *text);
|
||||
|
||||
static void msg_channel_flags(enum message_type msgtype,
|
||||
struct Client *client_p,
|
||||
struct Client *source_p,
|
||||
struct Channel *chptr, int flags, const char *text);
|
||||
chan::chan *chptr, int flags, const char *text);
|
||||
|
||||
static void msg_client(enum message_type msgtype,
|
||||
struct Client *source_p, struct Client *target_p, const char *text);
|
||||
|
@ -190,17 +190,17 @@ m_message(enum message_type msgtype, struct MsgBuf *msgbuf_p,
|
|||
{
|
||||
case ENTITY_CHANNEL:
|
||||
msg_channel(msgtype, client_p, source_p,
|
||||
(struct Channel *) targets[i].ptr, parv[2]);
|
||||
(chan::chan *) targets[i].ptr, parv[2]);
|
||||
break;
|
||||
|
||||
case ENTITY_CHANNEL_OPMOD:
|
||||
msg_channel_opmod(msgtype, client_p, source_p,
|
||||
(struct Channel *) targets[i].ptr, parv[2]);
|
||||
(chan::chan *) targets[i].ptr, parv[2]);
|
||||
break;
|
||||
|
||||
case ENTITY_CHANOPS_ON_CHANNEL:
|
||||
msg_channel_flags(msgtype, client_p, source_p,
|
||||
(struct Channel *) targets[i].ptr,
|
||||
(chan::chan *) targets[i].ptr,
|
||||
targets[i].flags, parv[2]);
|
||||
break;
|
||||
|
||||
|
@ -235,7 +235,7 @@ build_target_list(enum message_type msgtype, struct Client *client_p,
|
|||
{
|
||||
int type;
|
||||
char *p, *nick, *target_list;
|
||||
struct Channel *chptr = NULL;
|
||||
chan::chan *chptr = NULL;
|
||||
struct Client *target_p;
|
||||
|
||||
target_list = LOCAL_COPY(nicks_channels); /* skip strcpy for non-lazyleafs */
|
||||
|
@ -310,9 +310,9 @@ build_target_list(enum message_type msgtype, struct Client *client_p,
|
|||
for(;;)
|
||||
{
|
||||
if(*nick == '@')
|
||||
type |= CHFL_CHANOP;
|
||||
type |= chan::CHANOP;
|
||||
else if(*nick == '+')
|
||||
type |= CHFL_CHANOP | CHFL_VOICE;
|
||||
type |= chan::CHANOP | chan::VOICE;
|
||||
else
|
||||
break;
|
||||
nick++;
|
||||
|
@ -334,7 +334,7 @@ build_target_list(enum message_type msgtype, struct Client *client_p,
|
|||
|
||||
if((chptr = find_channel(nick)) != NULL)
|
||||
{
|
||||
struct membership *msptr;
|
||||
chan::membership *msptr;
|
||||
|
||||
msptr = find_channel_membership(chptr, source_p);
|
||||
|
||||
|
@ -455,7 +455,7 @@ duplicate_ptr(void *ptr)
|
|||
*/
|
||||
static void
|
||||
msg_channel(enum message_type msgtype,
|
||||
struct Client *client_p, struct Client *source_p, struct Channel *chptr,
|
||||
struct Client *client_p, struct Client *source_p, chan::chan *chptr,
|
||||
const char *text)
|
||||
{
|
||||
int result;
|
||||
|
@ -485,9 +485,14 @@ msg_channel(enum message_type msgtype,
|
|||
if (msgtype == MESSAGE_TYPE_PRIVMSG)
|
||||
{
|
||||
if (!EmptyString(hdata.reason))
|
||||
sendto_one_numeric(source_p, ERR_CANNOTSENDTOCHAN,form_str(ERR_CANNOTSENDTOCHAN)" (%s).",chptr->chname,hdata.reason);
|
||||
sendto_one_numeric(source_p, ERR_CANNOTSENDTOCHAN,
|
||||
form_str(ERR_CANNOTSENDTOCHAN)" (%s).",
|
||||
chptr->name.c_str(),
|
||||
hdata.reason);
|
||||
else
|
||||
sendto_one_numeric(source_p, ERR_CANNOTSENDTOCHAN,form_str(ERR_CANNOTSENDTOCHAN),chptr->chname);
|
||||
sendto_one_numeric(source_p, ERR_CANNOTSENDTOCHAN,
|
||||
form_str(ERR_CANNOTSENDTOCHAN),
|
||||
chptr->name.c_str());
|
||||
}
|
||||
|
||||
return;
|
||||
|
@ -506,43 +511,46 @@ msg_channel(enum message_type msgtype,
|
|||
/* chanops and voiced can flood their own channel with impunity */
|
||||
if((result = can_send(chptr, source_p, NULL)))
|
||||
{
|
||||
if(result != CAN_SEND_OPV && MyClient(source_p) &&
|
||||
if(result != chan::CAN_SEND_OPV && MyClient(source_p) &&
|
||||
!IsOper(source_p) &&
|
||||
!add_channel_target(source_p, chptr))
|
||||
{
|
||||
sendto_one(source_p, form_str(ERR_TARGCHANGE),
|
||||
me.name, source_p->name, chptr->chname);
|
||||
me.name,
|
||||
source_p->name,
|
||||
chptr->name.c_str());
|
||||
return;
|
||||
}
|
||||
if(result == CAN_SEND_OPV ||
|
||||
!flood_attack_channel(msgtype, source_p, chptr, chptr->chname))
|
||||
if(result == chan::CAN_SEND_OPV ||
|
||||
!flood_attack_channel(msgtype, source_p, chptr))
|
||||
{
|
||||
sendto_channel_flags(client_p, ALL_MEMBERS, source_p, chptr,
|
||||
"%s %s :%s", cmdname[msgtype], chptr->chname, text);
|
||||
sendto_channel_flags(client_p, chan::ALL_MEMBERS, source_p, chptr,
|
||||
"%s %s :%s",
|
||||
cmdname[msgtype],
|
||||
chptr->name.c_str(),
|
||||
text);
|
||||
}
|
||||
}
|
||||
else if(chptr->mode.mode & chan::mode::OPMODERATE &&
|
||||
(!(chptr->mode.mode & chan::mode::NOPRIVMSGS) ||
|
||||
IsMember(source_p, chptr)))
|
||||
(!(chptr->mode.mode & chan::mode::NOPRIVMSGS) || is_member(chptr, source_p)))
|
||||
{
|
||||
if(MyClient(source_p) && !IsOper(source_p) &&
|
||||
!add_channel_target(source_p, chptr))
|
||||
if(MyClient(source_p) && !IsOper(source_p) && !add_channel_target(source_p, chptr))
|
||||
{
|
||||
sendto_one(source_p, form_str(ERR_TARGCHANGE),
|
||||
me.name, source_p->name, chptr->chname);
|
||||
me.name,
|
||||
source_p->name,
|
||||
chptr->name.c_str());
|
||||
return;
|
||||
}
|
||||
if(!flood_attack_channel(msgtype, source_p, chptr, chptr->chname))
|
||||
{
|
||||
sendto_channel_opmod(client_p, source_p, chptr,
|
||||
cmdname[msgtype], text);
|
||||
}
|
||||
|
||||
if(!flood_attack_channel(msgtype, source_p, chptr))
|
||||
sendto_channel_opmod(client_p, source_p, chptr, cmdname[msgtype], text);
|
||||
}
|
||||
else
|
||||
{
|
||||
if(msgtype != MESSAGE_TYPE_NOTICE)
|
||||
sendto_one_numeric(source_p, ERR_CANNOTSENDTOCHAN,
|
||||
form_str(ERR_CANNOTSENDTOCHAN), chptr->chname);
|
||||
form_str(ERR_CANNOTSENDTOCHAN), chptr->name.c_str());
|
||||
}
|
||||
}
|
||||
/*
|
||||
|
@ -560,7 +568,7 @@ msg_channel(enum message_type msgtype,
|
|||
static void
|
||||
msg_channel_opmod(enum message_type msgtype,
|
||||
struct Client *client_p, struct Client *source_p,
|
||||
struct Channel *chptr, const char *text)
|
||||
chan::chan *chptr, const char *text)
|
||||
{
|
||||
hook_data_privmsg_channel hdata;
|
||||
|
||||
|
@ -584,26 +592,24 @@ msg_channel_opmod(enum message_type msgtype,
|
|||
{
|
||||
/* could be empty after colour stripping and
|
||||
* that would cause problems later */
|
||||
if(msgtype != MESSAGE_TYPE_NOTICE)
|
||||
sendto_one(source_p, form_str(ERR_NOTEXTTOSEND), me.name, source_p->name);
|
||||
if (msgtype != MESSAGE_TYPE_NOTICE)
|
||||
sendto_one(source_p, form_str(ERR_NOTEXTTOSEND),
|
||||
me.name,
|
||||
source_p->name);
|
||||
return;
|
||||
}
|
||||
|
||||
if(chptr->mode.mode & chan::mode::OPMODERATE &&
|
||||
(!(chptr->mode.mode & chan::mode::NOPRIVMSGS) ||
|
||||
IsMember(source_p, chptr)))
|
||||
if (chptr->mode.mode & chan::mode::OPMODERATE &&
|
||||
(!(chptr->mode.mode & chan::mode::NOPRIVMSGS) || is_member(chptr, source_p)))
|
||||
{
|
||||
if(!flood_attack_channel(msgtype, source_p, chptr, chptr->chname))
|
||||
{
|
||||
sendto_channel_opmod(client_p, source_p, chptr,
|
||||
cmdname[msgtype], text);
|
||||
}
|
||||
if (!flood_attack_channel(msgtype, source_p, chptr))
|
||||
sendto_channel_opmod(client_p, source_p, chptr, cmdname[msgtype], text);
|
||||
}
|
||||
else
|
||||
{
|
||||
if(msgtype != MESSAGE_TYPE_NOTICE)
|
||||
sendto_one_numeric(source_p, ERR_CANNOTSENDTOCHAN,
|
||||
form_str(ERR_CANNOTSENDTOCHAN), chptr->chname);
|
||||
if (msgtype != MESSAGE_TYPE_NOTICE)
|
||||
sendto_one_numeric(source_p, ERR_CANNOTSENDTOCHAN, form_str(ERR_CANNOTSENDTOCHAN),
|
||||
chptr->name.c_str());
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -622,20 +628,20 @@ msg_channel_opmod(enum message_type msgtype,
|
|||
*/
|
||||
static void
|
||||
msg_channel_flags(enum message_type msgtype, struct Client *client_p,
|
||||
struct Client *source_p, struct Channel *chptr, int flags, const char *text)
|
||||
struct Client *source_p, chan::chan *chptr, int flags, const char *text)
|
||||
{
|
||||
int type;
|
||||
char c;
|
||||
hook_data_privmsg_channel hdata;
|
||||
|
||||
if(flags & CHFL_VOICE)
|
||||
if(flags & chan::VOICE)
|
||||
{
|
||||
type = ONLY_CHANOPSVOICED;
|
||||
type = chan::ONLY_CHANOPSVOICED;
|
||||
c = '+';
|
||||
}
|
||||
else
|
||||
{
|
||||
type = ONLY_CHANOPS;
|
||||
type = chan::ONLY_CHANOPS;
|
||||
c = '@';
|
||||
}
|
||||
|
||||
|
@ -671,7 +677,7 @@ msg_channel_flags(enum message_type msgtype, struct Client *client_p,
|
|||
}
|
||||
|
||||
sendto_channel_flags(client_p, type, source_p, chptr, "%s %c%s :%s",
|
||||
cmdname[msgtype], c, chptr->chname, text);
|
||||
cmdname[msgtype], c, chptr->name.c_str(), text);
|
||||
}
|
||||
|
||||
static void
|
||||
|
|
|
@ -61,8 +61,8 @@ DECLARE_MODULE_AV2(mode, NULL, NULL, mode_clist, NULL, NULL, NULL, NULL, mode_de
|
|||
static void
|
||||
m_mode(struct MsgBuf *msgbuf_p, struct Client *client_p, struct Client *source_p, int parc, const char *parv[])
|
||||
{
|
||||
struct Channel *chptr = NULL;
|
||||
struct membership *msptr;
|
||||
chan::chan *chptr = NULL;
|
||||
chan::membership *msptr;
|
||||
int n = 2;
|
||||
const char *dest;
|
||||
int operspy = 0;
|
||||
|
@ -90,7 +90,7 @@ m_mode(struct MsgBuf *msgbuf_p, struct Client *client_p, struct Client *source_p
|
|||
return;
|
||||
}
|
||||
|
||||
if(!check_channel_name(dest))
|
||||
if(!chan::check_channel_name(dest))
|
||||
{
|
||||
sendto_one_numeric(source_p, ERR_BADCHANNAME, form_str(ERR_BADCHANNAME), parv[1]);
|
||||
return;
|
||||
|
@ -109,7 +109,7 @@ m_mode(struct MsgBuf *msgbuf_p, struct Client *client_p, struct Client *source_p
|
|||
if(parc < n + 1)
|
||||
{
|
||||
if(operspy)
|
||||
report_operspy(source_p, "MODE", chptr->chname);
|
||||
report_operspy(source_p, "MODE", chptr->name.c_str());
|
||||
|
||||
sendto_one(source_p, form_str(RPL_CHANNELMODEIS),
|
||||
me.name, source_p->name, parv[1],
|
||||
|
@ -136,7 +136,7 @@ m_mode(struct MsgBuf *msgbuf_p, struct Client *client_p, struct Client *source_p
|
|||
static void
|
||||
ms_mode(struct MsgBuf *msgbuf_p, struct Client *client_p, struct Client *source_p, int parc, const char *parv[])
|
||||
{
|
||||
struct Channel *chptr;
|
||||
chan::chan *chptr;
|
||||
|
||||
chptr = find_channel(parv[1]);
|
||||
|
||||
|
@ -153,11 +153,11 @@ ms_mode(struct MsgBuf *msgbuf_p, struct Client *client_p, struct Client *source_
|
|||
static void
|
||||
ms_tmode(struct MsgBuf *msgbuf_p, struct Client *client_p, struct Client *source_p, int parc, const char *parv[])
|
||||
{
|
||||
struct Channel *chptr = NULL;
|
||||
struct membership *msptr;
|
||||
chan::chan *chptr = NULL;
|
||||
chan::membership *msptr;
|
||||
|
||||
/* Now, try to find the channel in question */
|
||||
if(!rfc1459::is_chan_prefix(parv[2][0]) || !check_channel_name(parv[2]))
|
||||
if(!rfc1459::is_chan_prefix(parv[2][0]) || !chan::check_channel_name(parv[2]))
|
||||
{
|
||||
sendto_one_numeric(source_p, ERR_BADCHANNAME, form_str(ERR_BADCHANNAME), parv[2]);
|
||||
return;
|
||||
|
@ -191,10 +191,10 @@ ms_tmode(struct MsgBuf *msgbuf_p, struct Client *client_p, struct Client *source
|
|||
static void
|
||||
ms_mlock(struct MsgBuf *msgbuf_p, struct Client *client_p, struct Client *source_p, int parc, const char *parv[])
|
||||
{
|
||||
struct Channel *chptr = NULL;
|
||||
chan::chan *chptr = NULL;
|
||||
|
||||
/* Now, try to find the channel in question */
|
||||
if(!rfc1459::is_chan_prefix(parv[2][0]) || !check_channel_name(parv[2]))
|
||||
if(!rfc1459::is_chan_prefix(parv[2][0]) || !chan::check_channel_name(parv[2]))
|
||||
{
|
||||
sendto_one_numeric(source_p, ERR_BADCHANNAME, form_str(ERR_BADCHANNAME), parv[2]);
|
||||
return;
|
||||
|
@ -218,29 +218,33 @@ ms_mlock(struct MsgBuf *msgbuf_p, struct Client *client_p, struct Client *source
|
|||
}
|
||||
|
||||
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)
|
||||
possibly_remove_lower_forward(struct Client *fakesource_p,
|
||||
int mems,
|
||||
chan::chan *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 = (Ban *)ptr->data;
|
||||
if(!irccmp(actualBan->banstr, mask) &&
|
||||
(actualBan->forward == NULL ||
|
||||
irccmp(actualBan->forward, forward) < 0))
|
||||
const auto actualBan((chan::ban *)ptr->data);
|
||||
if(!irccmp(actualBan->banstr.c_str(), mask) &&
|
||||
(actualBan->forward.empty() ||
|
||||
irccmp(actualBan->forward.c_str(), 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 : "");
|
||||
sendto_channel_local(mems, chptr,
|
||||
":%s MODE %s -%c %s%s%s",
|
||||
fakesource_p->name,
|
||||
chptr->name.c_str(),
|
||||
mchar,
|
||||
actualBan->banstr.c_str(),
|
||||
actualBan->forward.size()? "$" : "",
|
||||
actualBan->forward.size()? actualBan->forward.c_str() : "");
|
||||
|
||||
rb_dlinkDelete(&actualBan->node, banlist);
|
||||
free_ban(actualBan);
|
||||
delete actualBan;
|
||||
return;
|
||||
}
|
||||
}
|
||||
|
@ -251,7 +255,7 @@ ms_bmask(struct MsgBuf *msgbuf_p, struct Client *client_p, struct Client *source
|
|||
{
|
||||
static char modebuf[BUFSIZE];
|
||||
static char parabuf[BUFSIZE];
|
||||
struct Channel *chptr;
|
||||
chan::chan *chptr;
|
||||
rb_dlink_list *banlist;
|
||||
char *s, *forward;
|
||||
char *t;
|
||||
|
@ -267,7 +271,7 @@ ms_bmask(struct MsgBuf *msgbuf_p, struct Client *client_p, struct Client *source
|
|||
int mems;
|
||||
struct Client *fakesource_p;
|
||||
|
||||
if(!rfc1459::is_chan_prefix(parv[2][0]) || !check_channel_name(parv[2]))
|
||||
if(!rfc1459::is_chan_prefix(parv[2][0]) || !chan::check_channel_name(parv[2]))
|
||||
return;
|
||||
|
||||
if((chptr = find_channel(parv[2])) == NULL)
|
||||
|
@ -281,28 +285,28 @@ ms_bmask(struct MsgBuf *msgbuf_p, struct Client *client_p, struct Client *source
|
|||
{
|
||||
case 'b':
|
||||
banlist = &chptr->banlist;
|
||||
mode_type = CHFL_BAN;
|
||||
mems = ALL_MEMBERS;
|
||||
mode_type = chan::mode::BAN;
|
||||
mems = chan::ALL_MEMBERS;
|
||||
break;
|
||||
|
||||
case 'e':
|
||||
banlist = &chptr->exceptlist;
|
||||
mode_type = CHFL_EXCEPTION;
|
||||
mode_type = chan::mode::EXCEPTION;
|
||||
needcap = CAP_EX;
|
||||
mems = ONLY_CHANOPS;
|
||||
mems = chan::ONLY_CHANOPS;
|
||||
break;
|
||||
|
||||
case 'I':
|
||||
banlist = &chptr->invexlist;
|
||||
mode_type = CHFL_INVEX;
|
||||
mode_type = chan::mode::INVEX;
|
||||
needcap = CAP_IE;
|
||||
mems = ONLY_CHANOPS;
|
||||
mems = chan::ONLY_CHANOPS;
|
||||
break;
|
||||
|
||||
case 'q':
|
||||
banlist = &chptr->quietlist;
|
||||
mode_type = CHFL_QUIET;
|
||||
mems = ALL_MEMBERS;
|
||||
mode_type = chan::mode::QUIET;
|
||||
mems = chan::ALL_MEMBERS;
|
||||
break;
|
||||
|
||||
/* maybe we should just blindly propagate this? */
|
||||
|
@ -318,7 +322,7 @@ ms_bmask(struct MsgBuf *msgbuf_p, struct Client *client_p, struct Client *source
|
|||
fakesource_p = &me;
|
||||
else
|
||||
fakesource_p = source_p;
|
||||
mlen = sprintf(modebuf, ":%s MODE %s +", fakesource_p->name, chptr->chname);
|
||||
mlen = sprintf(modebuf, ":%s MODE %s +", fakesource_p->name, chptr->name.c_str());
|
||||
mbuf = modebuf + mlen;
|
||||
pbuf = parabuf;
|
||||
|
||||
|
@ -407,5 +411,5 @@ ms_bmask(struct MsgBuf *msgbuf_p, struct Client *client_p, struct Client *source
|
|||
}
|
||||
|
||||
sendto_server(client_p, chptr, CAP_TS6 | needcap, NOCAPS, ":%s BMASK %ld %s %s :%s",
|
||||
source_p->id, (long) chptr->channelts, chptr->chname, parv[3], parv[4]);
|
||||
source_p->id, (long) chptr->channelts, chptr->name.c_str(), parv[3], parv[4]);
|
||||
}
|
||||
|
|
|
@ -590,18 +590,19 @@ change_local_nick(struct Client *client_p, struct Client *source_p,
|
|||
{
|
||||
struct Client *target_p;
|
||||
rb_dlink_node *ptr, *next_ptr;
|
||||
struct Channel *chptr;
|
||||
chan::chan *chptr;
|
||||
char note[NICKLEN + 10];
|
||||
int samenick;
|
||||
|
||||
if (dosend)
|
||||
{
|
||||
chptr = find_bannickchange_channel(source_p);
|
||||
chptr = chan::find_bannickchange_channel(source_p);
|
||||
if (chptr != NULL)
|
||||
{
|
||||
sendto_one_numeric(source_p, ERR_BANNICKCHANGE,
|
||||
form_str(ERR_BANNICKCHANGE),
|
||||
nick, chptr->chname);
|
||||
form_str(ERR_BANNICKCHANGE),
|
||||
nick,
|
||||
chptr->name.c_str());
|
||||
return;
|
||||
}
|
||||
if((source_p->localClient->last_nick_change + ConfigFileEntry.max_nick_time) < rb_current_time())
|
||||
|
@ -633,7 +634,7 @@ change_local_nick(struct Client *client_p, struct Client *source_p,
|
|||
monitor_signoff(source_p);
|
||||
/* we only do bancache for local users -- jilles */
|
||||
if(source_p->user)
|
||||
invalidate_bancache_user(source_p);
|
||||
chan::invalidate_bancache_user(source_p);
|
||||
}
|
||||
|
||||
sendto_realops_snomask(SNO_NCHANGE, L_ALL,
|
||||
|
|
|
@ -40,8 +40,8 @@ DECLARE_MODULE_AV2(part, NULL, NULL, part_clist, NULL, NULL, NULL, NULL, part_de
|
|||
static void part_one_client(struct Client *client_p,
|
||||
struct Client *source_p, char *name,
|
||||
const char *reason);
|
||||
static bool can_send_part(struct Client *source_p, struct Channel *chptr, struct membership *msptr);
|
||||
static bool do_message_hook(struct Client *source_p, struct Channel *chptr, const char **reason);
|
||||
static bool can_send_part(struct Client *source_p, chan::chan *chptr, chan::membership *msptr);
|
||||
static bool do_message_hook(struct Client *source_p, chan::chan *chptr, const char **reason);
|
||||
|
||||
|
||||
/*
|
||||
|
@ -86,8 +86,8 @@ m_part(struct MsgBuf *msgbuf_p, struct Client *client_p, struct Client *source_p
|
|||
static void
|
||||
part_one_client(struct Client *client_p, struct Client *source_p, char *name, const char *reason)
|
||||
{
|
||||
struct Channel *chptr;
|
||||
struct membership *msptr;
|
||||
chan::chan *chptr;
|
||||
chan::membership *msptr;
|
||||
|
||||
if((chptr = find_channel(name)) == NULL)
|
||||
{
|
||||
|
@ -103,7 +103,7 @@ part_one_client(struct Client *client_p, struct Client *source_p, char *name, co
|
|||
}
|
||||
|
||||
if(MyConnect(source_p) && !IsOper(source_p) && !IsExemptSpambot(source_p))
|
||||
check_spambot_warning(source_p, NULL);
|
||||
chan::check_spambot_warning(source_p, NULL);
|
||||
|
||||
/*
|
||||
* Remove user from the old channel (if any)
|
||||
|
@ -117,19 +117,34 @@ part_one_client(struct Client *client_p, struct Client *source_p, char *name, co
|
|||
{
|
||||
|
||||
sendto_server(client_p, chptr, CAP_TS6, NOCAPS,
|
||||
":%s PART %s :%s", use_id(source_p), chptr->chname, reason);
|
||||
sendto_channel_local(ALL_MEMBERS, chptr, ":%s!%s@%s PART %s :%s",
|
||||
source_p->name, source_p->username,
|
||||
source_p->host, chptr->chname, reason);
|
||||
":%s PART %s :%s",
|
||||
use_id(source_p),
|
||||
chptr->name.c_str(),
|
||||
reason);
|
||||
|
||||
sendto_channel_local(chan::ALL_MEMBERS, chptr,
|
||||
":%s!%s@%s PART %s :%s",
|
||||
source_p->name,
|
||||
source_p->username,
|
||||
source_p->host,
|
||||
chptr->name.c_str(),
|
||||
reason);
|
||||
}
|
||||
else
|
||||
{
|
||||
sendto_server(client_p, chptr, CAP_TS6, NOCAPS,
|
||||
":%s PART %s", use_id(source_p), chptr->chname);
|
||||
sendto_channel_local(ALL_MEMBERS, chptr, ":%s!%s@%s PART %s",
|
||||
source_p->name, source_p->username,
|
||||
source_p->host, chptr->chname);
|
||||
":%s PART %s",
|
||||
use_id(source_p),
|
||||
chptr->name.c_str());
|
||||
|
||||
sendto_channel_local(chan::ALL_MEMBERS, chptr,
|
||||
":%s!%s@%s PART %s",
|
||||
source_p->name,
|
||||
source_p->username,
|
||||
source_p->host,
|
||||
chptr->name.c_str());
|
||||
}
|
||||
|
||||
remove_user_from_channel(msptr);
|
||||
}
|
||||
|
||||
|
@ -147,7 +162,7 @@ part_one_client(struct Client *client_p, struct Client *source_p, char *name, co
|
|||
* - none.
|
||||
*/
|
||||
static bool
|
||||
can_send_part(struct Client *source_p, struct Channel *chptr, struct membership *msptr)
|
||||
can_send_part(struct Client *source_p, chan::chan *chptr, chan::membership *msptr)
|
||||
{
|
||||
if (!can_send(chptr, source_p, msptr))
|
||||
return false;
|
||||
|
@ -171,7 +186,7 @@ can_send_part(struct Client *source_p, struct Channel *chptr, struct membership
|
|||
* - reason may be modified.
|
||||
*/
|
||||
static bool
|
||||
do_message_hook(struct Client *source_p, struct Channel *chptr, const char **reason)
|
||||
do_message_hook(struct Client *source_p, chan::chan *chptr, const char **reason)
|
||||
{
|
||||
hook_data_privmsg_channel hdata;
|
||||
|
||||
|
|
|
@ -211,8 +211,8 @@ static void
|
|||
m_chantrace(struct MsgBuf *msgbuf_p, struct Client *client_p, struct Client *source_p, int parc, const char *parv[])
|
||||
{
|
||||
struct Client *target_p;
|
||||
struct Channel *chptr;
|
||||
struct membership *msptr;
|
||||
chan::chan *chptr;
|
||||
chan::membership *msptr;
|
||||
const char *sockhost;
|
||||
const char *name;
|
||||
rb_dlink_node *ptr;
|
||||
|
@ -242,19 +242,19 @@ m_chantrace(struct MsgBuf *msgbuf_p, struct Client *client_p, struct Client *sou
|
|||
|
||||
/* dont report operspys for nonexistant channels. */
|
||||
if(operspy)
|
||||
report_operspy(source_p, "CHANTRACE", chptr->chname);
|
||||
report_operspy(source_p, "CHANTRACE", chptr->name.c_str());
|
||||
|
||||
if(!operspy && !IsMember(client_p, chptr))
|
||||
if(!operspy && !is_member(chptr, client_p))
|
||||
{
|
||||
sendto_one_numeric(source_p, ERR_NOTONCHANNEL, form_str(ERR_NOTONCHANNEL),
|
||||
chptr->chname);
|
||||
chptr->name.c_str());
|
||||
return;
|
||||
}
|
||||
|
||||
RB_DLINK_FOREACH(ptr, chptr->members.head)
|
||||
{
|
||||
msptr = (membership *)ptr->data;
|
||||
target_p = msptr->client_p;
|
||||
msptr = (chan::membership *)ptr->data;
|
||||
target_p = msptr->client;
|
||||
|
||||
if(EmptyString(target_p->sockhost))
|
||||
sockhost = empty_sockhost;
|
||||
|
|
|
@ -43,7 +43,7 @@ mapi_cap_list_av2 invite_cap_list[] = {
|
|||
|
||||
DECLARE_MODULE_AV2(invite, NULL, NULL, invite_clist, NULL, NULL, invite_cap_list, NULL, invite_desc);
|
||||
|
||||
static bool add_invite(struct Channel *, struct Client *);
|
||||
static bool add_invite(chan::chan *, struct Client *);
|
||||
|
||||
/* m_invite()
|
||||
* parv[1] - user to invite
|
||||
|
@ -53,8 +53,8 @@ static void
|
|||
m_invite(struct MsgBuf *msgbuf_p, struct Client *client_p, struct Client *source_p, int parc, const char *parv[])
|
||||
{
|
||||
struct Client *target_p;
|
||||
struct Channel *chptr;
|
||||
struct membership *msptr;
|
||||
chan::chan *chptr;
|
||||
chan::membership *msptr;
|
||||
int store_invite = 0;
|
||||
|
||||
if(MyClient(source_p) && !IsFloodDone(source_p))
|
||||
|
@ -77,7 +77,7 @@ m_invite(struct MsgBuf *msgbuf_p, struct Client *client_p, struct Client *source
|
|||
return;
|
||||
}
|
||||
|
||||
if(check_channel_name(parv[2]) == 0)
|
||||
if(chan::check_channel_name(parv[2]) == 0)
|
||||
{
|
||||
sendto_one_numeric(source_p, ERR_BADCHANNAME,
|
||||
form_str(ERR_BADCHANNAME),
|
||||
|
@ -120,7 +120,7 @@ m_invite(struct MsgBuf *msgbuf_p, struct Client *client_p, struct Client *source
|
|||
return;
|
||||
}
|
||||
|
||||
if(IsMember(target_p, chptr))
|
||||
if(is_member(chptr, target_p))
|
||||
{
|
||||
sendto_one_numeric(source_p, ERR_USERONCHANNEL,
|
||||
form_str(ERR_USERONCHANNEL),
|
||||
|
@ -203,25 +203,25 @@ m_invite(struct MsgBuf *msgbuf_p, struct Client *client_p, struct Client *source
|
|||
add_reply_target(target_p, source_p);
|
||||
sendto_one(target_p, ":%s!%s@%s INVITE %s :%s",
|
||||
source_p->name, source_p->username, source_p->host,
|
||||
target_p->name, chptr->chname);
|
||||
target_p->name, chptr->name.c_str());
|
||||
|
||||
if(store_invite)
|
||||
{
|
||||
if (!add_invite(chptr, target_p))
|
||||
return;
|
||||
|
||||
sendto_channel_local_with_capability(CHFL_CHANOP, 0, CAP_INVITE_NOTIFY, chptr,
|
||||
sendto_channel_local_with_capability(chan::CHANOP, 0, CAP_INVITE_NOTIFY, chptr,
|
||||
":%s NOTICE %s :%s is inviting %s to %s.",
|
||||
me.name, chptr->chname, source_p->name, target_p->name, chptr->chname);
|
||||
sendto_channel_local_with_capability(CHFL_CHANOP, CAP_INVITE_NOTIFY, 0, chptr,
|
||||
me.name, chptr->name.c_str(), source_p->name, target_p->name, chptr->name.c_str());
|
||||
sendto_channel_local_with_capability(chan::CHANOP, CAP_INVITE_NOTIFY, 0, chptr,
|
||||
":%s!%s@%s INVITE %s %s", source_p->name, source_p->username,
|
||||
source_p->host, target_p->name, chptr->chname);
|
||||
source_p->host, target_p->name, chptr->name.c_str());
|
||||
}
|
||||
}
|
||||
|
||||
sendto_server(source_p, chptr, CAP_TS6, 0, ":%s INVITE %s %s %lu",
|
||||
use_id(source_p), use_id(target_p),
|
||||
chptr->chname, (unsigned long) chptr->channelts);
|
||||
chptr->name.c_str(), (unsigned long) chptr->channelts);
|
||||
}
|
||||
|
||||
/* add_invite()
|
||||
|
@ -231,7 +231,7 @@ m_invite(struct MsgBuf *msgbuf_p, struct Client *client_p, struct Client *source
|
|||
* side effects - client is added to invite list.
|
||||
*/
|
||||
static bool
|
||||
add_invite(struct Channel *chptr, struct Client *who)
|
||||
add_invite(chan::chan *chptr, struct Client *who)
|
||||
{
|
||||
rb_dlink_node *ptr;
|
||||
|
||||
|
@ -247,7 +247,7 @@ add_invite(struct Channel *chptr, struct Client *who)
|
|||
ConfigChannel.max_chans_per_user)
|
||||
{
|
||||
ptr = who->user->invited.tail;
|
||||
del_invite((Channel *)ptr->data, who);
|
||||
del_invite((chan::chan *)ptr->data, who);
|
||||
}
|
||||
|
||||
/* add user to channel invite list */
|
||||
|
|
|
@ -65,7 +65,7 @@ DECLARE_MODULE_AV2(knock, _modinit, _moddeinit, knock_clist, NULL, NULL, NULL, N
|
|||
static void
|
||||
m_knock(struct MsgBuf *msgbuf_p, struct Client *client_p, struct Client *source_p, int parc, const char *parv[])
|
||||
{
|
||||
struct Channel *chptr;
|
||||
chan::chan *chptr;
|
||||
char *p, *name;
|
||||
|
||||
if(MyClient(source_p) && ConfigChannel.use_knock == 0)
|
||||
|
@ -88,7 +88,7 @@ m_knock(struct MsgBuf *msgbuf_p, struct Client *client_p, struct Client *source_
|
|||
return;
|
||||
}
|
||||
|
||||
if(IsMember(source_p, chptr))
|
||||
if(is_member(chptr, source_p))
|
||||
{
|
||||
if(MyClient(source_p))
|
||||
sendto_one(source_p, form_str(ERR_KNOCKONCHAN),
|
||||
|
@ -106,7 +106,7 @@ m_knock(struct MsgBuf *msgbuf_p, struct Client *client_p, struct Client *source_
|
|||
}
|
||||
|
||||
/* cant knock to a +p channel */
|
||||
if(HiddenChannel(chptr))
|
||||
if(hidden(chptr))
|
||||
{
|
||||
sendto_one_numeric(source_p, ERR_CANNOTSENDTOCHAN,
|
||||
form_str(ERR_CANNOTSENDTOCHAN), name);
|
||||
|
@ -117,8 +117,8 @@ m_knock(struct MsgBuf *msgbuf_p, struct Client *client_p, struct Client *source_
|
|||
if(MyClient(source_p))
|
||||
{
|
||||
/* don't allow a knock if the user is banned */
|
||||
if(is_banned(chptr, source_p, NULL, NULL, NULL, NULL) == CHFL_BAN ||
|
||||
is_quieted(chptr, source_p, NULL, NULL, NULL) == CHFL_BAN)
|
||||
if(is_banned(chptr, source_p, NULL, NULL, NULL, NULL) == chan::mode::BAN ||
|
||||
is_quieted(chptr, source_p, NULL, NULL, NULL) == chan::mode::BAN)
|
||||
{
|
||||
sendto_one_numeric(source_p, ERR_CANNOTSENDTOCHAN,
|
||||
form_str(ERR_CANNOTSENDTOCHAN), name);
|
||||
|
@ -153,7 +153,7 @@ m_knock(struct MsgBuf *msgbuf_p, struct Client *client_p, struct Client *source_
|
|||
chptr->last_knock = rb_current_time();
|
||||
|
||||
if(ConfigChannel.use_knock)
|
||||
sendto_channel_local(chptr->mode.mode & chan::mode::FREEINVITE ? ALL_MEMBERS : ONLY_CHANOPS,
|
||||
sendto_channel_local(chptr->mode.mode & chan::mode::FREEINVITE ? chan::ALL_MEMBERS : chan::ONLY_CHANOPS,
|
||||
chptr, form_str(RPL_KNOCK),
|
||||
me.name, name, name, source_p->name,
|
||||
source_p->username, source_p->host);
|
||||
|
|
|
@ -45,9 +45,9 @@ static void _moddeinit(void);
|
|||
static void m_list(struct MsgBuf *, struct Client *, struct Client *, int, const char **);
|
||||
static void mo_list(struct MsgBuf *, struct Client *, struct Client *, int, const char **);
|
||||
|
||||
static void list_one_channel(struct Client *source_p, struct Channel *chptr, int visible);
|
||||
static void list_one_channel(struct Client *source_p, chan::chan *chptr, int visible);
|
||||
|
||||
static void safelist_one_channel(struct Client *source_p, struct Channel *chptr, struct ListClient *params);
|
||||
static void safelist_one_channel(struct Client *source_p, chan::chan *chptr, struct ListClient *params);
|
||||
static void safelist_check_cliexit(hook_data_client_exit * hdata);
|
||||
static void safelist_client_instantiate(struct Client *, struct ListClient *);
|
||||
static void safelist_client_release(struct Client *);
|
||||
|
@ -124,7 +124,7 @@ m_list(struct MsgBuf *msgbuf_p, struct Client *client_p, struct Client *source_p
|
|||
return;
|
||||
}
|
||||
|
||||
if (parc < 2 || !IsChannelName(parv[1]))
|
||||
if (parc < 2 || chan::is_name(parv[1]))
|
||||
{
|
||||
/* pace this due to the sheer traffic involved */
|
||||
if (((last_used + ConfigFileEntry.pace_wait) > rb_current_time()))
|
||||
|
@ -172,7 +172,7 @@ mo_list(struct MsgBuf *msgbuf_p, struct Client *client_p, struct Client *source_
|
|||
}
|
||||
|
||||
/* Single channel. */
|
||||
if (args && IsChannelName(args))
|
||||
if (args && chan::is_name(args))
|
||||
{
|
||||
safelist_channel_named(source_p, args, operspy);
|
||||
return;
|
||||
|
@ -279,19 +279,19 @@ mo_list(struct MsgBuf *msgbuf_p, struct Client *client_p, struct Client *source_
|
|||
* outputs - none
|
||||
* side effects - a channel is listed
|
||||
*/
|
||||
static void list_one_channel(struct Client *source_p, struct Channel *chptr,
|
||||
static void list_one_channel(struct Client *source_p, chan::chan *chptr,
|
||||
int visible)
|
||||
{
|
||||
char topic[TOPICLEN + 1];
|
||||
|
||||
if (chptr->topic != NULL)
|
||||
rb_strlcpy(topic, chptr->topic, sizeof topic);
|
||||
if (!chptr->topic.text.empty())
|
||||
rb_strlcpy(topic, chptr->topic.text.c_str(), sizeof topic);
|
||||
else
|
||||
topic[0] = '\0';
|
||||
strip_colour(topic);
|
||||
sendto_one(source_p, form_str(RPL_LIST), me.name, source_p->name,
|
||||
visible ? "" : "!",
|
||||
chptr->chname, rb_dlink_list_length(&chptr->members),
|
||||
chptr->name.c_str(), rb_dlink_list_length(&chptr->members),
|
||||
topic);
|
||||
}
|
||||
|
||||
|
@ -373,7 +373,7 @@ static void safelist_client_release(struct Client *client_p)
|
|||
*/
|
||||
static void safelist_channel_named(struct Client *source_p, const char *name, int operspy)
|
||||
{
|
||||
struct Channel *chptr;
|
||||
chan::chan *chptr;
|
||||
char *p;
|
||||
int visible;
|
||||
|
||||
|
@ -398,7 +398,7 @@ static void safelist_channel_named(struct Client *source_p, const char *name, in
|
|||
return;
|
||||
}
|
||||
|
||||
visible = !SecretChannel(chptr) || IsMember(source_p, chptr);
|
||||
visible = !secret(chptr) || is_member(chptr, source_p);
|
||||
if (visible || operspy)
|
||||
list_one_channel(source_p, chptr, visible);
|
||||
|
||||
|
@ -414,11 +414,11 @@ static void safelist_channel_named(struct Client *source_p, const char *name, in
|
|||
* side effects - a channel is listed if it meets the
|
||||
* requirements
|
||||
*/
|
||||
static void safelist_one_channel(struct Client *source_p, struct Channel *chptr, struct ListClient *params)
|
||||
static void safelist_one_channel(struct Client *source_p, chan::chan *chptr, struct ListClient *params)
|
||||
{
|
||||
int visible;
|
||||
|
||||
visible = !SecretChannel(chptr) || IsMember(source_p, chptr);
|
||||
visible = !secret(chptr) || is_member(chptr, source_p);
|
||||
if (!visible && !params->operspy)
|
||||
return;
|
||||
|
||||
|
@ -426,12 +426,11 @@ static void safelist_one_channel(struct Client *source_p, struct Channel *chptr,
|
|||
|| (unsigned int)chptr->members.length > params->users_max)
|
||||
return;
|
||||
|
||||
if (params->topic_min && chptr->topic_time < params->topic_min)
|
||||
if (params->topic_min && chptr->topic.time < params->topic_min)
|
||||
return;
|
||||
|
||||
/* If a topic TS is provided, don't show channels without a topic set. */
|
||||
if (params->topic_max && (chptr->topic_time > params->topic_max
|
||||
|| chptr->topic_time == 0))
|
||||
if (params->topic_max && (chptr->topic.time > params->topic_max || chptr->topic.time == 0))
|
||||
return;
|
||||
|
||||
if (params->created_min && chptr->channelts < params->created_min)
|
||||
|
@ -457,11 +456,11 @@ static void safelist_iterate_client(struct Client *source_p)
|
|||
void *elem;
|
||||
RB_RADIXTREE_FOREACH_FROM(elem, &iter, channel_tree, source_p->localClient->safelist_data->chname)
|
||||
{
|
||||
const auto chptr(reinterpret_cast<Channel *>(elem));
|
||||
const auto chptr(reinterpret_cast<chan::chan *>(elem));
|
||||
if (safelist_sendq_exceeded(source_p->from))
|
||||
{
|
||||
rb_free(source_p->localClient->safelist_data->chname);
|
||||
source_p->localClient->safelist_data->chname = rb_strdup(chptr->chname);
|
||||
source_p->localClient->safelist_data->chname = rb_strdup(chptr->name.c_str());
|
||||
|
||||
return;
|
||||
}
|
||||
|
|
|
@ -51,7 +51,7 @@ static void
|
|||
m_names(struct MsgBuf *msgbuf_p, struct Client *client_p, struct Client *source_p, int parc, const char *parv[])
|
||||
{
|
||||
static time_t last_used = 0;
|
||||
struct Channel *chptr = NULL;
|
||||
chan::chan *chptr = NULL;
|
||||
char *s;
|
||||
|
||||
if(parc > 1 && !EmptyString(parv[1]))
|
||||
|
@ -60,7 +60,7 @@ m_names(struct MsgBuf *msgbuf_p, struct Client *client_p, struct Client *source_
|
|||
if((s = strchr(p, ',')))
|
||||
*s = '\0';
|
||||
|
||||
if(!check_channel_name(p))
|
||||
if(!chan::check_channel_name(p))
|
||||
{
|
||||
sendto_one_numeric(source_p, ERR_BADCHANNAME,
|
||||
form_str(ERR_BADCHANNAME),
|
||||
|
@ -112,15 +112,15 @@ names_global(struct Client *source_p)
|
|||
bool dont_show = false;
|
||||
rb_dlink_node *lp, *ptr;
|
||||
struct Client *target_p;
|
||||
struct Channel *chptr = NULL;
|
||||
struct membership *msptr;
|
||||
chan::chan *chptr = NULL;
|
||||
chan::membership *msptr;
|
||||
char buf[BUFSIZE];
|
||||
char *t;
|
||||
|
||||
/* first do all visible channels */
|
||||
RB_DLINK_FOREACH(ptr, global_channel_list.head)
|
||||
RB_DLINK_FOREACH(ptr, chan::global_channel_list.head)
|
||||
{
|
||||
chptr = (Channel *)ptr->data;
|
||||
chptr = (chan::chan *)ptr->data;
|
||||
channel_member_names(chptr, source_p, 0);
|
||||
}
|
||||
cur_len = mlen = sprintf(buf, form_str(RPL_NAMREPLY),
|
||||
|
@ -145,11 +145,10 @@ names_global(struct Client *source_p)
|
|||
*/
|
||||
RB_DLINK_FOREACH(lp, target_p->user->channel.head)
|
||||
{
|
||||
msptr = (membership *)lp->data;
|
||||
chptr = msptr->chptr;
|
||||
msptr = (chan::membership *)lp->data;
|
||||
chptr = msptr->chan;
|
||||
|
||||
if(PubChannel(chptr) || IsMember(source_p, chptr) ||
|
||||
SecretChannel(chptr))
|
||||
if(pub(chptr) || is_member(chptr, source_p) || secret(chptr))
|
||||
{
|
||||
dont_show = true;
|
||||
break;
|
||||
|
|
|
@ -184,7 +184,7 @@ parse_resv(struct Client *source_p, const char *name, const char *reason, int te
|
|||
(temp_time > 0) ? SHARED_TRESV : SHARED_PRESV))
|
||||
return;
|
||||
|
||||
if(IsChannelName(name))
|
||||
if(chan::is_name(name))
|
||||
{
|
||||
if(hash_find_resv(name))
|
||||
{
|
||||
|
@ -257,7 +257,7 @@ parse_resv(struct Client *source_p, const char *name, const char *reason, int te
|
|||
}
|
||||
|
||||
add_to_resv_hash(aconf->host, aconf);
|
||||
resv_chan_forcepart(aconf->host, aconf->passwd, temp_time);
|
||||
chan::resv_chan_forcepart(aconf->host, aconf->passwd, temp_time);
|
||||
}
|
||||
else if(clean_resv_nick(name))
|
||||
{
|
||||
|
@ -490,7 +490,7 @@ remove_resv(struct Client *source_p, const char *name, int propagated)
|
|||
rb_dlink_node *ptr;
|
||||
time_t now;
|
||||
|
||||
if(IsChannelName(name))
|
||||
if(chan::is_name(name))
|
||||
{
|
||||
if((aconf = hash_find_resv(name)) == NULL)
|
||||
{
|
||||
|
|
|
@ -123,7 +123,7 @@ me_su(struct MsgBuf *msgbuf_p, struct Client *client_p, struct Client *source_p,
|
|||
target_p->name, target_p->username, target_p->host,
|
||||
EmptyString(target_p->user->suser) ? "*" : target_p->user->suser);
|
||||
|
||||
invalidate_bancache_user(target_p);
|
||||
chan::invalidate_bancache_user(target_p);
|
||||
}
|
||||
|
||||
static void
|
||||
|
@ -212,7 +212,7 @@ doit:
|
|||
|
||||
monitor_signoff(target_p);
|
||||
|
||||
invalidate_bancache_user(target_p);
|
||||
chan::invalidate_bancache_user(target_p);
|
||||
|
||||
sendto_realops_snomask(SNO_NCHANGE, L_ALL,
|
||||
"Nick change: From %s to %s [%s@%s]",
|
||||
|
|
|
@ -391,7 +391,7 @@ quote_splitmode(struct Client *source_p, const char *charval, int intval)
|
|||
get_oper_name(source_p));
|
||||
|
||||
splitchecking = true;
|
||||
check_splitmode(NULL);
|
||||
chan::check_splitmode(NULL);
|
||||
}
|
||||
}
|
||||
else
|
||||
|
@ -414,7 +414,7 @@ quote_splitnum(struct Client *source_p, const char *arg, int newval)
|
|||
split_servers = newval;
|
||||
|
||||
if(splitchecking)
|
||||
check_splitmode(NULL);
|
||||
chan::check_splitmode(NULL);
|
||||
}
|
||||
else
|
||||
sendto_one_notice(source_p, ":SPLITNUM is currently %i", split_servers);
|
||||
|
@ -431,7 +431,7 @@ quote_splitusers(struct Client *source_p, const char *arg, int newval)
|
|||
split_users = newval;
|
||||
|
||||
if(splitchecking)
|
||||
check_splitmode(NULL);
|
||||
chan::check_splitmode(NULL);
|
||||
}
|
||||
else
|
||||
sendto_one_notice(source_p, ":SPLITUSERS is currently %i", split_users);
|
||||
|
|
|
@ -1275,7 +1275,7 @@ static void
|
|||
stats_memory (struct Client *source_p)
|
||||
{
|
||||
struct Client *target_p;
|
||||
struct Channel *chptr;
|
||||
chan::chan *chptr;
|
||||
rb_dlink_node *rb_dlink;
|
||||
rb_dlink_node *ptr;
|
||||
int channel_count = 0;
|
||||
|
@ -1346,11 +1346,11 @@ stats_memory (struct Client *source_p)
|
|||
}
|
||||
|
||||
/* Count up all channels, ban lists, except lists, Invex lists */
|
||||
RB_DLINK_FOREACH(ptr, global_channel_list.head)
|
||||
RB_DLINK_FOREACH(ptr, chan::global_channel_list.head)
|
||||
{
|
||||
chptr = (Channel *)ptr->data;
|
||||
chptr = (chan::chan *)ptr->data;
|
||||
channel_count++;
|
||||
channel_memory += (strlen(chptr->chname) + sizeof(struct Channel));
|
||||
channel_memory += (strlen(chptr->name.c_str()) + sizeof(chan::chan));
|
||||
|
||||
channel_users += rb_dlink_list_length(&chptr->members);
|
||||
channel_invites += rb_dlink_list_length(&chptr->invites);
|
||||
|
@ -1359,28 +1359,28 @@ stats_memory (struct Client *source_p)
|
|||
{
|
||||
channel_bans++;
|
||||
|
||||
channel_ban_memory += sizeof(rb_dlink_node) + sizeof(struct Ban);
|
||||
channel_ban_memory += sizeof(rb_dlink_node) + sizeof(chan::ban);
|
||||
}
|
||||
|
||||
RB_DLINK_FOREACH(rb_dlink, chptr->exceptlist.head)
|
||||
{
|
||||
channel_except++;
|
||||
|
||||
channel_except_memory += (sizeof(rb_dlink_node) + sizeof(struct Ban));
|
||||
channel_except_memory += (sizeof(rb_dlink_node) + sizeof(chan::ban));
|
||||
}
|
||||
|
||||
RB_DLINK_FOREACH(rb_dlink, chptr->invexlist.head)
|
||||
{
|
||||
channel_invex++;
|
||||
|
||||
channel_invex_memory += (sizeof(rb_dlink_node) + sizeof(struct Ban));
|
||||
channel_invex_memory += (sizeof(rb_dlink_node) + sizeof(chan::ban));
|
||||
}
|
||||
|
||||
RB_DLINK_FOREACH(rb_dlink, chptr->quietlist.head)
|
||||
{
|
||||
channel_quiets++;
|
||||
|
||||
channel_quiet_memory += (sizeof(rb_dlink_node) + sizeof(struct Ban));
|
||||
channel_quiet_memory += (sizeof(rb_dlink_node) + sizeof(chan::ban));
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
@ -59,7 +59,7 @@ DECLARE_MODULE_AV2(tb, NULL, NULL, tb_clist, NULL, NULL, NULL, NULL, tb_desc);
|
|||
static void
|
||||
ms_tb(struct MsgBuf *msgbuf_p, struct Client *client_p, struct Client *source_p, int parc, const char *parv[])
|
||||
{
|
||||
struct Channel *chptr;
|
||||
chan::chan *chptr;
|
||||
const char *newtopic;
|
||||
const char *newtopicwho;
|
||||
time_t newtopicts;
|
||||
|
@ -92,23 +92,23 @@ ms_tb(struct MsgBuf *msgbuf_p, struct Client *client_p, struct Client *source_p,
|
|||
if (EmptyString(newtopic))
|
||||
return;
|
||||
|
||||
if(chptr->topic == NULL || chptr->topic_time > newtopicts)
|
||||
if(!chptr->topic || chptr->topic.time > newtopicts)
|
||||
{
|
||||
/* its possible the topicts is a few seconds out on some
|
||||
* servers, due to lag when propagating it, so if theyre the
|
||||
* same topic just drop the message --fl
|
||||
*/
|
||||
if(chptr->topic != NULL && strcmp(chptr->topic, newtopic) == 0)
|
||||
if(chptr->topic && strcmp(chptr->topic.text.c_str(), newtopic) == 0)
|
||||
return;
|
||||
|
||||
set_channel_topic(chptr, newtopic, newtopicwho, newtopicts);
|
||||
sendto_channel_local(ALL_MEMBERS, chptr, ":%s TOPIC %s :%s",
|
||||
fakesource_p->name, chptr->chname, newtopic);
|
||||
sendto_channel_local(chan::ALL_MEMBERS, chptr, ":%s TOPIC %s :%s",
|
||||
fakesource_p->name, chptr->name.c_str(), newtopic);
|
||||
sendto_server(client_p, chptr, CAP_TB|CAP_TS6, NOCAPS,
|
||||
":%s TB %s %ld %s%s:%s",
|
||||
use_id(source_p), chptr->chname, (long) chptr->topic_time,
|
||||
ConfigChannel.burst_topicwho ? chptr->topic_info : "",
|
||||
ConfigChannel.burst_topicwho ? " " : "", chptr->topic);
|
||||
use_id(source_p), chptr->name.c_str(), (long) chptr->topic.time,
|
||||
ConfigChannel.burst_topicwho ? chptr->topic.info.c_str() : "",
|
||||
ConfigChannel.burst_topicwho ? " " : "", chptr->topic.text.c_str());
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -123,7 +123,7 @@ ms_tb(struct MsgBuf *msgbuf_p, struct Client *client_p, struct Client *source_p,
|
|||
static void
|
||||
ms_etb(struct MsgBuf *msgbuf_p, struct Client *client_p, struct Client *source_p, int parc, const char *parv[])
|
||||
{
|
||||
struct Channel *chptr;
|
||||
chan::chan *chptr;
|
||||
const char *newtopic;
|
||||
const char *newtopicwho;
|
||||
time_t channelts, newtopicts;
|
||||
|
@ -148,17 +148,17 @@ ms_etb(struct MsgBuf *msgbuf_p, struct Client *client_p, struct Client *source_p
|
|||
newtopicwho = parv[4];
|
||||
newtopic = parv[parc - 1];
|
||||
|
||||
if(chptr->topic == NULL || chptr->channelts > channelts ||
|
||||
(chptr->channelts == channelts && chptr->topic_time < newtopicts))
|
||||
if(!chptr->topic || chptr->channelts > channelts ||
|
||||
(chptr->channelts == channelts && chptr->topic.time < newtopicts))
|
||||
{
|
||||
textchange = chptr->topic == NULL || strcmp(chptr->topic, newtopic);
|
||||
textchange = chptr->topic.text.empty() || strcmp(chptr->topic.text.c_str(), newtopic);
|
||||
can_use_tb = textchange && !EmptyString(newtopic) &&
|
||||
(chptr->topic == NULL || chptr->topic_time > newtopicts);
|
||||
(chptr->topic.text.empty() || chptr->topic.time > newtopicts);
|
||||
|
||||
set_channel_topic(chptr, newtopic, newtopicwho, newtopicts);
|
||||
newtopic = chptr->topic ? chptr->topic : "";
|
||||
if (chptr->topic_info)
|
||||
newtopicwho = chptr->topic_info;
|
||||
newtopic = !chptr->topic.text.empty()? chptr->topic.text.c_str() : "";
|
||||
if (!chptr->topic.info.empty())
|
||||
newtopicwho = chptr->topic.info.c_str(); //TODO: XXX: ??
|
||||
|
||||
/* Do not send a textually identical topic to clients,
|
||||
* but do propagate the new topicts/topicwho to servers.
|
||||
|
@ -166,65 +166,65 @@ ms_etb(struct MsgBuf *msgbuf_p, struct Client *client_p, struct Client *source_p
|
|||
if(textchange)
|
||||
{
|
||||
if (IsPerson(fakesource_p))
|
||||
sendto_channel_local(ALL_MEMBERS, chptr,
|
||||
sendto_channel_local(chan::ALL_MEMBERS, chptr,
|
||||
":%s!%s@%s TOPIC %s :%s",
|
||||
fakesource_p->name,
|
||||
fakesource_p->username,
|
||||
fakesource_p->host,
|
||||
chptr->chname,
|
||||
chptr->name.c_str(),
|
||||
newtopic);
|
||||
else
|
||||
sendto_channel_local(ALL_MEMBERS, chptr,
|
||||
sendto_channel_local(chan::ALL_MEMBERS, chptr,
|
||||
":%s TOPIC %s :%s",
|
||||
fakesource_p->name,
|
||||
chptr->chname, newtopic);
|
||||
chptr->name.c_str(), newtopic);
|
||||
}
|
||||
/* Propagate channelts as given, because an older channelts
|
||||
* forces any change.
|
||||
*/
|
||||
sendto_server(client_p, chptr, CAP_EOPMOD|CAP_TS6, NOCAPS,
|
||||
":%s ETB %ld %s %ld %s :%s",
|
||||
use_id(source_p), (long)channelts, chptr->chname,
|
||||
use_id(source_p), (long)channelts, chptr->name.c_str(),
|
||||
(long)newtopicts, newtopicwho, newtopic);
|
||||
source_server_p = IsServer(source_p) ? source_p : source_p->servptr;
|
||||
if (can_use_tb)
|
||||
sendto_server(client_p, chptr, CAP_TB|CAP_TS6, CAP_EOPMOD,
|
||||
":%s TB %s %ld %s :%s",
|
||||
use_id(source_server_p),
|
||||
chptr->chname, (long)newtopicts,
|
||||
chptr->name.c_str(), (long)newtopicts,
|
||||
newtopicwho, newtopic);
|
||||
else if (IsPerson(source_p) && textchange)
|
||||
{
|
||||
member = IsMember(source_p, chptr);
|
||||
member = is_member(chptr, source_p);
|
||||
if (!member)
|
||||
sendto_server(client_p, chptr, CAP_TS6, CAP_EOPMOD,
|
||||
":%s SJOIN %ld %s + :@%s",
|
||||
use_id(source_server_p),
|
||||
(long)chptr->channelts,
|
||||
chptr->chname, use_id(source_p));
|
||||
chptr->name.c_str(), use_id(source_p));
|
||||
if (EmptyString(newtopic) ||
|
||||
newtopicts >= rb_current_time() - 60)
|
||||
sendto_server(client_p, chptr, CAP_TS6, CAP_EOPMOD,
|
||||
":%s TOPIC %s :%s",
|
||||
use_id(source_p),
|
||||
chptr->chname, newtopic);
|
||||
chptr->name.c_str(), newtopic);
|
||||
else
|
||||
{
|
||||
sendto_server(client_p, chptr, CAP_TS6, CAP_EOPMOD,
|
||||
":%s TOPIC %s :%s",
|
||||
use_id(source_p),
|
||||
chptr->chname, "");
|
||||
chptr->name.c_str(), "");
|
||||
sendto_server(client_p, chptr, CAP_TB|CAP_TS6, CAP_EOPMOD,
|
||||
":%s TB %s %ld %s :%s",
|
||||
use_id(source_server_p),
|
||||
chptr->chname, (long)newtopicts,
|
||||
chptr->name.c_str(), (long)newtopicts,
|
||||
newtopicwho, newtopic);
|
||||
}
|
||||
if (!member)
|
||||
sendto_server(client_p, chptr, CAP_TS6, CAP_EOPMOD,
|
||||
":%s PART %s :Topic set for %s",
|
||||
use_id(source_p),
|
||||
chptr->chname, newtopicwho);
|
||||
chptr->name.c_str(), newtopicwho);
|
||||
}
|
||||
else if (textchange)
|
||||
{
|
||||
|
@ -233,7 +233,7 @@ ms_etb(struct MsgBuf *msgbuf_p, struct Client *client_p, struct Client *source_p
|
|||
*/
|
||||
sendto_server(client_p, chptr, CAP_TS6, CAP_EOPMOD,
|
||||
":%s NOTICE %s :*** Notice -- Dropping topic change for %s",
|
||||
me.id, chptr->chname, chptr->chname);
|
||||
me.id, chptr->name.c_str(), chptr->name.c_str());
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
@ -68,7 +68,7 @@ mo_testline(struct MsgBuf *msgbuf_p, struct Client *client_p, struct Client *sou
|
|||
|
||||
mask = LOCAL_COPY(parv[1]);
|
||||
|
||||
if (IsChannelName(mask))
|
||||
if (chan::is_name(mask))
|
||||
{
|
||||
resv_p = hash_find_resv(mask);
|
||||
if (resv_p != NULL)
|
||||
|
|
|
@ -46,8 +46,8 @@ DECLARE_MODULE_AV2(topic, NULL, NULL, topic_clist, NULL, NULL, NULL, NULL, topic
|
|||
static void
|
||||
m_topic(struct MsgBuf *msgbuf_p, struct Client *client_p, struct Client *source_p, int parc, const char *parv[])
|
||||
{
|
||||
struct Channel *chptr = NULL;
|
||||
struct membership *msptr;
|
||||
chan::chan *chptr = NULL;
|
||||
chan::membership *msptr;
|
||||
char *p = NULL;
|
||||
const char *name;
|
||||
int operspy = 0;
|
||||
|
@ -99,12 +99,12 @@ m_topic(struct MsgBuf *msgbuf_p, struct Client *client_p, struct Client *source_
|
|||
!add_channel_target(source_p, chptr))
|
||||
{
|
||||
sendto_one(source_p, form_str(ERR_TARGCHANGE),
|
||||
me.name, source_p->name, chptr->chname);
|
||||
me.name, source_p->name, chptr->name.c_str());
|
||||
return;
|
||||
}
|
||||
|
||||
if(((chptr->mode.mode & chan::mode::TOPICLIMIT) == 0 ||
|
||||
get_channel_access(source_p, chptr, msptr, MODE_ADD, NULL) >= CHFL_CHANOP) &&
|
||||
get_channel_access(source_p, chptr, msptr, MODE_ADD, NULL) >= chan::CHANOP) &&
|
||||
(!MyClient(source_p) ||
|
||||
can_send(chptr, source_p, msptr)))
|
||||
{
|
||||
|
@ -121,13 +121,13 @@ m_topic(struct MsgBuf *msgbuf_p, struct Client *client_p, struct Client *source_
|
|||
|
||||
sendto_server(client_p, chptr, CAP_TS6, NOCAPS,
|
||||
":%s TOPIC %s :%s",
|
||||
use_id(source_p), chptr->chname,
|
||||
chptr->topic == NULL ? "" : chptr->topic);
|
||||
sendto_channel_local(ALL_MEMBERS,
|
||||
use_id(source_p), chptr->name.c_str(),
|
||||
chptr->topic? "" : chptr->topic.text.c_str());
|
||||
sendto_channel_local(chan::ALL_MEMBERS,
|
||||
chptr, ":%s!%s@%s TOPIC %s :%s",
|
||||
source_p->name, source_p->username,
|
||||
source_p->host, chptr->chname,
|
||||
chptr->topic == NULL ? "" : chptr->topic);
|
||||
source_p->host, chptr->name.c_str(),
|
||||
chptr->topic? "" : chptr->topic.text.c_str());
|
||||
}
|
||||
else
|
||||
sendto_one(source_p, form_str(ERR_CHANOPRIVSNEEDED),
|
||||
|
@ -137,26 +137,33 @@ m_topic(struct MsgBuf *msgbuf_p, struct Client *client_p, struct Client *source_
|
|||
else if(MyClient(source_p))
|
||||
{
|
||||
if(operspy)
|
||||
report_operspy(source_p, "TOPIC", chptr->chname);
|
||||
if(!IsMember(source_p, chptr) && SecretChannel(chptr) &&
|
||||
!operspy)
|
||||
report_operspy(source_p, "TOPIC", chptr->name.c_str());
|
||||
|
||||
if(!is_member(chptr, source_p) && secret(chptr) && !operspy)
|
||||
{
|
||||
sendto_one_numeric(source_p, ERR_NOTONCHANNEL,
|
||||
form_str(ERR_NOTONCHANNEL), name);
|
||||
sendto_one_numeric(source_p, ERR_NOTONCHANNEL, form_str(ERR_NOTONCHANNEL), name);
|
||||
return;
|
||||
}
|
||||
if(chptr->topic == NULL)
|
||||
|
||||
if(!chptr->topic)
|
||||
sendto_one(source_p, form_str(RPL_NOTOPIC),
|
||||
me.name, source_p->name, name);
|
||||
me.name,
|
||||
source_p->name,
|
||||
name);
|
||||
else
|
||||
{
|
||||
sendto_one(source_p, form_str(RPL_TOPIC),
|
||||
me.name, source_p->name, chptr->chname, chptr->topic);
|
||||
me.name,
|
||||
source_p->name,
|
||||
chptr->name.c_str(),
|
||||
chptr->topic.text.c_str());
|
||||
|
||||
sendto_one(source_p, form_str(RPL_TOPICWHOTIME),
|
||||
me.name, source_p->name, chptr->chname,
|
||||
chptr->topic_info,
|
||||
(unsigned long)chptr->topic_time);
|
||||
me.name,
|
||||
source_p->name,
|
||||
chptr->name.c_str(),
|
||||
chptr->topic.info.c_str(),
|
||||
ulong(chptr->topic.time));
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -173,14 +180,16 @@ m_topic(struct MsgBuf *msgbuf_p, struct Client *client_p, struct Client *source_
|
|||
static void
|
||||
ms_topic(struct MsgBuf *msgbuf_p, struct Client *client_p, struct Client *source_p, int parc, const char *parv[])
|
||||
{
|
||||
struct Channel *chptr = NULL;
|
||||
chan::chan *chptr = NULL;
|
||||
|
||||
if((chptr = find_channel(parv[1])) == NULL)
|
||||
return;
|
||||
|
||||
set_channel_topic(chptr, parv[4], parv[2], atoi(parv[3]));
|
||||
|
||||
sendto_channel_local(ALL_MEMBERS, chptr, ":%s TOPIC %s :%s",
|
||||
source_p->name, parv[1],
|
||||
chptr->topic == NULL ? "" : chptr->topic);
|
||||
sendto_channel_local(chan::ALL_MEMBERS, chptr,
|
||||
":%s TOPIC %s :%s",
|
||||
source_p->name,
|
||||
parv[1],
|
||||
chptr->topic.text.c_str());
|
||||
}
|
||||
|
|
|
@ -49,12 +49,12 @@ struct who_format
|
|||
|
||||
static void m_who(struct MsgBuf *, struct Client *, struct Client *, int, const char **);
|
||||
|
||||
static void do_who_on_channel(struct Client *source_p, struct Channel *chptr,
|
||||
static void do_who_on_channel(struct Client *source_p, chan::chan *chptr,
|
||||
int server_oper, int member,
|
||||
struct who_format *fmt);
|
||||
static void who_global(struct Client *source_p, const char *mask, int server_oper, int operspy, struct who_format *fmt);
|
||||
static void do_who(struct Client *source_p,
|
||||
struct Client *target_p, struct membership *msptr,
|
||||
struct Client *target_p, chan::membership *msptr,
|
||||
struct who_format *fmt);
|
||||
|
||||
struct Message who_msgtab = {
|
||||
|
@ -88,10 +88,10 @@ m_who(struct MsgBuf *msgbuf_p, struct Client *client_p, struct Client *source_p,
|
|||
{
|
||||
static time_t last_used = 0;
|
||||
struct Client *target_p;
|
||||
struct membership *msptr;
|
||||
chan::membership *msptr;
|
||||
char *mask;
|
||||
rb_dlink_node *lp;
|
||||
struct Channel *chptr = NULL;
|
||||
chan::chan *chptr = NULL;
|
||||
int server_oper = parc > 2 ? (*parv[2] == 'o') : 0; /* Show OPERS only */
|
||||
int member;
|
||||
int operspy = 0;
|
||||
|
@ -146,8 +146,8 @@ m_who(struct MsgBuf *msgbuf_p, struct Client *client_p, struct Client *source_p,
|
|||
|
||||
if((lp = source_p->user->channel.head) != NULL)
|
||||
{
|
||||
msptr = (membership *)lp->data;
|
||||
do_who_on_channel(source_p, msptr->chptr, server_oper, true, &fmt);
|
||||
msptr = (chan::membership *)lp->data;
|
||||
do_who_on_channel(source_p, msptr->chan, server_oper, true, &fmt);
|
||||
}
|
||||
|
||||
sendto_one(source_p, form_str(RPL_ENDOFWHO),
|
||||
|
@ -169,7 +169,7 @@ m_who(struct MsgBuf *msgbuf_p, struct Client *client_p, struct Client *source_p,
|
|||
}
|
||||
|
||||
/* '/who #some_channel' */
|
||||
if(IsChannelName(mask))
|
||||
if(chan::is_name(mask))
|
||||
{
|
||||
/* List all users on a given channel */
|
||||
chptr = find_channel(parv[1] + operspy);
|
||||
|
@ -186,11 +186,11 @@ m_who(struct MsgBuf *msgbuf_p, struct Client *client_p, struct Client *source_p,
|
|||
}
|
||||
|
||||
if(operspy)
|
||||
report_operspy(source_p, "WHO", chptr->chname);
|
||||
report_operspy(source_p, "WHO", chptr->name.c_str());
|
||||
|
||||
if(IsMember(source_p, chptr) || operspy)
|
||||
if(is_member(chptr, source_p) || operspy)
|
||||
do_who_on_channel(source_p, chptr, server_oper, true, &fmt);
|
||||
else if(!SecretChannel(chptr))
|
||||
else if(!secret(chptr))
|
||||
do_who_on_channel(source_p, chptr, server_oper, false, &fmt);
|
||||
}
|
||||
|
||||
|
@ -209,15 +209,15 @@ m_who(struct MsgBuf *msgbuf_p, struct Client *client_p, struct Client *source_p,
|
|||
isinvis = IsInvisible(target_p);
|
||||
RB_DLINK_FOREACH(lp, target_p->user->channel.head)
|
||||
{
|
||||
msptr = (membership *)lp->data;
|
||||
chptr = msptr->chptr;
|
||||
msptr = (chan::membership *)lp->data;
|
||||
chptr = msptr->chan;
|
||||
|
||||
member = IsMember(source_p, chptr);
|
||||
member = is_member(chptr, source_p);
|
||||
|
||||
if(isinvis && !member)
|
||||
continue;
|
||||
|
||||
if(member || (!isinvis && PubChannel(chptr)))
|
||||
if(member || (!isinvis && pub(chptr)))
|
||||
break;
|
||||
}
|
||||
|
||||
|
@ -225,7 +225,7 @@ m_who(struct MsgBuf *msgbuf_p, struct Client *client_p, struct Client *source_p,
|
|||
* target_p of chptr
|
||||
*/
|
||||
if(lp != NULL)
|
||||
do_who(source_p, target_p, (membership *)lp->data, &fmt);
|
||||
do_who(source_p, target_p, (chan::membership *)lp->data, &fmt);
|
||||
else
|
||||
do_who(source_p, target_p, NULL, &fmt);
|
||||
|
||||
|
@ -282,18 +282,18 @@ m_who(struct MsgBuf *msgbuf_p, struct Client *client_p, struct Client *source_p,
|
|||
* marks matched clients.
|
||||
*/
|
||||
static void
|
||||
who_common_channel(struct Client *source_p, struct Channel *chptr,
|
||||
who_common_channel(struct Client *source_p, chan::chan *chptr,
|
||||
const char *mask, int server_oper, int *maxmatches,
|
||||
struct who_format *fmt)
|
||||
{
|
||||
struct membership *msptr;
|
||||
chan::membership *msptr;
|
||||
struct Client *target_p;
|
||||
rb_dlink_node *ptr;
|
||||
|
||||
RB_DLINK_FOREACH(ptr, chptr->members.head)
|
||||
{
|
||||
msptr = (membership *)ptr->data;
|
||||
target_p = msptr->client_p;
|
||||
msptr = (chan::membership *)ptr->data;
|
||||
target_p = msptr->client;
|
||||
|
||||
if(!IsInvisible(target_p) || IsMarked(target_p))
|
||||
continue;
|
||||
|
@ -335,7 +335,7 @@ who_common_channel(struct Client *source_p, struct Channel *chptr,
|
|||
static void
|
||||
who_global(struct Client *source_p, const char *mask, int server_oper, int operspy, struct who_format *fmt)
|
||||
{
|
||||
struct membership *msptr;
|
||||
chan::membership *msptr;
|
||||
struct Client *target_p;
|
||||
rb_dlink_node *lp, *ptr;
|
||||
int maxmatches = 500;
|
||||
|
@ -347,8 +347,8 @@ who_global(struct Client *source_p, const char *mask, int server_oper, int opers
|
|||
{
|
||||
RB_DLINK_FOREACH(lp, source_p->user->channel.head)
|
||||
{
|
||||
msptr = (membership *)lp->data;
|
||||
who_common_channel(source_p, msptr->chptr, mask, server_oper, &maxmatches, fmt);
|
||||
msptr = (chan::membership *)lp->data;
|
||||
who_common_channel(source_p, msptr->chan, mask, server_oper, &maxmatches, fmt);
|
||||
}
|
||||
}
|
||||
else if (!ConfigFileEntry.operspy_dont_care_user_info)
|
||||
|
@ -407,17 +407,17 @@ who_global(struct Client *source_p, const char *mask, int server_oper, int opers
|
|||
* side effects - do a who on given channel
|
||||
*/
|
||||
static void
|
||||
do_who_on_channel(struct Client *source_p, struct Channel *chptr,
|
||||
do_who_on_channel(struct Client *source_p, chan::chan *chptr,
|
||||
int server_oper, int member, struct who_format *fmt)
|
||||
{
|
||||
struct Client *target_p;
|
||||
struct membership *msptr;
|
||||
chan::membership *msptr;
|
||||
rb_dlink_node *ptr;
|
||||
|
||||
RB_DLINK_FOREACH(ptr, chptr->members.head)
|
||||
{
|
||||
msptr = (membership *)ptr->data;
|
||||
target_p = msptr->client_p;
|
||||
msptr = (chan::membership *)ptr->data;
|
||||
target_p = msptr->client;
|
||||
|
||||
if(server_oper && !IsOper(target_p))
|
||||
continue;
|
||||
|
@ -464,7 +464,7 @@ append_format(char *buf, size_t bufsize, size_t *pos, const char *fmt, ...)
|
|||
*/
|
||||
|
||||
static void
|
||||
do_who(struct Client *source_p, struct Client *target_p, struct membership *msptr, struct who_format *fmt)
|
||||
do_who(struct Client *source_p, struct Client *target_p, chan::membership *msptr, struct who_format *fmt)
|
||||
{
|
||||
char status[16];
|
||||
char str[510 + 1]; /* linebuf.c will add \r\n */
|
||||
|
@ -472,11 +472,11 @@ do_who(struct Client *source_p, struct Client *target_p, struct membership *mspt
|
|||
const char *q;
|
||||
|
||||
sprintf(status, "%c%s%s",
|
||||
target_p->user->away ? 'G' : 'H', IsOper(target_p) ? "*" : "", msptr ? find_channel_status(msptr, fmt->fields || IsCapable(source_p, CLICAP_MULTI_PREFIX)) : "");
|
||||
target_p->user->away ? 'G' : 'H', IsOper(target_p) ? "*" : "", msptr ? find_status(msptr, fmt->fields || IsCapable(source_p, CLICAP_MULTI_PREFIX)) : "");
|
||||
|
||||
if (fmt->fields == 0)
|
||||
sendto_one(source_p, form_str(RPL_WHOREPLY), me.name,
|
||||
source_p->name, msptr ? msptr->chptr->chname : "*",
|
||||
source_p->name, msptr ? msptr->chan->name.c_str() : "*",
|
||||
target_p->username, target_p->host,
|
||||
target_p->servptr->name, target_p->name, status,
|
||||
ConfigServerHide.flatten_links && !IsOper(source_p) && !IsExemptShide(source_p) ? 0 : target_p->hopcount,
|
||||
|
@ -490,7 +490,7 @@ do_who(struct Client *source_p, struct Client *target_p, struct membership *mspt
|
|||
if (fmt->fields & FIELD_QUERYTYPE)
|
||||
append_format(str, sizeof str, &pos, " %s", fmt->querytype);
|
||||
if (fmt->fields & FIELD_CHANNEL)
|
||||
append_format(str, sizeof str, &pos, " %s", msptr ? msptr->chptr->chname : "*");
|
||||
append_format(str, sizeof str, &pos, " %s", msptr? msptr->chan->name.c_str() : "*");
|
||||
if (fmt->fields & FIELD_USER)
|
||||
append_format(str, sizeof str, &pos, " %s", target_p->username);
|
||||
if (fmt->fields & FIELD_IP)
|
||||
|
|
|
@ -206,8 +206,8 @@ single_whois(struct Client *source_p, struct Client *target_p, int operspy)
|
|||
{
|
||||
char buf[BUFSIZE];
|
||||
rb_dlink_node *ptr;
|
||||
struct membership *msptr;
|
||||
struct Channel *chptr;
|
||||
chan::membership *msptr;
|
||||
chan::chan *chptr;
|
||||
int cur_len = 0;
|
||||
int mlen;
|
||||
char *t;
|
||||
|
@ -254,17 +254,17 @@ single_whois(struct Client *source_p, struct Client *target_p, int operspy)
|
|||
{
|
||||
RB_DLINK_FOREACH(ptr, target_p->user->channel.head)
|
||||
{
|
||||
msptr = (membership *)ptr->data;
|
||||
chptr = msptr->chptr;
|
||||
msptr = (chan::membership *)ptr->data;
|
||||
chptr = msptr->chan;
|
||||
|
||||
hdata.chptr = chptr;
|
||||
|
||||
hdata.approved = ShowChannel(source_p, chptr);
|
||||
hdata.approved = can_show(chptr, source_p);
|
||||
call_hook(doing_whois_channel_visibility_hook, &hdata);
|
||||
|
||||
if(hdata.approved || operspy)
|
||||
{
|
||||
if((cur_len + strlen(chptr->chname) + 3) > (BUFSIZE - 5))
|
||||
if((cur_len + strlen(chptr->name.c_str()) + 3) > (BUFSIZE - 5))
|
||||
{
|
||||
sendto_one(source_p, "%s", buf);
|
||||
cur_len = mlen + extra_space;
|
||||
|
@ -273,8 +273,8 @@ single_whois(struct Client *source_p, struct Client *target_p, int operspy)
|
|||
|
||||
tlen = sprintf(t, "%s%s%s ",
|
||||
hdata.approved ? "" : "!",
|
||||
find_channel_status(msptr, 1),
|
||||
chptr->chname);
|
||||
find_status(msptr, 1),
|
||||
chptr->name.c_str());
|
||||
t += tlen;
|
||||
cur_len += tlen;
|
||||
}
|
||||
|
|
Loading…
Reference in a new issue