ViewVC Help
View File | Revision Log | Show Annotations | View Changeset | Root Listing
root/svn/ircd-hybrid/trunk/modules/m_motd.c
Revision: 4759
Committed: Sun Oct 19 10:54:43 2014 UTC (10 years, 10 months ago) by michael
Content type: text/x-csrc
File size: 3881 byte(s)
Log Message:
- Improved RPL_LOAD2HI numeric

File Contents

# Content
1 /*
2 * ircd-hybrid: an advanced, lightweight Internet Relay Chat Daemon (ircd)
3 *
4 * Copyright (c) 1997-2014 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_motd.c
23 * \brief Includes required functions for processing the MOTD command.
24 * \version $Id$
25 */
26
27 #include "stdinc.h"
28 #include "list.h"
29 #include "client.h"
30 #include "motd.h"
31 #include "ircd.h"
32 #include "send.h"
33 #include "numeric.h"
34 #include "server.h"
35 #include "parse.h"
36 #include "modules.h"
37 #include "conf.h"
38
39
40 /*! \brief Sends the "message of the day" and notifies irc-operators
41 * about the MOTD request
42 *
43 * \param source_p Pointer to client to report to
44 */
45 static void
46 do_motd(struct Client *source_p)
47 {
48 sendto_realops_flags(UMODE_SPY, L_ALL, SEND_NOTICE,
49 "MOTD requested by %s (%s@%s) [%s]",
50 source_p->name, source_p->username,
51 source_p->host, source_p->servptr->name);
52 motd_send(source_p);
53 }
54
55 /*! \brief MOTD command handler
56 *
57 * \param source_p Pointer to allocated Client struct from which the message
58 * originally comes from. This can be a local or remote client.
59 * \param parc Integer holding the number of supplied arguments.
60 * \param parv Argument vector where parv[0] .. parv[parc-1] are non-NULL
61 * pointers.
62 * \note Valid arguments for this command are:
63 * - parv[0] = command
64 * - parv[1] = nickname/servername
65 */
66 static int
67 m_motd(struct Client *source_p, int parc, char *parv[])
68 {
69 static time_t last_used = 0;
70
71 if ((last_used + ConfigGeneral.pace_wait) > CurrentTime)
72 {
73 sendto_one_numeric(source_p, &me, RPL_LOAD2HI, "MOTD");
74 return 0;
75 }
76
77 last_used = CurrentTime;
78
79 /* This is safe enough to use during non hidden server mode */
80 if (!ConfigServerHide.disable_remote_commands && !ConfigServerHide.hide_servers)
81 if (hunt_server(source_p, ":%s MOTD :%s", 1, parc, parv) != HUNTED_ISME)
82 return 0;
83
84 do_motd(source_p);
85 return 0;
86 }
87
88 /*! \brief MOTD command handler
89 *
90 * \param source_p Pointer to allocated Client struct from which the message
91 * originally comes from. This can be a local or remote client.
92 * \param parc Integer holding the number of supplied arguments.
93 * \param parv Argument vector where parv[0] .. parv[parc-1] are non-NULL
94 * pointers.
95 * \note Valid arguments for this command are:
96 * - parv[0] = command
97 * - parv[1] = nickname/servername
98 */
99 static int
100 ms_motd(struct Client *source_p, int parc, char *parv[])
101 {
102 if (hunt_server(source_p, ":%s MOTD :%s", 1, parc, parv) != HUNTED_ISME)
103 return 0;
104
105 do_motd(source_p);
106 return 0;
107 }
108
109 static struct Message motd_msgtab =
110 {
111 "MOTD", NULL, 0, 0, 0, MAXPARA, MFLG_SLOW, 0,
112 { m_unregistered, m_motd, ms_motd, m_ignore, ms_motd, m_ignore }
113 };
114
115 static void
116 module_init(void)
117 {
118 mod_add_cmd(&motd_msgtab);
119 }
120
121 static void
122 module_exit(void)
123 {
124 mod_del_cmd(&motd_msgtab);
125 }
126
127 struct module module_entry =
128 {
129 .node = { NULL, NULL, NULL },
130 .name = NULL,
131 .version = "$Revision$",
132 .handle = NULL,
133 .modinit = module_init,
134 .modexit = module_exit,
135 .flags = 0
136 };

Properties

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