From: sirvulcan Date: Tue, 23 May 2006 07:30:54 +0000 (+0000) Subject: setting an epithet now sets the epithet as a SWHOIS message in the ircd (nefarious... X-Git-Tag: 1.9~559 X-Git-Url: https://jfr.im/git/irc/evilnet/x3.git/commitdiff_plain/569587404da2a897f15e6b0d4bd64e8fbe5617c4?hp=68b754827164504609b223470066edfc4aa075dd setting an epithet now sets the epithet as a SWHOIS message in the ircd (nefarious only) --- diff --git a/ChangeLog b/ChangeLog index 2538bfa..4343ecf 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,6 +1,18 @@ /*********************************************************************** X3 ChangeLog +2006-05-23 Neil Spierling + + * src/chanserv.c: Set SWHOIS's when a user auths. + + * src/hosthiding.c: Fixed a segfault. + + * src/nickserv.c: Epithets now use SWHOIS. + + * src/proto.h: Declerations for irc_swhois. + + * src/proto-p10.c: Handle SWHOIS's. + 2006-05-23 Neil Spierling * src/hash.h: Bumped SOCKIPLEN diff --git a/src/chanserv.c b/src/chanserv.c index ba9ab9a..3f9dcd1 100644 --- a/src/chanserv.c +++ b/src/chanserv.c @@ -7151,6 +7151,9 @@ handle_auth(struct userNode *user, UNUSED_ARG(struct handle_info *old_handle)) irc_silence(user, user->handle_info->ignores->list[i], 1); } } + + if (user->handle_info->epithet) + irc_swhois(chanserv, user, user->handle_info->epithet); } static void diff --git a/src/hosthiding.c b/src/hosthiding.c index 9c46528..943e230 100644 --- a/src/hosthiding.c +++ b/src/hosthiding.c @@ -260,6 +260,9 @@ make_ipv6virthost (char *curr, char *host, char *new) int parc = 0, parc2 = 0; unsigned int hash[8]; + if ((strlen(host) < 3) || (strlen(curr) < 3)) + return; + strncpy (s, curr, HOSTLEN); strncpy (s2, host, HOSTLEN); diff --git a/src/nickserv.c b/src/nickserv.c index 12e1a30..676c5c8 100644 --- a/src/nickserv.c +++ b/src/nickserv.c @@ -2861,6 +2861,8 @@ static OPTION_FUNC(opt_epithet) { if ((argc > 1) && oper_has_access(user, nickserv, nickserv_conf.set_epithet_level, 0)) { char *epithet; + struct userNode *target, *next_un; + if (!override) { send_message(user, nickserv, "MSG_SETTING_PRIVILEGED", argv[0]); return 0; @@ -2874,6 +2876,12 @@ static OPTION_FUNC(opt_epithet) hi->epithet = NULL; else hi->epithet = strdup(epithet); + + for (target = hi->users; target; target = next_un) { + irc_swhois(nickserv, target, hi->epithet); + + next_un = target->next_authed; + } } if (hi->epithet) diff --git a/src/proto-p10.c b/src/proto-p10.c index d545a62..7d17423 100644 --- a/src/proto-p10.c +++ b/src/proto-p10.c @@ -91,6 +91,7 @@ #define CMD_SQUIT "SQUIT" #define CMD_STATS "STATS" #define CMD_SVSNICK "SVSNICK" +#define CMD_SWHOIS "SWHOIS" #define CMD_TIME "TIME" #define CMD_TOPIC "TOPIC" #define CMD_TRACE "TRACE" @@ -178,6 +179,7 @@ #define TOK_SQUIT "SQ" #define TOK_STATS "R" #define TOK_SVSNICK "SN" +#define TOK_SWHOIS "SW" #define TOK_TIME "TI" #define TOK_TOPIC "T" #define TOK_TRACE "TR" @@ -275,6 +277,7 @@ #define P10_SQUIT TYPE(SQUIT) #define P10_STATS TYPE(STATS) #define P10_SVSNICK TYPE(SVSNICK) +#define P10_SWHOIS TYPE(SWHOIS) #define P10_TIME TYPE(TIME) #define P10_TOPIC TYPE(TOPIC) #define P10_TRACE TYPE(TRACE) @@ -897,6 +900,14 @@ irc_svsnick(struct userNode *from, struct userNode *target, const char *newnick) putsock("%s " P10_SVSNICK " %s %s "FMT_TIME_T, from->uplink->numeric, target->numeric, newnick, now); } +void +irc_swhois(struct userNode *from, struct userNode *target, const char *message) +{ + putsock("%s " P10_SWHOIS " %s %s%s", from->uplink->numeric, target->numeric, message ? ":" : "", + message ? message : ""); + +} + void irc_part(struct userNode *who, struct chanNode *what, const char *reason) { @@ -1866,6 +1877,8 @@ init_parse(void) dict_insert(irc_func_dict, TOK_STATS, cmd_stats); dict_insert(irc_func_dict, CMD_SVSNICK, cmd_svsnick); dict_insert(irc_func_dict, TOK_SVSNICK, cmd_svsnick); + dict_insert(irc_func_dict, CMD_SWHOIS, cmd_dummy); + dict_insert(irc_func_dict, TOK_SWHOIS, cmd_dummy); dict_insert(irc_func_dict, CMD_WHOIS, cmd_whois); dict_insert(irc_func_dict, TOK_WHOIS, cmd_whois); dict_insert(irc_func_dict, CMD_GLINE, cmd_gline); diff --git a/src/proto.h b/src/proto.h index c892d9b..a4f8546 100644 --- a/src/proto.h +++ b/src/proto.h @@ -151,6 +151,7 @@ void irc_kill(struct userNode *from, struct userNode *target, const char *messag void irc_raw(const char *what); void irc_stats(struct userNode *from, struct server *target, char type); void irc_svsnick(struct userNode *from, struct userNode *target, const char *newnick); +void irc_swhois(struct userNode *from, struct userNode *target, const char *message); /* account maintenance */ void irc_rename(struct userNode *user, const char *new_handle);