Author: Isomer <isomer@coders.net>
[ircu2.10.12-pk.git] / ircd / parse.c
index fcf819d97b69a3785f1ca78c35de71236ffabd28..2a4287b1caafa577369d72cbc0f40d988a6c96f6 100644 (file)
@@ -27,6 +27,7 @@
 #include "ircd.h"
 #include "ircd_alloc.h"
 #include "ircd_chattr.h"
+#include "ircd_reply.h"
 #include "ircd_string.h"
 #include "map.h"
 #include "msg.h"
@@ -353,7 +354,11 @@ struct Message msgtab[] = {
     TOK_OPER,
     0, MAXPARA, MFLG_SLOW, 0,
     /* UNREG, CLIENT, SERVER, OPER, SERVICE */
+#ifndef NOOPER    
     { m_unregistered, m_oper, ms_oper, mo_oper, m_ignore }
+#else
+    { m_unregistered, m_oper, m_ignore, m_ignore, m_ignore }
+#endif
   },
   {
     MSG_CONNECT,
@@ -764,7 +769,7 @@ int parse_client(struct Client *cptr, char *buffer, char *bufend)
   struct Message* mptr;
   MessageHandler  handler = 0;
 
-  Debug((DEBUG_DEBUG, "Parsing: %s", buffer));
+  Debug((DEBUG_DEBUG, "Client Parsing: %s", buffer));
 
   if (IsDead(cptr))
     return 0;
@@ -811,8 +816,7 @@ int parse_client(struct Client *cptr, char *buffer, char *bufend)
     if (buffer[0] != '\0')
     {
       if (IsUser(from))
-        sendto_one(from, ":%s %d %s %s :Unknown command",
-            me.name, ERR_UNKNOWNCOMMAND, from->name, ch);
+       send_reply(from, ERR_UNKNOWNCOMMAND, ch);
       Debug((DEBUG_ERROR, "Unknown (%s) from %s",
             ch, get_client_name(cptr, HIDE_IP)));
     }
@@ -883,7 +887,7 @@ int parse_client(struct Client *cptr, char *buffer, char *bufend)
    */
   if (!IsUser(cptr) && 0 == (mptr->flags & MFLG_UNREG)) {
     if (0 == (mptr->flags & MFLG_IGNORE))
-      sendto_one(from, ":%s %d * %s :Register first.",
+      sendto_one(from, ":%s %d * %s :Register first.", /* XXX DEAD */
                  me.name, ERR_NOTREGISTERED, ch);
     return -1;
   }
@@ -910,7 +914,7 @@ int parse_server(struct Client *cptr, char *buffer, char *bufend)
   int             paramcount;
   struct Message* mptr;
 
-  Debug((DEBUG_DEBUG, "Parsing: %s", buffer));
+  Debug((DEBUG_DEBUG, "Server Parsing: %s", buffer));
 
 #ifdef GODMODE
   len = strlen(buffer);
@@ -1036,8 +1040,8 @@ int parse_server(struct Client *cptr, char *buffer, char *bufend)
         /* Kill the unknown numeric prefix upstream if
          * it's server still exists: */
         if ((server = FindNServer(numeric_prefix)) && server->from == cptr)
-          sendto_one(cptr, "%s KILL %s :%s (Unknown numeric nick)",
-                     NumServ(&me), numeric_prefix, me.name);
+         sendcmdto_one(&me, CMD_KILL, cptr, "%s :%s (Unknown numeric nick)",
+                       numeric_prefix, me.name);
       }
       /*
        * Things that must be allowed to travel
@@ -1084,7 +1088,7 @@ int parse_server(struct Client *cptr, char *buffer, char *bufend)
   if (len == 3 && IsDigit(*ch))
   {
     numeric = (*ch - '0') * 100 + (*(ch + 1) - '0') * 10 + (*(ch + 2) - '0');
-    paramcount = MAXPARA;
+    paramcount = 2; /* destination, and the rest of it */
     ServerStats->is_num++;
     mptr = NULL;                /* Init. to avoid stupid compiler warning :/ */
   }
@@ -1179,7 +1183,10 @@ int parse_server(struct Client *cptr, char *buffer, char *bufend)
          * The rest is single parameter--can
          * include blanks also.
          */
-        para[++i] = s + 1;
+       if (numeric)
+         para[++i] = s; /* preserve the colon to make do_numeric happy */
+       else
+         para[++i] = s + 1;
         break;
       }
       para[++i] = s;