]> jfr.im git - solanum.git/blobdiff - modules/m_time.c
extensions/umode_hide_idle_time: mask times for hidden sources (#373)
[solanum.git] / modules / m_time.c
index 19a83225dc5a030f0e2513e0e05533b452429916..268e40f601aa34cd725c24da4940636cf17161db 100644 (file)
@@ -20,8 +20,6 @@
  *  along with this program; if not, write to the Free Software
  *  Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307
  *  USA
- *
- *  $Id: m_time.c 254 2005-09-21 23:35:12Z nenolod $
  */
 
 #include "stdinc.h"
 #include "parse.h"
 #include "modules.h"
 #include "packet.h"
-#include "sprintf_irc.h"
 
-static int m_time(struct Client *, struct Client *, int, const char **);
+static const char time_desc[] =
+       "Provides the TIME command to show the current server time";
+
+static void m_time(struct MsgBuf *, struct Client *, struct Client *, int, const char **);
 static char *date(void);
 
 struct Message time_msgtab = {
-       "TIME", 0, 0, 0, MFLG_SLOW,
+       "TIME", 0, 0, 0, 0,
        {mg_unreg, {m_time, 0}, {m_time, 2}, mg_ignore, mg_ignore, {m_time, 0}}
 };
 
 mapi_clist_av1 time_clist[] = { &time_msgtab, NULL };
-DECLARE_MODULE_AV1(time, NULL, NULL, time_clist, NULL, NULL, "$Revision: 254 $");
+DECLARE_MODULE_AV2(time, NULL, NULL, time_clist, NULL, NULL, NULL, NULL, time_desc);
 
 static const char *months[] = {
        "January", "February", "March", "April",
@@ -61,11 +61,10 @@ static const char *weekdays[] = {
 
 /*
  * m_time
- *      parv[0] = sender prefix
  *      parv[1] = servername
  */
-static int
-m_time(struct Client *client_p, struct Client *source_p, int parc, const char *parv[])
+static void
+m_time(struct MsgBuf *msgbuf_p, struct Client *client_p, struct Client *source_p, int parc, const char *parv[])
 {
        /* this is not rate limited, so end the grace period */
        if(MyClient(source_p) && !IsFloodDone(source_p))
@@ -74,8 +73,6 @@ m_time(struct Client *client_p, struct Client *source_p, int parc, const char *p
        if(hunt_server(client_p, source_p, ":%s TIME :%s", 1, parc, parv) == HUNTED_ISME)
                sendto_one_numeric(source_p, RPL_TIME, form_str(RPL_TIME),
                                   me.name, date());
-
-       return 0;
 }
 
 /* date()
@@ -111,10 +108,10 @@ date(void)
        if(minswest < 0)
                minswest = -minswest;
 
-       rb_sprintf(buf, "%s %s %d %d -- %02u:%02u:%02u %c%02u:%02u",
+       sprintf(buf, "%s %s %d %d -- %02u:%02u:%02u %c%02u:%02u",
                   weekdays[lt->tm_wday], months[lt->tm_mon], lt->tm_mday,
                   lt->tm_year + 1900, lt->tm_hour, lt->tm_min, lt->tm_sec,
-                  plus, minswest / 60, minswest % 60);
+                  plus, (unsigned int)minswest / 60, (unsigned int)minswest % 60);
 
        return buf;
 }