X-Git-Url: https://jfr.im/git/irc/evilnet/x3.git/blobdiff_plain/1dfca92d3acee0bfed41678f6f390bab22d97db3..f79cdffc2ce0a1a1a74ca5eadc85b165a9f6944f:/src/proto-p10.c diff --git a/src/proto-p10.c b/src/proto-p10.c index 4a4dbb9..88989bf 100644 --- a/src/proto-p10.c +++ b/src/proto-p10.c @@ -80,6 +80,7 @@ #define CMD_PROTO "PROTO" #define CMD_QUIT "QUIT" #define CMD_REHASH "REHASH" +#define CMD_REMOVE "REMOVE" #define CMD_RESET "RESET" #define CMD_RESTART "RESTART" #define CMD_RPING "RPING" @@ -121,6 +122,7 @@ #define CMD_WHO "WHO" #define CMD_WHOIS "WHOIS" #define CMD_WHOWAS "WHOWAS" +#define CMD_ZLINE "ZLINE" /* Tokenized commands. */ #define TOK_ACCOUNT "AC" @@ -177,6 +179,7 @@ #define TOK_PROTO "PROTO" #define TOK_QUIT "Q" #define TOK_REHASH "REHASH" +#define TOK_REMOVE "RM" #define TOK_RESET "RESET" #define TOK_RESTART "RESTART" #define TOK_RPING "RI" @@ -218,6 +221,7 @@ #define TOK_WHO "H" #define TOK_WHOIS "W" #define TOK_WHOWAS "X" +#define TOK_ZLINE "ZL" /* Protocol messages; aliased to full commands or tokens depending on compile-time configuration. ircu prefers tokens WITH THE @@ -283,6 +287,7 @@ #define P10_PROTO TYPE(PROTO) #define P10_QUIT TYPE(QUIT) #define P10_REHASH TYPE(REHASH) +#define P10_REMOVE TYPE(REMOVE) #define P10_RESET TYPE(RESET) #define P10_RESTART TYPE(RESTART) #define P10_RPING TYPE(RPING) @@ -323,6 +328,7 @@ #define P10_WHO TYPE(WHO) #define P10_WHOIS TYPE(WHOIS) #define P10_WHOWAS TYPE(WHOWAS) +#define P10_ZLINE TYPE(ZLINE) #define P10_EXEMPT TYPE(EXEMPT) /* Servers claiming to have a boot or link time before PREHISTORY @@ -343,8 +349,8 @@ static const char *his_servername; static const char *his_servercomment; static int extended_accounts; -/* These correspond to 1 << X: 012345678901234567 */ -const char irc_user_mode_chars[] = "o iw dkgn I"; +/* These correspond to 1 << X: 01234567890123456789012345 */ +const char irc_user_mode_chars[] = "oOiw dkgh x BnIX azDRWHLq"; static struct userNode *AddUser(struct server* uplink, const char *nick, const char *ident, const char *hostname, const char *modes, const char *numeric, const char *userinfo, time_t timestamp, const char *realip); @@ -514,7 +520,7 @@ irc_p10_pton(irc_in_addr_t *ip, const char *input) do { if (*input == '_') { unsigned int left; - for (left = (25 - strlen(input)) / 3; left; left--) + for (left = (25 - strlen(input)) / 3 - pos; left; left--) ip->in6[pos++] = 0; input++; } else { @@ -1247,7 +1253,7 @@ static CMD_FUNC(cmd_whois) else irc_numeric(from, RPL_WHOISUSER, "%s %s %s * :%s", who->nick, who->ident, who->hostname, who->info); - if (IsService(who) || (from == who)) { + if (!IsService(who) || (from == who)) { struct modeNode *mn; mlen = strlen(self->name) + strlen(from->nick) + 12 + strlen(who->nick); len = 0; @@ -1795,7 +1801,9 @@ static CMD_FUNC(cmd_burst) struct modeNode *mNode; long mode; int oplevel = -1; + int type = 0; char *user, *end, sep; + char *tstr; time_t in_timestamp; char* parm = NULL; @@ -1803,6 +1811,11 @@ static CMD_FUNC(cmd_burst) return 0; modes[0] = 0; + tstr = conf_get_data("server/type", RECDB_QSTRING); + if(tstr) { + type = atoi(tstr); + } + exemptlist[0] = 0; banlist[0] = 0; @@ -1813,7 +1826,7 @@ static CMD_FUNC(cmd_burst) int n_modes; for (pos=argv[next], n_modes = 1; *pos; pos++) if ((*pos == 'k') || (*pos == 'l') || (*pos == 'A') - || (*pos == 'U')) + || (*pos == 'U') || ((type > 7) && (*pos == 'L'))) n_modes++; if (next + n_modes > argc) n_modes = argc - next; @@ -2700,6 +2713,11 @@ init_parse(void) /* We have reliable clock! Always! Wraaa! */ dict_insert(irc_func_dict, CMD_SETTIME, cmd_dummy); dict_insert(irc_func_dict, TOK_SETTIME, cmd_dummy); + /* Ignore ZLINE/ZL/REMOVE/RM */ + dict_insert(irc_func_dict, CMD_ZLINE, cmd_dummy); + dict_insert(irc_func_dict, TOK_ZLINE, cmd_dummy); + dict_insert(irc_func_dict, CMD_REMOVE, cmd_dummy); + dict_insert(irc_func_dict, TOK_REMOVE, cmd_dummy); /* ignore /trace and /motd commands targetted at us */ dict_insert(irc_func_dict, TOK_TRACE, cmd_dummy); @@ -3312,6 +3330,14 @@ void mod_usermode(struct userNode *user, const char *mode_change) { assign_fakehost(user, host, 0); } break; + case 'a': do_user_mode(FLAGS_ADMIN); break; + case 'z': do_user_mode(FLAGS_SSL); break; + case 'D': do_user_mode(FLAGS_PRIVDEAF); break; + case 'R': do_user_mode(FLAGS_ACCOUNTONLY); break; + case 'W': do_user_mode(FLAGS_WHOIS); break; + case 'H': do_user_mode(FLAGS_HIDEOPER); break; + case 'L': do_user_mode(FLAGS_NOLINK); break; + case 'q': do_user_mode(FLAGS_COMMONCHANSONLY); break; } #undef do_user_mode } @@ -3609,6 +3635,7 @@ mod_chanmode_announce(struct userNode *who, struct chanNode *channel, struct mod DO_MODE_CHAR(NOQUITMSGS, 'Q'); DO_MODE_CHAR(NOAMSG, 'T'); DO_MODE_CHAR(OPERSONLY, 'O'); + DO_MODE_CHAR(ADMINSONLY, 'a'); DO_MODE_CHAR(REGISTERED, 'z'); DO_MODE_CHAR(SSLONLY, 'Z'); DO_MODE_CHAR(HIDEMODE, 'L'); @@ -3665,6 +3692,7 @@ mod_chanmode_announce(struct userNode *who, struct chanNode *channel, struct mod DO_MODE_CHAR(NOQUITMSGS, 'Q'); DO_MODE_CHAR(NOAMSG, 'T'); DO_MODE_CHAR(OPERSONLY, 'O'); + DO_MODE_CHAR(ADMINSONLY, 'a'); DO_MODE_CHAR(REGISTERED, 'z'); DO_MODE_CHAR(SSLONLY, 'Z'); DO_MODE_CHAR(HIDEMODE, 'L'); @@ -3740,6 +3768,7 @@ mod_chanmode_format(struct mod_chanmode *change, char *outbuff) DO_MODE_CHAR(NOQUITMSGS, 'Q'); DO_MODE_CHAR(NOAMSG, 'T'); DO_MODE_CHAR(OPERSONLY, 'O'); + DO_MODE_CHAR(ADMINSONLY, 'a'); DO_MODE_CHAR(REGISTERED, 'z'); DO_MODE_CHAR(SSLONLY, 'Z'); DO_MODE_CHAR(HIDEMODE, 'L'); @@ -3764,6 +3793,7 @@ mod_chanmode_format(struct mod_chanmode *change, char *outbuff) DO_MODE_CHAR(NOQUITMSGS, 'Q'); DO_MODE_CHAR(NOAMSG, 'T'); DO_MODE_CHAR(OPERSONLY, 'O'); + DO_MODE_CHAR(ADMINSONLY, 'a'); DO_MODE_CHAR(REGISTERED, 'z'); DO_MODE_CHAR(SSLONLY, 'Z'); DO_MODE_CHAR(HIDEMODE, 'L');