X-Git-Url: https://jfr.im/git/irc/evilnet/x3.git/blobdiff_plain/75ddd32792fd2d0bf86c6e85d360c661134a0681..0b401fb654b69fd9649954a9bdd5ff041971e62d:/src/opserv.c diff --git a/src/opserv.c b/src/opserv.c index 170877c..69fff83 100644 --- a/src/opserv.c +++ b/src/opserv.c @@ -217,8 +217,8 @@ static const struct message_entry msgtab[] = { { "OSMSG_WHOIS_PRIVS", "IRCd Privs : %s" }, { "OSMSG_WHOIS_CHANNELS", "Channels : %s" }, { "OSMSG_WHOIS_HIDECHANS", "Channel list omitted for your sanity." }, - { "OSMSG_WHOIS_VERSION", "Version : %s" }, - { "OSMSG_WHOIS_SSLFP", "SSL f/print : %s" }, + { "OSMSG_WHOIS_VERSION", "Version : %s" }, + { "OSMSG_WHOIS_SSLFP", "Cert f/print : %s" }, { "OSMSG_WHOIS_MARK", "Mark : %s" }, { "OSMSG_WHOIS_MARKS", "Marks : %s" }, { "OSMSG_WHOIS_NO_NOTICE", "No_notices : %s" }, @@ -586,6 +586,7 @@ typedef enum { REACT_GLINE, REACT_TRACK, REACT_SHUN, + REACT_TEMPSHUN, REACT_SVSJOIN, REACT_SVSPART, REACT_VERSION, @@ -1531,6 +1532,12 @@ opserv_shun(struct userNode *target, char *src_handle, char *reason, unsigned lo return shun_add(src_handle, mask, duration, reason, now, 1); } +static void +opserv_tempshun(struct userNode *target, UNUSED_ARG(char *src_handle), char *reason) +{ + irc_tempshun(opserv, target, 0, reason); +} + static MODCMD_FUNC(cmd_sblock) { struct userNode *target; @@ -1574,7 +1581,7 @@ static MODCMD_FUNC(cmd_sblock) if(!svccmd_can_invoke(user, cmd->parent->bot, shun_cmd, channel, SVCCMD_NOISY)) return 0; } - reason = (argc > 2) ? unsplit_string(argv+2, argc-2, NULL) : NULL; + reason = (argc > offset) ? unsplit_string(argv+offset, argc-offset, NULL) : NULL; shun = opserv_shun(target, user->handle_info->handle, reason, duration); reply("OSMSG_SHUN_ISSUED", shun->target); return 1; @@ -2587,6 +2594,7 @@ static MODCMD_FUNC(cmd_stats_alerts) { case REACT_GLINE: reaction = "gline"; break; case REACT_TRACK: reaction = "track"; break; case REACT_SHUN: reaction = "shun"; break; + case REACT_TEMPSHUN: reaction = "tempshun"; break; case REACT_SVSJOIN: reaction = "svsjoin"; break; case REACT_SVSPART: reaction = "svspart"; break; case REACT_VERSION: reaction = "version"; break; @@ -4919,6 +4927,8 @@ add_user_alert(const char *key, void *data, UNUSED_ARG(void *extra)) reaction = REACT_TRACK; else if (!irccasecmp(react, "shun")) reaction = REACT_SHUN; + else if (!irccasecmp(react, "tempshun")) + reaction = REACT_TEMPSHUN; else if (!irccasecmp(react, "svsjoin")) reaction = REACT_SVSJOIN; else if (!irccasecmp(react, "svspart")) @@ -5214,6 +5224,7 @@ opserv_saxdb_write(struct saxdb_context *ctx) case REACT_GLINE: reaction = "gline"; break; case REACT_TRACK: reaction = "track"; break; case REACT_SHUN: reaction = "shun"; break; + case REACT_TEMPSHUN: reaction = "tempshun"; break; case REACT_SVSJOIN: reaction = "svsjoin"; break; case REACT_SVSPART: reaction = "svspart"; break; case REACT_VERSION: reaction = "version"; break; @@ -5814,67 +5825,68 @@ discrim_match(discrim_t discrim, struct userNode *user) matches++; break; case 'O': - if(IsOper(user) != 0 != negate) matches++; + if((IsOper(user) != 0) != negate) matches++; break; case 'o': - if(IsOper(user) != 0 != negate) matches++; + if((IsOper(user) != 0) != negate) matches++; break; case 'i': - if(IsInvisible(user) != 0 != negate) matches++; + if((IsInvisible(user) != 0) != negate) matches++; break; case 'w': - if(IsWallOp(user) != 0 != negate) matches++; + if((IsWallOp(user) != 0) != negate) matches++; break; case 'd': - if(IsDeaf(user) != 0 != negate) matches++; + if((IsDeaf(user) != 0) != negate) matches++; break; case 'k': - if(IsService(user) != 0 != negate) matches++; + if((IsService(user) != 0) != negate) matches++; break; case 'g': - if(IsGlobal(user) != 0 != negate) matches++; + if((IsGlobal(user) != 0) != negate) matches++; break; case 'h': - if(IsSetHost(user) != 0 != negate) matches++; + if((IsSetHost(user) != 0) != negate) matches++; break; case 'B': - if(IsBotM(user) != 0 != negate) matches++; + if((IsBotM(user) != 0) != negate) matches++; break; + case 'p': case 'n': - if(IsHideChans(user) != 0 != negate) matches++; + if((IsHideChans(user) != 0) != negate) matches++; break; case 'I': - if(IsHideIdle(user) != 0 != negate) matches++; + if((IsHideIdle(user) != 0) != negate) matches++; break; case 'X': - if(IsXtraOp(user) != 0 != negate) matches++; + if((IsXtraOp(user) != 0) != negate) matches++; break; case 'x': - if(IsHiddenHost(user) != 0 != negate) matches++; + if((IsHiddenHost(user) != 0) != negate) matches++; break; case 'a': - if(IsAdmin(user) != 0 != negate) matches++; + if((IsAdmin(user) != 0) != negate) matches++; break; case 'z': - if(IsSSL(user) != 0 != negate) matches++; + if((IsSSL(user) != 0) != negate) matches++; break; case 'D': - if(IsPrivDeaf(user) != 0 != negate) matches++; + if((IsPrivDeaf(user) != 0) != negate) matches++; break; case 'R': - if(IsAccountOnly(user) != 0 != negate) matches++; + if((IsAccountOnly(user) != 0) != negate) matches++; break; case 'W': - if(IsWhoisNotice(user) != 0 != negate) matches++; + if((IsWhoisNotice(user) != 0) != negate) matches++; break; case 'H': - if(IsHideOper(user) != 0 != negate) matches++; + if((IsHideOper(user) != 0) != negate) matches++; break; case 'L': - if(IsHideOper(user) != 0 != negate) matches++; + if((IsHideOper(user) != 0) != negate) matches++; break; case 'q': - if(IsCommonChansOnly(user) != 0 != negate) matches++; + if((IsCommonChansOnly(user) != 0) != negate) matches++; break; } } @@ -6074,6 +6086,18 @@ trace_shun_func(struct userNode *match, void *extra) return 0; } +static int +trace_tempshun_func(struct userNode *match, void *extra) +{ + struct discrim_and_source *das = extra; + + if (is_oper_victim(das->source, match, das->discrim->match_opers, 1) && is_trust_victim(match, das->discrim->match_trusted)) { + opserv_tempshun(match, das->source->handle_info->handle, das->discrim->reason); + } + + return 0; +} + static int trace_kill_func(struct userNode *match, void *extra) { @@ -6311,6 +6335,8 @@ static MODCMD_FUNC(cmd_trace) action = trace_gline_func; else if (!irccasecmp(argv[1], "shun")) action = trace_shun_func; + else if (!irccasecmp(argv[1], "tempshun")) + action = trace_tempshun_func; else if (!irccasecmp(argv[1], "kill")) action = trace_kill_func; else if (!irccasecmp(argv[1], "gag")) @@ -6874,6 +6900,9 @@ alert_check_user(const char *key, void *data, void *extra) case REACT_SHUN: opserv_shun(user, alert->owner, alert->discrim->reason, alert->discrim->duration); return 1; + case REACT_TEMPSHUN: + opserv_tempshun(user, alert->owner, alert->discrim->reason); + return 1; case REACT_SVSJOIN: opserv_svsjoin(user, alert->owner, alert->discrim->reason, alert->discrim->chantarget, alert->discrim->checkrestrictions); break; @@ -7087,6 +7116,8 @@ static MODCMD_FUNC(cmd_addalert) #endif } else if (!irccasecmp(argv[2], "shun")) reaction = REACT_SHUN; + else if(!irccasecmp(argv[2], "tempshun")) + reaction = REACT_TEMPSHUN; else if(!irccasecmp(argv[2], "svsjoin")) reaction = REACT_SVSJOIN; else if(!irccasecmp(argv[2], "svspart")) @@ -7388,6 +7419,7 @@ init_opserv(const char *nick) opserv_define_func("ADDALERT SILENT", NULL, 900, 0, 0); opserv_define_func("ADDALERT GLINE", NULL, 900, 0, 0); opserv_define_func("ADDALERT SHUN", NULL, 900, 0, 0); + opserv_define_func("ADDALERT TEMPSHUN", NULL, 900, 0, 0); opserv_define_func("ADDALERT TRACK", NULL, 900, 0, 0); opserv_define_func("ADDALERT KILL", NULL, 900, 0, 0); opserv_define_func("ADDALERT SVSJOIN", NULL, 999, 0, 0); @@ -7501,6 +7533,7 @@ init_opserv(const char *nick) opserv_define_func("TRACE DOMAINS", NULL, 0, 0, 0); opserv_define_func("TRACE GLINE", NULL, 600, 0, 0); opserv_define_func("TRACE SHUN", NULL, 600, 0, 0); + opserv_define_func("TRACE TEMPSHUN", NULL, 600, 0, 0); opserv_define_func("TRACE GAG", NULL, 600, 0, 0); opserv_define_func("TRACE KILL", NULL, 600, 0, 0); opserv_define_func("TRACE VERSION", NULL, 999, 0, 0);