1 add HasHiddenHostOrIsSetHost() macro instead of having to test HasHiddenHost() and IsSetHost() in many places
3 diff -r 702b5aa2127f include/client.h
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))
13 /** Mark a client as having an in-progress net.burst. */
14 #define SetBurst(x) SetFlag(x, FLAG_BURST)
15 diff -r 702b5aa2127f ircd/m_check.c
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));
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);
27 diff -r 702b5aa2127f ircd/m_userhost.c
28 --- a/ircd/m_userhost.c
29 +++ b/ircd/m_userhost.c
31 * of +x. If an oper wants the real host, he should go to
34 - (HasHiddenHost(cptr) || IsSetHost(cptr)) && (sptr != cptr) ?
35 + HasHiddenHostOrIsSetHost(cptr) && (sptr != cptr) ?
36 cli_user(cptr)->host : cli_user(cptr)->realhost);
39 diff -r 702b5aa2127f ircd/m_userip.c
43 * of +x. If an oper wants the real IP, he should go to
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)));
51 diff -r 702b5aa2127f ircd/m_who.c
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)
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)))
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)
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)))
88 diff -r 702b5aa2127f ircd/m_whois.c
93 send_reply(sptr, RPL_WHOISACCOUNT, name, user->account);
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)));
100 diff -r 702b5aa2127f ircd/send.c
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));
111 return (match(mask, cli_name(cli_user(one)->server)) == 0);
112 diff -r 702b5aa2127f ircd/whocmds.c
117 if (fields & WHO_FIELD_NIP)
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));
124 diff -r 702b5aa2127f ircd/whowas.c
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));