X-Git-Url: https://jfr.im/git/irc/evilnet/x3.git/blobdiff_plain/3408efdc14a736c3a867f055168be02bddf5b4e9..c0601d1e22c5c3749ea94c1c4359f9223b732fe4:/src/proto-p10.c diff --git a/src/proto-p10.c b/src/proto-p10.c index e819d88..b71eef3 100644 --- a/src/proto-p10.c +++ b/src/proto-p10.c @@ -175,7 +175,7 @@ #define TOK_PONG "Z" #define TOK_POST "POST" #define TOK_PRIVMSG "P" -#define TOK_PRIVS "PR" +#define TOK_PRIVS "PRIVS" #define TOK_PROTO "PROTO" #define TOK_QUIT "Q" #define TOK_REHASH "REHASH" @@ -1094,23 +1094,27 @@ void irc_topic(struct userNode *service, struct userNode *who, struct chanNode *what, const char *topic) { - int type = 4, host_in_topic = 0, hasident = 0; - const char *hstr, *tstr; + int type = 4, host_in_topic = 0, hasident = 0, hhtype = 0; + const char *hstr, *tstr, *hhstr, *htstr; char *host, *hostmask; char shost[MAXLEN]; char sident[MAXLEN]; tstr = conf_get_data("server/type", RECDB_QSTRING); hstr = conf_get_data("server/host_in_topic", RECDB_QSTRING); + hhstr = conf_get_data("server/hidden_host", RECDB_QSTRING); + htstr = conf_get_data("server/hidden_host_type", RECDB_QSTRING); if(tstr) type = atoi(tstr); else type = 4;/* default to 040 style topics */ + if (htstr) + hhtype = atoi(htstr); if (hstr) { - if (IsFakeHost(who)) + if (IsHiddenHost(who) && IsFakeHost(who)) safestrncpy(shost, who->fakehost, sizeof(shost)); - else if (IsSetHost(who)) { + else if (IsHiddenHost(who) && IsSetHost(who)) { hostmask = strdup(who->sethost); if ((host = (strrchr(hostmask, '@')))) { hasident = 1; @@ -1124,6 +1128,10 @@ irc_topic(struct userNode *service, struct userNode *who, struct chanNode *what, safestrncpy(sident, who->ident, sizeof(shost)); safestrncpy(shost, host, sizeof(shost)); + } else if (IsHiddenHost(who) && (hhtype == 1) && who->handle_info && hhstr) { + snprintf(shost, sizeof(shost), "%s.%s", who->handle_info->handle, hhstr); + } else if (IsHiddenHost(who) && (hhtype == 2) && who->crypthost[0]) { + safestrncpy(shost, who->crypthost, sizeof(shost)); } else safestrncpy(shost, who->hostname, sizeof(shost)); @@ -2231,9 +2239,11 @@ static CMD_FUNC(cmd_kill) * Ghost response to a KILL we sent out earlier. So we only * whine if the target is local. */ - if (!strncmp(argv[1], self->numeric, strlen(self->numeric))) + if (!strncmp(argv[1], self->numeric, strlen(self->numeric))) { log_module(MAIN_LOG, LOG_ERROR, "Unable to find kill victim %s", argv[1]); - return 0; + return 0; + } + return 1; } if (IsLocal(user) && IsService(user)) {