Skip to content
Snippets Groups Projects
Commit 8e5bab52 authored by Randy Sommerfeld's avatar Randy Sommerfeld
Browse files

Allow commas in Mask= for .ini configs

parent 727ad405
No related branches found
No related tags found
1 merge request!463MRC mods by Codefenix (2024-10-20)
...@@ -250,8 +250,8 @@ function ini_sections() { ...@@ -250,8 +250,8 @@ function ini_sections() {
} }
function ini_Info(arg, ini) { function ini_Info(arg, ini) {
if (ini.ServerName) if (ini.Servername)
ServerName = ini.ServerName; ServerName = ini.Servername;
if (ini.Description) if (ini.Description)
ServerDesc = ini.Description; ServerDesc = ini.Description;
if (ini.Admin1) if (ini.Admin1)
...@@ -305,12 +305,13 @@ function ini_Class(arg, ini) { ...@@ -305,12 +305,13 @@ function ini_Class(arg, ini) {
/* Former I:Line */ /* Former I:Line */
function ini_Allow(arg, ini) { function ini_Allow(arg, ini) {
var ircclass; var ircclass, masks, i;
if (!ini.Mask.match("[@]")) { if (!ini.Mask) {
log(LOG_WARNING, log(LOG_WARNING,format(
"!WARNING Malformed mask in Allow section. Proper format is user@hostname but usually *@*" "!WARNING No mask found in [Allow:%s], ignoring this section.",
); arg
))
return; return;
} }
...@@ -323,18 +324,30 @@ function ini_Allow(arg, ini) { ...@@ -323,18 +324,30 @@ function ini_Allow(arg, ini) {
ircclass = 0; ircclass = 0;
} }
ILines[arg] = new ILine( masks = ini.Mask.split(",");
ini.Mask,
for (i in masks) {
if (!masks[i].match("[@]")) {
log(LOG_WARNING,format(
"!WARNING Malformed mask in [Allow:%s]: %s. Ignoring.",
arg,
masks[i]
));
continue;
}
ILines.push(new ILine(
masks[i],
null, /* password */ null, /* password */
ini.Mask, /* hostmask */ masks[i], /* hostmask */
null, /* port */ null, /* port */
ircclass ircclass
); ));
}
} }
/* Former O:Line */ /* Former O:Line */
function ini_Operator(arg, ini) { function ini_Operator(arg, ini) {
var ircclass; var ircclass, masks, i;
if (!ini.Nick || !ini.Mask || !ini.Password || !ini.Flags || !ini.Class) { if (!ini.Nick || !ini.Mask || !ini.Password || !ini.Flags || !ini.Class) {
log(LOG_WARNING,format( log(LOG_WARNING,format(
...@@ -361,27 +374,39 @@ function ini_Operator(arg, ini) { ...@@ -361,27 +374,39 @@ function ini_Operator(arg, ini) {
ircclass = 0; ircclass = 0;
} }
masks = ini.Mask.split(",");
for (i in masks) {
if (!masks[i].match("[@]")) {
log(LOG_WARNING,format(
"!WARNING Malformed mask in [Operator:%s] %s. Ignored.",
arg,
masks[i]
));
continue;
}
OLines.push(new OLine( OLines.push(new OLine(
ini.Mask, masks[i],
ini.Password, ini.Password,
ini.Nick, ini.Nick,
parse_oline_flags(ini.Flags), parse_oline_flags(ini.Flags),
ircclass ircclass
)); ));
}
return; return;
} }
/* Former U:Line */ /* Former U:Line */
function ini_Services(arg, ini) { function ini_Services(arg, ini) {
if (ini.Server) if (ini.Servername)
ULines.push(ini.Server); ULines.push(ini.Servername);
return; return;
} }
/* Former K:Line & Z:Line */ /* Former K:Line & Z:Line */
function ini_Ban(arg, ini) { function ini_Ban(arg, ini) {
var kline_mask; var kline_mask, masks, i;
if (!ini.Mask) { if (!ini.Mask) {
log(LOG_WARNING,format( log(LOG_WARNING,format(
...@@ -391,13 +416,18 @@ function ini_Ban(arg, ini) { ...@@ -391,13 +416,18 @@ function ini_Ban(arg, ini) {
return; return;
} }
kline_mask = create_ban_mask(ini.Mask, true /* kline */); masks = ini.Mask.split(",");
for (i in masks) {
kline_mask = create_ban_mask(masks[i], true /* kline */);
if (!kline_mask) { if (!kline_mask) {
log(LOG_WARNING,format( log(LOG_WARNING,format(
"!WARNING Invalid ban mask %s Ignoring.", "!WARNING Invalid ban mask in [Ban:%s] %s Ignoring.",
ini.Mask arg,
masks[i]
)); ));
return; continue;
} }
KLines.push(new KLine( KLines.push(new KLine(
...@@ -406,6 +436,7 @@ function ini_Ban(arg, ini) { ...@@ -406,6 +436,7 @@ function ini_Ban(arg, ini) {
"K" /* ban type: K, A, or Z. */ "K" /* ban type: K, A, or Z. */
)); ));
} }
}
/* Former H:Line */ /* Former H:Line */
/* Servermasks are deprecated */ /* Servermasks are deprecated */
...@@ -467,6 +498,8 @@ function ini_Server(arg, ini) { ...@@ -467,6 +498,8 @@ function ini_Server(arg, ini) {
/* Former Q:Lines */ /* Former Q:Lines */
function ini_Restrict(arg, ini) { function ini_Restrict(arg, ini) {
var masks, i;
if (!ini.Mask) { if (!ini.Mask) {
log(LOG_WARNING,format( log(LOG_WARNING,format(
"!WARNING Missing Mask from Restrict:%s. Section ignored.", "!WARNING Missing Mask from Restrict:%s. Section ignored.",
...@@ -474,11 +507,16 @@ function ini_Restrict(arg, ini) { ...@@ -474,11 +507,16 @@ function ini_Restrict(arg, ini) {
)); ));
return; return;
} }
masks = ini.Mask.split(",");
for (i in masks) {
QLines.push(new QLine( QLines.push(new QLine(
ini.Mask, masks[i],
ini.Reason ? ini.Reason : "No reason provided." ini.Reason ? ini.Reason : "No reason provided."
)); ));
} }
}
function ini_RBL(arg, ini) { function ini_RBL(arg, ini) {
if (!ini.Hostname) { if (!ini.Hostname) {
......
...@@ -1448,7 +1448,7 @@ function IRCClient_do_stats(statschar) { ...@@ -1448,7 +1448,7 @@ function IRCClient_do_stats(statschar) {
case "c": case "c":
for (i in CLines) { for (i in CLines) {
this.numeric(213,format( this.numeric(213,format(
"C %s * %s %s %s", "C %s * %s %s %u",
CLines[i].host, CLines[i].host,
CLines[i].servername, CLines[i].servername,
CLines[i].port ? CLines[i].port : "*", CLines[i].port ? CLines[i].port : "*",
...@@ -1456,7 +1456,7 @@ function IRCClient_do_stats(statschar) { ...@@ -1456,7 +1456,7 @@ function IRCClient_do_stats(statschar) {
)); ));
if (NLines[i]) { if (NLines[i]) {
this.numeric(214,format( this.numeric(214,format(
"N %s * %s %s %s", "N %s * %s %s %u",
NLines[i].host, NLines[i].host,
NLines[i].servername, NLines[i].servername,
NLines[i].flags, NLines[i].flags,
...@@ -1479,7 +1479,7 @@ function IRCClient_do_stats(statschar) { ...@@ -1479,7 +1479,7 @@ function IRCClient_do_stats(statschar) {
case "i": case "i":
for (i in ILines) { for (i in ILines) {
this.numeric(215,format( this.numeric(215,format(
"I %s * %s %s %s", "I %s * %s %s %u",
ILines[i].ipmask, ILines[i].ipmask,
ILines[i].hostmask, ILines[i].hostmask,
ILines[i].port ? ILines[i].port : "*", ILines[i].port ? ILines[i].port : "*",
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment