ViewVC Help
View File | Revision Log | Show Annotations | View Changeset | Root Listing
root/svn/ircd-hybrid/trunk/modules/m_motd.c
Revision: 3347
Committed: Sun Apr 20 14:03:06 2014 UTC (11 years, 4 months ago) by michael
Content type: text/x-csrc
File size: 3903 byte(s)
Log Message:
- Moved files:
  s_user.c -> user.c
  s_misc.c -> misc.c
  s_serv.c -> server.c

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., 59 Temple Place, Suite 330, Boston, MA 02111-1307
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 + ConfigFileEntry.pace_wait) > CurrentTime)
72 {
73 sendto_one_numeric(source_p, &me, RPL_LOAD2HI);
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,
82 parc, parv) != HUNTED_ISME)
83 return 0;
84
85 do_motd(source_p);
86 return 0;
87 }
88
89 /*! \brief MOTD command handler
90 *
91 * \param source_p Pointer to allocated Client struct from which the message
92 * originally comes from. This can be a local or remote client.
93 * \param parc Integer holding the number of supplied arguments.
94 * \param parv Argument vector where parv[0] .. parv[parc-1] are non-NULL
95 * pointers.
96 * \note Valid arguments for this command are:
97 * - parv[0] = command
98 * - parv[1] = nickname/servername
99 */
100 static int
101 ms_motd(struct Client *source_p, int parc, char *parv[])
102 {
103 if (hunt_server(source_p, ":%s MOTD :%s", 1,
104 parc, parv) != HUNTED_ISME)
105 return 0;
106
107 do_motd(source_p);
108 return 0;
109 }
110
111 static struct Message motd_msgtab =
112 {
113 "MOTD", 0, 0, 0, MAXPARA, MFLG_SLOW, 0,
114 { m_unregistered, m_motd, ms_motd, m_ignore, ms_motd, m_ignore }
115 };
116
117 static void
118 module_init(void)
119 {
120 mod_add_cmd(&motd_msgtab);
121 }
122
123 static void
124 module_exit(void)
125 {
126 mod_del_cmd(&motd_msgtab);
127 }
128
129 struct module module_entry =
130 {
131 .node = { NULL, NULL, NULL },
132 .name = NULL,
133 .version = "$Revision$",
134 .handle = NULL,
135 .modinit = module_init,
136 .modexit = module_exit,
137 .flags = 0
138 };

Properties

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