1
0
mirror of https://github.com/unrealircd/unrealircd.git synced 2026-07-02 21:13:12 +02:00

More sendnumeric() and sendnumericfmt() conversions.

This commit is contained in:
Bram Matthys
2019-05-22 17:09:12 +02:00
parent 4a11309344
commit 418b42e5bf
10 changed files with 44 additions and 78 deletions
+3 -5
View File
@@ -136,14 +136,12 @@ CMD_FUNC(m_dccallow)
if (!didlist && !myncmp(s, "list", 4))
{
didanything = didlist = 1;
sendto_one(sptr, ":%s %d %s :The following users are on your dcc allow list:",
me.name, RPL_DCCINFO, sptr->name);
sendnumericfmt(sptr, RPL_DCCINFO, "The following users are on your dcc allow list:");
for(lp = sptr->user->dccallow; lp; lp = lp->next)
{
if (lp->flags == DCC_LINK_REMOTE)
continue;
sendto_one(sptr, ":%s %d %s :%s (%s@%s)", me.name,
RPL_DCCLIST, sptr->name, lp->value.cptr->name,
sendnumericfmt(sptr, RPL_DCCLIST, "%s (%s@%s)", lp->value.cptr->name,
lp->value.cptr->user->username,
GetHost(lp->value.cptr));
}
@@ -153,7 +151,7 @@ CMD_FUNC(m_dccallow)
{
didanything = didhelp = 1;
for(ptr = dcc_help; *ptr; ptr++)
sendto_one(sptr, ":%s %d %s :%s", me.name, RPL_DCCINFO, sptr->name, *ptr);
sendnumericfmt(sptr, RPL_DCCINFO, "%s", *ptr);
sendnumeric(sptr, RPL_ENDOFDCCLIST, s);
}
}
+2 -2
View File
@@ -136,8 +136,8 @@ CMD_FUNC(m_ircops)
opers, opers != 1 ? "s" : "",
aways);
sendto_one(sptr, ":%s %d %s :%s", me.name, RPL_TEXT, sptr->name, buf);
sendto_one(sptr, ":%s %d %s :End of /IRCOPS list", me.name, RPL_TEXT, sptr->name);
sendnumericfmt(sptr, RPL_TEXT, "%s", buf);
sendnumericfmt(sptr, RPL_TEXT, "End of /IRCOPS list");
return 0;
}
+6 -11
View File
@@ -614,10 +614,8 @@ int size_string, ret;
if ((fl = dcc_isforbidden(sptr, realfile)))
{
char *displayfile = dcc_displayfile(realfile);
sendto_one(sptr,
":%s %d %s :*** Cannot DCC SEND file %s to %s (%s)",
me.name, RPL_TEXT,
sptr->name, displayfile, target, fl->reason);
sendnumericfmt(sptr,
RPL_TEXT, "*** Cannot DCC SEND file %s to %s (%s)", displayfile, target, fl->reason);
sendnotice(sptr, "*** You have been blocked from sending files, reconnect to regain permission to send files");
sptr->flags |= FLAGS_DCCBLOCK;
@@ -630,10 +628,8 @@ int size_string, ret;
if (!targetcli && ((fl = dcc_isdiscouraged(sptr, realfile))))
{
char *displayfile = dcc_displayfile(realfile);
sendto_one(sptr,
":%s %d %s :*** Cannot DCC SEND file %s to %s (%s)",
me.name, RPL_TEXT,
sptr->name, displayfile, target, fl->reason);
sendnumericfmt(sptr,
RPL_TEXT, "*** Cannot DCC SEND file %s to %s (%s)", displayfile, target, fl->reason);
return 0; /* block */
}
return 1; /* allowed */
@@ -686,9 +682,8 @@ int size_string;
if (!on_dccallow_list(to, from))
{
char *displayfile = dcc_displayfile(realfile);
sendto_one(from,
":%s %d %s :*** Cannot DCC SEND file %s to %s (%s)",
me.name, RPL_TEXT, from->name, displayfile, to->name, fl->reason);
sendnumericfmt(from,
RPL_TEXT, "*** Cannot DCC SEND file %s to %s (%s)", displayfile, to->name, fl->reason);
sendnotice(from, "User %s is currently not accepting DCC SENDs with such a filename/filetype from you. "
"Your file %s was not sent.", to->name, displayfile);
sendnotice(to, "%s (%s@%s) tried to DCC SEND you a file named '%s', the request has been blocked.",
+1 -3
View File
@@ -93,9 +93,7 @@ CMD_FUNC(m_motd)
/* tm_year should be zero only if the struct is zero-ed */
if (themotd && themotd->lines && themotd->last_modified.tm_year)
{
sendto_one(sptr, ":%s %d %s :- %d/%d/%d %d:%02d",
me.name, RPL_MOTD, sptr->name,
themotd->last_modified.tm_mday,
sendnumericfmt(sptr, RPL_MOTD, "- %d/%d/%d %d:%02d", themotd->last_modified.tm_mday,
themotd->last_modified.tm_mon + 1,
themotd->last_modified.tm_year + 1900,
themotd->last_modified.tm_hour,
+1 -1
View File
@@ -189,7 +189,7 @@ CMD_FUNC(m_oper)
/* Check oper::require_modes */
if (operblock->require_modes & ~sptr->umodes)
{
sendto_one(sptr, ":%s %d %s :You are missing user modes required to OPER", me.name, ERR_NOOPERHOST, sptr->name);
sendnumericfmt(sptr, ERR_NOOPERHOST, "You are missing user modes required to OPER");
sendto_snomask_global
(SNO_OPER, "Failed OPER attempt by %s (%s@%s) [lacking modes '%s' in oper::require-modes]",
sptr->name, sptr->user->username, sptr->local->sockhost, get_modestr(operblock->require_modes & ~sptr->umodes));
+1 -2
View File
@@ -390,8 +390,7 @@ int parse2(aClient *cptr, aClient **fromptr, MessageTag *mtags, char *ch, char *
** of notices -- Syzop.
*/
if (!IsRegistered(cptr) && stricmp(ch, "NOTICE")) {
sendto_one(from, ":%s %d %s :You have not registered",
me.name, ERR_NOTREGISTERED, ch);
sendnumericfmt(from, ERR_NOTREGISTERED, "You have not registered");
parse_addlag(cptr, bytes);
return -1;
}
+1 -1
View File
@@ -509,7 +509,7 @@ static char *replies[] = {
/* 462 ERR_ALREADYREGISTRED */ ":You may not reregister",
/* 463 ERR_NOPERMFORHOST */ ":Your host isn't among the privileged",
/* 464 ERR_PASSWDMISMATCH */ ":Password Incorrect",
/* 465 ERR_YOUREBANNEDCREEP */ ":You are banned from this server. Mail %s for more information",
/* 465 ERR_YOUREBANNEDCREEP */ ":%s",
/* 466 */ NULL, /* rfc1459 */
/* 467 ERR_KEYSET */ "%s :Channel key already set",
/* 468 ERR_ONLYSERVERSCANCHANGE */ "%s :Only servers can change that mode",
+1 -2
View File
@@ -224,8 +224,7 @@ int found = 0;
}
if (!found)
{
sendto_one(sptr, ":%s %d %s :%s is not in your DCC allow list",
me.name, RPL_DCCINFO, sptr->name, optr->name);
sendnumericfmt(sptr, RPL_DCCINFO, "%s is not in your DCC allow list", optr->name);
return 0;
}
+1 -4
View File
@@ -1203,10 +1203,7 @@ int banned_client(aClient *acptr, char *bantype, char *reason, int global, int n
*/
if (noexit != NO_EXIT_CLIENT)
{
sendto_one(acptr,":%s %d %s :%s",
me.name, ERR_YOUREBANNEDCREEP,
(*acptr->name ? acptr->name : "*"),
buf);
sendnumeric(acptr, ERR_YOUREBANNEDCREEP, buf);
sendnotice(acptr, "%s", buf);
} else {
send_raw_direct(acptr, ":%s %d %s :%s",
+27 -47
View File
@@ -280,38 +280,26 @@ void m_info_send(aClient *sptr)
{
char **text = unrealinfo;
sendto_one(sptr, ":%s %d %s :========== %s ==========",
me.name, RPL_INFO, sptr->name, IRCDTOTALVERSION);
sendnumericfmt(sptr, RPL_INFO, "========== %s ==========", IRCDTOTALVERSION);
while (*text)
sendto_one(sptr, ":%s %d %s :| %s",
me.name, RPL_INFO, sptr->name, *text++);
sendnumericfmt(sptr, RPL_INFO, "| %s", *text++);
sendto_one(sptr, ":%s %d %s :|", me.name, RPL_INFO, sptr->name);
sendto_one(sptr, ":%s %d %s :|", me.name, RPL_INFO, sptr->name);
sendto_one(sptr, ":%s %d %s :| Credits - Type /Credits",
me.name, RPL_INFO, sptr->name);
sendto_one(sptr, ":%s %d %s :| DALnet Credits - Type /DalInfo",
me.name, RPL_INFO, sptr->name);
sendto_one(sptr, ":%s %d %s :|", me.name, RPL_INFO, sptr->name);
sendto_one(sptr, ":%s %d %s :| This is an UnrealIRCd-style server",
me.name, RPL_INFO, sptr->name);
sendto_one(sptr, ":%s %d %s :| If you find any bugs, please report them at:",
me.name, RPL_INFO, sptr->name);
sendto_one(sptr, ":%s %d %s :| https://bugs.unrealircd.org/",
me.name, RPL_INFO, sptr->name);
sendto_one(sptr,
":%s %d %s :| UnrealIRCd Homepage: https://www.unrealircd.org",
me.name, RPL_INFO, sptr->name);
sendto_one(sptr,
":%s %d %s :============================================", me.name,
RPL_INFO, sptr->name);
sendto_one(sptr, ":%s %d %s :Birth Date: %s, compile # %s", me.name,
RPL_INFO, sptr->name, creation, generation);
sendto_one(sptr, ":%s %d %s :On-line since %s", me.name, RPL_INFO,
sptr->name, myctime(me.local->firsttime));
sendto_one(sptr, ":%s %d %s :ReleaseID (%s)", me.name, RPL_INFO,
sptr->name, buildid);
sendnumericfmt(sptr, RPL_INFO, "|");
sendnumericfmt(sptr, RPL_INFO, "|");
sendnumericfmt(sptr, RPL_INFO, "| Credits - Type /Credits");
sendnumericfmt(sptr, RPL_INFO, "| DALnet Credits - Type /DalInfo");
sendnumericfmt(sptr, RPL_INFO, "|");
sendnumericfmt(sptr, RPL_INFO, "| This is an UnrealIRCd-style server");
sendnumericfmt(sptr, RPL_INFO, "| If you find any bugs, please report them at:");
sendnumericfmt(sptr, RPL_INFO, "| https://bugs.unrealircd.org/");
sendnumericfmt(sptr,
RPL_INFO, "| UnrealIRCd Homepage: https://www.unrealircd.org");
sendnumericfmt(sptr,
RPL_INFO, "============================================");
sendnumericfmt(sptr, RPL_INFO, "Birth Date: %s, compile # %s", creation, generation);
sendnumericfmt(sptr, RPL_INFO, "On-line since %s", myctime(me.local->firsttime));
sendnumericfmt(sptr, RPL_INFO, "ReleaseID (%s)", buildid);
sendnumeric(sptr, RPL_ENDOFINFO);
}
@@ -351,11 +339,9 @@ CMD_FUNC(m_dalinfo)
sendnumeric(sptr, RPL_INFO, *text++);
sendnumeric(sptr, RPL_INFO, "");
sendto_one(sptr,
":%s %d %s :Birth Date: %s, compile # %s",
me.name, RPL_INFO, sptr->name, creation, generation);
sendto_one(sptr, ":%s %d %s :On-line since %s",
me.name, RPL_INFO, sptr->name, myctime(me.local->firsttime));
sendnumericfmt(sptr,
RPL_INFO, "Birth Date: %s, compile # %s", creation, generation);
sendnumericfmt(sptr, RPL_INFO, "On-line since %s", myctime(me.local->firsttime));
sendnumeric(sptr, RPL_ENDOFINFO);
}
@@ -402,11 +388,9 @@ CMD_FUNC(m_credits)
sendnumeric(sptr, RPL_INFO, *text++);
sendnumeric(sptr, RPL_INFO, "");
sendto_one(sptr,
":%s %d %s :Birth Date: %s, compile # %s",
me.name, RPL_INFO, sptr->name, creation, generation);
sendto_one(sptr, ":%s %d %s :On-line since %s",
me.name, RPL_INFO, sptr->name, myctime(me.local->firsttime));
sendnumericfmt(sptr,
RPL_INFO, "Birth Date: %s, compile # %s", creation, generation);
sendnumericfmt(sptr, RPL_INFO, "On-line since %s", myctime(me.local->firsttime));
sendnumeric(sptr, RPL_ENDOFINFO);
}
@@ -899,16 +883,13 @@ int short_motd(aClient *sptr)
if (themotd->last_modified.tm_year)
{
tm = &themotd->last_modified; /* for readability */
sendnumeric(sptr, RPL_MOTDSTART,
me.name);
sendto_one(sptr, ":%s %d %s :- %d/%d/%d %d:%02d", me.name,
RPL_MOTD, sptr->name, tm->tm_mday, tm->tm_mon + 1,
sendnumeric(sptr, RPL_MOTDSTART, me.name);
sendnumericfmt(sptr, RPL_MOTD, "- %d/%d/%d %d:%02d", tm->tm_mday, tm->tm_mon + 1,
1900 + tm->tm_year, tm->tm_hour, tm->tm_min);
}
if (is_short)
{
sendnumeric(sptr, RPL_MOTD,
"This is the short MOTD. To view the complete MOTD type /motd");
sendnumeric(sptr, RPL_MOTD, "This is the short MOTD. To view the complete MOTD type /motd");
sendnumeric(sptr, RPL_MOTD, "");
}
@@ -917,8 +898,7 @@ int short_motd(aClient *sptr)
motdline = themotd->lines;
while (motdline)
{
sendnumeric(sptr, RPL_MOTD,
motdline->line);
sendnumeric(sptr, RPL_MOTD, motdline->line);
motdline = motdline->next;
}
sendnumeric(sptr, RPL_ENDOFMOTD);