make use of the SND_EXPLICIT flag to specify a pattern, reducing most output from 2 lines to 1 line few minor other changes: changed hidden to delayedjoin, changed no modes to just + same as /MODE shows added zombie and delayedjoin prefix to header for check channel changed all (timestamp) output to [timestamp] seems more consistent with other places (e.g. snomask HACK MODEs) added [] param to syntax of command in the comments diff -r a698927b198f ircd/m_check.c --- a/ircd/m_check.c +++ b/ircd/m_check.c @@ -71,7 +71,7 @@ */ /* - * Syntax: CHECK [-flags] + * Syntax: CHECK [] [-flags] * * Where valid flags are: * -c: Show channels when checking a hostmask. @@ -238,7 +238,7 @@ char *zombie, *showlevel; if (flags & CHECK_SHOWUSERS) { - send_reply(sptr, RPL_DATASTR, "Users (@ = op, + = voice)"); + send_reply(sptr, RPL_DATASTR, ":Users (! = zombie, @ = op, + = voice, < = delayedjoin)"); } if (flags & CHECK_CLONES) { @@ -324,89 +324,72 @@ cntr++; } - send_reply(sptr, RPL_DATASTR, " "); + send_reply(sptr, RPL_DATASTR, ": "); if (flags & CHECK_CLONES) { - ircd_snprintf(0, outbuf, sizeof(outbuf), - "Total users:: %d (%d ops, %d voiced, %d clones, %d authed, %d hidden)", - cntr, opcntr, vcntr, clones, authed, delayedjoin); + send_reply(sptr, SND_EXPLICIT | RPL_DATASTR, + ":Total users:: %d (%d ops, %d voiced, %d clones, %d authed, %d delayedjoin)", + cntr, opcntr, vcntr, clones, authed, delayedjoin); for (lp = chptr->members; lp; lp = lp->next_member) { cli_marker(lp->user) = 0; } } else { - ircd_snprintf(0, outbuf, sizeof(outbuf), - "Total users:: %d (%d ops, %d voiced, %d authed, %d hidden)", - cntr, opcntr, vcntr, authed, delayedjoin); + send_reply(sptr, SND_EXPLICIT | RPL_DATASTR, + ":Total users:: %d (%d ops, %d voiced, %d authed, %d delayedjoin)", + cntr, opcntr, vcntr, authed, delayedjoin); } - send_reply(sptr, RPL_DATASTR, outbuf); - send_reply(sptr, RPL_DATASTR, " "); + send_reply(sptr, RPL_DATASTR, ": "); /* Do not display bans if ! flags & CHECK_SHOWUSERS */ if (flags & CHECK_SHOWUSERS) { - send_reply(sptr, RPL_DATASTR, "Bans on channel::"); + send_reply(sptr, RPL_DATASTR, ":Bans on channel::"); for (ban = chptr->banlist; ban; ban = ban->next) { - ircd_snprintf(0, outbuf, sizeof(outbuf), "[%d] - %s - Set by %s, on %s (%Tu)", + send_reply(sptr, SND_EXPLICIT | RPL_DATASTR, + ":[%d] - %s - Set by %s, on %s [%Tu]", ++bans, ban->banstr, ban->who, myctime(ban->when), ban->when); - send_reply(sptr, RPL_DATASTR, outbuf); } if (bans == 0) - send_reply(sptr, RPL_DATASTR, ""); + send_reply(sptr, RPL_DATASTR, ":"); } send_reply(sptr, RPL_ENDOFCHECK, " "); } void checkChannel(struct Client *sptr, struct Channel *chptr) { - char outbuf[TOPICLEN + MODEBUFLEN + 64], modebuf[MODEBUFLEN], parabuf[MODEBUFLEN]; + char modebuf[MODEBUFLEN], parabuf[MODEBUFLEN]; /* Header */ - send_reply(sptr, RPL_DATASTR, " "); + send_reply(sptr, RPL_DATASTR, ": "); send_reply(sptr, RPL_CHKHEAD, "channel", chptr->chname); - send_reply(sptr, RPL_DATASTR, " "); + send_reply(sptr, RPL_DATASTR, ": "); /* Creation Time */ - ircd_snprintf(sptr, outbuf, sizeof(outbuf), " Creation time:: %s (%Tu)", myctime(chptr->creationtime), chptr->creationtime); - send_reply(sptr, RPL_DATASTR, outbuf); + send_reply(sptr, SND_EXPLICIT | RPL_DATASTR, ": Creation time:: %s [%Tu]", + myctime(chptr->creationtime), chptr->creationtime); /* Topic */ if (strlen(chptr->topic) <= 0) - send_reply(sptr, RPL_DATASTR, " Topic:: "); + send_reply(sptr, RPL_DATASTR, ": Topic:: "); else { - ircd_snprintf(sptr, outbuf, sizeof(outbuf), " Topic:: %s", chptr->topic); - send_reply(sptr, RPL_DATASTR, outbuf); + send_reply(sptr, SND_EXPLICIT | RPL_DATASTR, ": Topic:: %s", chptr->topic); /* ..set by */ - ircd_snprintf(sptr, outbuf, sizeof(outbuf), " Set by:: %s", chptr->topic_nick); - send_reply(sptr, RPL_DATASTR, outbuf); + send_reply(sptr, SND_EXPLICIT | RPL_DATASTR, ": Set by:: %s", chptr->topic_nick); - ircd_snprintf(sptr, outbuf, sizeof(outbuf), " Set at:: %s (%Tu)", myctime(chptr->topic_time), chptr->topic_time); - send_reply(sptr, RPL_DATASTR, outbuf); + send_reply(sptr, SND_EXPLICIT | RPL_DATASTR, ": Set at:: %s [%Tu]", myctime(chptr->topic_time), chptr->topic_time); } /* Channel Modes */ - - strcpy(outbuf, "Channel mode(s):: "); - - modebuf[0] = '\0'; - parabuf[0] = '\0'; - - channel_modes(sptr, modebuf, parabuf, sizeof(modebuf), chptr, NULL); - - if(modebuf[1] == '\0') - strcat(outbuf, ""); - else if(*parabuf) { - strcat(outbuf, modebuf); - strcat(outbuf, " "); - strcat(outbuf, parabuf); - } - else - strcat(outbuf, modebuf); - - send_reply(sptr, RPL_DATASTR, outbuf); + *modebuf = '\0'; + *parabuf = '\0'; + modebuf[1] = '\0'; + channel_modes(sptr, modebuf, parabuf, sizeof(parabuf), chptr, NULL); + send_reply(sptr, SND_EXPLICIT | RPL_DATASTR, ":Channel mode(s):: %s %s", + modebuf ? modebuf : "+", parabuf); /* Don't send 'END OF CHECK' message, it's sent in checkUsers, which is called after this. */ } @@ -415,53 +398,45 @@ struct Channel *chptr; struct Membership *lp; struct irc_sockaddr sin; - char outbuf[BUFSIZE]; char *umodes; time_t nowr; /* Header */ - send_reply(sptr, RPL_DATASTR, " "); + send_reply(sptr, RPL_DATASTR, ": "); send_reply(sptr, RPL_CHKHEAD, "user", cli_name(acptr)); - send_reply(sptr, RPL_DATASTR, " "); + send_reply(sptr, RPL_DATASTR, ": "); - ircd_snprintf(0, outbuf, sizeof(outbuf), " Nick:: %s (%s%s)", cli_name(acptr), NumNick(acptr)); - send_reply(sptr, RPL_DATASTR, outbuf); + send_reply(sptr, SND_EXPLICIT | RPL_DATASTR, ": Nick:: %s (%s%s)", cli_name(acptr), NumNick(acptr)); - if (MyUser(acptr)) { - ircd_snprintf(0, outbuf, sizeof(outbuf), " Signed on:: %s (%Tu)", myctime(acptr->cli_firsttime), acptr->cli_firsttime); - send_reply(sptr, RPL_DATASTR, outbuf); - } + if (MyUser(acptr)) + send_reply(sptr, SND_EXPLICIT | RPL_DATASTR, ": Signed on:: %s [%Tu]", myctime(acptr->cli_firsttime), acptr->cli_firsttime); - ircd_snprintf(0, outbuf, sizeof(outbuf), " Timestamp:: %s (%d)", myctime(acptr->cli_lastnick), acptr->cli_lastnick); - send_reply(sptr, RPL_DATASTR, outbuf); + send_reply(sptr, SND_EXPLICIT | RPL_DATASTR, ": Timestamp:: %s [%d]", myctime(acptr->cli_lastnick), acptr->cli_lastnick); - ircd_snprintf(0, outbuf, sizeof(outbuf), " User/Hostmask:: %s@%s [%s] (Clients: %hu)", cli_user(acptr)->username, cli_user(acptr)->host, - ircd_ntoa(&(cli_ip(acptr))), IPcheck_nr(acptr)); - send_reply(sptr, RPL_DATASTR, outbuf); + send_reply(sptr, SND_EXPLICIT | RPL_DATASTR, ": User/Hostmask:: %s@%s [%s] (Clients: %hu)", + cli_user(acptr)->username, cli_user(acptr)->host, ircd_ntoa(&(cli_ip(acptr))), IPcheck_nr(acptr)); - if (IsSetHost(acptr) || HasHiddenHost(acptr)) { - ircd_snprintf(0, outbuf, sizeof(outbuf), " Real User/Host:: %s@%s", cli_user(acptr)->realusername, cli_user(acptr)->realhost); - send_reply(sptr, RPL_DATASTR, outbuf); - } + if (IsSetHost(acptr) || HasHiddenHost(acptr)) + send_reply(sptr, SND_EXPLICIT | RPL_DATASTR, ": Real User/Host:: %s@%s", cli_user(acptr)->realusername, cli_user(acptr)->realhost); - ircd_snprintf(0, outbuf, sizeof(outbuf), " Real Name:: %s%c", cli_info(acptr), COLOR_OFF); - send_reply(sptr, RPL_DATASTR, outbuf); + /* COLOR_OFF ? */ + send_reply(sptr, SND_EXPLICIT | RPL_DATASTR, ": Real Name:: %s", cli_info(acptr)); if( IsService(cli_user(acptr)->server)) { if (IsChannelService(acptr)) - send_reply(sptr, RPL_DATASTR, " Status:: Network Service"); + send_reply(sptr, RPL_DATASTR, ": Status:: Network Service"); else if (IsAnOper(acptr)) - send_reply(sptr, RPL_DATASTR, " Status:: IRC Operator (service) (ID: %s)", cli_user(acptr)->opername ? cli_user(acptr)->opername : ""); + send_reply(sptr, SND_EXPLICIT | RPL_DATASTR, ": Status:: IRC Operator (service) (ID: %s)", cli_user(acptr)->opername ? cli_user(acptr)->opername : ""); else - send_reply(sptr, RPL_DATASTR, " Status:: Client (service)"); - } else if (IsAnOper(acptr)) { - ircd_snprintf(0, outbuf, sizeof(outbuf), " Status:: IRC Operator (ID: %s)", cli_user(acptr)->opername ? cli_user(acptr)->opername : ""); - send_reply(sptr, RPL_DATASTR, outbuf); - } else - send_reply(sptr, RPL_DATASTR, " Status:: Client"); + send_reply(sptr, RPL_DATASTR, ": Status:: Client (service)"); + } else if (IsAnOper(acptr)) + send_reply(sptr, SND_EXPLICIT | RPL_DATASTR, ": Status:: IRC Operator (ID: %s)", + cli_user(acptr)->opername ? cli_user(acptr)->opername : ""); + else + /* this really needed ? */ + send_reply(sptr, RPL_DATASTR, ": Status:: Client"); - ircd_snprintf(0, outbuf, sizeof(outbuf), " Connected to:: %s (Hops: %d)", cli_name(cli_user(acptr)->server), cli_hopcount(acptr)); - send_reply(sptr, RPL_DATASTR, outbuf); + send_reply(sptr, SND_EXPLICIT | RPL_DATASTR, ": Connected to:: %s (Hops: %d)", cli_name(cli_user(acptr)->server), cli_hopcount(acptr)); /* +s (SERV_NOTICE) is not relayed to us from remote servers, * so we cannot tell if a remote client has that mode set. @@ -471,11 +446,10 @@ /* show the usermodes and account info (but not OperID and sethost) */ umodes = umode_str(acptr, UMODE_AND_ACCOUNT); - ircd_snprintf(0, outbuf, sizeof(outbuf), " Usermode(s):: %s%s", *umodes ? "+" : "", umodes); - send_reply(sptr, RPL_DATASTR, outbuf); + send_reply(sptr, SND_EXPLICIT | RPL_DATASTR, ": Usermode(s):: +%s", umodes); if (cli_user(acptr)->joined == 0) - send_reply(sptr, RPL_DATASTR, " Channel(s):: "); + send_reply(sptr, RPL_DATASTR, ": Channel(s):: "); else if (cli_user(acptr)->joined > 50) { /* NB. As a sanity check, we DO NOT show the individual channels the @@ -485,22 +459,21 @@ * they are on *that* many). */ - ircd_snprintf(0, outbuf, sizeof(outbuf), " Channel(s):: - (total: %u)", cli_user(acptr)->joined); - send_reply(sptr, RPL_DATASTR, outbuf); + send_reply(sptr, SND_EXPLICIT | RPL_DATASTR, ": Channel(s):: - (total: %u)", cli_user(acptr)->joined); } else { char chntext[BUFSIZE]; - int len = strlen(" Channel(s):: "); + int len = strlen(": Channel(s):: "); int mlen = strlen(me.cli_name) + len + strlen(cli_name(sptr)); *chntext = '\0'; - strcpy(chntext, " Channel(s):: "); + strcpy(chntext, ": Channel(s):: "); for (lp = cli_user(acptr)->channel; lp; lp = lp->next_channel) { chptr = lp->channel; if (len + strlen(chptr->chname) + mlen > BUFSIZE - 5) { send_reply(sptr, RPL_DATASTR, chntext); *chntext = '\0'; - strcpy(chntext, " Channel(s):: "); + strcpy(chntext, ": Channel(s):: "); len = strlen(chntext); } if (IsDeaf(acptr)) @@ -530,39 +503,31 @@ if (MyUser(acptr)) { nowr = CurrentTime - cli_user(acptr)->last; - ircd_snprintf(0, outbuf, sizeof(outbuf), " Idle for:: %d days, %02ld:%02ld:%02ld", - nowr / 86400, (nowr / 3600) % 24, (nowr / 60) % 60, nowr % 60); - send_reply(sptr, RPL_DATASTR, outbuf); + send_reply(sptr, SND_EXPLICIT | RPL_DATASTR, ": Idle for:: %d days, %02ld:%02ld:%02ld", + nowr / 86400, (nowr / 3600) % 24, (nowr / 60) % 60, nowr % 60); } /* Away message (if applicable) */ - if (cli_user(acptr)->away) { - ircd_snprintf(0, outbuf, sizeof(outbuf), " Away message:: %s", cli_user(acptr)->away); - send_reply(sptr, RPL_DATASTR, outbuf); - } + if (cli_user(acptr)->away) + send_reply(sptr, SND_EXPLICIT | RPL_DATASTR, ": Away message:: %s", cli_user(acptr)->away); /* If local user.. */ if (MyUser(acptr)) { os_get_peername(con_fd(cli_connect(sptr)), &sin); - send_reply(sptr, RPL_DATASTR, " "); - ircd_snprintf(0, outbuf, sizeof(outbuf), " Ports:: %d -> %d (client -> server)", - sin.port, cli_listener(acptr)->addr.port); - send_reply(sptr, RPL_DATASTR, outbuf); + send_reply(sptr, RPL_DATASTR, ": "); + send_reply(sptr, SND_EXPLICIT | RPL_DATASTR, ": Ports:: %d -> %d (client -> server)", + sin.port, cli_listener(acptr)->addr.port); if (feature_bool(FEAT_EXTENDED_CHECKCMD)) { /* Note: sendq = receiveq for a client (it makes sense really) */ - ircd_snprintf(0, outbuf, sizeof(outbuf), " Data sent:: %lu.%0.3u Kb (%u protocol messages)", - (unsigned long)cli_receiveB(acptr) / 1024, (unsigned long)cli_receiveB(acptr) % 1024, cli_receiveM(acptr)); - send_reply(sptr, RPL_DATASTR, outbuf); - ircd_snprintf(0, outbuf, sizeof(outbuf), " Data received:: %lu.%0.3lu Kb (%u protocol messages)", - (unsigned long)cli_sendB(acptr) / 1024, (unsigned long)cli_sendB(acptr) % 1024, cli_sendM(acptr)); - send_reply(sptr, RPL_DATASTR, outbuf); - ircd_snprintf(0, outbuf, sizeof(outbuf), " receiveQ size:: %d bytes (max. %d bytes)", - DBufLength(&(cli_recvQ(acptr))), feature_int(FEAT_CLIENT_FLOOD)); - send_reply(sptr, RPL_DATASTR, outbuf); - ircd_snprintf(0, outbuf, sizeof(outbuf), " sendQ size:: %d bytes (max. %d bytes)", - DBufLength(&(cli_sendQ(acptr))), get_sendq(acptr)); - send_reply(sptr, RPL_DATASTR, outbuf); + send_reply(sptr, SND_EXPLICIT | RPL_DATASTR, ": Data sent:: %lu.%0.3u Kb (%u protocol messages)", + (unsigned long)cli_receiveB(acptr) / 1024, (unsigned long)cli_receiveB(acptr) % 1024, cli_receiveM(acptr)); + send_reply(sptr, SND_EXPLICIT | RPL_DATASTR, ": Data received:: %lu.%0.3lu Kb (%u protocol messages)", + (unsigned long)cli_sendB(acptr) / 1024, (unsigned long)cli_sendB(acptr) % 1024, cli_sendM(acptr)); + send_reply(sptr, SND_EXPLICIT | RPL_DATASTR, ": receiveQ size:: %d bytes (max. %d bytes)", + DBufLength(&(cli_recvQ(acptr))), feature_int(FEAT_CLIENT_FLOOD)); + send_reply(sptr, SND_EXPLICIT | RPL_DATASTR, ": sendQ size:: %d bytes (max. %d bytes)", + DBufLength(&(cli_sendQ(acptr))), get_sendq(acptr)); } } @@ -571,50 +536,50 @@ } void checkServer(struct Client *sptr, struct Client *acptr) { - char outbuf[BUFSIZE]; /* Header */ - send_reply(sptr, RPL_DATASTR, " "); + send_reply(sptr, RPL_DATASTR, ": "); send_reply(sptr, RPL_CHKHEAD, "server", acptr->cli_name); - send_reply(sptr, RPL_DATASTR, " "); + send_reply(sptr, RPL_DATASTR, ": "); - ircd_snprintf(0, outbuf, sizeof(outbuf), " Connected at:: %s (%Tu)", myctime(acptr->cli_serv->timestamp), acptr->cli_serv->timestamp); - send_reply(sptr, RPL_DATASTR, outbuf); + send_reply(sptr, SND_EXPLICIT | RPL_DATASTR, ": Connected at:: %s [%Tu]", + myctime(acptr->cli_serv->timestamp), acptr->cli_serv->timestamp); - ircd_snprintf(0, outbuf, sizeof(outbuf), " Server name:: %s", acptr->cli_name); - send_reply(sptr, RPL_DATASTR, outbuf); + send_reply(sptr, SND_EXPLICIT | RPL_DATASTR, ": Server name:: %s", acptr->cli_name); - ircd_snprintf(0, outbuf, sizeof(outbuf), " Numeric:: %s --> %d", NumServ(acptr), base64toint(acptr->cli_yxx)); - send_reply(sptr, RPL_DATASTR, outbuf); + send_reply(sptr, SND_EXPLICIT | RPL_DATASTR, ": Numeric:: %s --> %d", + NumServ(acptr), base64toint(acptr->cli_yxx)); - ircd_snprintf(0, outbuf, sizeof(outbuf), " Users:: %d / %d", (acptr == &me) ? UserStats.local_clients : cli_serv(acptr)->clients, + send_reply(sptr, SND_EXPLICIT | RPL_DATASTR, ": Users:: %d / %d", + (acptr == &me) ? UserStats.local_clients : cli_serv(acptr)->clients, base64toint(cli_serv(acptr)->nn_capacity)); - send_reply(sptr, RPL_DATASTR, outbuf); if (IsBurst(acptr)) - send_reply(sptr, RPL_DATASTR, " Status:: Bursting"); + send_reply(sptr, RPL_DATASTR, ": Status:: Bursting"); else if (IsBurstAck(acptr)) - send_reply(sptr, RPL_DATASTR, " Status:: Awaiting EOB Ack"); + send_reply(sptr, RPL_DATASTR, ": Status:: Awaiting EOB Ack"); else if (IsService(acptr)) - send_reply(sptr, RPL_DATASTR, " Status:: Network Service"); + send_reply(sptr, RPL_DATASTR, ": Status:: Network Service"); else if (IsHub(acptr)) - send_reply(sptr, RPL_DATASTR, " Status:: Network Hub"); + send_reply(sptr, RPL_DATASTR, ": Status:: Network Hub"); if (feature_bool(FEAT_EXTENDED_CHECKCMD)) { int dlinkc = 0; struct DLink* slink = NULL; - send_reply(sptr, RPL_DATASTR, " "); - send_reply(sptr, RPL_DATASTR, "Downlinks::"); - for (slink = cli_serv(acptr)->down; slink; slink = slink->next) { - ircd_snprintf(0, outbuf, sizeof(outbuf), "[%d] - %s%s", ++dlinkc, - IsBurst(slink->value.cptr) ? "*" : IsBurstAck(slink->value.cptr) ? "!" : IsService(slink->value.cptr) ? "=" : IsHub(slink->value.cptr) ? "+" : " ", - cli_name(slink->value.cptr)); - send_reply(sptr, RPL_DATASTR, outbuf); - } + send_reply(sptr, RPL_DATASTR, ": "); + send_reply(sptr, RPL_DATASTR, ":Downlinks::"); + for (slink = cli_serv(acptr)->down; slink; slink = slink->next) + send_reply(sptr, SND_EXPLICIT | RPL_DATASTR, ":[%d] - %s%s", + ++dlinkc, + IsBurst(slink->value.cptr) ? "*" : + (IsBurstAck(slink->value.cptr) ? "!" : + (IsService(slink->value.cptr) ? "=" : + (IsHub(slink->value.cptr) ? "+" : " "))), + cli_name(slink->value.cptr)); if (!dlinkc) - send_reply(sptr, RPL_DATASTR, ""); + send_reply(sptr, RPL_DATASTR, ":"); } /* Send 'END OF CHECK' message */ @@ -626,7 +591,6 @@ struct Channel *chptr; struct Membership *lp; int count = 0, found = 0; - char outbuf[BUFSIZE]; char targhost[NICKLEN + USERLEN + HOSTLEN + 3], curhost[NICKLEN + USERLEN + HOSTLEN + 3]; char hoststr[NICKLEN + USERLEN + HOSTLEN + 3]; char nickm[NICKLEN + 1], userm[USERLEN + 1], hostm[HOSTLEN + 1]; @@ -686,8 +650,7 @@ break; if(count >= 500) { /* sanity stuff */ - ircd_snprintf(0, outbuf, sizeof(outbuf), "More than %d results, truncating...", count); - send_reply(sptr, RPL_DATASTR, outbuf); + send_reply(sptr, SND_EXPLICIT | RPL_DATASTR, ":More than %d results, truncating...", count); break; } @@ -718,37 +681,43 @@ /* Show header if we've found at least 1 record */ if (count == 0) { /* Output header */ - send_reply(sptr, RPL_DATASTR, " "); + send_reply(sptr, RPL_DATASTR, ": "); send_reply(sptr, RPL_CHKHEAD, "host", targhost); - send_reply(sptr, RPL_DATASTR, " "); + send_reply(sptr, RPL_DATASTR, ": "); if (flags & CHECK_SHOWMORE) - ircd_snprintf(0, outbuf, sizeof(outbuf), "No. %s nick user@host [IP] (usermodes) :realname", (flags & CHECK_CLONES) ? "[clients]" : ""); + send_reply(sptr, SND_EXPLICIT | RPL_DATASTR, ":No. %s nick user@host [IP] (usermodes) :realname", + (flags & CHECK_CLONES) ? "[clients]" : ""); else - ircd_snprintf(0, outbuf, sizeof(outbuf), "%s %-*s%-*s%s", "No.", (NICKLEN + 2), "Nick", - (USERLEN + 2), "User", "Host"); - send_reply(sptr, RPL_DATASTR, outbuf); + send_reply(sptr, SND_EXPLICIT | RPL_DATASTR, ":%s %-*s%-*s%s", "No.", + (NICKLEN + 2), "Nick", (USERLEN + 2), "User", "Host"); } if (flags & CHECK_SHOWMORE) { /* show more information */ umodes = umode_str(acptr, UMODE_AND_ACCOUNT_SHORT); - ircd_snprintf(0, outbuf, sizeof(outbuf), "%-4d ", (count+1)); if (flags & CHECK_CLONES) - ircd_snprintf(0, outbuf, sizeof(outbuf), "%s[%+3hu] ", outbuf, IPcheck_nr(acptr)); - ircd_snprintf(0, outbuf, sizeof(outbuf), "%s%s %s@%s [%s] (%s%s) :%s", outbuf, - acptr->cli_name, - cli_user(acptr)->realusername, cli_user(acptr)->realhost, - ircd_ntoa(&(cli_ip(acptr))), - *umodes ? "+" : "", umodes, - (flags & CHECK_SHOWSERVER) ? cli_name(cli_user(acptr)->server) : cli_info(acptr)); - } else { + send_reply(sptr, SND_EXPLICIT | RPL_DATASTR, ":%-4d [%+3hu] %s %s@%s [%s] (+%s) :%s", + (count+1), + IPcheck_nr(acptr), + acptr->cli_name, + cli_user(acptr)->realusername, cli_user(acptr)->realhost, + ircd_ntoa(&(cli_ip(acptr))), + umodes, + (flags & CHECK_SHOWSERVER) ? cli_name(cli_user(acptr)->server) : cli_info(acptr)); + else + send_reply(sptr, SND_EXPLICIT | RPL_DATASTR, ":%-4d %s %s@%s [%s] (+%s) :%s", + (count+1), + acptr->cli_name, + cli_user(acptr)->realusername, cli_user(acptr)->realhost, + ircd_ntoa(&(cli_ip(acptr))), + umodes, + (flags & CHECK_SHOWSERVER) ? cli_name(cli_user(acptr)->server) : cli_info(acptr)); + } else /* default output */ - ircd_snprintf(0, outbuf, sizeof(outbuf), "%-4d %-*s%-*s%s", (count+1), (NICKLEN + 2), - acptr->cli_name, (USERLEN + 2), cli_user(acptr)->realusername, - (flags & CHECK_SHOWIPS) ? ircd_ntoa(&(cli_ip(acptr))) : cli_user(acptr)->realhost); - } - send_reply(sptr, RPL_DATASTR, outbuf); + send_reply(sptr, SND_EXPLICIT | RPL_DATASTR, ":%-4d %-*s%-*s%s", + (count+1), (NICKLEN + 2), acptr->cli_name, (USERLEN + 2), cli_user(acptr)->realusername, + (flags & CHECK_SHOWIPS) ? ircd_ntoa(&(cli_ip(acptr))) : cli_user(acptr)->realhost); /* Show channel output (if applicable) - the 50 channel limit sanity check * is specifically to prevent coredumping when someone lamely tries to /check @@ -757,17 +726,17 @@ if (flags & CHECK_CHECKCHAN) { if (cli_user(acptr)->joined > 0 && cli_user(acptr)->joined <= 50) { char chntext[BUFSIZE]; - int len = strlen(" on channels: "); + int len = strlen(": on channels: "); int mlen = strlen(me.cli_name) + len + strlen(sptr->cli_name); *chntext = '\0'; - strcpy(chntext, " on channels: "); + strcpy(chntext, ": on channels: "); for (lp = cli_user(acptr)->channel; lp; lp = lp->next_channel) { chptr = lp->channel; if (len + strlen(chptr->chname) + mlen > BUFSIZE - 5) { send_reply(sptr, RPL_DATASTR, chntext); *chntext = '\0'; - strcpy(chntext, " on channels: "); + strcpy(chntext, ": on channels: "); len = strlen(chntext); } if (IsDeaf(acptr)) @@ -793,7 +762,7 @@ if (chntext[0] != '\0') send_reply(sptr, RPL_DATASTR, chntext); - send_reply(sptr, RPL_DATASTR, " "); + send_reply(sptr, RPL_DATASTR, ": "); } } count++; @@ -801,11 +770,8 @@ } if (count > 0) { - send_reply(sptr, RPL_DATASTR, " "); - - ircd_snprintf(0, outbuf, sizeof(outbuf), "Matching records found:: %d", count); - send_reply(sptr, RPL_DATASTR, outbuf); - + send_reply(sptr, RPL_DATASTR, ": "); + send_reply(sptr, SND_EXPLICIT | RPL_DATASTR, ":Matching records found:: %d", count); send_reply(sptr, RPL_ENDOFCHECK, " "); } diff -r a698927b198f ircd/s_err.c --- a/ircd/s_err.c +++ b/ircd/s_err.c @@ -612,7 +612,7 @@ /* 289 */ { 0 }, /* 290 */ - { RPL_DATASTR, ":%s", "290" }, + { RPL_DATASTR, "%s", "290" }, /* 291 */ { RPL_ENDOFCHECK, ":%s", "291" }, /* 292 */