]> jfr.im git - irc/quakenet/snircd-patchqueue.git/blame_incremental - whoban.patch
opername: prefix jupe reasons with the oper's opername
[irc/quakenet/snircd-patchqueue.git] / whoban.patch
... / ...
CommitLineData
1Add account into ban owner info
2
3When an unauthed client sets a ban, nick is saved as owner of the ban,
4when the client is authed, account.users.quakenet.org is saved.
5
6This should not break clients as servernames can (and did appear there
7in asuka) and probably appear there in other IRCDs. Forcing a nick!user@host
8format seems odd, *!*@account.users.quakenet.org seems a bit ugly, and saving
9the nick and user part too costs even more and adds little, account is the most
10significant piece of info there already.
11
12What about a channel service like Q:
13Should we then save Q.users.quakenet.org, or simply stick to Q
14Q, or rather in general, a channel service normally does not change nicks?
15and since Q does set quite a lot of bans (and topics), this might save a bit on bandwidth.
16
17diff -r 3ce73eae4fd5 include/channel.h
18--- a/include/channel.h Tue Mar 23 14:15:58 2010 +0100
19+++ b/include/channel.h Tue Mar 23 14:18:15 2010 +0100
20@@ -266,7 +266,8 @@
21 unsigned short flags; /**< modifier flags for the ban */
22 unsigned char nu_len; /**< length of nick!user part of banstr */
23 unsigned char addrbits; /**< netmask length for BAN_IPMASK bans */
24- char who[NICKLEN+1]; /**< name of client that set the ban */
25+ char who[ACCOUNTLEN > NICKLEN ? ACCOUNTLEN+1 : NICKLEN+1]; /**< nick or the account of client that set the ban */
26+ int who_is_account; /**< 0 when who is nick, 1 when an account */
27 char banstr[NICKLEN+USERLEN+HOSTLEN+3]; /**< hostmask that the ban matches */
28 };
29
30diff -r 3ce73eae4fd5 ircd/channel.c
31--- a/ircd/channel.c Tue Mar 23 14:15:58 2010 +0100
32+++ b/ircd/channel.c Tue Mar 23 14:18:15 2010 +0100
33@@ -1304,7 +1304,10 @@
34
35 for (lp = chptr->banlist; lp; lp = lp->next)
36 send_reply(cptr, RPL_BANLIST, chptr->chname, lp->banstr,
37- lp->who, lp->when);
38+ lp->who,
39+ lp->who_is_account ? "." : "",
40+ lp->who_is_account ? feature_str(FEAT_HIDDEN_HOST) : "",
41+ lp->when);
42
43 send_reply(cptr, RPL_ENDOFBANLIST, chptr->chname);
44 }
45@@ -3005,8 +3008,12 @@
46 if (!IsUser(state->sptr) ||
47 (feature_bool(FEAT_HIS_MODEWHO) && state->mbuf != NULL && (state->mbuf->mb_dest & MODEBUF_DEST_OPMODE))) {
48 ircd_strncpy(newban->who, "*", NICKLEN);
49+ newban->who_is_account = 0;
50 } else {
51- ircd_strncpy(newban->who, cli_name(state->sptr), NICKLEN);
52+ ircd_strncpy(newban->who,
53+ IsAccount(state->sptr) ? cli_user(state->sptr)->account : cli_name(state->sptr),
54+ IsAccount(state->sptr) ? ACCOUNTLEN : NICKLEN);
55+ newban->who_is_account = IsAccount(state->sptr) ? 1 : 0;
56 }
57
58 newban->when = TStime();
59@@ -3095,6 +3102,7 @@
60 if (state->flags & MODE_PARSE_SET) { /* create a new ban */
61 newban = make_ban(ban->banstr);
62 strcpy(newban->who, ban->who);
63+ newban->who_is_account = ban->who_is_account;
64 newban->when = ban->when;
65 newban->flags = ban->flags & BAN_IPMASK;
66
67diff -r 3ce73eae4fd5 ircd/m_check.c
68--- a/ircd/m_check.c Tue Mar 23 14:15:58 2010 +0100
69+++ b/ircd/m_check.c Tue Mar 23 14:18:15 2010 +0100
70@@ -348,8 +348,10 @@
71
72 for (ban = chptr->banlist; ban; ban = ban->next) {
73 send_reply(sptr, SND_EXPLICIT | RPL_DATASTR,
74- ":[%d] - %s - Set by %s, on %s [%Tu]",
75- ++bans, ban->banstr, ban->who, myctime(ban->when), ban->when);
76+ ":[%d] - %s - Set by %s%s%s, on %s [%Tu]",
77+ ++bans, ban->banstr,
78+ ban->who, ban->who_is_account ? "." : "", ban->who_is_account ? feature_str(FEAT_HIDDEN_HOST) : "",
79+ myctime(ban->when), ban->when);
80 }
81
82 if (bans == 0)
83diff -r 3ce73eae4fd5 ircd/s_err.c
84--- a/ircd/s_err.c Tue Mar 23 14:15:58 2010 +0100
85+++ b/ircd/s_err.c Tue Mar 23 14:18:15 2010 +0100
86@@ -766,7 +766,7 @@
87 /* 366 */
88 { RPL_ENDOFNAMES, "%s :End of /NAMES list.", "366" },
89 /* 367 */
90- { RPL_BANLIST, "%s %s %s %Tu", "367" },
91+ { RPL_BANLIST, "%s %s %s%s%s %Tu", "367" },
92 /* 368 */
93 { RPL_ENDOFBANLIST, "%s :End of Channel Ban List", "368" },
94 /* 369 */