]> jfr.im git - irc/quakenet/snircd-patchqueue.git/blob - paranoid.patch
rename patch files
[irc/quakenet/snircd-patchqueue.git] / paranoid.patch
1 # HG changeset patch
2 # Parent 4a99caecf4d0ac2dccf921617dd974f66f8ad9b4
3
4 diff -r 4a99caecf4d0 include/client.h
5 --- a/include/client.h Sat Jul 20 14:46:36 2013 +0100
6 +++ b/include/client.h Sat Jul 20 14:47:02 2013 +0100
7 @@ -90,7 +90,7 @@
8 #define FlagClr(set,flag) ((set)->bits[FLAGSET_INDEX(flag)] &= ~FLAGSET_MASK(flag))
9
10 /** String containing valid user modes, in no particular order. */
11 -#define infousermodes "diOoswkgxRXIn"
12 +#define infousermodes "diOoswkgxRXInP"
13
14 /** Operator privileges. */
15 enum Priv
16 @@ -167,6 +167,7 @@
17 FLAG_ACCOUNT, /**< account name has been set */
18 FLAG_ACCOUNTONLY, /**< ASUKA_R: hide privmsgs/notices if
19 user is not authed or opered */
20 + FLAG_PARANOID, /**< ASUKA_P: sends notices on whois */
21 FLAG_HIDDENHOST, /**< user's host is hidden */
22 FLAG_SETHOST, /**< ASUKA_h: oper's host is changed */
23 FLAG_NOCHAN, /**< user's channels are hidden */
24 @@ -599,6 +600,9 @@
25 /** Return non-zero if the client should not receive privmsgs/notices
26 * from unauthed users */
27 #define IsAccountOnly(x) HasFlag(x, FLAG_ACCOUNTONLY)
28 +/** Return non-zero if the client should receive notices when someone
29 + * does a whois on it. */
30 +#define IsParanoid(x) HasFlag(x, FLAG_PARANOID)
31
32 /** Return non-zero if the client has operator or server privileges. */
33 #define IsPrivileged(x) (IsAnOper(x) || IsServer(x))
34 @@ -658,6 +662,8 @@
35 #define SetPingSent(x) SetFlag(x, FLAG_PINGSENT)
36 /** Mark a client as having mode +R (account only). */
37 #define SetAccountOnly(x) SetFlag(x, FLAG_ACCOUNTONLY)
38 +/** Mark a client as having mode +P (paranoid). */
39 +#define SetParanoid(x) SetFlag(x, FLAG_PARANOID)
40
41 /** Return non-zero if \a sptr sees \a acptr as an operator. */
42 #define SeeOper(sptr,acptr) (IsAnOper(acptr) && (HasPriv(acptr, PRIV_DISPLAY) \
43 @@ -703,6 +709,8 @@
44 #define ClearHub(x) ClrFlag(x, FLAG_HUB)
45 /** Remove mode +R (account only) from a client */
46 #define ClearAccountOnly(x) ClrFlag(x, FLAG_ACCOUNTONLY)
47 +/** Remove mode +P (paranoid) from a client */
48 +#define ClearParanoid(x) ClrFlag(x, FLAG_PARANOID)
49
50 /* free flags */
51 #define FREEFLAG_SOCKET 0x0001 /**< socket needs to be freed */
52 diff -r 4a99caecf4d0 ircd/m_whois.c
53 --- a/ircd/m_whois.c Sat Jul 20 14:46:36 2013 +0100
54 +++ b/ircd/m_whois.c Sat Jul 20 14:47:02 2013 +0100
55 @@ -215,6 +215,9 @@
56 send_reply(sptr, RPL_WHOISACTUALLY, name, user->realusername,
57 user->realhost, ircd_ntoa(&cli_ip(acptr)));
58
59 + if (!IsAnOper(sptr) && IsParanoid(acptr) && IsAnOper(acptr))
60 + sendcmdto_one(&me, CMD_NOTICE, acptr, "%C :whois: %s performed a /WHOIS on you.", acptr, cli_name(sptr));
61 +
62 /* Hint: if your looking to add more flags to a user, eg +h, here's
63 * probably a good place to add them :)
64 */
65 diff -r 4a99caecf4d0 ircd/s_user.c
66 --- a/ircd/s_user.c Sat Jul 20 14:46:36 2013 +0100
67 +++ b/ircd/s_user.c Sat Jul 20 14:47:02 2013 +0100
68 @@ -518,7 +518,8 @@
69 { FLAG_XTRAOP, 'X' },
70 { FLAG_NOCHAN, 'n' },
71 { FLAG_NOIDLE, 'I' },
72 - { FLAG_SETHOST, 'h' }
73 + { FLAG_SETHOST, 'h' },
74 + { FLAG_PARANOID, 'P' }
75 };
76
77 /** Length of #userModeList. */
78 @@ -1339,6 +1340,12 @@
79 else
80 ClearAccountOnly(sptr);
81 break;
82 + case 'P':
83 + if (what == MODE_ADD)
84 + SetParanoid(sptr);
85 + else
86 + ClearParanoid(sptr);
87 + break;
88 default:
89 send_reply(sptr, ERR_UMODEUNKNOWNFLAG, *m);
90 break;
91 @@ -1369,6 +1376,8 @@
92 ClearNoChan(sptr);
93 if (!FlagHas(&setflags, FLAG_NOIDLE) && !IsOper(sptr))
94 ClearNoIdle(sptr);
95 + if (!FlagHas(&setflags, FLAG_PARANOID) && !IsOper(sptr))
96 + ClearParanoid(sptr);
97
98 /*
99 * only send wallops to opers