Author: Kev <klmitch@mit.edu>
authorKevin L. Mitchell <klmitch@mit.edu>
Fri, 28 Apr 2000 16:16:06 +0000 (16:16 +0000)
committerKevin L. Mitchell <klmitch@mit.edu>
Fri, 28 Apr 2000 16:16:06 +0000 (16:16 +0000)
Log message:

use the new sendcmdto_* stuff for do_numeric, along with fixing a minor
bug in send_reply()

Status: Stable
Testing needed:

This patch has been carefully tested, and should work fine; continual
testing will be necessary, however

git-svn-id: file:///home/klmitch/undernet-ircu/undernet-ircu-svn/ircu2/trunk@213 c9e4aea6-c8fd-4c43-8297-357d70d61c8c

ChangeLog
ircd/ircd_reply.c
ircd/parse.c
ircd/s_numeric.c

index 58e11b5851790017788478079e30d92481af6c79..29e7f0e62cbc089522fb75a59e683bb46f4dceb8 100644 (file)
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,5 +1,13 @@
 2000-04-28  Kevin L. Mitchell  <klmitch@mit.edu>
 
+       * ircd/ircd_reply.c (send_reply): fix a slight bug...
+
+       * ircd/s_numeric.c (do_numeric): use new sendcmdto_* functions,
+       kinda hackish...
+
+       * ircd/parse.c (parse_server): argument wrangling to make
+       processing in do_numeric a little easier to deal with
+
        * ircd/s_serv.c (server_estab): SERVER should come from
        acptr->serv->up, not &me
 
 #
 # ChangeLog for ircu2.10.11
 #
-# $Id: ChangeLog,v 1.110 2000-04-28 15:34:34 kev Exp $
+# $Id: ChangeLog,v 1.111 2000-04-28 16:16:06 kev Exp $
 #
 # Insert new changes at beginning of the change list.
 #
index a4aae188c4e64e90f94d747a68ee748170418912..043da3cfc1494820c65d7de37089690f4123befd 100644 (file)
@@ -113,8 +113,8 @@ int send_reply(struct Client *to, int reply, ...)
   assert(0 != vd.vd_format);
 
   /* build buffer */
-  ircd_snprintf(to, sndbuf, sizeof(sndbuf) - 2, "%:#C %s %C %v", &me, num->str,
-               to, &vd);
+  ircd_snprintf(to->from, sndbuf, sizeof(sndbuf) - 2, "%:#C %s %C %v", &me,
+               num->str, to, &vd);
 
   va_end(vd.vd_args);
 
index 7d78eca91443e4633eed714ad58b560100a4fdd2..9d76052616dccf2ab979fcc975ce5baad3dc2857 100644 (file)
@@ -1088,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 :/ */
   }
@@ -1183,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;
index 993b1e235e31d34f86731468cba4af228270b339..747567cb3a978bcc9254a247546c673fe0c53fd2 100644 (file)
 #include "client.h"
 #include "hash.h"
 #include "ircd.h"
+#include "ircd_snprintf.h"
 #include "numnicks.h"
 #include "send.h"
 #include "struct.h"
 
 
-static char buffer[1024];
-
 /*
  * do_numeric()
  * Rewritten by Nemesi, Jan 1999, to support numeric nicks in parv[1]
@@ -47,8 +46,7 @@ int do_numeric(int numeric, int nnn, struct Client *cptr, struct Client *sptr,
 {
   struct Client *acptr = 0;
   struct Channel *achptr = 0;
-  char *p, *b;
-  int i;
+  char num[4];
 
   /* Avoid trash, we need it to come from a server and have a target  */
   if ((parc < 2) || !IsServer(sptr))
@@ -72,26 +70,13 @@ int do_numeric(int numeric, int nnn, struct Client *cptr, struct Client *sptr,
   if (numeric < 100)
     numeric += 100;
 
-  /* Rebuild the buffer with all the parv[] without wasting cycles :) */
-  b = buffer;
-  if (parc > 2)
-  {
-    for (i = 2; i < (parc - 1); i++)
-      for (*b++ = ' ', p = parv[i]; *p; p++)
-        *b++ = *p;
-    for (*b++ = ' ', *b++ = ':', p = parv[parc - 1]; *p; p++)
-      *b++ = *p;
-  }
-  *b = '\000';
-
-  /* Since .06 this will implicitly use numeric nicks when needed     */
+  ircd_snprintf(0, num, sizeof(num), "%03d", numeric);
 
   if (acptr)
-    sendto_prefix_one(acptr, sptr, ":%s %d %s%s",
-        sptr->name, numeric, acptr->name, buffer);
+    sendcmdto_one(sptr, num, num, acptr, "%C %s", acptr, parv[2]);
   else
-    sendto_channel_butone(cptr, sptr, achptr, ":%s %d %s%s",
-        sptr->name, numeric, achptr->chname, buffer);
+    sendcmdto_channel_butone(sptr, num, num, achptr, cptr,
+                            SKIP_DEAF | SKIP_BURST, "%H %s", achptr, parv[2]);
 
   return 0;
 }