From 6766b2e0ed682f66fd778ed873e7aaf1e3726af5 Mon Sep 17 00:00:00 2001 From: "Kevin L. Mitchell" Date: Fri, 28 Apr 2000 16:16:06 +0000 Subject: [PATCH] Author: Kev 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 | 10 +++++++++- ircd/ircd_reply.c | 4 ++-- ircd/parse.c | 7 +++++-- ircd/s_numeric.c | 27 ++++++--------------------- 4 files changed, 22 insertions(+), 26 deletions(-) diff --git a/ChangeLog b/ChangeLog index 58e11b5..29e7f0e 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,5 +1,13 @@ 2000-04-28 Kevin L. Mitchell + * 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 @@ -947,7 +955,7 @@ # # 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. # diff --git a/ircd/ircd_reply.c b/ircd/ircd_reply.c index a4aae18..043da3c 100644 --- a/ircd/ircd_reply.c +++ b/ircd/ircd_reply.c @@ -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); diff --git a/ircd/parse.c b/ircd/parse.c index 7d78eca..9d76052 100644 --- a/ircd/parse.c +++ b/ircd/parse.c @@ -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; diff --git a/ircd/s_numeric.c b/ircd/s_numeric.c index 993b1e2..747567c 100644 --- a/ircd/s_numeric.c +++ b/ircd/s_numeric.c @@ -25,13 +25,12 @@ #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; } -- 2.20.1