/[svn]/ircd-hybrid/branches/8.1.x/modules/m_motd.c
ViewVC logotype

Contents of /ircd-hybrid/branches/8.1.x/modules/m_motd.c

Parent Directory Parent Directory | Revision Log Revision Log


Revision 2965 - (show annotations)
Thu Jan 30 18:12:54 2014 UTC (6 years, 5 months ago) by michael
File MIME type: text/x-chdr
File size: 3426 byte(s)
- m_admin.c, m_motd.c: do_admin() and do_motd() always succeed. Make them a void again.

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 "s_serv.h" /* hunt_server */
35 #include "parse.h"
36 #include "modules.h"
37 #include "conf.h"
38
39
40 static int
41 do_motd(struct Client *source_p)
42 {
43 sendto_realops_flags(UMODE_SPY, L_ALL, SEND_NOTICE,
44 "MOTD requested by %s (%s@%s) [%s]",
45 source_p->name, source_p->username,
46 source_p->host, source_p->servptr->name);
47 motd_send(source_p);
48 }
49
50 /*
51 ** m_motd
52 ** parv[0] = sender prefix
53 ** parv[1] = servername
54 */
55 static int
56 m_motd(struct Client *client_p, struct Client *source_p,
57 int parc, char *parv[])
58 {
59 static time_t last_used = 0;
60
61 if ((last_used + ConfigFileEntry.pace_wait) > CurrentTime)
62 {
63 /* safe enough to give this on a local connect only */
64 sendto_one(source_p, form_str(RPL_LOAD2HI),
65 me.name, source_p->name);
66 return 0;
67 }
68
69 last_used = CurrentTime;
70
71 /* This is safe enough to use during non hidden server mode */
72 if (!ConfigServerHide.disable_remote_commands && !ConfigServerHide.hide_servers)
73 if (hunt_server(client_p, source_p, ":%s MOTD :%s", 1,
74 parc, parv) != HUNTED_ISME)
75 return 0;
76
77 do_motd(source_p);
78 return 0;
79 }
80
81 /*
82 * 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 ** mo_motd
91 ** parv[0] = sender prefix
92 ** parv[1] = servername
93 */
94 static int
95 mo_motd(struct Client *client_p, struct Client *source_p,
96 int parc, char *parv[])
97 {
98 if (hunt_server(client_p, source_p, ":%s MOTD :%s", 1,
99 parc, parv) != HUNTED_ISME)
100 return 0;
101
102 do_motd(source_p);
103 return 0;
104 }
105
106 static struct Message motd_msgtab =
107 {
108 "MOTD", 0, 0, 0, MAXPARA, MFLG_SLOW, 0,
109 { m_unregistered, m_motd, mo_motd, m_ignore, mo_motd, m_ignore }
110 };
111
112 static void
113 module_init(void)
114 {
115 mod_add_cmd(&motd_msgtab);
116 }
117
118 static void
119 module_exit(void)
120 {
121 mod_del_cmd(&motd_msgtab);
122 }
123
124 struct module module_entry =
125 {
126 .node = { NULL, NULL, NULL },
127 .name = NULL,
128 .version = "$Revision$",
129 .handle = NULL,
130 .modinit = module_init,
131 .modexit = module_exit,
132 .flags = 0
133 };

Properties

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

svnadmin@ircd-hybrid.org
ViewVC Help
Powered by ViewVC 1.1.28