]>
Commit | Line | Data |
---|---|---|
1 | Add opername to snomask and remote connect wallops | |
2 | ||
3 | in form of nick(opername) | |
4 | new function get_client_name_and_opername() add in s_misc.c | |
5 | mirrored after get_client_name() which can return either nick/server or nick[ident@ip] | |
6 | ||
7 | diff -r 7ba3fe4d0f40 include/client.h | |
8 | --- a/include/client.h Thu Jan 22 00:59:17 2009 +0100 | |
9 | +++ b/include/client.h Thu Jan 22 00:59:43 2009 +0100 | |
10 | @@ -806,6 +806,7 @@ | |
11 | #define IPV6USERBITS 64 | |
12 | ||
13 | extern const char* get_client_name(const struct Client* sptr, int showip); | |
14 | +extern const char* get_client_name_and_opername(const struct Client* sptr); | |
15 | extern const char* client_get_default_umode(const struct Client* sptr); | |
16 | extern int client_get_ping(const struct Client* local_client); | |
17 | extern void client_drop_sendq(struct Connection* con); | |
18 | diff -r 7ba3fe4d0f40 ircd/channel.c | |
19 | --- a/ircd/channel.c Thu Jan 22 00:59:17 2009 +0100 | |
20 | +++ b/ircd/channel.c Thu Jan 22 00:59:43 2009 +0100 | |
21 | @@ -1952,8 +1952,8 @@ | |
22 | if (mbuf->mb_dest & MODEBUF_DEST_HACK4) | |
23 | sendto_opmask_butone(0, SNO_HACK4, "HACK(4): %s MODE %s %s%s%s%s%s%s " | |
24 | "[%Tu]", | |
25 | - cli_name(feature_bool(FEAT_HIS_SNOTICES) ? | |
26 | - mbuf->mb_source : app_source), | |
27 | + feature_bool(FEAT_HIS_SNOTICES) ? | |
28 | + get_client_name_and_opername(mbuf->mb_source) : cli_name(app_source), | |
29 | mbuf->mb_channel->chname, | |
30 | rembuf_i ? "-" : "", rembuf, addbuf_i ? "+" : "", | |
31 | addbuf, remstr, addstr, | |
32 | diff -r 7ba3fe4d0f40 ircd/gline.c | |
33 | --- a/ircd/gline.c Thu Jan 22 00:59:17 2009 +0100 | |
34 | +++ b/ircd/gline.c Thu Jan 22 00:59:43 2009 +0100 | |
35 | @@ -561,7 +561,7 @@ | |
36 | "%s adding %s %s for %s%s%s%s%s, expiring at " | |
37 | "%Tu: %s", | |
38 | (feature_bool(FEAT_HIS_SNOTICES) || IsServer(sptr)) ? | |
39 | - cli_name(sptr) : | |
40 | + get_client_name_and_opername(sptr) : | |
41 | cli_name((cli_user(sptr))->server), | |
42 | (flags & GLINE_LOCAL) ? "local" : "global", | |
43 | (flags & GLINE_BADCHAN) ? "BADCHAN" : "GLINE", | |
44 | @@ -648,7 +648,7 @@ | |
45 | "%s activating global %s for %s%s%s%s%s, " | |
46 | "expiring at %Tu: %s", | |
47 | (feature_bool(FEAT_HIS_SNOTICES) || IsServer(sptr)) ? | |
48 | - cli_name(sptr) : | |
49 | + get_client_name_and_opername(sptr) : | |
50 | cli_name((cli_user(sptr))->server), | |
51 | GlineIsBadChan(gline) ? "BADCHAN" : "GLINE", | |
52 | GlineIsBadChan(gline)|GlineIsRealName(gline) ? "" : gline->gl_nick, | |
53 | @@ -721,7 +721,7 @@ | |
54 | sendto_opmask_butone(0, SNO_GLINE, "%s %s %s for %s%s%s%s%s, expiring at %Tu: " | |
55 | "%s", | |
56 | (feature_bool(FEAT_HIS_SNOTICES) || IsServer(sptr)) ? | |
57 | - cli_name(sptr) : | |
58 | + get_client_name_and_opername(sptr) : | |
59 | cli_name((cli_user(sptr))->server), | |
60 | msg, GlineIsBadChan(gline) ? "BADCHAN" : "GLINE", | |
61 | GlineIsBadChan(gline)|GlineIsRealName(gline) ? "" : gline->gl_nick, | |
62 | @@ -981,7 +981,7 @@ | |
63 | sendto_opmask_butone(0, flags & GLINE_AUTO ? SNO_GLINE : SNO_GLINE, | |
64 | "%s modifying global %s for %s%s%s%s%s:%s", | |
65 | (feature_bool(FEAT_HIS_SNOTICES) || IsServer(sptr)) ? | |
66 | - cli_name(sptr) : cli_name((cli_user(sptr))->server), | |
67 | + get_client_name_and_opername(sptr) : cli_name((cli_user(sptr))->server), | |
68 | GlineIsBadChan(gline) ? "BADCHAN" : "GLINE", | |
69 | GlineIsBadChan(gline)|GlineIsRealName(gline) ? "" : gline->gl_nick, | |
70 | GlineIsBadChan(gline)|GlineIsRealName(gline) ? "" : "!", | |
71 | @@ -1039,7 +1039,7 @@ | |
72 | /* Inform ops and log it */ | |
73 | sendto_opmask_butone(0, SNO_GLINE, "%s removing local %s for %s%s%s%s%s", | |
74 | (feature_bool(FEAT_HIS_SNOTICES) || IsServer(sptr)) ? | |
75 | - cli_name(sptr) : cli_name((cli_user(sptr))->server), | |
76 | + get_client_name_and_opername(sptr) : cli_name((cli_user(sptr))->server), | |
77 | GlineIsBadChan(gline) ? "BADCHAN" : "GLINE", | |
78 | GlineIsBadChan(gline)|GlineIsRealName(gline) ? "" : gline->gl_nick, | |
79 | GlineIsBadChan(gline)|GlineIsRealName(gline) ? "" : "!", | |
80 | diff -r 7ba3fe4d0f40 ircd/jupe.c | |
81 | --- a/ircd/jupe.c Thu Jan 22 00:59:17 2009 +0100 | |
82 | +++ b/ircd/jupe.c Thu Jan 22 00:59:43 2009 +0100 | |
83 | @@ -156,7 +156,7 @@ | |
84 | sendto_opmask_butone(0, SNO_NETWORK, "%s adding %sJUPE for %s, expiring at " | |
85 | "%Tu: %s", | |
86 | (feature_bool(FEAT_HIS_SNOTICES) || IsServer(sptr)) ? | |
87 | - cli_name(sptr) : | |
88 | + get_client_name_and_opername(sptr) : | |
89 | cli_name((cli_user(sptr))->server), | |
90 | flags & JUPE_LOCAL ? "local " : "", server, | |
91 | expire + TSoffset, reason); | |
92 | @@ -216,7 +216,7 @@ | |
93 | sendto_opmask_butone(0, SNO_NETWORK, "%s activating JUPE for %s, expiring " | |
94 | "at %Tu: %s", | |
95 | (feature_bool(FEAT_HIS_SNOTICES) || IsServer(sptr)) ? | |
96 | - cli_name(sptr) : | |
97 | + get_client_name_and_opername(sptr) : | |
98 | cli_name((cli_user(sptr))->server), | |
99 | jupe->ju_server, jupe->ju_expire + TSoffset, | |
100 | jupe->ju_reason); | |
101 | @@ -269,7 +269,7 @@ | |
102 | sendto_opmask_butone(0, SNO_NETWORK, "%s %s JUPE for %s, expiring at %Tu: " | |
103 | "%s", | |
104 | (feature_bool(FEAT_HIS_SNOTICES) || IsServer(sptr)) ? | |
105 | - cli_name(sptr) : | |
106 | + get_client_name_and_opername(sptr) : | |
107 | cli_name((cli_user(sptr))->server), | |
108 | JupeIsLocal(jupe) ? "removing local" : "deactivating", | |
109 | jupe->ju_server, jupe->ju_expire + TSoffset, | |
110 | diff -r 7ba3fe4d0f40 ircd/m_connect.c | |
111 | --- a/ircd/m_connect.c Thu Jan 22 00:59:17 2009 +0100 | |
112 | +++ b/ircd/m_connect.c Thu Jan 22 00:59:43 2009 +0100 | |
113 | @@ -197,7 +197,7 @@ | |
114 | sendwallto_group_butone(&me, WALL_WALLOPS, 0, | |
115 | "Remote CONNECT %s %s from %s", aconf->name, | |
116 | parv[2] ? parv[2] : "", | |
117 | - get_client_name(sptr, HIDE_IP)); | |
118 | + get_client_name_and_opername(sptr)); | |
119 | log_write(LS_NETWORK, L_INFO, 0, "CONNECT From %C : %s %s", sptr, aconf->name, | |
120 | parv[2] ? parv[2] : ""); | |
121 | ||
122 | diff -r 7ba3fe4d0f40 ircd/m_join.c | |
123 | --- a/ircd/m_join.c Thu Jan 22 00:59:17 2009 +0100 | |
124 | +++ b/ircd/m_join.c Thu Jan 22 00:59:43 2009 +0100 | |
125 | @@ -242,8 +242,8 @@ | |
126 | } | |
127 | /* send accountability notice */ | |
128 | if (err) | |
129 | - sendto_opmask_butone(0, SNO_HACK4, "OPER JOIN: %C JOIN %H " | |
130 | - "(overriding +%c)", sptr, chptr, err); | |
131 | + sendto_opmask_butone(0, SNO_HACK4, "OPER JOIN: %s JOIN %H " | |
132 | + "(overriding +%c)", get_client_name_and_opername(sptr), chptr, err); | |
133 | err = 0; | |
134 | } | |
135 | ||
136 | diff -r 7ba3fe4d0f40 ircd/m_kill.c | |
137 | --- a/ircd/m_kill.c Thu Jan 22 00:59:17 2009 +0100 | |
138 | +++ b/ircd/m_kill.c Thu Jan 22 00:59:43 2009 +0100 | |
139 | @@ -127,7 +127,7 @@ | |
140 | */ | |
141 | sendto_opmask_butone(0, snomask, | |
142 | "Received KILL message for %s from %s Path: %s!%s %s", | |
143 | - get_client_name(victim, SHOW_IP), cli_name(sptr), | |
144 | + get_client_name(victim, SHOW_IP), get_client_name_and_opername(sptr), | |
145 | inpath, path, msg); | |
146 | log_write_kill(victim, sptr, inpath, path, msg); | |
147 | ||
148 | diff -r 7ba3fe4d0f40 ircd/m_rehash.c | |
149 | --- a/ircd/m_rehash.c Thu Jan 22 00:59:17 2009 +0100 | |
150 | +++ b/ircd/m_rehash.c Thu Jan 22 00:59:43 2009 +0100 | |
151 | @@ -121,8 +121,8 @@ | |
152 | } | |
153 | ||
154 | send_reply(sptr, RPL_REHASHING, configfile); | |
155 | - sendto_opmask_butone(0, SNO_OLDSNO, "%C is rehashing Server config file", | |
156 | - sptr); | |
157 | + sendto_opmask_butone(0, SNO_OLDSNO, "%s is rehashing Server config file", | |
158 | + get_client_name_and_opername(sptr)); | |
159 | ||
160 | log_write(LS_SYSTEM, L_INFO, 0, "REHASH From %#C", sptr); | |
161 | ||
162 | diff -r 7ba3fe4d0f40 ircd/m_settime.c | |
163 | --- a/ircd/m_settime.c Thu Jan 22 00:59:17 2009 +0100 | |
164 | +++ b/ircd/m_settime.c Thu Jan 22 00:59:43 2009 +0100 | |
165 | @@ -177,7 +177,7 @@ | |
166 | else /* tell opers about time change */ | |
167 | { | |
168 | sendto_opmask_butone(0, SNO_OLDSNO, "SETTIME from %s, clock is set %ld " | |
169 | - "seconds %s", cli_name(sptr), (dt < 0) ? -dt : dt, | |
170 | + "seconds %s", get_client_name_and_opername(sptr), (dt < 0) ? -dt : dt, | |
171 | (dt < 0) ? "forwards" : "backwards"); | |
172 | /* Apply time change... */ | |
173 | TSoffset -= dt; | |
174 | @@ -252,7 +252,7 @@ | |
175 | else /* tell opers about time change */ | |
176 | { | |
177 | sendto_opmask_butone(0, SNO_OLDSNO, "SETTIME from %s, clock is set %ld " | |
178 | - "seconds %s", cli_name(sptr), (dt < 0) ? -dt : dt, | |
179 | + "seconds %s", get_client_name_and_opername(sptr), (dt < 0) ? -dt : dt, | |
180 | (dt < 0) ? "forwards" : "backwards"); | |
181 | TSoffset -= dt; /* apply time change */ | |
182 | if (IsUser(sptr)) /* let user know what we did */ | |
183 | diff -r 7ba3fe4d0f40 ircd/s_misc.c | |
184 | --- a/ircd/s_misc.c Thu Jan 22 00:59:17 2009 +0100 | |
185 | +++ b/ircd/s_misc.c Thu Jan 22 00:59:43 2009 +0100 | |
186 | @@ -169,6 +169,20 @@ | |
187 | ircd_snprintf(0, nbuf, sizeof(nbuf), "%s[%s@%s]", cli_name(sptr), | |
188 | IsIdented(sptr) ? cli_username(sptr) : "", | |
189 | cli_sock_ip(sptr)); | |
190 | + return nbuf; | |
191 | +} | |
192 | + | |
193 | +/** Return the name of the client and the opername for accountability purposes | |
194 | + * in snomask and other places. | |
195 | + * @param sptr Client to operate on. | |
196 | + * @return Either cli_name(\a sptr) or a static buffer. | |
197 | + */ | |
198 | +const char* get_client_name_and_opername(const struct Client* sptr) { | |
199 | + static char nbuf[NICKLEN + 1 + ACCOUNTLEN + 2]; | |
200 | + | |
201 | + if (!IsUser(sptr) || !cli_user(sptr)->opername) | |
202 | + return cli_name(sptr); | |
203 | + ircd_snprintf(0, nbuf, sizeof(nbuf), "%s(%s)", cli_name(sptr), cli_user(sptr)->opername); | |
204 | return nbuf; | |
205 | } | |
206 | ||
207 | @@ -474,7 +488,7 @@ | |
208 | (cli_user(killer)->server == victim || | |
209 | cli_user(killer)->server == cli_serv(victim)->up) ? | |
210 | "Local" : "Remote", | |
211 | - get_client_name(killer, HIDE_IP), | |
212 | + get_client_name_and_opername(killer), | |
213 | cli_name(cli_user(killer)->server)); | |
214 | else if (killer != &me && cli_serv(victim)->up != killer) | |
215 | sendto_opmask_butone(0, SNO_OLDSNO, "Received SQUIT %s from %s :", |