summaryrefslogtreecommitdiff
path: root/src/helperfuncs.cpp
diff options
context:
space:
mode:
authorPeter Powell <petpow@saberuk.com>2018-03-29 19:04:11 +0100
committerPeter Powell <petpow@saberuk.com>2018-04-22 23:38:13 +0100
commit506344a903d3fa2fcb53f22a3a1c8174b1deb357 (patch)
treed75dba71a58ec6c4e29290ee07d8b9c55f9ab080 /src/helperfuncs.cpp
parent6d1c1cb51753f986b86b408a5828373d0066624b (diff)
Improve support for MOTD escape codes.
- Implement escapes for italic, monospace, and strikethrough. - Use the escape codes in the example MOTDs to demonstrate their formatting effects. - Remove support for octal escape codes. In modern computing octal is rarely used and is confusing for users who might confuse it for decimal.
Diffstat (limited to 'src/helperfuncs.cpp')
-rw-r--r--src/helperfuncs.cpp27
1 files changed, 14 insertions, 13 deletions
diff --git a/src/helperfuncs.cpp b/src/helperfuncs.cpp
index e331ba9dc..111e1363f 100644
--- a/src/helperfuncs.cpp
+++ b/src/helperfuncs.cpp
@@ -146,19 +146,20 @@ void InspIRCd::ProcessColors(file_cache& input)
{
std::string character;
std::string replace;
- special_chars(const std::string &c, const std::string &r) : character(c), replace(r) { }
- }
-
- special[] = {
- special_chars("\\002", "\002"), // Bold
- special_chars("\\037", "\037"), // underline
- special_chars("\\003", "\003"), // Color
- special_chars("\\017", "\017"), // Stop colors
- special_chars("\\u", "\037"), // Alias for underline
- special_chars("\\b", "\002"), // Alias for Bold
- special_chars("\\x", "\017"), // Alias for stop
- special_chars("\\c", "\003"), // Alias for color
- special_chars("", "")
+ special_chars(const std::string& c, const std::string& r)
+ : character(c)
+ , replace(r)
+ {
+ }
+ } special[] = {
+ special_chars("\\b", "\x02"), // Bold
+ special_chars("\\c", "\x03"), // Color
+ special_chars("\\i", "\x1D"), // Italic
+ special_chars("\\m", "\x11"), // Monospace
+ special_chars("\\s", "\x1E"), // Strikethrough
+ special_chars("\\u", "\x1F"), // Underline
+ special_chars("\\x", "\x0F"), // Reset
+ special_chars("\\", "")
};
for(file_cache::iterator it = input.begin(), it_end = input.end(); it != it_end; it++)