ViewVC Help
View File | Revision Log | Show Annotations | View Changeset | Root Listing
root/svn/ircd-hybrid/trunk/modules/m_motd.c
Revision: 1618
Committed: Tue Oct 30 21:04:38 2012 UTC (12 years, 9 months ago) by michael
Content type: text/x-csrc
File size: 3414 byte(s)
Log Message:
- Made m_globops() and ms_globops() use sendto_realops_flags()
- Added message-type parameter to sendto_realops_flags() which can be one of
  SEND_NOTICE, SEND_GLOBAL, SEND_LOCOPS
- Forward-port -r1617

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 "s_serv.h" /* hunt_server */
33     #include "parse.h"
34     #include "modules.h"
35 michael 1309 #include "conf.h"
36 adx 30
37    
38 michael 1144 static void
39     do_motd(struct Client *source_p)
40 adx 30 {
41 michael 1618 sendto_realops_flags(UMODE_SPY, L_ALL, SEND_NOTICE,
42 michael 1144 "MOTD requested by %s (%s@%s) [%s]",
43     source_p->name, source_p->username,
44     source_p->host, source_p->servptr->name);
45 adx 30 send_message_file(source_p, &ConfigFileEntry.motd);
46     }
47    
48     /*
49     ** m_motd
50     ** parv[0] = sender prefix
51     ** parv[1] = servername
52     */
53     static void
54     m_motd(struct Client *client_p, struct Client *source_p,
55     int parc, char *parv[])
56     {
57     static time_t last_used = 0;
58    
59     if ((last_used + ConfigFileEntry.pace_wait) > CurrentTime)
60     {
61     /* safe enough to give this on a local connect only */
62 michael 589 sendto_one(source_p, form_str(RPL_LOAD2HI),
63     me.name, source_p->name);
64 adx 30 return;
65     }
66    
67 michael 589 last_used = CurrentTime;
68    
69 adx 30 /* This is safe enough to use during non hidden server mode */
70     if (!ConfigFileEntry.disable_remote && !ConfigServerHide.hide_servers)
71 michael 1144 if (hunt_server(client_p, source_p, ":%s MOTD :%s", 1,
72     parc, parv) != HUNTED_ISME)
73 adx 30 return;
74    
75 michael 1144 do_motd(source_p);
76 adx 30 }
77    
78     /*
79 michael 1230 * note regarding mo_motd being used twice:
80     * this is not a kludge. any rate limiting, shide, or whatever
81     * other access restrictions should be done by the source's server.
82     * for security's sake, still check that the source is an oper
83     * for 'oper only' information in the mo_ function(s).
84     */
85    
86     /*
87 adx 30 ** mo_motd
88     ** parv[0] = sender prefix
89     ** parv[1] = servername
90     */
91     static void
92     mo_motd(struct Client *client_p, struct Client *source_p,
93     int parc, char *parv[])
94     {
95     if (!IsClient(source_p))
96     return;
97    
98 michael 1144 if (hunt_server(client_p, source_p, ":%s MOTD :%s", 1,
99     parc, parv) != HUNTED_ISME)
100 adx 30 return;
101    
102 michael 1144 do_motd(source_p);
103 adx 30 }
104 michael 1230
105     static struct Message motd_msgtab = {
106     "MOTD", 0, 0, 0, MAXPARA, MFLG_SLOW, 0,
107     { m_unregistered, m_motd, mo_motd, m_ignore, mo_motd, m_ignore }
108     };
109    
110     static void
111     module_init(void)
112     {
113     mod_add_cmd(&motd_msgtab);
114     }
115    
116     static void
117     module_exit(void)
118     {
119     mod_del_cmd(&motd_msgtab);
120     }
121    
122     struct module module_entry = {
123     .node = { NULL, NULL, NULL },
124     .name = NULL,
125     .version = "$Revision$",
126     .handle = NULL,
127     .modinit = module_init,
128     .modexit = module_exit,
129     .flags = 0
130     };

Properties

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