X-Git-Url: https://jfr.im/git/solanum.git/blobdiff_plain/105a4985b402b3ab294e3bec1fa75bac75430482..ea41b24fd4807e3565bf5f8f293e2efc4c20b62d:/modules/m_motd.c diff --git a/modules/m_motd.c b/modules/m_motd.c index b81c8e98..f71ea801 100644 --- a/modules/m_motd.c +++ b/modules/m_motd.c @@ -36,8 +36,10 @@ #include "cache.h" #include "ratelimit.h" -static int m_motd(struct MsgBuf *, struct Client *, struct Client *, int, const char **); -static int mo_motd(struct MsgBuf *, struct Client *, struct Client *, int, const char **); +static const char motd_desc[] = "Provides the MOTD command to view the Message of the Day"; + +static void m_motd(struct MsgBuf *, struct Client *, struct Client *, int, const char **); +static void mo_motd(struct MsgBuf *, struct Client *, struct Client *, int, const char **); struct Message motd_msgtab = { "MOTD", 0, 0, 0, 0, @@ -52,7 +54,7 @@ mapi_hlist_av1 motd_hlist[] = { { NULL, NULL } }; -DECLARE_MODULE_AV2(motd, NULL, NULL, motd_clist, motd_hlist, NULL, NULL, NULL, NULL); +DECLARE_MODULE_AV2(motd, NULL, NULL, motd_clist, motd_hlist, NULL, NULL, NULL, motd_desc); static void motd_spy(struct Client *); @@ -60,46 +62,43 @@ static void motd_spy(struct Client *); ** m_motd ** parv[1] = servername */ -static int +static void m_motd(struct MsgBuf *msgbuf_p, struct Client *client_p, struct Client *source_p, int parc, const char *parv[]) { static time_t last_used = 0; - if((last_used + ConfigFileEntry.pace_wait) > rb_current_time() || !ratelimit_client(source_p, 6)) - { + if (parc < 2) { + /* do nothing */ + } else if ((last_used + ConfigFileEntry.pace_wait) > rb_current_time() || !ratelimit_client(source_p, 6)) { /* safe enough to give this on a local connect only */ sendto_one(source_p, form_str(RPL_LOAD2HI), me.name, source_p->name, "MOTD"); sendto_one(source_p, form_str(RPL_ENDOFMOTD), me.name, source_p->name); - return 0; - } - else + return; + } else { last_used = rb_current_time(); + } if(hunt_server(client_p, source_p, ":%s MOTD :%s", 1, parc, parv) != HUNTED_ISME) - return 0; + return; motd_spy(source_p); send_user_motd(source_p); - - return 0; } /* ** mo_motd ** parv[1] = servername */ -static int +static void mo_motd(struct MsgBuf *msgbuf_p, struct Client *client_p, struct Client *source_p, int parc, const char *parv[]) { if(hunt_server(client_p, source_p, ":%s MOTD :%s", 1, parc, parv) != HUNTED_ISME) - return 0; + return; motd_spy(source_p); send_user_motd(source_p); - - return 0; } /* motd_spy()