ViewVC Help
View File | Revision Log | Show Annotations | View Changeset | Root Listing
root/svn/ircd-hybrid/branches/8.1.x/modules/m_motd.c
Revision: 2821
Committed: Wed Jan 15 23:12:35 2014 UTC (10 years, 3 months ago) by michael
Content type: text/x-csrc
File size: 3428 byte(s)
Log Message:
- Clean up all files in modules/ (fixed indentation, removed whitespaces/tabs)
- Fixed copyright years
- Made module handlers int type for later use

File Contents

# User Rev Content
1 adx 30 /*
2 michael 2821 * ircd-hybrid: an advanced, lightweight Internet Relay Chat Daemon (ircd)
3 adx 30 *
4 michael 2821 * Copyright (c) 1997-2014 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     * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307
19     * USA
20     */
21    
22 michael 2821 /*! \file m_motd.c
23     * \brief Includes required functions for processing the MOTD command.
24     * \version $Id$
25     */
26    
27 adx 30 #include "stdinc.h"
28 michael 1011 #include "list.h"
29 adx 30 #include "client.h"
30     #include "motd.h"
31     #include "ircd.h"
32     #include "send.h"
33     #include "numeric.h"
34     #include "s_serv.h" /* hunt_server */
35     #include "parse.h"
36     #include "modules.h"
37 michael 1309 #include "conf.h"
38 adx 30
39    
40 michael 2821 static int
41 michael 1144 do_motd(struct Client *source_p)
42 adx 30 {
43 michael 1618 sendto_realops_flags(UMODE_SPY, L_ALL, SEND_NOTICE,
44 michael 1144 "MOTD requested by %s (%s@%s) [%s]",
45     source_p->name, source_p->username,
46     source_p->host, source_p->servptr->name);
47 michael 2151 motd_send(source_p);
48 michael 2821 return 0;
49 adx 30 }
50    
51     /*
52     ** m_motd
53     ** parv[0] = sender prefix
54     ** parv[1] = servername
55     */
56 michael 2821 static int
57 adx 30 m_motd(struct Client *client_p, struct Client *source_p,
58     int parc, char *parv[])
59     {
60     static time_t last_used = 0;
61    
62     if ((last_used + ConfigFileEntry.pace_wait) > CurrentTime)
63     {
64     /* safe enough to give this on a local connect only */
65 michael 1834 sendto_one(source_p, form_str(RPL_LOAD2HI),
66 michael 589 me.name, source_p->name);
67 michael 2821 return 0;
68 adx 30 }
69    
70 michael 589 last_used = CurrentTime;
71    
72 adx 30 /* This is safe enough to use during non hidden server mode */
73 michael 2197 if (!ConfigServerHide.disable_remote_commands && !ConfigServerHide.hide_servers)
74 michael 1144 if (hunt_server(client_p, source_p, ":%s MOTD :%s", 1,
75     parc, parv) != HUNTED_ISME)
76 michael 2821 return 0;
77 adx 30
78 michael 2821 return do_motd(source_p);
79 adx 30 }
80    
81     /*
82 michael 1230 * note regarding mo_motd being used twice:
83     * this is not a kludge. any rate limiting, shide, or whatever
84     * other access restrictions should be done by the source's server.
85     * for security's sake, still check that the source is an oper
86     * for 'oper only' information in the mo_ function(s).
87     */
88    
89     /*
90 adx 30 ** mo_motd
91     ** parv[0] = sender prefix
92     ** parv[1] = servername
93     */
94 michael 2821 static int
95 adx 30 mo_motd(struct Client *client_p, struct Client *source_p,
96     int parc, char *parv[])
97     {
98 michael 1144 if (hunt_server(client_p, source_p, ":%s MOTD :%s", 1,
99     parc, parv) != HUNTED_ISME)
100 michael 2821 return 0;
101 adx 30
102 michael 2821 return do_motd(source_p);
103 adx 30 }
104 michael 1230
105 michael 2821 static struct Message motd_msgtab =
106     {
107 michael 1230 "MOTD", 0, 0, 0, MAXPARA, MFLG_SLOW, 0,
108     { m_unregistered, m_motd, mo_motd, m_ignore, mo_motd, m_ignore }
109     };
110    
111     static void
112     module_init(void)
113     {
114     mod_add_cmd(&motd_msgtab);
115     }
116    
117     static void
118     module_exit(void)
119     {
120     mod_del_cmd(&motd_msgtab);
121     }
122    
123 michael 2821 struct module module_entry =
124     {
125 michael 1230 .node = { NULL, NULL, NULL },
126     .name = NULL,
127     .version = "$Revision$",
128     .handle = NULL,
129     .modinit = module_init,
130     .modexit = module_exit,
131     .flags = 0
132     };

Properties

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