Skip to content
Permalink
Browse files

Replace WeeChat color codes by "?" in incoming IRC messages (bug #25862)

  • Loading branch information...
flashcode committed Mar 18, 2009
1 parent a394ed5 commit cefb8a50f24009a3a7d5f8e3a1f686788efa9b55
Showing with 8 additions and 2 deletions.
  1. +8 −2 src/plugins/irc/irc-color.c
@@ -54,12 +54,13 @@ 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
x * Note: after use, string returned has to be free()
* Note: after use, string returned has to be free()
*/

char *
irc_color_decode (const char *string, int keep_colors)
{
char *string_without_weechat_colors;
unsigned char *out, *ptr_string;
int out_length, length, out_pos;
char str_fg[3], str_bg[3], str_color[128];
@@ -75,7 +76,9 @@ irc_color_decode (const char *string, int keep_colors)
italic = 0;
underline = 0;

ptr_string = (unsigned char *)string;
string_without_weechat_colors = weechat_string_remove_color (string, "?");
ptr_string = (string_without_weechat_colors) ?
(unsigned char *)string_without_weechat_colors : (unsigned char *)string;
out[0] = '\0';
while (ptr_string && ptr_string[0])
{
@@ -193,6 +196,9 @@ irc_color_decode (const char *string, int keep_colors)
}
}

if (string_without_weechat_colors)
free (string_without_weechat_colors);

return (char *)out;
}

0 comments on commit cefb8a5

Please sign in to comment.
You can’t perform that action at this time.