summaryrefslogtreecommitdiff
path: root/src/plugins
diff options
context:
space:
mode:
authorSebastien Helleu <flashcode@flashtux.org>2009-03-07 00:18:19 +0100
committerSebastien Helleu <flashcode@flashtux.org>2009-03-07 00:18:19 +0100
commit997434ef8b1706d47274ede37a009dc883003c82 (patch)
tree94e01f55f8601faaf6a02dbaafdba292c4407bb6 /src/plugins
parent780a7478ee02952c23ff7b71d1ec7bc02fdad5ce (diff)
downloadweechat-997434ef8b1706d47274ede37a009dc883003c82.zip
Fix bug with text attribute in IRC messages: toggle attribute instead of always forcing it to on (bug #25770)
Diffstat (limited to 'src/plugins')
-rw-r--r--src/plugins/irc/irc-color.c29
1 files changed, 23 insertions, 6 deletions
diff --git a/src/plugins/irc/irc-color.c b/src/plugins/irc/irc-color.c
index f1f06eeec..6e1fe3d4c 100644
--- a/src/plugins/irc/irc-color.c
+++ b/src/plugins/irc/irc-color.c
@@ -54,7 +54,7 @@ char *irc_color_to_weechat[IRC_NUM_COLORS] =
* irc_color_decode: replace IRC colors by WeeChat colors
* if keep_colors == 0: remove any color/style in message
* otherwise: keep colors
- * Note: after use, string returned has to be free()
+x * Note: after use, string returned has to be free()
*/
char *
@@ -63,13 +63,18 @@ irc_color_decode (const char *string, int keep_colors)
unsigned char *out, *ptr_string;
int out_length, length, out_pos;
char str_fg[3], str_bg[3], str_color[128];
- int fg, bg;
+ int fg, bg, bold, reverse, italic, underline;
out_length = (strlen (string) * 2) + 1;
out = malloc (out_length);
if (!out)
return NULL;
+ bold = 0;
+ reverse = 0;
+ italic = 0;
+ underline = 0;
+
ptr_string = (unsigned char *)string;
out[0] = '\0';
while (ptr_string && ptr_string[0])
@@ -78,12 +83,18 @@ irc_color_decode (const char *string, int keep_colors)
{
case IRC_COLOR_BOLD_CHAR:
if (keep_colors)
- strcat ((char *)out, weechat_color("bold"));
+ strcat ((char *)out,
+ weechat_color((bold) ? "-bold" : "bold"));
+ bold ^= 1;
ptr_string++;
break;
case IRC_COLOR_RESET_CHAR:
if (keep_colors)
strcat ((char *)out, weechat_color("reset"));
+ bold = 0;
+ reverse = 0;
+ italic = 0;
+ underline = 0;
ptr_string++;
break;
case IRC_COLOR_FIXED_CHAR:
@@ -92,17 +103,23 @@ irc_color_decode (const char *string, int keep_colors)
case IRC_COLOR_REVERSE_CHAR:
case IRC_COLOR_REVERSE2_CHAR:
if (keep_colors)
- strcat ((char *)out, weechat_color("reverse"));
+ strcat ((char *)out,
+ weechat_color((reverse) ? "-reverse" : "reverse"));
+ reverse ^= 1;
ptr_string++;
break;
case IRC_COLOR_ITALIC_CHAR:
if (keep_colors)
- strcat ((char *)out, weechat_color("italic"));
+ strcat ((char *)out,
+ weechat_color((italic) ? "-italic" : "italic"));
+ italic ^= 1;
ptr_string++;
break;
case IRC_COLOR_UNDERLINE_CHAR:
if (keep_colors)
- strcat ((char *)out, weechat_color("underline"));
+ strcat ((char *)out,
+ weechat_color((underline) ? "-underline" : "underline"));
+ underline ^= 1;
ptr_string++;
break;
case IRC_COLOR_COLOR_CHAR: