ViewVC Help
View File | Revision Log | Show Annotations | View Changeset | Root Listing
root/svn/ircd-hybrid/trunk/modules/m_motd.c
Revision: 1155
Committed: Tue Aug 9 20:27:45 2011 UTC (14 years ago) by michael
Content type: text/x-csrc
Original Path: ircd-hybrid/modules/m_motd.c
File size: 3385 byte(s)
Log Message:
- recreate "trunk"

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

Properties

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