]>
Commit | Line | Data |
---|---|---|
619a6949 | 1 | add HasHiddenHostOrIsSetHost() macro instead of having to test HasHiddenHost() and IsSetHost() in many places |
2 | ||
ff8777da | 3 | diff -r 702b5aa2127f include/client.h |
619a6949 | 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) | |
ff8777da | 15 | diff -r 702b5aa2127f ircd/m_check.c |
619a6949 | 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 ? */ | |
ff8777da | 27 | diff -r 702b5aa2127f ircd/m_userhost.c |
619a6949 | 28 | --- a/ircd/m_userhost.c |
29 | +++ b/ircd/m_userhost.c | |
30 | @@ -104,7 +104,7 @@ | |
31 | * of +x. If an oper wants the real host, he should go to | |
32 | * /whois to get it. | |
33 | */ | |
34 | - (HasHiddenHost(cptr) || IsSetHost(cptr)) && (sptr != cptr) ? | |
35 | + HasHiddenHostOrIsSetHost(cptr) && (sptr != cptr) ? | |
36 | cli_user(cptr)->host : cli_user(cptr)->realhost); | |
37 | } | |
38 | ||
ff8777da | 39 | diff -r 702b5aa2127f ircd/m_userip.c |
619a6949 | 40 | --- a/ircd/m_userip.c |
41 | +++ b/ircd/m_userip.c | |
42 | @@ -106,7 +106,7 @@ | |
43 | * of +x. If an oper wants the real IP, he should go to | |
44 | * /whois to get it. | |
45 | */ | |
46 | - ((HasHiddenHost(cptr) || IsSetHost(cptr) || feature_bool(FEAT_HIS_USERIP)) && (sptr != cptr)) ? | |
47 | + ((HasHiddenHostOrIsSetHost(cptr) || feature_bool(FEAT_HIS_USERIP)) && (sptr != cptr)) ? | |
48 | feature_str(FEAT_HIDDEN_IP) : | |
49 | ircd_ntoa(&cli_ip(cptr))); | |
50 | } | |
ff8777da | 51 | diff -r 702b5aa2127f ircd/m_who.c |
619a6949 | 52 | --- a/ircd/m_who.c |
53 | +++ b/ircd/m_who.c | |
54 | @@ -398,14 +398,13 @@ | |
55 | && ((!(matchsel & WHO_FIELD_HOS)) | |
56 | || matchexec(cli_user(acptr)->host, mymask, minlen)) | |
57 | && ((!(matchsel & WHO_FIELD_HOS)) | |
58 | - || !IsSetHost(acptr) | |
59 | - || !HasHiddenHost(acptr) | |
60 | + || !HasHiddenHostOrIsSetHost(acptr) | |
61 | || !IsAnOper(sptr) | |
62 | || matchexec(cli_user(acptr)->realhost, mymask, minlen)) | |
63 | && ((!(matchsel & WHO_FIELD_REN)) | |
64 | || matchexec(cli_info(acptr), mymask, minlen)) | |
65 | && ((!(matchsel & WHO_FIELD_NIP)) | |
66 | - || ((HasHiddenHost(acptr) || IsSetHost(acptr)) && !IsAnOper(sptr)) | |
67 | + || (HasHiddenHostOrIsSetHost(acptr) && !IsAnOper(sptr)) | |
68 | || !ipmask_check(&cli_ip(acptr), &imask, ibits)) | |
69 | && ((!(matchsel & WHO_FIELD_ACC)) | |
70 | || matchexec(cli_user(acptr)->account, mymask, minlen))) | |
71 | @@ -437,14 +436,13 @@ | |
72 | && ((!(matchsel & WHO_FIELD_HOS)) | |
73 | || matchexec(cli_user(acptr)->host, mymask, minlen)) | |
74 | && ((!(matchsel & WHO_FIELD_HOS)) | |
75 | - || !IsSetHost(acptr) | |
76 | - || !HasHiddenHost(acptr) | |
77 | + || !HasHiddenHostOrIsSetHost(acptr) | |
78 | || !IsAnOper(sptr) | |
79 | || matchexec(cli_user(acptr)->realhost, mymask, minlen)) | |
80 | && ((!(matchsel & WHO_FIELD_REN)) | |
81 | || matchexec(cli_info(acptr), mymask, minlen)) | |
82 | && ((!(matchsel & WHO_FIELD_NIP)) | |
83 | - || ((HasHiddenHost(acptr) || IsSetHost(acptr)) && !IsAnOper(sptr)) | |
84 | + || (HasHiddenHostOrIsSetHost(acptr) && !IsAnOper(sptr)) | |
85 | || !ipmask_check(&cli_ip(acptr), &imask, ibits)) | |
86 | && ((!(matchsel & WHO_FIELD_ACC)) | |
87 | || matchexec(cli_user(acptr)->account, mymask, minlen))) | |
ff8777da | 88 | diff -r 702b5aa2127f ircd/m_whois.c |
619a6949 | 89 | --- a/ircd/m_whois.c |
90 | +++ b/ircd/m_whois.c | |
91 | @@ -214,7 +214,7 @@ | |
92 | if (IsAccount(acptr)) | |
93 | send_reply(sptr, RPL_WHOISACCOUNT, name, user->account); | |
94 | ||
95 | - if ((HasHiddenHost(acptr) || IsSetHost(acptr)) && ((IsAnOper(sptr) && HasPriv(sptr, PRIV_USER_PRIVACY)) || acptr == sptr)) | |
96 | + if (HasHiddenHostOrIsSetHost(acptr) && ((IsAnOper(sptr) && HasPriv(sptr, PRIV_USER_PRIVACY)) || acptr == sptr)) | |
97 | send_reply(sptr, RPL_WHOISACTUALLY, name, user->realusername, | |
98 | user->realhost, ircd_ntoa(&cli_ip(acptr))); | |
99 | ||
ff8777da | 100 | diff -r 702b5aa2127f ircd/send.c |
619a6949 | 101 | --- a/ircd/send.c |
102 | +++ b/ircd/send.c | |
103 | @@ -281,7 +281,7 @@ | |
104 | { | |
105 | case MATCH_HOST: | |
106 | return (match(mask, cli_user(one)->host) == 0 || | |
107 | - ((HasHiddenHost(one) || IsSetHost(one)) && match(mask, cli_user(one)->realhost) == 0)); | |
108 | + (HasHiddenHostOrIsSetHost(one) && match(mask, cli_user(one)->realhost) == 0)); | |
109 | case MATCH_SERVER: | |
110 | default: | |
111 | return (match(mask, cli_name(cli_user(one)->server)) == 0); | |
ff8777da | 112 | diff -r 702b5aa2127f ircd/whocmds.c |
619a6949 | 113 | --- a/ircd/whocmds.c |
114 | +++ b/ircd/whocmds.c | |
115 | @@ -134,7 +134,7 @@ | |
116 | ||
117 | if (fields & WHO_FIELD_NIP) | |
118 | { | |
119 | - const char* p2 = (HasHiddenHost(acptr) || IsSetHost(acptr) || feature_bool(FEAT_HIS_USERIP)) && (!IsAnOper(sptr) || (IsAnOper(sptr) && !HasPriv(sptr, PRIV_USER_PRIVACY))) ? | |
120 | + const char* p2 = (HasHiddenHostOrIsSetHost(acptr) || feature_bool(FEAT_HIS_USERIP)) && (!IsAnOper(sptr) || (IsAnOper(sptr) && !HasPriv(sptr, PRIV_USER_PRIVACY))) ? | |
121 | feature_str(FEAT_HIDDEN_IP) : | |
122 | ircd_ntoa(&cli_ip(acptr)); | |
123 | *(p1++) = ' '; | |
ff8777da | 124 | diff -r 702b5aa2127f ircd/whowas.c |
619a6949 | 125 | --- a/ircd/whowas.c |
126 | +++ b/ircd/whowas.c | |
127 | @@ -272,7 +272,7 @@ | |
128 | DupString(ww->name, cli_name(cptr)); | |
129 | DupString(ww->username, cli_user(cptr)->username); | |
130 | DupString(ww->hostname, cli_user(cptr)->host); | |
131 | - if (HasHiddenHost(cptr)) | |
132 | + if (HasHiddenHostOrIsSetHost(cptr)) | |
133 | DupString(ww->realhost, cli_user(cptr)->realhost); | |
134 | DupString(ww->servername, cli_name(cli_user(cptr)->server)); | |
135 | DupString(ww->realname, cli_info(cptr)); |