1
0
mirror of https://github.com/weechat/weechat.git synced 2026-07-01 07:16:37 +02:00

irc: remove function irc_color_decode_for_user_entry

Since commits d03eb52d49 and
0c48b7ab8b, the IRC color codes are the
same in input line and messages, so the function
irc_color_decode_for_user_entry is not needed any more.
It was used only to decode colors when completing the command /topic
(with the channel topic).
This commit is contained in:
Sebastien Helleu
2013-12-04 07:51:59 +01:00
parent 03fa2448ef
commit 57cda6a331
3 changed files with 2 additions and 74 deletions
-68
View File
@@ -262,74 +262,6 @@ irc_color_decode (const char *string, int keep_colors)
return (char *)out;
}
/*
* Replaces IRC color codes by codes for command line.
*
* Note: result must be freed after use.
*/
char *
irc_color_decode_for_user_entry (const char *string)
{
unsigned char *out, *ptr_string;
int out_length, out_pos, length;
if (!string)
return NULL;
out_length = (strlen (string) * 2) + 1;
out = malloc (out_length);
if (!out)
return NULL;
ptr_string = (unsigned char *)string;
out_pos = 0;
while (ptr_string && ptr_string[0] && (out_pos < out_length - 1))
{
switch (ptr_string[0])
{
case IRC_COLOR_BOLD_CHAR:
out[out_pos++] = 0x02;
ptr_string++;
break;
case IRC_COLOR_FIXED_CHAR:
ptr_string++;
break;
case IRC_COLOR_RESET_CHAR:
out[out_pos++] = 0x0F;
ptr_string++;
break;
case IRC_COLOR_REVERSE_CHAR:
out[out_pos++] = 0x16;
ptr_string++;
break;
case IRC_COLOR_ITALIC_CHAR:
out[out_pos++] = 0x1D;
ptr_string++;
break;
case IRC_COLOR_UNDERLINE_CHAR:
out[out_pos++] = 0x1F;
ptr_string++;
break;
case IRC_COLOR_COLOR_CHAR:
out[out_pos++] = 0x03;
ptr_string++;
break;
default:
length = weechat_utf8_char_size ((char *)ptr_string);
if (length == 0)
length = 1;
memcpy (out + out_pos, ptr_string, length);
out_pos += length;
ptr_string += length;
}
}
out[out_pos] = '\0';
return (char *)out;
}
/*
* Replaces color codes in command line by IRC color codes.
*
-1
View File
@@ -87,7 +87,6 @@
#define IRC_COLOR_ITEM_LAG_FINISHED weechat_color(weechat_config_string(irc_config_color_item_lag_finished))
extern char *irc_color_decode (const char *string, int keep_colors);
extern char *irc_color_decode_for_user_entry (const char *string);
extern char *irc_color_encode (const char *string, int keep_colors);
extern char *irc_color_modifier_cb (void *data, const char *modifier,
const char *modifier_data,
+2 -5
View File
@@ -409,7 +409,7 @@ irc_completion_channel_topic_cb (void *data, const char *completion_item,
struct t_gui_buffer *buffer,
struct t_gui_completion *completion)
{
char *topic, *topic_color;
char *topic;
int length;
IRC_BUFFER_GET_SERVER_CHANNEL(buffer);
@@ -442,12 +442,9 @@ irc_completion_channel_topic_cb (void *data, const char *completion_item,
else
topic = strdup (ptr_channel->topic);
topic_color = irc_color_decode_for_user_entry ((topic) ? topic : ptr_channel->topic);
weechat_hook_completion_list_add (completion,
(topic_color) ? topic_color : ((topic) ? topic : ptr_channel->topic),
(topic) ? topic : ptr_channel->topic,
0, WEECHAT_LIST_POS_SORT);
if (topic_color)
free (topic_color);
if (topic)
free (topic);
}