]> jfr.im git - irc/quakenet/snircd-patchqueue.git/blob - opername.patch
removed cmdhelp.patch
[irc/quakenet/snircd-patchqueue.git] / opername.patch
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 a15df3a06d8e include/client.h
8 --- a/include/client.h Sun Feb 15 16:00:04 2009 +0100
9 +++ b/include/client.h Sun Feb 15 16:03:43 2009 +0100
10 @@ -812,6 +812,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 a15df3a06d8e ircd/channel.c
19 --- a/ircd/channel.c Sun Feb 15 16:00:04 2009 +0100
20 +++ b/ircd/channel.c Sun Feb 15 16:03:43 2009 +0100
21 @@ -1926,8 +1926,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 a15df3a06d8e ircd/gline.c
33 --- a/ircd/gline.c Sun Feb 15 16:00:04 2009 +0100
34 +++ b/ircd/gline.c Sun Feb 15 16:03:43 2009 +0100
35 @@ -560,7 +560,7 @@
36 sendto_opmask_butone(0, (flags & GLINE_AUTO) ? SNO_AUTO : SNO_GLINE,
37 "%s adding %s%s %s for %s%s%s%s%s, expiring at %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_ACTIVE) ? "" : "deactivated ",
43 (flags & GLINE_LOCAL) ? "local" : "global",
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, GlineIsAuto(gline) ? SNO_AUTO : SNO_GLINE,
55 "%s %s %s for %s%s%s%s%s, expiring at %Tu: %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 @@ -932,7 +932,7 @@
63 sendto_opmask_butone(0, GlineIsAuto(gline) ? SNO_AUTO : 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 @@ -991,7 +991,7 @@
72 sendto_opmask_butone(0, GlineIsAuto(gline) ? SNO_AUTO : SNO_GLINE,
73 "%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 a15df3a06d8e ircd/jupe.c
81 --- a/ircd/jupe.c Sun Feb 15 16:00:04 2009 +0100
82 +++ b/ircd/jupe.c Sun Feb 15 16:03: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 @@ -225,7 +225,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 @@ -278,7 +278,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 a15df3a06d8e ircd/m_connect.c
111 --- a/ircd/m_connect.c Sun Feb 15 16:00:04 2009 +0100
112 +++ b/ircd/m_connect.c Sun Feb 15 16:03: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 a15df3a06d8e ircd/m_join.c
123 --- a/ircd/m_join.c Sun Feb 15 16:00:04 2009 +0100
124 +++ b/ircd/m_join.c Sun Feb 15 16:03: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 a15df3a06d8e ircd/m_kill.c
137 --- a/ircd/m_kill.c Sun Feb 15 16:00:04 2009 +0100
138 +++ b/ircd/m_kill.c Sun Feb 15 16:03: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 a15df3a06d8e ircd/m_rehash.c
149 --- a/ircd/m_rehash.c Sun Feb 15 16:00:04 2009 +0100
150 +++ b/ircd/m_rehash.c Sun Feb 15 16:03: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 a15df3a06d8e ircd/m_settime.c
163 --- a/ircd/m_settime.c Sun Feb 15 16:00:04 2009 +0100
164 +++ b/ircd/m_settime.c Sun Feb 15 16:03: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 a15df3a06d8e ircd/s_misc.c
184 --- a/ircd/s_misc.c Sun Feb 15 16:00:04 2009 +0100
185 +++ b/ircd/s_misc.c Sun Feb 15 16:03:43 2009 +0100
186 @@ -172,6 +172,20 @@
187 return nbuf;
188 }
189
190 +/** Return the name of the client and the opername for accountability purposes
191 + * in snomask and other places.
192 + * @param sptr Client to operate on.
193 + * @return Either cli_name(\a sptr) or a static buffer.
194 + */
195 +const char* get_client_name_and_opername(const struct Client* sptr) {
196 + static char nbuf[NICKLEN + 1 + ACCOUNTLEN + 2];
197 +
198 + if (!IsUser(sptr) || !cli_user(sptr)->opername)
199 + return cli_name(sptr);
200 + ircd_snprintf(0, nbuf, sizeof(nbuf), "%s(%s)", cli_name(sptr), cli_user(sptr)->opername);
201 + return nbuf;
202 +}
203 +
204 /**
205 * Exit one client, local or remote. Assuming for local client that
206 * all dependents already have been removed, and socket is closed.
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 :",