X-Git-Url: https://jfr.im/git/irc/evilnet/x3.git/blobdiff_plain/d77556d0e56f84a130900b810ce6e164e76f0c5e..5e7fc6b57c676be84539ddb4bb40870235e7003f:/src/chanserv.c diff --git a/src/chanserv.c b/src/chanserv.c index 4ccda7d..cbba341 100644 --- a/src/chanserv.c +++ b/src/chanserv.c @@ -257,6 +257,7 @@ static const struct message_entry msgtab[] = { { "CSMSG_DURATION_TOO_LOW", "Timed bans must last for at least 15 seconds." }, { "CSMSG_DURATION_TOO_HIGH", "Timed bans must last for less than 2 years." }, { "CSMSG_LAME_MASK", "$b%s$b is a little too general. Try making it more specific." }, + { "CSMSG_NO_EXTBANS", "$b%s$b is an extended ban, which are not allowed." }, { "CSMSG_MASK_PROTECTED", "Sorry, ban for $b%s$b conflicts with a protected user's hostmask." }, { "CSMSG_NO_MATCHING_USERS", "No one in $b%s$b has a hostmask matching $b%s$b." }, { "CSMSG_BAN_NOT_FOUND", "Sorry, no ban or LAMER found: $b%s$b." }, @@ -441,7 +442,7 @@ static const struct message_entry msgtab[] = { { "CSMSG_HELPER_NO_ACCESS", "%s lacks access to %s but has $bsecurity override$b enabled." }, { "CSMSG_HELPER_HAS_ACCESS", "%s has $b%s$b access (%d) in %s and has $bsecurity override$b enabled." }, { "CSMSG_LAZY_SMURF_TARGET", "%s is %s ($bIRCOp$b; not logged in)." }, - { "CSMSG_SMURF_TARGET", "%s is %s ($b%s$b)." }, + { "CSMSG_SMURF_TARGET", "%s %s ($b%s$b)." }, { "CSMSG_OPERATOR_TITLE", "IRC operator" }, { "CSMSG_UC_H_TITLE", "network helper" }, { "CSMSG_LC_H_TITLE", "support helper" }, @@ -3807,6 +3808,13 @@ bad_channel_ban(struct chanNode *channel, struct userNode *user, const char *ban return 0; } +int is_extban(char *b) { + if(*b == '~') { + return 1; + } + return 0; +} + static int eject_user(struct userNode *user, struct chanNode *channel, unsigned int argc, char *argv[], struct svccmd *cmd, int action) { @@ -3934,6 +3942,13 @@ eject_user(struct userNode *user, struct chanNode *channel, unsigned int argc, c reply("CSMSG_LAME_MASK", argv[1]); return 0; } + //TODO: We have no support to do protection etc etc so for now we dont let you use x3 to set extended bans. + if(is_extban(argv[1])) + { + if(cmd) + reply("CSMSG_NO_EXTBANS", argv[1]); + return 0; + } if((action == ACTION_KICK) && (victimCount == 0)) { @@ -4258,7 +4273,8 @@ void expire_bans(UNUSED_ARG(void* data)) /* Real bans, not lamers */ count = 0; /* First find out how many bans were going to unset */ for (jj=0; jj < channel->channel->banlist.used; ++jj) { - if(channel->channel->banlist.list[jj]->set < bantimeout) + //TODO: for now, were just not removing extended bans, but ultimately some types we should, some shouldn't...see below + if(channel->channel->banlist.list[jj]->set < bantimeout && !is_extban(channel->channel->banlist.list[jj]->ban)) count++; } if(count > 0) { @@ -4268,7 +4284,8 @@ void expire_bans(UNUSED_ARG(void* data)) /* Real bans, not lamers */ /* Walk over every ban in this channel.. */ for (jj=0; jj < channel->channel->banlist.used; ++jj) { bn = channel->channel->banlist.list[jj]; - if (bn->set < bantimeout) { + //TODO: for now, were just not removing extended bans, but ultimately some types we should, some shouldn't...see above + if (bn->set < bantimeout && !is_extban(bn->ban)) { log_module(CS_LOG, LOG_DEBUG, "Removing ban %s from %s", bn->ban, channel->channel->name); /* Add this ban to the mode change */ @@ -4413,6 +4430,7 @@ static CHANSERV_FUNC(cmd_unbanall) return 0; } + // TODO: dont remove some kinds of extended bans such as ~c change = mod_chanmode_alloc(channel->banlist.used); for(ii=0; iibanlist.used; ii++) { @@ -4485,7 +4503,7 @@ static CHANSERV_FUNC(cmd_myaccess) continue; sbuf.used = 0; string_buffer_append_printf(&sbuf, "[%s (%d", cData->channel->name, uData->access); - if(uData->flags == USER_AUTO_OP) + if(uData->flags != 0) string_buffer_append(&sbuf, ','); if(IsUserSuspended(uData)) string_buffer_append(&sbuf, 's'); @@ -5540,7 +5558,7 @@ send_staff_list(struct userNode *to, struct userList *list, int skip_flags) user = list->list[nn]; if(user->modes & skip_flags) continue; - if(IsBot(user)) + if(IsBot(user) || IsHideOper(user)) continue; table.contents[table.length] = alloca(table.width*sizeof(**table.contents)); if(IsAway(user)) @@ -5679,6 +5697,9 @@ resync_channel(struct chanNode *channel) } else /* Give various userlevels their modes.. */ { + /* If the user has autoop/autovoice disabled then ignore them */ + if(uData && !IsUserAutoOp(uData)) + continue; if(uData && uData->access >= UL_OP ) { if(!(mn->modes & MODE_CHANOP)) @@ -6650,7 +6671,7 @@ static MODCMD_FUNC(chan_opt_maxsetinfo) if(argc > 1) { charmax = atoi(argv[1]); - if ((charmax > 0) && (charmax < chanserv_conf.max_userinfo_length)) + if ((charmax > 0) && (charmax <= chanserv_conf.max_userinfo_length)) channel->channel_info->maxsetinfo = charmax; } @@ -6998,10 +7019,6 @@ channel_multiple_option(enum charOption option, struct userNode *user, struct ch static MODCMD_FUNC(chan_opt_automode) { - if(check_user_level(channel, user, lvlInviteMe, 1, 0)) - { - reply("CSMSG_LOW_CHANNEL_ACCESS", channel->name); - } return channel_multiple_option(chAutomode, CSFUNC_ARGS); } @@ -7818,14 +7835,12 @@ static CHANSERV_FUNC(cmd_spin) char *oldnick = NULL; char *oldident = NULL; - char *oldhost = NULL; char abusednick[NICKLEN] = ""; int abusednum = 1 + (int) (10000.0 * (rand() / (RAND_MAX + 1.0))); struct userNode *clone; oldnick = strdup(user->nick); oldident = strdup(user->ident); - oldhost = strdup(user->hostname); //snprintf(abusednick, NICKLEN, "Abused%d", abusednum+(1 + rand() % 120)); while (1) { @@ -7837,7 +7852,7 @@ static CHANSERV_FUNC(cmd_spin) SVSNickChange(user, abusednick); irc_svsnick(chanserv, user, abusednick); - clone = AddLocalUser(oldnick, oldident, oldhost, "I got abused by the wheel of misfortune :D", "+i"); + clone = AddLocalUser(oldnick, oldident, "abused.by.wheel.of.misfortune", "I got abused by the wheel of misfortune :D", "+i"); timeq_add(now + 300, chanserv_remove_abuse, clone->nick); } /* kill */ @@ -8059,11 +8074,11 @@ static CHANSERV_FUNC(cmd_8ball) word3 = argc>3?argv[3]:""; /*** COLOR *****/ - if((word2) && strcasecmp(word1, "what") == 0 && strcasecmp(word2, "color") == 0) + if((word2) && strcasecmp(word1, "what") == 0 && ((strcasecmp(word2, "color") == 0) || (strcasecmp(word2, "colour") == 0))) eightball(eb, 1, accum); - else if((word3) && strcasecmp(word1, "what's") == 0 && strcasecmp(word2, "the") == 0 && strcasecmp(word3, "color") == 0) + else if((word3) && strcasecmp(word1, "what's") == 0 && strcasecmp(word2, "the") == 0 && ((strcasecmp(word2, "color") == 0) || (strcasecmp(word2, "colour") == 0))) eightball(eb, 1, accum); - else if((word3) && strcasecmp(word1, "whats") == 0 && strcasecmp(word2, "the") == 0 && strcasecmp(word3, "color") == 0) + else if((word3) && strcasecmp(word1, "whats") == 0 && strcasecmp(word2, "the") == 0 && ((strcasecmp(word2, "color") == 0) || (strcasecmp(word2, "colour") == 0))) eightball(eb, 1, accum); /*** LOCATION *****/ else if( @@ -9915,7 +9930,7 @@ chanserv_saxdb_write(struct saxdb_context *ctx) } static void -chanserv_db_cleanup(void) { +chanserv_db_cleanup(UNUSED_ARG(void *extra)) { unsigned int ii; unreg_part_func(handle_part, NULL); while(channelList) @@ -9990,8 +10005,8 @@ init_chanserv(const char *nick) modcmd_register(chanserv_module, "dnrsearch remove", NULL, 0, 0, NULL); modcmd_register(chanserv_module, "dnrsearch count", NULL, 0, 0, NULL); DEFINE_COMMAND(move, 1, MODCMD_REQUIRE_AUTHED|MODCMD_REQUIRE_REGCHAN, "template", "register", NULL); - DEFINE_COMMAND(csuspend, 2, MODCMD_REQUIRE_AUTHED|MODCMD_REQUIRE_REGCHAN, "flags", "+helping", NULL); - DEFINE_COMMAND(cunsuspend, 1, MODCMD_REQUIRE_AUTHED|MODCMD_REQUIRE_REGCHAN, "flags", "+helping", NULL); + DEFINE_COMMAND(csuspend, 2, MODCMD_REQUIRE_AUTHED|MODCMD_REQUIRE_REGCHAN|MODCMD_IGNORE_CSUSPEND, "flags", "+helping", NULL); + DEFINE_COMMAND(cunsuspend, 1, MODCMD_REQUIRE_AUTHED|MODCMD_REQUIRE_REGCHAN|MODCMD_IGNORE_CSUSPEND, "flags", "+helping", NULL); DEFINE_COMMAND(createnote, 5, 0, "level", "800", NULL); DEFINE_COMMAND(removenote, 2, 0, "level", "800", NULL); @@ -10180,7 +10195,7 @@ init_chanserv(const char *nick) } } - reg_exit_func(chanserv_db_cleanup); + reg_exit_func(chanserv_db_cleanup, NULL); message_register_table(msgtab); }