Author: Kev <klmitch@mit.edu>
authorKevin L. Mitchell <klmitch@mit.edu>
Mon, 24 Apr 2000 18:50:38 +0000 (18:50 +0000)
committerKevin L. Mitchell <klmitch@mit.edu>
Mon, 24 Apr 2000 18:50:38 +0000 (18:50 +0000)
Log message:

The conversion slowly continues

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

ChangeLog
ircd/gline.c
ircd/ircd.c
ircd/ircd_reply.c
ircd/ircd_snprintf.c
ircd/jupe.c
ircd/list.c
ircd/listener.c
ircd/map.c
ircd/parse.c

index bea7b76476d61bbe5857675f8210e5620730cf66..af553682583fdb55a79c67d663aebef92b4f5f40 100644 (file)
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,5 +1,23 @@
 2000-04-24  Kevin L. Mitchell  <klmitch@mit.edu>
 
+       * ircd/parse.c: use send_reply, sendcmdto_one
+
+       * ircd/map.c: use send_reply
+
+       * ircd/listener.c: use send_reply
+
+       * ircd/jupe.c: use sendto_opmask_butone, send_reply
+
+       * ircd/ircd_reply.c: use send_reply
+
+       * ircd/ircd.c: use sendto_opmask_butone
+
+       * ircd/gline.c: use sendto_opmask_butone, send_reply
+
+       * ircd/ircd_snprintf.c (doprintf): make it deal with incompletely
+       registered clients; make FLAG_ALT print nick!user@host; make
+       FLAG_COLON print :blah
+
        * ircd/class.c (report_classes): use send_reply instead of
        sendto_one
 
 #
 # ChangeLog for ircu2.10.11
 #
-# $Id: ChangeLog,v 1.99 2000-04-24 16:34:02 kev Exp $
+# $Id: ChangeLog,v 1.100 2000-04-24 18:50:37 kev Exp $
 #
 # Insert new changes at beginning of the change list.
 #
index 21e3a48d75e2359db69389e02ba1c70f5d73f168..93a0587f5cd8549a46c2d8fc03365f97a40397a3 100644 (file)
@@ -152,12 +152,13 @@ do_gline(struct Client *cptr, struct Client *sptr, struct Gline *gline)
          (!acptr->user->username ||
           match(gline->gl_user, acptr->user->username) == 0)) {
        /* ok, here's one that got G-lined */
+       /* XXX sendto_one used for K-line reason */
        sendto_one(acptr, ":%s %d %s :*** %s.", me.name, ERR_YOUREBANNEDCREEP,
                   acptr->name, gline->gl_reason);
 
        /* let the ops know about it */
-       sendto_op_mask(SNO_GLINE, "G-line active for %s",
-                      get_client_name(acptr, FALSE));
+       sendto_opmask_butone(0, SNO_GLINE, "G-line active for %s",
+                            get_client_name(acptr, FALSE));
 
        /* and get rid of him */
        if ((tval = exit_client_msg(cptr, acptr, &me, "G-lined (%s)",
@@ -206,7 +207,7 @@ gline_add(struct Client *cptr, struct Client *sptr, char *userhost,
    */
   if (!(flags & GLINE_FORCE) && (expire <= 0 || expire > GLINE_MAX_EXPIRE)) {
     if (!IsServer(sptr) && MyConnect(sptr))
-      send_error_to_client(sptr, ERR_BADEXPIRE, expire);
+      send_reply(sptr, ERR_BADEXPIRE, expire);
     return 0;
   }
 
@@ -228,12 +229,12 @@ gline_add(struct Client *cptr, struct Client *sptr, char *userhost,
 #endif /* BADCHAN */
 
   /* Inform ops... */
-  sendto_op_mask(SNO_GLINE, "%s adding %s %s for %s, expiring at "
-                TIME_T_FMT ": %s",
-                IsServer(sptr) ? sptr->name : sptr->user->server->name,
-                flags & GLINE_LOCAL ? "local" : "global",
-                flags & GLINE_BADCHAN ? "BADCHAN" : "GLINE", userhost,
-                expire + TSoffset, reason);
+  sendto_opmask_butone(0, SNO_GLINE, "%s adding %s %s for %s, expiring at "
+                      "%Tu: %s",
+                      IsServer(sptr) ? sptr->name : sptr->user->server->name,
+                      flags & GLINE_LOCAL ? "local" : "global",
+                      flags & GLINE_BADCHAN ? "BADCHAN" : "GLINE", userhost,
+                      expire + TSoffset, reason);
 
 #ifdef GPATH
   /* and log it */
@@ -298,13 +299,13 @@ gline_activate(struct Client *cptr, struct Client *sptr, struct Gline *gline,
     return 0; /* was active to begin with */
 
   /* Inform ops and log it */
-  sendto_op_mask(SNO_GLINE, "%s activating global %s for %s%s%s, expiring at "
-                TIME_T_FMT ": %s",
-                IsServer(sptr) ? sptr->name : sptr->user->server->name,
-                GlineIsBadChan(gline) ? "BADCHAN" : "GLINE",
-                gline->gl_user, GlineIsBadChan(gline) ? "" : "@",
-                GlineIsBadChan(gline) ? "" : gline->gl_host,
-                gline->gl_expire + TSoffset, gline->gl_reason);
+  sendto_opmask_butone(0, SNO_GLINE, "%s activating global %s for %s%s%s, "
+                      "expiring at %Tu: %s",
+                      IsServer(sptr) ? sptr->name : sptr->user->server->name,
+                      GlineIsBadChan(gline) ? "BADCHAN" : "GLINE",
+                      gline->gl_user, GlineIsBadChan(gline) ? "" : "@",
+                      GlineIsBadChan(gline) ? "" : gline->gl_host,
+                      gline->gl_expire + TSoffset, gline->gl_reason);
 
 #ifdef GPATH
   if (IsServer(sptr))
@@ -356,15 +357,15 @@ gline_deactivate(struct Client *cptr, struct Client *sptr, struct Gline *gline,
   }
 
   /* Inform ops and log it */
-  sendto_op_mask(SNO_GLINE, "%s %s %s for %s%s%s, expiring at "
-                TIME_T_FMT ": %s",
-                IsServer(sptr) ? sptr->name : sptr->user->server->name,
-                GlineIsLocal(gline) ? "removing local" :
-                "deactivating global",
-                GlineIsBadChan(gline) ? "BADCHAN" : "GLINE",
-                gline->gl_user, GlineIsBadChan(gline) ? "" : "@",
-                GlineIsBadChan(gline) ? "" : gline->gl_host,
-                gline->gl_expire + TSoffset, gline->gl_reason);
+  sendto_opmask_butone(0, SNO_GLINE, "%s %s %s for %s%s%s, expiring at %Tu: "
+                      "%s",
+                      IsServer(sptr) ? sptr->name : sptr->user->server->name,
+                      GlineIsLocal(gline) ? "removing local" :
+                      "deactivating global",
+                      GlineIsBadChan(gline) ? "BADCHAN" : "GLINE",
+                      gline->gl_user, GlineIsBadChan(gline) ? "" : "@",
+                      GlineIsBadChan(gline) ? "" : gline->gl_host,
+                      gline->gl_expire + TSoffset, gline->gl_reason);
 
 #ifdef GPATH
   if (IsServer(sptr))
@@ -539,7 +540,7 @@ gline_list(struct Client *sptr, char *userhost)
 
   if (userhost) {
     if (!(gline = gline_find(userhost, GLINE_ANY))) /* no such gline */
-      return send_error_to_client(sptr, ERR_NOSUCHGLINE, userhost);
+      return send_reply(sptr, ERR_NOSUCHGLINE, userhost);
 
     /* send gline information along */
     send_reply(sptr, RPL_GLIST, gline->gl_user,
index e325aabcebe6bcf44da33533415a753fb955d0f7..a7793acdf92ae8b07302a87c34cb3b33eb63372f 100644 (file)
@@ -95,7 +95,7 @@ extern etext(void);
 
 static void server_reboot(const char* message)
 {
-  sendto_ops("Restarting server: %s", message);
+  sendto_opmask_butone(0, SNO_OLDSNO, "Restarting server: %s", message);
   Debug((DEBUG_NOTICE, "Restarting server..."));
   flush_connections(0);
 
@@ -118,7 +118,7 @@ static void server_reboot(const char* message)
 void server_die(const char* message)
 {
   ircd_log(L_CRIT, "Server terminating: %s", message);
-  sendto_ops("Server terminating: %s", message);
+  sendto_opmask_butone(0, SNO_OLDSNO, "Server terminating: %s", message);
   flush_connections(0);
   close_connections(1);
   thisServer.running = 0;
@@ -249,7 +249,8 @@ static time_t try_connections(void)
       (*pconf = con_conf)->next = 0;
     }
     if (connect_server(con_conf, 0, 0))
-      sendto_ops("Connection to %s activated.", con_conf->name);
+      sendto_opmask_butone(0, SNO_OLDSNO, "Connection to %s activated.",
+                          con_conf->name);
   }
   Debug((DEBUG_NOTICE, "Next connection check : %s", myctime(next)));
   return (next);
@@ -321,7 +322,8 @@ static time_t check_pings(void)
       
       /* If it was a server, then tell ops about it. */
       if (IsServer(cptr) || IsConnecting(cptr) || IsHandshake(cptr))
-        sendto_ops("No response from %s, closing link", cptr->name);
+       sendto_opmask_butone(0, SNO_OLDSNO,
+                            "No response from %s, closing link", cptr->name);
 
       exit_client_msg(cptr, cptr, &me, "Ping timeout");
       continue;
@@ -337,6 +339,7 @@ static time_t check_pings(void)
        * nospoof PONG.
        */
       if (*cptr->name && cptr->user && *cptr->user->username) {
+       /* XXX sendto_one used to send numeric XXX */
         sendto_one(cptr,
             ":%s %d %s :Your client may not be compatible with this server.",
             me.name, ERR_BADPING, cptr->name);
@@ -361,6 +364,7 @@ static time_t check_pings(void)
        */
       cptr->lasttime = CurrentTime - max_ping;
       
+      /* XXX sendto_one sending PING; must be very careful XXX */
       if (IsUser(cptr))
         sendto_one(cptr, MSG_PING " :%s", me.name);
       else
index 078ab621848dc2cba1e5d450cc1575bf4c5bcfaa..3e1981a8f6456df2afa459bfcda611565b815dde 100644 (file)
@@ -35,8 +35,7 @@
 
 int need_more_params(struct Client* cptr, const char* cmd)
 {
-  sendto_one(cptr, err_str(ERR_NEEDMOREPARAMS), 
-             me.name, (*cptr->name) ? cptr->name : "*", cmd);
+  send_reply(cptr, ERR_NEEDMOREPARAMS, cmd);
   return 0;
 }
 
@@ -126,13 +125,13 @@ int send_admin_info(struct Client* sptr, const struct ConfItem* admin)
 {
   assert(0 != sptr);
   if (admin) {
-    sendto_one(sptr, rpl_str(RPL_ADMINME),    me.name, sptr->name, me.name);
-    sendto_one(sptr, rpl_str(RPL_ADMINLOC1),  me.name, sptr->name, admin->host);
-    sendto_one(sptr, rpl_str(RPL_ADMINLOC2),  me.name, sptr->name, admin->passwd);
-    sendto_one(sptr, rpl_str(RPL_ADMINEMAIL), me.name, sptr->name, admin->name);
+    send_reply(sptr, RPL_ADMINME,    me.name);
+    send_reply(sptr, RPL_ADMINLOC1,  admin->host);
+    send_reply(sptr, RPL_ADMINLOC2,  admin->passwd);
+    send_reply(sptr, RPL_ADMINEMAIL, admin->name);
   }
   else
-    send_error_to_client(sptr, ERR_NOADMININFO, me.name);
+    send_reply(sptr, ERR_NOADMININFO, me.name);
   return 0;
 }
 
index 00d07827e9c379d38b0e54249b51b7e3c8998721..c3ac949028c00e0fe8a100dc2b3f23cba114379f 100644 (file)
@@ -105,9 +105,9 @@ struct FieldData {
 #define FLAG_SPACE     0x00000004      /* found a ' ' flag */
 #define FLAG_ALT       0x00000008      /* found a '#' flag */
 #define FLAG_ZERO      0x00000010      /* found a '0' flag */
+#define FLAG_COLON     0x00000020      /* found a ':' flag */
 
-#define FLAG_RESERVED2 0x00000020      /* reserved for future expansion */
-#define FLAG_RESERVED1 0x00000040
+#define FLAG_RESERVED1 0x00000040      /* reserved for future expansion */
 #define FLAG_RESERVED0 0x00000080
 
 /* integer types */
@@ -1533,6 +1533,11 @@ doprintf(struct Client *dest, struct BufData *buf_p, const char *fmt,
          fld_s.flags |= FLAG_ALT;
        continue;
 
+      case ':': /* Deal with the colon flag */
+       if (state == FLAG)
+         fld_s.flags |= FLAG_COLON;
+       continue;
+
       case '0': /* Deal with a zero flag */
        if (state == FLAG) {
          fld_s.flags |= FLAG_ZERO;
@@ -1645,11 +1650,12 @@ doprintf(struct Client *dest, struct BufData *buf_p, const char *fmt,
 
       case 's': /* convert a string */
        fld_s.flags &= ~(FLAG_PLUS | FLAG_SPACE | FLAG_ALT | FLAG_ZERO |
-                        TYPE_MASK);
+                        FLAG_COLON | TYPE_MASK);
        fld_s.flags |= ARG_PTR | CONV_STRING;
        break;
 
       case 'd':  case 'i':
+       fld_s.flags &= ~(FLAG_COLON);
        fld_s.flags |= ARG_INT | CONV_INT;
        break;
 
@@ -1663,7 +1669,7 @@ doprintf(struct Client *dest, struct BufData *buf_p, const char *fmt,
          fld_s.base = BASE_HEX;
        /*FALLTHROUGH*/
       case 'u': /* Unsigned int */
-       fld_s.flags &= ~(FLAG_PLUS | FLAG_SPACE);
+       fld_s.flags &= ~(FLAG_PLUS | FLAG_SPACE | FLAG_COLON);
        fld_s.flags |= INFO_UNSIGNED | ARG_INT | CONV_INT;
        break;
 
@@ -1677,13 +1683,13 @@ doprintf(struct Client *dest, struct BufData *buf_p, const char *fmt,
 
       case 'c': /* character */
        fld_s.flags &= ~(FLAG_PLUS | FLAG_SPACE | FLAG_ALT | FLAG_ZERO |
-                         TYPE_MASK);
+                        FLAG_COLON | TYPE_MASK);
        fld_s.flags |= INFO_UNSIGNED | ARG_INT | TYPE_CHAR | CONV_CHAR;
        fld_s.prec = -1;
        break;
 
       case 'p': /* display a pointer */
-       fld_s.flags &= ~(FLAG_PLUS | FLAG_SPACE | TYPE_MASK);
+       fld_s.flags &= ~(FLAG_PLUS | FLAG_SPACE | FLAG_COLON | TYPE_MASK);
        fld_s.flags |= (FLAG_ALT | FLAG_ZERO | TYPE_POINTER | ARG_PTR |
                        CONV_INT | INFO_UNSIGNED);
        fld_s.prec = (SIZEOF_VOID_P * 2); /* number of characters */
@@ -1716,20 +1722,19 @@ doprintf(struct Client *dest, struct BufData *buf_p, const char *fmt,
 
       case 'm': /* write out a string describing an errno error */
        fld_s.flags &= ~(FLAG_PLUS | FLAG_SPACE | FLAG_ALT | FLAG_ZERO |
-                         TYPE_MASK);
+                        FLAG_COLON | TYPE_MASK);
        fld_s.flags |= CONV_STRING;
        fld_s.value.v_ptr = (void *)strerror(errno);
        break;
 
       case 'v': /* here's the infamous %v... */
        fld_s.flags &= ~(FLAG_PLUS | FLAG_SPACE | FLAG_ALT | FLAG_ZERO |
-                        TYPE_MASK);
+                        FLAG_COLON | TYPE_MASK);
        fld_s.flags |= ARG_PTR | CONV_VARARGS;
        break;
 
       case 'C': /* convert a client name... */
-       fld_s.flags &= ~(FLAG_PLUS | FLAG_SPACE | FLAG_ALT | FLAG_ZERO |
-                        TYPE_MASK);
+       fld_s.flags &= ~(FLAG_PLUS | FLAG_SPACE | FLAG_ZERO | TYPE_MASK);
        fld_s.flags |= ARG_PTR | CONV_CLIENT;
        break;
 
@@ -1993,8 +1998,8 @@ doprintf(struct Client *dest, struct BufData *buf_p, const char *fmt,
       vdata->vd_overflow = SNP_MAX(buf_s.buf_overflow, buf_s.overflow);
     } else if ((fld_s.flags & CONV_MASK) == CONV_CLIENT) {
       struct Client *cptr = (struct Client*) fld_s.value.v_ptr;
-      char *str1 = 0, *str2 = 0;
-      int slen1 = 0, slen2 = 0, plen = 0;
+      char *str1 = 0, *str2 = 0, *str3 = 0;
+      int slen1 = 0, slen2 = 0, slen3 = 0, elen = 0, plen = 0;
 
       /* &me is used if it's not a definite server */
       if (dest && (IsServer(dest) || IsMe(dest))) {
@@ -2004,21 +2009,47 @@ doprintf(struct Client *dest, struct BufData *buf_p, const char *fmt,
          str1 = cptr->user->server->yxx;
          str2 = cptr->yxx;
        }
-      } else
-       str1 = cptr->name;
+       fld_s.flags &= ~(FLAG_ALT | FLAG_COLON);
+      } else {
+       str1 = *cptr->name ? cptr->name : "*";
+       if (!IsServer(dest) && fld_s.flags & FLAG_ALT) {
+         str2 = cptr->user->username;
+         str3 = cptr->user->host;
+       } else
+         fld_s.flags &= ~FLAG_ALT;
+      }
 
-      slen1 = my_strnlen(str1, fld_s.prec);
-      if (str2 && (fld_s.prec < 0 || fld_s.prec - slen1 > 0))
-       slen2 = my_strnlen(str2, fld_s.prec < 0 ? -1 : fld_s.prec - slen1);
-      plen = (fld_s.width - (slen1 + slen2) <= 0 ? 0 :
-             fld_s.width - (slen1 + slen2));
+      if (fld_s.flags & FLAG_COLON)
+       elen++; /* account for : */
+
+      slen1 = my_strnlen(str1, fld_s.prec < 0 ? -1 : fld_s.prec - elen);
+      if (fld_s.flags & FLAG_ALT)
+       elen++; /* account for ! */
+      if (str2 && (fld_s.prec < 0 || fld_s.prec - (slen1 + elen) > 0))
+       slen2 = my_strnlen(str2, fld_s.prec < 0 ? -1 : fld_s.prec -
+                          (slen1 + elen));
+      if (fld_s.flags & FLAG_ALT)
+       elen++; /* account for @ */
+      if (str3 && (fld_s.prec < 0 || fld_s.prec - (slen1 + slen2 + elen) > 0))
+       slen3 = my_strnlen(str3, fld_s.prec < 0 ? -1 : fld_s.prec -
+                          (slen1 + slen2 + elen));
+      plen = (fld_s.width - (slen1 + slen2 + slen3 + elen) <= 0 ? 0 :
+             fld_s.width - (slen1 + slen2 + slen3 + elen));
 
       if (plen > 0 && !(fld_s.flags & FLAG_MINUS))
        do_pad(buf_p, plen, spaces); /* pre-padding */
 
+      if (fld_s.flags & FLAG_COLON)
+       addc(buf_p, ':');
       adds(buf_p, slen1, str1);
+      if (fld_s.flags & FLAG_ALT)
+       addc(buf_p, '!');
       if (str2)
        adds(buf_p, slen2, str2);
+      if (fld_s.flags & FLAG_ALT)
+       addc(buf_p, '@');
+      if (str3)
+       adds(buf_p, slen3, str3);
 
       if (plen > 0 &&  (fld_s.flags & FLAG_MINUS))
        do_pad(buf_p, plen, spaces); /* post-padding */
index c2eed4b3264a2aac499ecb22696f1fbde3ccb10b..ca4d06e3af689ca011e0b400d41a6fadc4fa79c7 100644 (file)
@@ -110,18 +110,18 @@ jupe_add(struct Client *cptr, struct Client *sptr, char *server, char *reason,
    */
   if (expire <= 0 || expire > JUPE_MAX_EXPIRE) {
     if (!IsServer(cptr) && MyConnect(cptr))
-      send_error_to_client(cptr, ERR_BADEXPIRE, expire);
+      send_reply(cptr, ERR_BADEXPIRE, expire);
     return 0;
   }
 
   expire += CurrentTime; /* convert from lifetime to timestamp */
 
   /* Inform ops and log it */
-    sendto_op_mask(SNO_NETWORK, "%s adding %sJUPE for %s, expiring at "
-                  TIME_T_FMT ": %s",
-                  IsServer(sptr) ? sptr->name : sptr->user->server->name,
-                  flags & JUPE_LOCAL ? "local " : "", server,
-                  expire + TSoffset, reason);
+  sendto_opmask_butone(0, SNO_NETWORK, "%s adding %sJUPE for %s, expiring at "
+                      "%Tu: %s", IsServer(sptr) ? sptr->name :
+                      sptr->user->server->name,
+                      flags & JUPE_LOCAL ? "local " : "", server,
+                      expire + TSoffset, reason);
 
 #ifdef JPATH
   if (IsServer(sptr))
@@ -170,10 +170,11 @@ jupe_activate(struct Client *cptr, struct Client *sptr, struct Jupe *jupe,
     return 0; /* was active to begin with */
 
   /* Inform ops and log it */
-  sendto_op_mask(SNO_NETWORK, "%s activating JUPE for %s, expiring at "
-                TIME_T_FMT ": %s",
-                IsServer(sptr) ? sptr->name : sptr->user->server->name,
-                jupe->ju_server, jupe->ju_expire + TSoffset, jupe->ju_reason);
+  sendto_opmask_butone(0, SNO_NETWORK, "%s activating JUPE for %s, expiring "
+                      "at %Tu: %s",
+                      IsServer(sptr) ? sptr->name : sptr->user->server->name,
+                      jupe->ju_server, jupe->ju_expire + TSoffset,
+                      jupe->ju_reason);
 
 #ifdef JPATH
   if (IsServer(sptr))
@@ -219,11 +220,12 @@ jupe_deactivate(struct Client *cptr, struct Client *sptr, struct Jupe *jupe,
   }
 
   /* Inform ops and log it */
-  sendto_op_mask(SNO_NETWORK, "%s %s JUPE for %s, expiring at " TIME_T_FMT
-                ": %s",
-                IsServer(sptr) ? sptr->name : sptr->user->server->name,
-                JupeIsLocal(jupe) ? "removing local" : "deactivating",
-                jupe->ju_server, jupe->ju_expire + TSoffset, jupe->ju_reason);
+  sendto_opmask_butone(0, SNO_NETWORK, "%s %s JUPE for %s, expiring at %Tu: "
+                      "%s",
+                      IsServer(sptr) ? sptr->name : sptr->user->server->name,
+                      JupeIsLocal(jupe) ? "removing local" : "deactivating",
+                      jupe->ju_server, jupe->ju_expire + TSoffset,
+                      jupe->ju_reason);
 
 #ifdef JPATH
   if (IsServer(sptr))
@@ -320,7 +322,7 @@ jupe_list(struct Client *sptr, char *server)
 
   if (server) {
     if (!(jupe = jupe_find(server))) /* no such jupe */
-      return send_error_to_client(sptr, ERR_NOSUCHJUPE, server);
+      return send_reply(sptr, ERR_NOSUCHJUPE, server);
 
     /* send jupe information along */
     send_reply(sptr, RPL_JUPELIST, jupe->ju_server, jupe->ju_expire + TSoffset,
index 98eaaa646e6cb99120ec7ece4a22d54d94d2642c..f1089bb3a459a35f9cc2ad9c5aed092914b4e1d4 100644 (file)
@@ -310,6 +310,7 @@ void free_class(struct ConfClass * tmp)
 }
 
 #ifdef  DEBUGMODE
+/* XXX uses sendto_one to send a RPL_STATSDEBUG -- no string for rpl */
 void send_listinfo(struct Client *cptr, char *name)
 {
   int inuse = 0, mem = 0, tmp = 0;
index f158ec1a71e933d7014db0be4317d3fc7e8e7d55..ce7ddc7065a8aa66762fe2cb36cddde00f95634f 100644 (file)
@@ -23,6 +23,7 @@
 #include "ircd.h"
 #include "ircd_alloc.h"
 #include "ircd_osdep.h"
+#include "ircd_reply.h"
 #include "ircd_string.h"
 #include "numeric.h"
 #include "s_bsd.h"
@@ -127,11 +128,9 @@ void show_ports(struct Client* sptr, int show_hidden, int port, int count)
     }
     else
       flags[1] = '\0';
-        
-    sendto_one(sptr, rpl_str(RPL_STATSPLINE),
-               me.name, sptr->name, listener->port,
-               listener->ref_count, flags, 
-               (listener->active) ? "active" : "disabled");
+
+    send_reply(sptr, RPL_STATSPLINE, listener->port, listener->ref_count,
+              flags, (listener->active) ? "active" : "disabled");
     if (--count == 0)
       break;
   }
index 10401ed9155ed62619bd793da11af09032faf309..1b9a7066b97d4574a092e7364d77f955014dda3d 100644 (file)
@@ -21,6 +21,7 @@
 #include "map.h"
 #include "client.h"
 #include "ircd.h"
+#include "ircd_reply.h"
 #include "list.h"
 #include "match.h"
 #include "numeric.h"
@@ -40,8 +41,7 @@ void dump_map(struct Client *cptr, struct Client *server, char *mask, int prompt
 
   *p = '\0';
   if (prompt_length > 60)
-    sendto_one(cptr, rpl_str(RPL_MAPMORE), me.name, cptr->name,
-        prompt, server->name);
+    send_reply(cptr, RPL_MAPMORE, prompt, server->name);
   else {
     char lag[512];
     if (server->serv->lag>10000)
@@ -50,12 +50,9 @@ void dump_map(struct Client *cptr, struct Client *server, char *mask, int prompt
        strcpy(lag,"(0s)");
     else
        sprintf(lag,"(%is)",server->serv->lag);
-    sendto_one(cptr, rpl_str(RPL_MAP), me.name, cptr->name,
-        prompt, 
-       ((IsBurstOrBurstAck(server)) ? "*" : ""),
-        server->name, 
-        lag,
-        (server == &me) ? UserStats.local_clients : server->serv->clients);
+    send_reply(cptr, RPL_MAP, prompt, ((IsBurstOrBurstAck(server)) ? "*" : ""),
+              server->name, lag, (server == &me) ? UserStats.local_clients :
+              server->serv->clients);
   }
   if (prompt_length > 0)
   {
index fcf819d97b69a3785f1ca78c35de71236ffabd28..c147c8f2f73fc492b0cdcdb6cf18ae5fbba44440 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"
@@ -811,8 +812,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)));
     }
@@ -1036,8 +1036,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