From 8acd7a02aeda01c0ac828b05c36f10bbacaea70e Mon Sep 17 00:00:00 2001 From: Florent Le Coz Date: Sat, 9 Nov 2013 23:20:12 +0100 Subject: Aaaand, I forgot to add files --- src/bridge/colors.hpp | 21 +++++++++++++++++++++ 1 file changed, 21 insertions(+) create mode 100644 src/bridge/colors.hpp (limited to 'src/bridge/colors.hpp') diff --git a/src/bridge/colors.hpp b/src/bridge/colors.hpp new file mode 100644 index 0000000..a4775e1 --- /dev/null +++ b/src/bridge/colors.hpp @@ -0,0 +1,21 @@ +#ifndef COLORS_INCLUDED +# define COLORS_INCLUDED + +#include + +/** + * A module handling the conversion between IRC colors and XHTML-IM, and vice versa. + */ + +#define IRC_COLOR_BOLD_CHAR '\x02' +#define IRC_COLOR_COLOR_CHAR '\x03' +#define IRC_COLOR_RESET_CHAR '\x0F' +#define IRC_COLOR_FIXED_CHAR '\x11' +#define IRC_COLOR_REVERSE_CHAR '\x12' +#define IRC_COLOR_REVERSE2_CHAR '\x16' +#define IRC_COLOR_ITALIC_CHAR '\x1D' +#define IRC_COLOR_UNDERLINE_CHAR '\x1F' + +void remove_irc_colors(std::string& str); + +#endif // COLORS_INCLUDED -- cgit v1.2.3 From fba01f46468050d4f3b8eb35373ed49a3584868e Mon Sep 17 00:00:00 2001 From: Florent Le Coz Date: Fri, 22 Nov 2013 21:00:07 +0100 Subject: Remove incomplete implementation of remove_irc_colors --- src/bridge/colors.hpp | 1 - 1 file changed, 1 deletion(-) (limited to 'src/bridge/colors.hpp') diff --git a/src/bridge/colors.hpp b/src/bridge/colors.hpp index a4775e1..da4498c 100644 --- a/src/bridge/colors.hpp +++ b/src/bridge/colors.hpp @@ -16,6 +16,5 @@ #define IRC_COLOR_ITALIC_CHAR '\x1D' #define IRC_COLOR_UNDERLINE_CHAR '\x1F' -void remove_irc_colors(std::string& str); #endif // COLORS_INCLUDED -- cgit v1.2.3 From e6f20d3c0fd4ba8696a4410a366741c9b9f3562d Mon Sep 17 00:00:00 2001 From: Florent Le Coz Date: Fri, 22 Nov 2013 21:00:32 +0100 Subject: Implement IRC format to xhtml-im conversion The generated XML is very verbose because each IRC formatting tag makes us close a element and reopen it with the new style applied. However, this works quite well and is easy to implement. --- src/bridge/colors.hpp | 56 +++++++++++++++++++++++++++++++++++++++++---------- 1 file changed, 45 insertions(+), 11 deletions(-) (limited to 'src/bridge/colors.hpp') diff --git a/src/bridge/colors.hpp b/src/bridge/colors.hpp index da4498c..82e6faf 100644 --- a/src/bridge/colors.hpp +++ b/src/bridge/colors.hpp @@ -1,20 +1,54 @@ #ifndef COLORS_INCLUDED # define COLORS_INCLUDED -#include - /** - * A module handling the conversion between IRC colors and XHTML-IM, and vice versa. + * A module handling the conversion between IRC colors and XHTML-IM, and + * vice versa. */ -#define IRC_COLOR_BOLD_CHAR '\x02' -#define IRC_COLOR_COLOR_CHAR '\x03' -#define IRC_COLOR_RESET_CHAR '\x0F' -#define IRC_COLOR_FIXED_CHAR '\x11' -#define IRC_COLOR_REVERSE_CHAR '\x12' -#define IRC_COLOR_REVERSE2_CHAR '\x16' -#define IRC_COLOR_ITALIC_CHAR '\x1D' -#define IRC_COLOR_UNDERLINE_CHAR '\x1F' +#include +#include +#include + +class XmlNode; + +namespace Xmpp +{ +// Contains: +// - an XMPP-valid UTF-8 body +// - an XML node representing the XHTML-IM body, or null + typedef std::tuple> body; +} +#define IRC_FORMAT_BOLD_CHAR '\x02' // done +#define IRC_FORMAT_COLOR_CHAR '\x03' // done +#define IRC_FORMAT_RESET_CHAR '\x0F' // done +#define IRC_FORMAT_FIXED_CHAR '\x11' // ?? +#define IRC_FORMAT_REVERSE_CHAR '\x12' // maybe one day +#define IRC_FORMAT_REVERSE2_CHAR '\x16' // wat +#define IRC_FORMAT_ITALIC_CHAR '\x1D' // done +#define IRC_FORMAT_UNDERLINE_CHAR '\x1F' // done + +static const char irc_format_char[] = { + IRC_FORMAT_BOLD_CHAR, + IRC_FORMAT_COLOR_CHAR, + IRC_FORMAT_RESET_CHAR, + IRC_FORMAT_FIXED_CHAR, + IRC_FORMAT_REVERSE_CHAR, + IRC_FORMAT_REVERSE2_CHAR, + IRC_FORMAT_ITALIC_CHAR, + IRC_FORMAT_UNDERLINE_CHAR, + '\x00' +}; + +/** + * Convert the passed string into an XML tree representing the XHTML version + * of the message, converting the IRC colors symbols into xhtml-im + * formatting. + * + * Returns the body cleaned from any IRC formatting (but without any xhtml), + * and the body as XHTML-IM + */ +Xmpp::body irc_format_to_xhtmlim(const std::string& str); #endif // COLORS_INCLUDED -- cgit v1.2.3 From 3d9183557f3ad9b599c812c03a445453e7d4f703 Mon Sep 17 00:00:00 2001 From: Emmanuel Gil Peyrot Date: Sun, 8 Jun 2014 05:35:36 +0200 Subject: Convert \n to
in xhtml body fix #2539 --- src/bridge/colors.hpp | 2 ++ 1 file changed, 2 insertions(+) (limited to 'src/bridge/colors.hpp') diff --git a/src/bridge/colors.hpp b/src/bridge/colors.hpp index 82e6faf..b5e6e7b 100644 --- a/src/bridge/colors.hpp +++ b/src/bridge/colors.hpp @@ -28,6 +28,7 @@ namespace Xmpp #define IRC_FORMAT_REVERSE2_CHAR '\x16' // wat #define IRC_FORMAT_ITALIC_CHAR '\x1D' // done #define IRC_FORMAT_UNDERLINE_CHAR '\x1F' // done +#define IRC_FORMAT_NEWLINE_CHAR '\n' // done static const char irc_format_char[] = { IRC_FORMAT_BOLD_CHAR, @@ -38,6 +39,7 @@ static const char irc_format_char[] = { IRC_FORMAT_REVERSE2_CHAR, IRC_FORMAT_ITALIC_CHAR, IRC_FORMAT_UNDERLINE_CHAR, + IRC_FORMAT_NEWLINE_CHAR, '\x00' }; -- cgit v1.2.3 From e7a91badcdd421e04eea8235debc8ae582919744 Mon Sep 17 00:00:00 2001 From: Florent Le Coz Date: Sat, 24 Oct 2015 15:21:05 +0200 Subject: =?UTF-8?q?Use=20=E2=80=9Cusing=E2=80=9D=20instead=20of=20typedef?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/bridge/colors.hpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'src/bridge/colors.hpp') diff --git a/src/bridge/colors.hpp b/src/bridge/colors.hpp index b5e6e7b..2ba80ee 100644 --- a/src/bridge/colors.hpp +++ b/src/bridge/colors.hpp @@ -17,7 +17,7 @@ namespace Xmpp // Contains: // - an XMPP-valid UTF-8 body // - an XML node representing the XHTML-IM body, or null - typedef std::tuple> body; + using body = std::tuple>; } #define IRC_FORMAT_BOLD_CHAR '\x02' // done -- cgit v1.2.3 From 81f8f45b371d1a0ef72c2768fbd1f9188fe83616 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?louiz=E2=80=99?= Date: Mon, 4 Jul 2016 17:53:53 +0200 Subject: Replace all include guards by #pragma once MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit It’s $CURRENT_YEAR --- src/bridge/colors.hpp | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) (limited to 'src/bridge/colors.hpp') diff --git a/src/bridge/colors.hpp b/src/bridge/colors.hpp index 2ba80ee..e2c8a87 100644 --- a/src/bridge/colors.hpp +++ b/src/bridge/colors.hpp @@ -1,5 +1,5 @@ -#ifndef COLORS_INCLUDED -# define COLORS_INCLUDED +#pragma once + /** * A module handling the conversion between IRC colors and XHTML-IM, and @@ -53,4 +53,4 @@ static const char irc_format_char[] = { */ Xmpp::body irc_format_to_xhtmlim(const std::string& str); -#endif // COLORS_INCLUDED + -- cgit v1.2.3