]> jfr.im git - irc/quakenet/snircd-patchqueue.git/blob - hashiddenhostorissethost.patch
opername: refresh for changes by sethost.patch
[irc/quakenet/snircd-patchqueue.git] / hashiddenhostorissethost.patch
1 add HasHiddenHostOrIsSetHost() macro instead of having to test HasHiddenHost() and IsSetHost() in many places
2
3 diff -r 2dbf2e34034c include/client.h
4 --- a/include/client.h
5 +++ b/include/client.h
6 @@ -634,6 +634,8 @@
7 #define HasHiddenHost(x) (IsHiddenHost(x) && IsAccount(x))
8 /** Return non-zero if the client is using a spoofhost */
9 #define IsSetHost(x) HasFlag(x, FLAG_SETHOST)
10 +/** Return non-zero if the client's host is hidden or is using a spoofhost */
11 +#define HasHiddenHostOrIsSetHost(x) (HasHiddenHost(x) || IsSetHost(x))
12
13 /** Mark a client as having an in-progress net.burst. */
14 #define SetBurst(x) SetFlag(x, FLAG_BURST)
15 diff -r 2dbf2e34034c ircd/m_check.c
16 --- a/ircd/m_check.c
17 +++ b/ircd/m_check.c
18 @@ -489,7 +489,7 @@
19 send_reply(sptr, SND_EXPLICIT | RPL_DATASTR, ": User/Hostmask:: %s@%s [%s] (Clients: %hu)",
20 cli_user(acptr)->username, cli_user(acptr)->host, ircd_ntoa(&(cli_ip(acptr))), IPcheck_nr(acptr));
21
22 - if (IsSetHost(acptr) || HasHiddenHost(acptr))
23 + if (HasHiddenHostOrIsSetHost(acptr))
24 send_reply(sptr, SND_EXPLICIT | RPL_DATASTR, ": Real User/Host:: %s@%s", cli_user(acptr)->realusername, cli_user(acptr)->realhost);
25
26 /* COLOR_OFF ? */
27 diff -r 2dbf2e34034c ircd/m_sethost.c
28 --- a/ircd/m_sethost.c
29 +++ b/ircd/m_sethost.c
30 @@ -136,7 +136,7 @@
31 send_reply(sptr, ERR_BADHOSTMASK, hostmask);
32 return 0;
33 }
34 - if (IsSetHost(sptr) || HasHiddenHost(sptr)) {
35 + if (HasHiddenHostOrIsSetHost(sptr)) {
36 ircd_snprintf(0, curhostmask, USERLEN + HOSTLEN + 2, "%s@%s", sptr->cli_user->username, sptr->cli_user->host);
37 if (0 == strcmp(hostmask, curhostmask)) {
38 send_reply(sptr, RPL_HOSTHIDDEN, curhostmask);
39 @@ -150,7 +150,7 @@
40 send_reply(sptr, ERR_BADHOSTMASK, parv[1]);
41 return 0;
42 }
43 - if (IsSetHost(sptr) || HasHiddenHost(sptr)) {
44 + if (HasHiddenHostOrIsSetHost(sptr)) {
45 if (0 == strcmp(parv[1], sptr->cli_user->host)) {
46 send_reply(sptr, RPL_HOSTHIDDEN, parv[1]);
47 return 0;
48 @@ -206,7 +206,7 @@
49 setflags = cli_flags(target);
50 FlagClr(&setflags, FLAG_SETHOST);
51
52 - if (IsSetHost(target) || HasHiddenHost(target)) {
53 + if (HasHiddenHostOrIsSetHost(target)) {
54 if ((0 == strcmp(parv[2], target->cli_user->username)) && (0 == strcmp(parv[3], target->cli_user->host)))
55 return 0;
56 }
57 diff -r 2dbf2e34034c ircd/m_userhost.c
58 --- a/ircd/m_userhost.c
59 +++ b/ircd/m_userhost.c
60 @@ -104,7 +104,7 @@
61 * of +x. If an oper wants the real host, he should go to
62 * /whois to get it.
63 */
64 - (HasHiddenHost(cptr) || IsSetHost(cptr)) && (sptr != cptr) ?
65 + HasHiddenHostOrIsSetHost(cptr) && (sptr != cptr) ?
66 cli_user(cptr)->host : cli_user(cptr)->realhost);
67 }
68
69 diff -r 2dbf2e34034c ircd/m_userip.c
70 --- a/ircd/m_userip.c
71 +++ b/ircd/m_userip.c
72 @@ -106,7 +106,7 @@
73 * of +x. If an oper wants the real IP, he should go to
74 * /whois to get it.
75 */
76 - ((HasHiddenHost(cptr) || IsSetHost(cptr) || feature_bool(FEAT_HIS_USERIP)) && (sptr != cptr)) ?
77 + ((HasHiddenHostOrIsSetHost(cptr) || feature_bool(FEAT_HIS_USERIP)) && (sptr != cptr)) ?
78 feature_str(FEAT_HIDDEN_IP) :
79 ircd_ntoa(&cli_ip(cptr)));
80 }
81 diff -r 2dbf2e34034c ircd/m_who.c
82 --- a/ircd/m_who.c
83 +++ b/ircd/m_who.c
84 @@ -398,14 +398,13 @@
85 && ((!(matchsel & WHO_FIELD_HOS))
86 || matchexec(cli_user(acptr)->host, mymask, minlen))
87 && ((!(matchsel & WHO_FIELD_HOS))
88 - || !IsSetHost(acptr)
89 - || !HasHiddenHost(acptr)
90 + || !HasHiddenHostOrIsSetHost(acptr)
91 || !IsAnOper(sptr)
92 || matchexec(cli_user(acptr)->realhost, mymask, minlen))
93 && ((!(matchsel & WHO_FIELD_REN))
94 || matchexec(cli_info(acptr), mymask, minlen))
95 && ((!(matchsel & WHO_FIELD_NIP))
96 - || ((HasHiddenHost(acptr) || IsSetHost(acptr)) && !IsAnOper(sptr))
97 + || (HasHiddenHostOrIsSetHost(acptr) && !IsAnOper(sptr))
98 || !ipmask_check(&cli_ip(acptr), &imask, ibits))
99 && ((!(matchsel & WHO_FIELD_ACC))
100 || matchexec(cli_user(acptr)->account, mymask, minlen)))
101 @@ -437,14 +436,13 @@
102 && ((!(matchsel & WHO_FIELD_HOS))
103 || matchexec(cli_user(acptr)->host, mymask, minlen))
104 && ((!(matchsel & WHO_FIELD_HOS))
105 - || !IsSetHost(acptr)
106 - || !HasHiddenHost(acptr)
107 + || !HasHiddenHostOrIsSetHost(acptr)
108 || !IsAnOper(sptr)
109 || matchexec(cli_user(acptr)->realhost, mymask, minlen))
110 && ((!(matchsel & WHO_FIELD_REN))
111 || matchexec(cli_info(acptr), mymask, minlen))
112 && ((!(matchsel & WHO_FIELD_NIP))
113 - || ((HasHiddenHost(acptr) || IsSetHost(acptr)) && !IsAnOper(sptr))
114 + || (HasHiddenHostOrIsSetHost(acptr) && !IsAnOper(sptr))
115 || !ipmask_check(&cli_ip(acptr), &imask, ibits))
116 && ((!(matchsel & WHO_FIELD_ACC))
117 || matchexec(cli_user(acptr)->account, mymask, minlen)))
118 diff -r 2dbf2e34034c ircd/m_whois.c
119 --- a/ircd/m_whois.c
120 +++ b/ircd/m_whois.c
121 @@ -214,7 +214,7 @@
122 if (IsAccount(acptr))
123 send_reply(sptr, RPL_WHOISACCOUNT, name, user->account);
124
125 - if ((HasHiddenHost(acptr) || IsSetHost(acptr)) && ((IsAnOper(sptr) && HasPriv(sptr, PRIV_USER_PRIVACY)) || acptr == sptr))
126 + if (HasHiddenHostOrIsSetHost(acptr) && ((IsAnOper(sptr) && HasPriv(sptr, PRIV_USER_PRIVACY)) || acptr == sptr))
127 send_reply(sptr, RPL_WHOISACTUALLY, name, user->realusername,
128 user->realhost, ircd_ntoa(&cli_ip(acptr)));
129
130 diff -r 2dbf2e34034c ircd/send.c
131 --- a/ircd/send.c
132 +++ b/ircd/send.c
133 @@ -281,7 +281,7 @@
134 {
135 case MATCH_HOST:
136 return (match(mask, cli_user(one)->host) == 0 ||
137 - ((HasHiddenHost(one) || IsSetHost(one)) && match(mask, cli_user(one)->realhost) == 0));
138 + (HasHiddenHostOrIsSetHost(one) && match(mask, cli_user(one)->realhost) == 0));
139 case MATCH_SERVER:
140 default:
141 return (match(mask, cli_name(cli_user(one)->server)) == 0);
142 diff -r 2dbf2e34034c ircd/whocmds.c
143 --- a/ircd/whocmds.c
144 +++ b/ircd/whocmds.c
145 @@ -134,7 +134,7 @@
146
147 if (fields & WHO_FIELD_NIP)
148 {
149 - const char* p2 = (HasHiddenHost(acptr) || IsSetHost(acptr) || feature_bool(FEAT_HIS_USERIP)) && (!IsAnOper(sptr) || (IsAnOper(sptr) && !HasPriv(sptr, PRIV_USER_PRIVACY))) ?
150 + const char* p2 = (HasHiddenHostOrIsSetHost(acptr) || feature_bool(FEAT_HIS_USERIP)) && (!IsAnOper(sptr) || (IsAnOper(sptr) && !HasPriv(sptr, PRIV_USER_PRIVACY))) ?
151 feature_str(FEAT_HIDDEN_IP) :
152 ircd_ntoa(&cli_ip(acptr));
153 *(p1++) = ' ';
154 diff -r 2dbf2e34034c ircd/whowas.c
155 --- a/ircd/whowas.c
156 +++ b/ircd/whowas.c
157 @@ -272,7 +272,7 @@
158 DupString(ww->name, cli_name(cptr));
159 DupString(ww->username, cli_user(cptr)->username);
160 DupString(ww->hostname, cli_user(cptr)->host);
161 - if (HasHiddenHost(cptr))
162 + if (HasHiddenHostOrIsSetHost(cptr))
163 DupString(ww->realhost, cli_user(cptr)->realhost);
164 DupString(ww->servername, cli_name(cli_user(cptr)->server));
165 DupString(ww->realname, cli_info(cptr));