ViewVC Help
View File | Revision Log | Show Annotations | View Changeset | Root Listing
root/svn/ircd-hybrid-7.3/modules/m_motd.c
Revision: 1065
Committed: Sun Feb 14 11:36:56 2010 UTC (16 years, 8 months ago) by michael
Content type: text/x-csrc
File size: 3608 byte(s)
Log Message:
- removed mr_motd. unregistered clients may no longer request a MOTD

File Contents

# User Rev Content
1 adx 30 /*
2     * ircd-hybrid: an advanced Internet Relay Chat Daemon(ircd).
3     * m_motd.c: Shows the current message of the day.
4     *
5     * Copyright (C) 2002 by the past and present ircd coders, and others.
6     *
7     * This program is free software; you can redistribute it and/or modify
8     * it under the terms of the GNU General Public License as published by
9     * the Free Software Foundation; either version 2 of the License, or
10     * (at your option) any later version.
11     *
12     * This program is distributed in the hope that it will be useful,
13     * but WITHOUT ANY WARRANTY; without even the implied warranty of
14     * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
15     * GNU General Public License for more details.
16     *
17     * You should have received a copy of the GNU General Public License
18     * along with this program; if not, write to the Free Software
19     * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307
20     * USA
21     *
22 knight 31 * $Id$
23 adx 30 */
24    
25     #include "stdinc.h"
26 michael 1011 #include "list.h"
27 adx 30 #include "client.h"
28     #include "motd.h"
29     #include "ircd.h"
30     #include "send.h"
31     #include "numeric.h"
32     #include "handlers.h"
33     #include "hook.h"
34     #include "msg.h"
35     #include "s_serv.h" /* hunt_server */
36     #include "parse.h"
37     #include "modules.h"
38     #include "s_conf.h"
39    
40 michael 589 static void m_motd(struct Client*, struct Client*, int, char *[]);
41     static void mo_motd(struct Client*, struct Client*, int, char *[]);
42 adx 30
43     /*
44     * note regarding mo_motd being used twice:
45     * this is not a kludge. any rate limiting, shide, or whatever
46     * other access restrictions should be done by the source's server.
47     * for security's sake, still check that the source is an oper
48     * for 'oper only' information in the mo_ function(s).
49     */
50     struct Message motd_msgtab = {
51     "MOTD", 0, 0, 0, 1, MFLG_SLOW, 0,
52 michael 1065 { m_unregistered, m_motd, mo_motd, m_ignore, mo_motd, m_ignore }
53 adx 30 };
54    
55     #ifndef STATIC_MODULES
56 knight 31 const char *_version = "$Revision$";
57 adx 30 static struct Callback *motd_cb;
58    
59     static void *
60     do_motd(va_list args)
61     {
62     struct Client *source_p = va_arg(args, struct Client *);
63    
64     send_message_file(source_p, &ConfigFileEntry.motd);
65     return NULL;
66     }
67    
68     void
69     _modinit(void)
70     {
71     motd_cb = register_callback("doing_motd", do_motd);
72     mod_add_cmd(&motd_msgtab);
73     }
74    
75     void
76     _moddeinit(void)
77     {
78     mod_del_cmd(&motd_msgtab);
79     uninstall_hook(motd_cb, do_motd);
80     }
81     #endif
82    
83     /*
84     ** m_motd
85     ** parv[0] = sender prefix
86     ** parv[1] = servername
87     */
88     static void
89     m_motd(struct Client *client_p, struct Client *source_p,
90     int parc, char *parv[])
91     {
92     static time_t last_used = 0;
93    
94     if ((last_used + ConfigFileEntry.pace_wait) > CurrentTime)
95     {
96     /* safe enough to give this on a local connect only */
97 michael 589 sendto_one(source_p, form_str(RPL_LOAD2HI),
98     me.name, source_p->name);
99 adx 30 return;
100     }
101    
102 michael 589 last_used = CurrentTime;
103    
104 adx 30 /* This is safe enough to use during non hidden server mode */
105     if (!ConfigFileEntry.disable_remote && !ConfigServerHide.hide_servers)
106 michael 589 if (hunt_server(client_p, source_p, ":%s MOTD :%s", 1, parc, parv)
107     != HUNTED_ISME)
108 adx 30 return;
109    
110     #ifdef STATIC_MODULES
111     send_message_file(source_p, &ConfigFileEntry.motd);
112     #else
113     execute_callback(motd_cb, source_p, parc, parv);
114     #endif
115     }
116    
117     /*
118     ** mo_motd
119     ** parv[0] = sender prefix
120     ** parv[1] = servername
121     */
122     static void
123     mo_motd(struct Client *client_p, struct Client *source_p,
124     int parc, char *parv[])
125     {
126     if (!IsClient(source_p))
127     return;
128    
129     if (hunt_server(client_p, source_p, ":%s MOTD :%s",1,parc,parv)!=HUNTED_ISME)
130     return;
131    
132     #ifdef STATIC_MODULES
133     send_message_file(source_p, &ConfigFileEntry.motd);
134     #else
135     execute_callback(motd_cb, source_p, parc, parv);
136     #endif
137     }

Properties

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