2 * ircd-ratbox: A slightly useful ircd.
3 * m_motd.c: Shows the current message of the day.
5 * Copyright (C) 1990 Jarkko Oikarinen and University of Oulu, Co Center
6 * Copyright (C) 1996-2002 Hybrid Development Team
7 * Copyright (C) 2002-2005 ircd-ratbox development team
9 * This program is free software; you can redistribute it and/or modify
10 * it under the terms of the GNU General Public License as published by
11 * the Free Software Foundation; either version 2 of the License, or
12 * (at your option) any later version.
14 * This program is distributed in the hope that it will be useful,
15 * but WITHOUT ANY WARRANTY; without even the implied warranty of
16 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
17 * GNU General Public License for more details.
19 * You should have received a copy of the GNU General Public License
20 * along with this program; if not, write to the Free Software
21 * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307
24 * $Id: m_motd.c 254 2005-09-21 23:35:12Z nenolod $
35 #include "s_serv.h" /* hunt_server */
41 static int m_motd(struct Client
*, struct Client
*, int, const char **);
42 static int mo_motd(struct Client
*, struct Client
*, int, const char **);
44 struct Message motd_msgtab
= {
45 "MOTD", 0, 0, 0, MFLG_SLOW
,
46 {mg_unreg
, {m_motd
, 0}, {mo_motd
, 0}, mg_ignore
, mg_ignore
, {mo_motd
, 0}}
51 mapi_clist_av1 motd_clist
[] = { &motd_msgtab
, NULL
};
52 mapi_hlist_av1 motd_hlist
[] = {
53 { "doing_motd", &doing_motd_hook
},
57 DECLARE_MODULE_AV1(motd
, NULL
, NULL
, motd_clist
, motd_hlist
, NULL
, "$Revision: 254 $");
59 static void motd_spy(struct Client
*);
63 ** parv[0] = sender prefix
64 ** parv[1] = servername
67 m_motd(struct Client
*client_p
, struct Client
*source_p
, int parc
, const char *parv
[])
69 static time_t last_used
= 0;
71 if((last_used
+ ConfigFileEntry
.pace_wait
) > CurrentTime
)
73 /* safe enough to give this on a local connect only */
74 sendto_one(source_p
, form_str(RPL_LOAD2HI
),
75 me
.name
, source_p
->name
, "MOTD");
76 sendto_one(source_p
, form_str(RPL_ENDOFMOTD
),
77 me
.name
, source_p
->name
);
81 last_used
= CurrentTime
;
83 if(hunt_server(client_p
, source_p
, ":%s MOTD :%s", 1, parc
, parv
) != HUNTED_ISME
)
87 send_user_motd(source_p
);
94 ** parv[0] = sender prefix
95 ** parv[1] = servername
98 mo_motd(struct Client
*client_p
, struct Client
*source_p
, int parc
, const char *parv
[])
100 if(hunt_server(client_p
, source_p
, ":%s MOTD :%s", 1, parc
, parv
) != HUNTED_ISME
)
104 send_user_motd(source_p
);
111 * input - pointer to client
113 * side effects - hook doing_motd is called
116 motd_spy(struct Client
*source_p
)
120 data
.client
= source_p
;
121 data
.arg1
= data
.arg2
= NULL
;
123 call_hook(doing_motd_hook
, &data
);