Add account into ban owner info When an unauthed client sets a ban, nick is saved as owner of the ban, when the client is authed, account.users.quakenet.org is saved. This should not break clients as servernames can (and did appear there in asuka) and probably appear there in other IRCDs. Forcing a nick!user@host format seems odd, *!*@account.users.quakenet.org seems a bit ugly, and saving the nick and user part too costs even more and adds little, account is the most significant piece of info there already. What about a channel service like Q: Should we then save Q.users.quakenet.org, or simply stick to Q Q, or rather in general, a channel service normally does not change nicks? and since Q does set quite a lot of bans (and topics), this might save a bit on bandwidth. diff -r 3ce73eae4fd5 include/channel.h --- a/include/channel.h Tue Mar 23 14:15:58 2010 +0100 +++ b/include/channel.h Tue Mar 23 14:18:15 2010 +0100 @@ -266,7 +266,8 @@ unsigned short flags; /**< modifier flags for the ban */ unsigned char nu_len; /**< length of nick!user part of banstr */ unsigned char addrbits; /**< netmask length for BAN_IPMASK bans */ - char who[NICKLEN+1]; /**< name of client that set the ban */ + char who[ACCOUNTLEN > NICKLEN ? ACCOUNTLEN+1 : NICKLEN+1]; /**< nick or the account of client that set the ban */ + int who_is_account; /**< 0 when who is nick, 1 when an account */ char banstr[NICKLEN+USERLEN+HOSTLEN+3]; /**< hostmask that the ban matches */ }; diff -r 3ce73eae4fd5 ircd/channel.c --- a/ircd/channel.c Tue Mar 23 14:15:58 2010 +0100 +++ b/ircd/channel.c Tue Mar 23 14:18:15 2010 +0100 @@ -1304,7 +1304,10 @@ for (lp = chptr->banlist; lp; lp = lp->next) send_reply(cptr, RPL_BANLIST, chptr->chname, lp->banstr, - lp->who, lp->when); + lp->who, + lp->who_is_account ? "." : "", + lp->who_is_account ? feature_str(FEAT_HIDDEN_HOST) : "", + lp->when); send_reply(cptr, RPL_ENDOFBANLIST, chptr->chname); } @@ -3005,8 +3008,12 @@ if (!IsUser(state->sptr) || (feature_bool(FEAT_HIS_MODEWHO) && state->mbuf != NULL && (state->mbuf->mb_dest & MODEBUF_DEST_OPMODE))) { ircd_strncpy(newban->who, "*", NICKLEN); + newban->who_is_account = 0; } else { - ircd_strncpy(newban->who, cli_name(state->sptr), NICKLEN); + ircd_strncpy(newban->who, + IsAccount(state->sptr) ? cli_user(state->sptr)->account : cli_name(state->sptr), + IsAccount(state->sptr) ? ACCOUNTLEN : NICKLEN); + newban->who_is_account = IsAccount(state->sptr) ? 1 : 0; } newban->when = TStime(); @@ -3095,6 +3102,7 @@ if (state->flags & MODE_PARSE_SET) { /* create a new ban */ newban = make_ban(ban->banstr); strcpy(newban->who, ban->who); + newban->who_is_account = ban->who_is_account; newban->when = ban->when; newban->flags = ban->flags & BAN_IPMASK; diff -r 3ce73eae4fd5 ircd/m_check.c --- a/ircd/m_check.c Tue Mar 23 14:15:58 2010 +0100 +++ b/ircd/m_check.c Tue Mar 23 14:18:15 2010 +0100 @@ -348,8 +348,10 @@ for (ban = chptr->banlist; ban; ban = ban->next) { send_reply(sptr, SND_EXPLICIT | RPL_DATASTR, - ":[%d] - %s - Set by %s, on %s [%Tu]", - ++bans, ban->banstr, ban->who, myctime(ban->when), ban->when); + ":[%d] - %s - Set by %s%s%s, on %s [%Tu]", + ++bans, ban->banstr, + ban->who, ban->who_is_account ? "." : "", ban->who_is_account ? feature_str(FEAT_HIDDEN_HOST) : "", + myctime(ban->when), ban->when); } if (bans == 0) diff -r 3ce73eae4fd5 ircd/s_err.c --- a/ircd/s_err.c Tue Mar 23 14:15:58 2010 +0100 +++ b/ircd/s_err.c Tue Mar 23 14:18:15 2010 +0100 @@ -766,7 +766,7 @@ /* 366 */ { RPL_ENDOFNAMES, "%s :End of /NAMES list.", "366" }, /* 367 */ - { RPL_BANLIST, "%s %s %s %Tu", "367" }, + { RPL_BANLIST, "%s %s %s%s%s %Tu", "367" }, /* 368 */ { RPL_ENDOFBANLIST, "%s :End of Channel Ban List", "368" }, /* 369 */