ViewVC Help
View File | Revision Log | Show Annotations | View Changeset | Root Listing
root/svn/ircd-hybrid/branches/8.2.x/modules/m_svshost.c
Revision: 8436
Committed: Thu Mar 29 09:04:53 2018 UTC (6 years ago) by michael
Content type: text/x-csrc
File size: 2811 byte(s)
Log Message:
- Stylistic changes

File Contents

# Content
1 /*
2 * ircd-hybrid: an advanced, lightweight Internet Relay Chat Daemon (ircd)
3 *
4 * Copyright (c) 2016-2018 ircd-hybrid development team
5 *
6 * This program is free software; you can redistribute it and/or modify
7 * it under the terms of the GNU General Public License as published by
8 * the Free Software Foundation; either version 2 of the License, or
9 * (at your option) any later version.
10 *
11 * This program is distributed in the hope that it will be useful,
12 * but WITHOUT ANY WARRANTY; without even the implied warranty of
13 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
14 * GNU General Public License for more details.
15 *
16 * You should have received a copy of the GNU General Public License
17 * along with this program; if not, write to the Free Software
18 * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301
19 * USA
20 */
21
22 /*! \file m_svshost.c
23 * \brief Includes required functions for processing the SVSHOST command.
24 * \version $Id$
25 */
26
27 #include "stdinc.h"
28 #include "client.h"
29 #include "ircd.h"
30 #include "send.h"
31 #include "channel_mode.h"
32 #include "parse.h"
33 #include "modules.h"
34 #include "user.h"
35
36
37 /*! \brief SVSHOST command handler
38 *
39 * \param source_p Pointer to allocated Client struct from which the message
40 * originally comes from. This can be a local or remote client.
41 * \param parc Integer holding the number of supplied arguments.
42 * \param parv Argument vector where parv[0] .. parv[parc-1] are non-NULL
43 * pointers.
44 * \note Valid arguments for this command are:
45 * - parv[0] = command
46 * - parv[1] = nickname
47 * - parv[2] = TS
48 * - parv[3] = host name
49 */
50 static int
51 ms_svshost(struct Client *source_p, int parc, char *parv[])
52 {
53 if (!HasFlag(source_p, FLAGS_SERVICE))
54 return 0;
55
56 struct Client *target_p;
57 if ((target_p = find_person(source_p, parv[1])) == NULL)
58 return 0;
59
60 uintmax_t ts = strtoumax(parv[2], NULL, 10);
61 if (ts && (ts != target_p->tsinfo))
62 return 0;
63
64 if (valid_hostname(parv[3]))
65 user_set_hostmask(target_p, parv[3]);
66
67 sendto_server(source_p, 0, 0, ":%s SVSHOST %s %ju %s",
68 source_p->id,
69 target_p->id, target_p->tsinfo, parv[3]);
70 return 0;
71 }
72
73 static struct Message svshost_msgtab =
74 {
75 .cmd = "SVSHOST",
76 .args_min = 4,
77 .args_max = MAXPARA,
78 .handlers[UNREGISTERED_HANDLER] = m_ignore,
79 .handlers[CLIENT_HANDLER] = m_ignore,
80 .handlers[SERVER_HANDLER] = ms_svshost,
81 .handlers[ENCAP_HANDLER] = m_ignore,
82 .handlers[OPER_HANDLER] = m_ignore
83 };
84
85 static void
86 module_init(void)
87 {
88 mod_add_cmd(&svshost_msgtab);
89 }
90
91 static void
92 module_exit(void)
93 {
94 mod_del_cmd(&svshost_msgtab);
95 }
96
97 struct module module_entry =
98 {
99 .version = "$Revision$",
100 .modinit = module_init,
101 .modexit = module_exit,
102 };

Properties

Name Value
svn:eol-style native
svn:keywords Id Revision