mirror of
https://github.com/inspircd/inspircd.git
synced 2025-03-10 02:59:01 -04:00
Make blockcolor only block known formatting codes.
This commit is contained in:
parent
babb39cb17
commit
ca0ea6e3d0
@ -65,9 +65,25 @@ public:
|
|||||||
if (!details.IsCTCP(ctcpname, message))
|
if (!details.IsCTCP(ctcpname, message))
|
||||||
message = details.text;
|
message = details.text;
|
||||||
|
|
||||||
for (const auto chr : message)
|
auto it = std::find_if(message.begin(), message.end(), [](const char& chr)
|
||||||
{
|
{
|
||||||
if (static_cast<unsigned char>(chr) < 32)
|
switch (chr)
|
||||||
|
{
|
||||||
|
case '\x02': // Bold
|
||||||
|
case '\x03': // Color
|
||||||
|
case '\x04': // Hex Color
|
||||||
|
case '\x1D': // Italic
|
||||||
|
case '\x11': // Monospace
|
||||||
|
case '\x16': // Reverse
|
||||||
|
case '\x1E': // Strikethrough
|
||||||
|
case '\x1F': // Underline
|
||||||
|
case '\x0F': // Reset
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
return false;
|
||||||
|
});
|
||||||
|
|
||||||
|
if (it != message.end())
|
||||||
{
|
{
|
||||||
if (modeset)
|
if (modeset)
|
||||||
user->WriteNumeric(Numerics::CannotSendTo(c, "messages containing formatting characters", &bc));
|
user->WriteNumeric(Numerics::CannotSendTo(c, "messages containing formatting characters", &bc));
|
||||||
@ -77,7 +93,6 @@ public:
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
|
||||||
return MOD_RES_PASSTHRU;
|
return MOD_RES_PASSTHRU;
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
Loading…
x
Reference in New Issue
Block a user