|
@@ -900,12 +900,12 @@ static void refresh_ban_kick(struct chanset_t* chan, memberlist *m, const char *
|
|
|
for (int cycle = 0; cycle < 2; cycle++) {
|
|
for (int cycle = 0; cycle < 2; cycle++) {
|
|
|
for (register maskrec* b = cycle ? chan->bans : global_bans; b; b = b->next) {
|
|
for (register maskrec* b = cycle ? chan->bans : global_bans; b; b = b->next) {
|
|
|
if (wild_match(b->mask, user) || match_cidr(b->mask, user)) {
|
|
if (wild_match(b->mask, user) || match_cidr(b->mask, user)) {
|
|
|
- if (role == 1 && chan_hasop(m))
|
|
|
|
|
|
|
+ if ((chan->role & ROLE_DEOP) && chan_hasop(m))
|
|
|
add_mode(chan, '-', 'o', m->nick); /* Guess it can't hurt. */
|
|
add_mode(chan, '-', 'o', m->nick); /* Guess it can't hurt. */
|
|
|
check_exemptlist(chan, user);
|
|
check_exemptlist(chan, user);
|
|
|
do_mask(chan, chan->channel.ban, b->mask, 'b');
|
|
do_mask(chan, chan->channel.ban, b->mask, 'b');
|
|
|
b->lastactive = now;
|
|
b->lastactive = now;
|
|
|
- if (role == 2) {
|
|
|
|
|
|
|
+ if (chan->role & ROLE_KICK) {
|
|
|
char c[512] = ""; /* The ban comment. */
|
|
char c[512] = ""; /* The ban comment. */
|
|
|
|
|
|
|
|
if (b->desc && b->desc[0] != '@')
|
|
if (b->desc && b->desc[0] != '@')
|
|
@@ -1294,12 +1294,26 @@ void check_this_user(char *hand, int del, char *host)
|
|
|
for (m = chan->channel.member; m && m->nick[0]; m = m->next) {
|
|
for (m = chan->channel.member; m && m->nick[0]; m = m->next) {
|
|
|
bool check_member = 0;
|
|
bool check_member = 0;
|
|
|
bool had_user = m->user ? 1 : 0;
|
|
bool had_user = m->user ? 1 : 0;
|
|
|
|
|
+ struct userrec* u;
|
|
|
|
|
+ bool matches_hand = false;
|
|
|
|
|
+
|
|
|
m->tried_getuser = 0;
|
|
m->tried_getuser = 0;
|
|
|
member_getuser(m);
|
|
member_getuser(m);
|
|
|
- struct userrec* u = m->user;
|
|
|
|
|
|
|
+ u = m->user;
|
|
|
|
|
+ if (u) {
|
|
|
|
|
+ matches_hand = (strcasecmp(u->handle, hand) == 0);
|
|
|
|
|
+ }
|
|
|
|
|
+
|
|
|
|
|
+ if (u && u->bot && matches_hand) {
|
|
|
|
|
+ /* Newly discovered bot, or deleted bot which fullfilled a role,
|
|
|
|
|
+ * need to rebalance. */
|
|
|
|
|
+ if (!del || (del && (*chan->bot_roles)[u->handle] != 0)) {
|
|
|
|
|
+ chan->needs_role_rebalance = 1;
|
|
|
|
|
+ }
|
|
|
|
|
+ }
|
|
|
if (m->user && !had_user) // If a member is newly recognized, act on it
|
|
if (m->user && !had_user) // If a member is newly recognized, act on it
|
|
|
check_member = 1;
|
|
check_member = 1;
|
|
|
- else if (del != 2 && m->user && !strcasecmp(m->user->handle, hand)) { //general check / -user, match specified user
|
|
|
|
|
|
|
+ else if (del != 2 && m->user && matches_hand) { //general check / -user, match specified user
|
|
|
check_member = 1;
|
|
check_member = 1;
|
|
|
if (del == 1)
|
|
if (del == 1)
|
|
|
u = NULL; // Pretend user doesn't exist when checking
|
|
u = NULL; // Pretend user doesn't exist when checking
|
|
@@ -2726,6 +2740,10 @@ static int gotjoin(char *from, char *chname)
|
|
|
m->last = now;
|
|
m->last = now;
|
|
|
m->delay = 0L;
|
|
m->delay = 0L;
|
|
|
m->flags = (chan_hasop(m) ? WASOP : 0);
|
|
m->flags = (chan_hasop(m) ? WASOP : 0);
|
|
|
|
|
+ /* New bot available for roles, rebalance. */
|
|
|
|
|
+ if (is_bot(m->user)) {
|
|
|
|
|
+ chan->needs_role_rebalance = 1;
|
|
|
|
|
+ }
|
|
|
set_handle_laston(chan->dname, m->user, now);
|
|
set_handle_laston(chan->dname, m->user, now);
|
|
|
// m->flags |= STOPWHO;
|
|
// m->flags |= STOPWHO;
|
|
|
irc_log(chan, "%s returned from netsplit", m->nick);
|
|
irc_log(chan, "%s returned from netsplit", m->nick);
|
|
@@ -2788,6 +2806,10 @@ static int gotjoin(char *from, char *chname)
|
|
|
} else {
|
|
} else {
|
|
|
irc_log(chan, "Join: %s (%s)", nick, uhost);
|
|
irc_log(chan, "Join: %s (%s)", nick, uhost);
|
|
|
detect_chan_flood(m, from, chan, FLOOD_JOIN);
|
|
detect_chan_flood(m, from, chan, FLOOD_JOIN);
|
|
|
|
|
+ /* New bot available for roles, rebalance. */
|
|
|
|
|
+ if (is_bot(m->user)) {
|
|
|
|
|
+ chan->needs_role_rebalance = 1;
|
|
|
|
|
+ }
|
|
|
set_handle_laston(chan->dname, m->user, now);
|
|
set_handle_laston(chan->dname, m->user, now);
|
|
|
}
|
|
}
|
|
|
}
|
|
}
|
|
@@ -2937,6 +2959,10 @@ static int gotpart(char *from, char *msg)
|
|
|
chan->ircnet_status &= ~(CHAN_PEND | CHAN_JOINING);
|
|
chan->ircnet_status &= ~(CHAN_PEND | CHAN_JOINING);
|
|
|
reset_chan_info(chan);
|
|
reset_chan_info(chan);
|
|
|
}
|
|
}
|
|
|
|
|
+ /* This bot fullfilled a role, need to rebalance. */
|
|
|
|
|
+ if (u && u->bot && (*chan->bot_roles)[u->handle] != 0) {
|
|
|
|
|
+ chan->needs_role_rebalance = 1;
|
|
|
|
|
+ }
|
|
|
set_handle_laston(chan->dname, u, now);
|
|
set_handle_laston(chan->dname, u, now);
|
|
|
|
|
|
|
|
if (m) {
|
|
if (m) {
|
|
@@ -3012,7 +3038,7 @@ static int gotkick(char *from, char *origmsg)
|
|
|
if (mv->user) {
|
|
if (mv->user) {
|
|
|
// Revenge kick clients that kick our bots
|
|
// Revenge kick clients that kick our bots
|
|
|
if (chan->revenge && !mv->is_me && m && m != mv && mv->user->bot && !(m->user && m->user->bot)) {
|
|
if (chan->revenge && !mv->is_me && m && m != mv && mv->user->bot && !(m->user && m->user->bot)) {
|
|
|
- if (role < 5 && !chan_sentkick(m) && me_op(chan)) {
|
|
|
|
|
|
|
+ if ((chan->role & ROLE_REVENGE) && !chan_sentkick(m) && me_op(chan)) {
|
|
|
m->flags |= SENTKICK;
|
|
m->flags |= SENTKICK;
|
|
|
dprintf(DP_MODE_NEXT, "KICK %s %s :%s%s\r\n", chan->name, m->nick, kickprefix, response(RES_REVENGE));
|
|
dprintf(DP_MODE_NEXT, "KICK %s %s :%s%s\r\n", chan->name, m->nick, kickprefix, response(RES_REVENGE));
|
|
|
} else {
|
|
} else {
|
|
@@ -3025,6 +3051,10 @@ static int gotkick(char *from, char *origmsg)
|
|
|
}
|
|
}
|
|
|
|
|
|
|
|
set_handle_laston(chan->dname, mv->user, now);
|
|
set_handle_laston(chan->dname, mv->user, now);
|
|
|
|
|
+ /* This bot fullfilled a role, need to rebalance. */
|
|
|
|
|
+ if (mv->user->bot && (*chan->bot_roles)[mv->user->handle] != 0) {
|
|
|
|
|
+ chan->needs_role_rebalance = 1;
|
|
|
|
|
+ }
|
|
|
}
|
|
}
|
|
|
irc_log(chan, "%s was kicked by %s (%s)", s1, from, msg);
|
|
irc_log(chan, "%s was kicked by %s (%s)", s1, from, msg);
|
|
|
/* Kicked ME?!? the sods! */
|
|
/* Kicked ME?!? the sods! */
|
|
@@ -3197,8 +3227,13 @@ static int gotquit(char *from, char *msg)
|
|
|
member_getuser(m);
|
|
member_getuser(m);
|
|
|
u = m->user;
|
|
u = m->user;
|
|
|
if (u) {
|
|
if (u) {
|
|
|
- if (u->bot)
|
|
|
|
|
|
|
+ if (u->bot) {
|
|
|
counter_clear(u->handle);
|
|
counter_clear(u->handle);
|
|
|
|
|
+ /* This bot fullfilled a role, need to rebalance. */
|
|
|
|
|
+ if ((*chan->bot_roles)[u->handle] != 0) {
|
|
|
|
|
+ chan->needs_role_rebalance = 1;
|
|
|
|
|
+ }
|
|
|
|
|
+ }
|
|
|
set_handle_laston(chan->dname, u, now); /* If you remove this, the bot will crash when the user record in question
|
|
set_handle_laston(chan->dname, u, now); /* If you remove this, the bot will crash when the user record in question
|
|
|
is removed/modified during the tcl binds below, and the users was on more
|
|
is removed/modified during the tcl binds below, and the users was on more
|
|
|
than one monitored channel */
|
|
than one monitored channel */
|