ViewVC Help
View File | Revision Log | Show Annotations | View Changeset | Root Listing
root/svn/ircd-hybrid/trunk/modules/m_time.c
Revision: 7006
Committed: Fri Jan 1 00:07:54 2016 UTC (10 years, 6 months ago) by michael
Content type: text/x-csrc
File size: 3424 byte(s)
Log Message:
- Update copyright years

File Contents

# User Rev Content
1 adx 30 /*
2 michael 2820 * ircd-hybrid: an advanced, lightweight Internet Relay Chat Daemon (ircd)
3 adx 30 *
4 michael 7006 * Copyright (c) 1997-2016 ircd-hybrid development team
5 adx 30 *
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 michael 4565 * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301
19 adx 30 * USA
20     */
21    
22 michael 2820 /*! \file m_time.c
23     * \brief Includes required functions for processing the TIME command.
24     * \version $Id$
25     */
26    
27 adx 30 #include "stdinc.h"
28     #include "client.h"
29     #include "ircd.h"
30     #include "numeric.h"
31 michael 3347 #include "misc.h"
32 michael 1309 #include "conf.h"
33 michael 3347 #include "server.h"
34 adx 30 #include "send.h"
35     #include "parse.h"
36     #include "modules.h"
37     #include "packet.h"
38    
39    
40 michael 3275 /*! \brief TIME command handler
41     *
42     * \param source_p Pointer to allocated Client struct from which the message
43     * originally comes from. This can be a local or remote client.
44     * \param parc Integer holding the number of supplied arguments.
45     * \param parv Argument vector where parv[0] .. parv[parc-1] are non-NULL
46     * pointers.
47     * \note Valid arguments for this command are:
48     * - parv[0] = command
49 michael 3300 * - parv[1] = nickname/servername
50 adx 30 */
51 michael 2820 static int
52 michael 3156 m_time(struct Client *source_p, int parc, char *parv[])
53 adx 30 {
54 michael 3300 /* This is not rate limited, so end the grace period */
55 michael 980 if (!IsFloodDone(source_p))
56 adx 30 flood_endgrace(source_p);
57    
58     /* This is safe enough to use during non hidden server mode */
59 michael 2196 if (!ConfigServerHide.disable_remote_commands)
60 michael 3156 if (hunt_server(source_p, ":%s TIME :%s", 1, parc, parv) != HUNTED_ISME)
61 michael 2820 return 0;
62 adx 30
63 michael 3109 sendto_one_numeric(source_p, &me, RPL_TIME, me.name, date(0));
64 michael 2820 return 0;
65 adx 30 }
66    
67 michael 3275 /*! \brief TIME command handler
68     *
69     * \param source_p Pointer to allocated Client struct from which the message
70     * originally comes from. This can be a local or remote client.
71     * \param parc Integer holding the number of supplied arguments.
72     * \param parv Argument vector where parv[0] .. parv[parc-1] are non-NULL
73     * pointers.
74     * \note Valid arguments for this command are:
75     * - parv[0] = command
76 michael 3300 * - parv[1] = nickname/servername
77 adx 30 */
78 michael 2820 static int
79 michael 3346 ms_time(struct Client *source_p, int parc, char *parv[])
80 adx 30 {
81 michael 4690 if (hunt_server(source_p, ":%s TIME :%s", 1, parc, parv) != HUNTED_ISME)
82     return 0;
83 michael 3109
84 michael 4690 sendto_one_numeric(source_p, &me, RPL_TIME, me.name, date(0));
85 michael 2820 return 0;
86 adx 30 }
87 michael 1230
88 michael 2820 static struct Message time_msgtab =
89     {
90 michael 5881 .cmd = "TIME",
91     .args_max = MAXPARA,
92     .handlers[UNREGISTERED_HANDLER] = m_unregistered,
93     .handlers[CLIENT_HANDLER] = m_time,
94     .handlers[SERVER_HANDLER] = ms_time,
95     .handlers[ENCAP_HANDLER] = m_ignore,
96     .handlers[OPER_HANDLER] = ms_time
97 michael 1230 };
98    
99     static void
100     module_init(void)
101     {
102     mod_add_cmd(&time_msgtab);
103     }
104    
105     static void
106     module_exit(void)
107     {
108     mod_del_cmd(&time_msgtab);
109     }
110    
111 michael 2820 struct module module_entry =
112     {
113 michael 1230 .version = "$Revision$",
114     .modinit = module_init,
115     .modexit = module_exit,
116     };

Properties

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