2 * IRC - Internet Relay Chat, ircd/m_hidehost.c
3 * Written by David Herrmann.
7 * m_functions execute protocol messages on this server:
9 * cptr is always NON-NULL, pointing to a *LOCAL* client
10 * structure (with an open socket connected!). This
11 * identifies the physical socket where the message
12 * originated (or which caused the m_function to be
13 * executed--some m_functions may call others...).
15 * sptr is the source of the message, defined by the
16 * prefix part of the message if present. If not
17 * or prefix not found, then sptr==cptr.
19 * (!IsServer(cptr)) => (cptr == sptr), because
20 * prefixes are taken *only* from servers...
23 * (sptr == cptr) => the message didn't
26 * (sptr != cptr && IsServer(sptr) means
27 * the prefix specified servername. (?)
29 * (sptr != cptr && !IsServer(sptr) means
30 * that message originated from a remote
35 * (!IsServer(sptr)) means that, sptr can safely
36 * taken as defining the target structure of the
37 * message in this server.
39 * *Always* true (if 'parse' and others are working correct):
41 * 1) sptr->from == cptr (note: cptr->from == cptr)
43 * 2) MyConnect(sptr) <=> sptr == cptr (e.g. sptr
44 * *cannot* be a local connection, unless it's
45 * actually cptr!). [MyConnect(x) should probably
46 * be defined as (x == x->from) --msa ]
48 * parc number of variable parameter strings (if zero,
49 * parv is allowed to be NULL)
51 * parv a NULL terminated list of parameter pointers,
53 * parv[0], sender (prefix string), if not present
54 * this points to an empty string.
55 * parv[1]...parv[parc-1]
56 * pointers to additional parameters
57 * parv[parc] == NULL, *always*
59 * note: it is guaranteed that parv[0]..parv[parc-1] are all
68 #include "ircd_defs.h"
69 #include "ircd_features.h"
71 #include "ircd_reply.h"
72 #include "ircd_string.h"
85 * parv[1] = target nick
88 * Allows ulined servers to force umode +x on remote users. Though, we should use numerics
89 * as target, the current services use nicknames. This may be changed in future.
91 * The HIDEHOST request can be generated by EVERY server. It is forwarded to the server
92 * of the user which then sets the umode +x and broadcasts the new umodes.
94 int ms_hidehost(struct Client *cptr, struct Client *sptr, int parc, char *parv[]) {
97 struct Flags setflags;
100 return need_more_params(sptr, "HIDEHOST");
103 /* Check whether the user is already gone or already hidden. */
104 if(!(acptr = FindUser(parv[1])) || !IsUser(acptr) || IsHiddenHost(acptr)) {
108 /* If the user is no local user, we forward the message to the user's server. */
109 if(!MyConnect(acptr)) {
110 sendcmdto_one(sptr, CMD_HIDEHOST, cli_user(acptr)->server, "%s", cli_name(acptr));
114 /* Set +x and propagate the changed modes. */
115 propagate = !!HasPriv(acptr, PRIV_PROPAGATE);
116 setflags = cli_flags(acptr);
117 hide_hostmask(acptr, HIDE_HOSTMASK_FLAG_HIDDENHOST);
118 send_umode_out(acptr, acptr, &setflags, propagate);