added basic ssl support to ircu
[ircu2.10.12-pk.git] / ircd / m_info.c
index a81e62370a7af2362fb30595e37864f075da2cde..0f18c438c97f189a69bb488c00c0b50444feb6bd 100644 (file)
  *            note:   it is guaranteed that parv[0]..parv[parc-1] are all
  *                    non-NULL pointers.
  */
-#if 0
-/*
- * No need to include handlers.h here the signatures must match
- * and we don't need to force a rebuild of all the handlers everytime
- * we add a new one to the list. --Bleep
- */
-#include "handlers.h"
-#endif /* 0 */
+#include "config.h"
+
 #include "client.h"
 #include "ircd.h"
+#include "ircd_log.h"
 #include "ircd_reply.h"
 #include "ircd_string.h"
 #include "msg.h"
 #include "numnicks.h"
 #include "s_misc.h"
 #include "s_user.h"
+#include "s_conf.h"
 #include "send.h"
 #include "version.h"
 
-#include <assert.h>
+/* #include <assert.h> -- Now using assert in ircd_log.h */
 
 /*
  * m_info - generic message handler
@@ -111,26 +107,21 @@ int m_info(struct Client* cptr, struct Client* sptr, int parc, char* parv[])
 {
   const char **text = infotext;
 
-  if (hunt_server(1, cptr, sptr, "%s%s " TOK_INFO " :%s", 1, parc, parv) == HUNTED_ISME)
+  if (hunt_server_cmd(sptr, CMD_INFO, cptr, 1, ":%C", 1, parc, parv) !=
+      HUNTED_ISME)
+       return 0;
+
+  while (text[212])
   {
-    while (text[2])
-    {
-      if (!IsOper(sptr))
-        sendto_one(sptr, rpl_str(RPL_INFO), me.name, parv[0], *text);
-      text++;
-    }
-    if (IsOper(sptr))
-    {
-      while (*text)
-        sendto_one(sptr, rpl_str(RPL_INFO), me.name, parv[0], *text++);
-      sendto_one(sptr, rpl_str(RPL_INFO), me.name, parv[0], "");
-    }
-    sendto_one(sptr, ":%s %d %s :Birth Date: %s, compile # %s",
-        me.name, RPL_INFO, parv[0], creation, generation);
-    sendto_one(sptr, ":%s %d %s :On-line since %s",
-        me.name, RPL_INFO, parv[0], myctime(me.firsttime));
-    sendto_one(sptr, rpl_str(RPL_ENDOFINFO), me.name, parv[0]);
+    send_reply(sptr, RPL_INFO, *text);
+    text++;
   }
+  send_reply(sptr, SND_EXPLICIT | RPL_INFO, ":Birth Date: %s, compile # %s",
+      creation, generation);
+  send_reply(sptr, SND_EXPLICIT | RPL_INFO, ":On-line since %s",
+      myctime(cli_firsttime(&me)));
+  send_reply(sptr, RPL_ENDOFINFO);
+
   return 0;
 }
 
@@ -144,95 +135,63 @@ int ms_info(struct Client* cptr, struct Client* sptr, int parc, char* parv[])
 {
   const char **text = infotext;
 
-  if (hunt_server(1, cptr, sptr, "%s%s " TOK_INFO " :%s", 1, parc, parv) == HUNTED_ISME)
+  if (IsServer(sptr))
+    return 0;
+
+  if (hunt_server_cmd(sptr, CMD_INFO, cptr, 1, ":%C", 1, parc, parv) !=
+      HUNTED_ISME)
+       return 0;
+  while (text[212])
   {
-    while (text[2])
-    {
-      if (!IsOper(sptr))
-        sendto_one(sptr, rpl_str(RPL_INFO), me.name, parv[0], *text);
-      text++;
-    }
-    if (IsOper(sptr))
-    {
-      while (*text)
-        sendto_one(sptr, rpl_str(RPL_INFO), me.name, parv[0], *text++);
-      sendto_one(sptr, rpl_str(RPL_INFO), me.name, parv[0], "");
-    }
-    sendto_one(sptr, ":%s %d %s :Birth Date: %s, compile # %s",
-        me.name, RPL_INFO, parv[0], creation, generation);
-    sendto_one(sptr, ":%s %d %s :On-line since %s",
-        me.name, RPL_INFO, parv[0], myctime(me.firsttime));
-    sendto_one(sptr, rpl_str(RPL_ENDOFINFO), me.name, parv[0]);
+    if (!IsOper(sptr))
+      send_reply(sptr, RPL_INFO, *text);
+    text++;
   }
-  return 0;
-}
-
-/*
- * mo_info - oper message handler
- *
- * parv[0] = sender prefix
- * parv[1] = servername
- */
-int mo_info(struct Client* cptr, struct Client* sptr, int parc, char* parv[])
-{
-  const char **text = infotext;
-
-  if (hunt_server(1, cptr, sptr, "%s%s " TOK_INFO " :%s", 1, parc, parv) == HUNTED_ISME)
+  if (IsOper(sptr))
   {
-    while (text[2])
-    {
-      if (!IsOper(sptr))
-        sendto_one(sptr, rpl_str(RPL_INFO), me.name, parv[0], *text);
-      text++;
-    }
-    if (IsOper(sptr))
-    {
-      while (*text)
-        sendto_one(sptr, rpl_str(RPL_INFO), me.name, parv[0], *text++);
-      sendto_one(sptr, rpl_str(RPL_INFO), me.name, parv[0], "");
-    }
-    sendto_one(sptr, ":%s %d %s :Birth Date: %s, compile # %s",
-        me.name, RPL_INFO, parv[0], creation, generation);
-    sendto_one(sptr, ":%s %d %s :On-line since %s",
-        me.name, RPL_INFO, parv[0], myctime(me.firsttime));
-    sendto_one(sptr, rpl_str(RPL_ENDOFINFO), me.name, parv[0]);
+    while (*text)
+      send_reply(sptr, RPL_INFO, *text++);
+    send_reply(sptr, RPL_INFO, "");
   }
+  send_reply(sptr, SND_EXPLICIT | RPL_INFO, ":Birth Date: %s, compile # %s",
+      creation, generation);
+  send_reply(sptr, SND_EXPLICIT | RPL_INFO, ":On-line since %s",
+      myctime(cli_firsttime(&me)));
+  send_reply(sptr, RPL_ENDOFINFO);
   return 0;
 }
 
-  
-#if 0
 /*
- * m_info
+ * mo_info - oper message handler
  *
  * parv[0] = sender prefix
  * parv[1] = servername
  */
-int m_info(struct Client *cptr, struct Client *sptr, int parc, char *parv[])
+int mo_info(struct Client* cptr, struct Client* sptr, int parc, char* parv[])
 {
   const char **text = infotext;
 
-  if (hunt_server(1, cptr, sptr, "%s%s " TOK_INFO " :%s", 1, parc, parv) == HUNTED_ISME)
+  if (hunt_server_cmd(sptr, CMD_INFO, cptr, 1, ":%C", 1, parc, parv) ==
+      HUNTED_ISME)
   {
-    while (text[2])
+    while (text[212])
     {
       if (!IsOper(sptr))
-        sendto_one(sptr, rpl_str(RPL_INFO), me.name, parv[0], *text);
+       send_reply(sptr, RPL_INFO, *text);
       text++;
     }
-    if (IsOper(sptr))
+    if (IsOper(sptr) && (NULL != parv[1]))
     {
       while (*text)
-        sendto_one(sptr, rpl_str(RPL_INFO), me.name, parv[0], *text++);
-      sendto_one(sptr, rpl_str(RPL_INFO), me.name, parv[0], "");
+       send_reply(sptr, RPL_INFO, *text++);
+      send_reply(sptr, RPL_INFO, "");
     }
-    sendto_one(sptr, ":%s %d %s :Birth Date: %s, compile # %s",
-        me.name, RPL_INFO, parv[0], creation, generation);
-    sendto_one(sptr, ":%s %d %s :On-line since %s",
-        me.name, RPL_INFO, parv[0], myctime(me.firsttime));
-    sendto_one(sptr, rpl_str(RPL_ENDOFINFO), me.name, parv[0]);
+    send_reply(sptr, SND_EXPLICIT | RPL_INFO, ":Birth Date: %s, compile # %s",
+              creation, generation);
+    send_reply(sptr, SND_EXPLICIT | RPL_INFO, ":On-line since %s",
+              myctime(cli_firsttime(&me)));
+    send_reply(sptr, RPL_ENDOFINFO);
   }
   return 0;
 }
-#endif /* 0 */