Remove incomplete implementation of remove_irc_colors
This commit is contained in:
@@ -28,7 +28,6 @@ std::string Bridge::sanitize_for_xmpp(const std::string& str)
|
|||||||
res = str;
|
res = str;
|
||||||
else
|
else
|
||||||
res = utils::convert_to_utf8(str, "ISO-8859-1");
|
res = utils::convert_to_utf8(str, "ISO-8859-1");
|
||||||
remove_irc_colors(res);
|
|
||||||
return res;
|
return res;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -3,22 +3,5 @@
|
|||||||
|
|
||||||
#include <iostream>
|
#include <iostream>
|
||||||
|
|
||||||
void remove_irc_colors(std::string& str)
|
|
||||||
{
|
{
|
||||||
auto it = std::remove_if(str.begin(), str.end(),
|
|
||||||
[](const char c)
|
|
||||||
{
|
|
||||||
if (c == IRC_COLOR_BOLD_CHAR || c == IRC_COLOR_COLOR_CHAR ||
|
|
||||||
c == IRC_COLOR_FIXED_CHAR || c == IRC_COLOR_RESET_CHAR ||
|
|
||||||
c == IRC_COLOR_REVERSE_CHAR || c == IRC_COLOR_REVERSE2_CHAR ||
|
|
||||||
c == IRC_COLOR_UNDERLINE_CHAR || c == IRC_COLOR_ITALIC_CHAR ||
|
|
||||||
// HACK: until we properly handle things
|
|
||||||
// like ^AVERSION^A, remove the ^A chars
|
|
||||||
// here.
|
|
||||||
c == '\u0001')
|
|
||||||
return true;
|
|
||||||
return false;
|
|
||||||
}
|
|
||||||
);
|
|
||||||
str.erase(it, str.end());
|
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -16,6 +16,5 @@
|
|||||||
#define IRC_COLOR_ITALIC_CHAR '\x1D'
|
#define IRC_COLOR_ITALIC_CHAR '\x1D'
|
||||||
#define IRC_COLOR_UNDERLINE_CHAR '\x1F'
|
#define IRC_COLOR_UNDERLINE_CHAR '\x1F'
|
||||||
|
|
||||||
void remove_irc_colors(std::string& str);
|
|
||||||
|
|
||||||
#endif // COLORS_INCLUDED
|
#endif // COLORS_INCLUDED
|
||||||
|
|||||||
@@ -44,10 +44,6 @@ int main()
|
|||||||
std::string from_ascii = utils::convert_to_utf8(original_latin1, "US-ASCII");
|
std::string from_ascii = utils::convert_to_utf8(original_latin1, "US-ASCII");
|
||||||
assert(from_ascii == "couc�ou");
|
assert(from_ascii == "couc�ou");
|
||||||
|
|
||||||
std::string coucou("\u0002\u0002COUCOU\u0003");
|
|
||||||
remove_irc_colors(coucou);
|
|
||||||
assert(coucou == "COUCOU");
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Utils
|
* Utils
|
||||||
*/
|
*/
|
||||||
|
|||||||
Reference in New Issue
Block a user