X-Git-Url: https://jfr.im/git/irc/evilnet/x3.git/blobdiff_plain/180e0971962fa45f6fae9e072d585620ae386d7f..f977edfa98c2e2e62bb302af7e97d8729c7d6202:/src/proto-p10.c diff --git a/src/proto-p10.c b/src/proto-p10.c index 0393b06..8ccc8e9 100644 --- a/src/proto-p10.c +++ b/src/proto-p10.c @@ -18,6 +18,8 @@ * Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA. */ +#include "nickserv.h" +#include "chanserv.h" #include "proto-common.c" /* Full commands. */ @@ -55,6 +57,7 @@ #define CMD_LIST "LIST" #define CMD_LUSERS "LUSERS" #define CMD_MAP "MAP" +#define CMD_MARK "MARK" #define CMD_MODE "MODE" #define CMD_MOTD "MOTD" #define CMD_NAMES "NAMES" @@ -123,6 +126,7 @@ #define TOK_EOB "EB" #define TOK_EOB_ACK "EA" #define TOK_ERROR "Y" +#define TOK_EXEMPT "EX" #define TOK_FAKEHOST "FA" #define TOK_GET "GET" #define TOK_GLINE "GL" @@ -139,6 +143,7 @@ #define TOK_LIST "LIST" #define TOK_LUSERS "LU" #define TOK_MAP "MAP" +#define TOK_MARK "MK" #define TOK_MODE "M" #define TOK_MOTD "MO" #define TOK_NAMES "E" @@ -234,6 +239,7 @@ #define P10_LIST TYPE(LIST) #define P10_LUSERS TYPE(LUSERS) #define P10_MAP TYPE(MAP) +#define P10_MARK TYPE(MARK) #define P10_MODE TYPE(MODE) #define P10_MOTD TYPE(MOTD) #define P10_NAMES TYPE(NAMES) @@ -281,6 +287,7 @@ #define P10_WHO TYPE(WHO) #define P10_WHOIS TYPE(WHOIS) #define P10_WHOWAS TYPE(WHOWAS) +#define P10_EXEMPT TYPE(EXEMPT) /* Servers claiming to have a boot or link time before PREHISTORY * trigger errors to the log. We hope no server has been running @@ -708,6 +715,16 @@ irc_mode(struct userNode *from, struct chanNode *target, const char *modes) target->name, modes, target->timestamp); } +/* Added to allow services to mode users + 2005 - 8 - 10 by Life4Christ +*/ +void +irc_umode(struct userNode *target, const char *modes) +{ + putsock("%s " P10_MODE " %s %s ",self->numeric,target->nick, modes); +} + + void irc_invite(struct userNode *from, struct userNode *who, struct chanNode *to) { @@ -1143,8 +1160,10 @@ static CMD_FUNC(cmd_burst) if (ctype == 1) { if (bcheck == 0) { /* strip % char off start of very first ban */ - strncat(banlist, strtok(parm, "%"), sizeof(banlist) - 1 - strlen(banlist)); - strncat(banlist, " ", sizeof(banlist) - 1 - strlen(banlist)); + if (strlen(parm) > 1) { + strncat(banlist, strtok(parm, "%"), sizeof(banlist) - 1 - strlen(banlist)); + strncat(banlist, " ", sizeof(banlist) - 1 - strlen(banlist)); + } bcheck = 1; } else { strncat(banlist, parm, sizeof(banlist) - 1 - strlen(banlist)); @@ -1691,6 +1710,14 @@ init_parse(void) dict_insert(irc_func_dict, TOK_WALLOPS, cmd_dummy); dict_insert(irc_func_dict, CMD_WALLHOPS, cmd_dummy); dict_insert(irc_func_dict, TOK_WALLHOPS, cmd_dummy); + dict_insert(irc_func_dict, TOK_WALLUSERS, cmd_dummy); + /* Ignore dnsbl exemptions */ + dict_insert(irc_func_dict, TOK_EXEMPT, cmd_dummy); + dict_insert(irc_func_dict, TOK_MARK, cmd_dummy); + /* Ignore privs */ + dict_insert(irc_func_dict, TOK_PRIVS, cmd_dummy); + /* Ignore remote luser */ + dict_insert(irc_func_dict, TOK_LUSERS, cmd_dummy); /* We have reliable clock! Always! Wraaa! */ dict_insert(irc_func_dict, CMD_SETTIME, cmd_dummy); dict_insert(irc_func_dict, TOK_SETTIME, cmd_dummy); @@ -2065,6 +2092,10 @@ AddUser(struct server* uplink, const char *nick, const char *ident, const char * for (n=0; nloc == 1) && (uNode->handle_info)) + send_func_list(uNode); + return uNode; } @@ -2079,6 +2110,9 @@ DelUser(struct userNode* user, struct userNode *killer, int announce, const char /* mark them as dead, in case anybody cares */ user->dead = 1; + /* remove pending adduser commands */ + wipe_adduser_pending(NULL, user); + /* remove user from all channels */ while (user->channels.used > 0) DelChannelUser(user, user->channels.list[user->channels.used-1]->channel, false, 0); @@ -2117,8 +2151,9 @@ DelUser(struct userNode* user, struct userNode *killer, int announce, const char free_user(user); } +static void call_oper_funcs(struct userNode *user); + void mod_usermode(struct userNode *user, const char *mode_change) { - static void call_oper_funcs(struct userNode *user); int add = 1; const char *word = mode_change; @@ -2133,13 +2168,15 @@ void mod_usermode(struct userNode *user, const char *mode_change) { case '+': add = 1; break; case '-': add = 0; break; case 'o': - do_user_mode(FLAGS_OPER); if (add) { - userList_append(&curr_opers, user); - call_oper_funcs(user); + if(!IsOper(user)) { /* Dont re-oper an oper */ + userList_append(&curr_opers, user); + call_oper_funcs(user); + } } else { userList_remove(&curr_opers, user); } + do_user_mode(FLAGS_OPER); break; case 'O': do_user_mode(FLAGS_LOCOP); break; case 'i': do_user_mode(FLAGS_INVISIBLE); @@ -2237,6 +2274,8 @@ mod_chanmode_parse(struct chanNode *channel, char **modes, unsigned int argc, un case 'Q': do_chan_mode(MODE_NOQUITMSGS); break; case 'T': do_chan_mode(MODE_NOAMSG); break; case 'O': do_chan_mode(MODE_OPERSONLY); break; + case 'Z': do_chan_mode(MODE_SSLONLY); break; + case 'L': do_chan_mode(MODE_HIDEMODE); break; case 'z': if (!(flags & MCP_REGISTERED)) { do_chan_mode(MODE_REGISTERED); @@ -2245,8 +2284,6 @@ mod_chanmode_parse(struct chanNode *channel, char **modes, unsigned int argc, un return NULL; } break; -// uncomment this when ssl is enabled on the network. -// case 'Z': do_chan_mode(MODE_SSLONLY); break; #undef do_chan_mode case 'l': if (add) { @@ -2414,8 +2451,8 @@ mod_chanmode_announce(struct userNode *who, struct chanNode *channel, struct mod DO_MODE_CHAR(NOAMSG, 'T'); DO_MODE_CHAR(OPERSONLY, 'O'); DO_MODE_CHAR(REGISTERED, 'z'); - // uncomment this for ssl support - //DO_MODE_CHAR(SSLONLY, 'Z'); + DO_MODE_CHAR(SSLONLY, 'Z'); + DO_MODE_CHAR(HIDEMODE, 'L'); #undef DO_MODE_CHAR if (change->modes_clear & channel->modes & MODE_KEY) mod_chanmode_append(&chbuf, 'k', channel->key); @@ -2466,8 +2503,8 @@ mod_chanmode_announce(struct userNode *who, struct chanNode *channel, struct mod DO_MODE_CHAR(NOAMSG, 'T'); DO_MODE_CHAR(OPERSONLY, 'O'); DO_MODE_CHAR(REGISTERED, 'z'); - // uncomment this for ssl support - //DO_MODE_CHAR(SSLONLY, 'Z'); + DO_MODE_CHAR(SSLONLY, 'Z'); + DO_MODE_CHAR(HIDEMODE, 'L'); #undef DO_MODE_CHAR if(change->modes_set & MODE_KEY) mod_chanmode_append(&chbuf, 'k', change->new_key); @@ -2535,8 +2572,8 @@ mod_chanmode_format(struct mod_chanmode *change, char *outbuff) DO_MODE_CHAR(NOAMSG, 'T'); DO_MODE_CHAR(OPERSONLY, 'O'); DO_MODE_CHAR(REGISTERED, 'z'); - // uncomment this for ssl support - //DO_MODE_CHAR(SSLONLY, 'Z'); + DO_MODE_CHAR(SSLONLY, 'Z'); + DO_MODE_CHAR(HIDEMODE, 'L'); #undef DO_MODE_CHAR } if (change->modes_set) { @@ -2559,8 +2596,8 @@ mod_chanmode_format(struct mod_chanmode *change, char *outbuff) DO_MODE_CHAR(NOAMSG, 'T'); DO_MODE_CHAR(OPERSONLY, 'O'); DO_MODE_CHAR(REGISTERED, 'z'); - // uncomment this for ssl support - //DO_MODE_CHAR(SSLONLY, 'Z'); + DO_MODE_CHAR(SSLONLY, 'Z'); + DO_MODE_CHAR(HIDEMODE, 'L'); #undef DO_MODE_CHAR switch (change->modes_set & (MODE_KEY|MODE_LIMIT)) { case MODE_KEY|MODE_LIMIT: @@ -2606,7 +2643,7 @@ clear_chanmode(struct chanNode *channel, const char *modes) case 'e': remove |= MODE_EXEMPT; break; case 'D': remove |= MODE_DELAYJOINS; break; case 'r': remove |= MODE_REGONLY; break; - case 'c': remove |= MODE_NOCOLORS; + case 'c': remove |= MODE_NOCOLORS; break; case 'C': remove |= MODE_NOCTCPS; break; case 'S': remove |= MODE_STRIPCOLOR; break; case 'M': remove |= MODE_MODUNREG; break; @@ -2615,6 +2652,8 @@ clear_chanmode(struct chanNode *channel, const char *modes) case 'T': remove |= MODE_NOAMSG; break; case 'O': remove |= MODE_OPERSONLY; break; case 'z': remove |= MODE_REGISTERED; break; + case 'Z': remove |= MODE_SSLONLY; break; + case 'L': remove |= MODE_HIDEMODE; break; } }