X-Git-Url: https://jfr.im/git/irc/evilnet/x3.git/blobdiff_plain/c99dcaf6a0f9c7798580fc9f315d7b368c9f972c..e0ee1ed8a1244740d4cad80273e0f4603e9cf744:/src/proto-p10.c diff --git a/src/proto-p10.c b/src/proto-p10.c index ed2242e..f55dd7e 100644 --- a/src/proto-p10.c +++ b/src/proto-p10.c @@ -744,6 +744,12 @@ irc_eob_ack(void) } } +void +irc_rpong(const char *from1, const char *from2, const char *pingtime, const char *clientinfo) +{ + putsock("%s " P10_RPONG " %s %s %s :%s", self->numeric, from1, from2, pingtime, clientinfo); +} + void irc_ping(const char *payload) { @@ -1116,6 +1122,11 @@ void irc_mark(struct userNode *user, char *mark) { char *host = user->hostname; + + /* TODO: Allow mark overwrite. If they are marked, and their fakehost is oldmark.hostname, update it to newmark.hostname so mark can be called multiple times. Probably requires ircd modification also */ + if(user->mark) + return; + /* if the mark will put us over the host length, clip some off the left hand side * to make room... */ @@ -1123,23 +1134,28 @@ irc_mark(struct userNode *user, char *mark) host += 1 + ( (strlen(host) + 1 + strlen(mark)) - HOSTLEN ); putsock("%s " CMD_MARK " %s DNSBL +m %s.%s", self->numeric, user->nick, mark, host); putsock("%s " CMD_MARK " %s DNSBL_DATA %s", self->numeric, user->nick, mark); + + /* Save it in the user */ + user->mark = strdup(mark); + /* If they are not otherwise marked, mark their host with fakehost */ - if(!IsFakeHost(user) && !IsSetHost(user) && !IsHiddenHost(user)) + if(!IsFakeHost(user) && !IsSetHost(user) && !(IsHiddenHost(user) && user->handle_info) ) { struct modeNode *mn = NULL; char fakehost[HOSTLEN]; unsigned int count = 0; unsigned int n = 0; - putsock("%s " CMD_MODE " %s +x", self->numeric, user->nick); putsock("%s " CMD_FAKEHOST " %s %s.%s", self->numeric, user->numeric, mark, host); + putsock("%s " CMD_MODE " %s +x", self->numeric, user->nick); snprintf(fakehost, sizeof(fakehost), "%s.%s", mark, host); safestrncpy(user->fakehost, fakehost, sizeof(user->fakehost)); for (n=count=0; nchannels.used; n++) { mn = user->channels.list[n]; - check_bans(user, mn->channel->name); + if (strlen(mn->channel->name) >= 1) /* Sanity */ + check_bans(user, mn->channel->name); } } } @@ -1294,6 +1310,19 @@ static CMD_FUNC(cmd_eob_ack) return 1; } +static CMD_FUNC(cmd_rping) +{ + struct server *dest; + + if (!(dest = GetServerN(argv[1]))) + return 0; + + if (dest == self) + irc_rpong(argv[2], argv[3], argv[4], argv[5]); + + return 1; +} + static CMD_FUNC(cmd_ping) { struct server *srv; @@ -1752,6 +1781,7 @@ static CMD_FUNC(cmd_mark) } else if(!strcasecmp(argv[2], "DNSBL_DATA")) { /* DNSBL_DATA name */ + target->mark = strdup(argv[3]); return 1; } @@ -2015,7 +2045,7 @@ static CMD_FUNC(cmd_svspart) if (argc < 3) return 0; - user = GetUserH(argv[1]); + user = GetUserN(argv[1]); if (!user) return 0; parse_foreach(argv[2], part_helper, NULL, NULL, NULL, user); @@ -2388,6 +2418,11 @@ init_parse(void) dict_insert(irc_func_dict, CMD_ADMIN, cmd_admin); dict_insert(irc_func_dict, TOK_ADMIN, cmd_admin); + dict_insert(irc_func_dict, CMD_RPING, cmd_rping); + dict_insert(irc_func_dict, TOK_RPING, cmd_rping); + dict_insert(irc_func_dict, CMD_RPONG, cmd_dummy); + dict_insert(irc_func_dict, TOK_RPONG, cmd_dummy); + /* In P10, DESTRUCT doesn't do anything except be broadcast to servers. * Apparently to obliterate channels from any servers that think they * exist? @@ -2873,6 +2908,12 @@ DelUser(struct userNode* user, struct userNode *killer, int announce, const char user->version_reply = NULL; } + /* clean up mark */ + if(user->mark) { + free(user->mark); + user->mark = NULL; + } + /* clean up geoip data if any */ if(user->country_code) free(user->country_code); if(user->city) free(user->city);