1
0
mirror of https://github.com/weechat/weechat.git synced 2026-07-10 11:43:13 +02:00

Fixed some bugs with color codes:

- colors are now removed in topic for display in title bar
- completion of /topic command now strips color codes
- color codes are encoded in commands (not only text sent to channel/pv)
- double '%' is replaced by single '%' in command line (when irc_colors_send is ON)
This commit is contained in:
Sebastien Helleu
2005-11-05 11:34:52 +00:00
parent fd562722d0
commit bea5769a05
16 changed files with 1532 additions and 1466 deletions
+20 -1
View File
@@ -481,7 +481,7 @@ int
exec_weechat_command (t_irc_server *server, char *string)
{
int i, argc, return_code, length1, length2;
char *command, *pos, *ptr_args, **argv, *alias_command;
char *command, *pos, *ptr_args, *ptr_args_color, **argv, *alias_command;
t_weechat_alias *ptr_alias;
if ((!string) || (!string[0]) || (string[0] != '/'))
@@ -512,6 +512,15 @@ exec_weechat_command (t_irc_server *server, char *string)
ptr_args = NULL;
}
ptr_args_color = NULL;
if (ptr_args && (cfg_irc_colors_send))
{
ptr_args_color = (char *)gui_color_encode ((unsigned char *)ptr_args);
if (ptr_args_color)
ptr_args = ptr_args_color;
}
#ifdef PLUGINS
if (!plugin_cmd_handler_exec ((server) ? server->name : "", command + 1, ptr_args))
#else
@@ -572,6 +581,8 @@ exec_weechat_command (t_irc_server *server, char *string)
}
free_exploded_string (argv);
free (command);
if (ptr_args_color)
free (ptr_args_color);
return 1;
}
}
@@ -619,6 +630,8 @@ exec_weechat_command (t_irc_server *server, char *string)
_("%s command \"%s\" needs a server connection!\n"),
WEECHAT_ERROR, irc_commands[i].command_name);
free (command);
if (ptr_args_color)
free (ptr_args_color);
return 0;
}
if (irc_commands[i].cmd_function_args)
@@ -637,6 +650,8 @@ exec_weechat_command (t_irc_server *server, char *string)
}
free_exploded_string (argv);
free (command);
if (ptr_args_color)
free (ptr_args_color);
return 1;
}
}
@@ -665,6 +680,8 @@ exec_weechat_command (t_irc_server *server, char *string)
free_exploded_string (argv);
free (command);
if (ptr_args_color)
free (ptr_args_color);
return 1;
}
}
@@ -676,6 +693,8 @@ exec_weechat_command (t_irc_server *server, char *string)
free_exploded_string (argv);
}
free (command);
if (ptr_args_color)
free (ptr_args_color);
return 0;
}
+12 -8
View File
@@ -108,7 +108,7 @@ completion_build_list (t_completion *completion, void *channel)
t_irc_server *ptr_server;
t_irc_channel *ptr_channel;
t_irc_nick *ptr_nick;
char *pos, option_name[256], *string;
char *pos, option_name[256], *string, *string2;
t_weechat_alias *ptr_alias;
t_config_option *option;
void *option_value;
@@ -647,15 +647,19 @@ completion_build_list (t_completion *completion, void *channel)
completion_stop (completion);
else
{
string = weechat_convert_encoding ((local_utf8) ?
cfg_look_charset_decode_iso : cfg_look_charset_decode_utf,
(cfg_look_charset_internal && cfg_look_charset_internal[0]) ?
cfg_look_charset_internal : local_charset,
((t_irc_channel *)channel)->topic);
string = (char *)gui_color_decode ((unsigned char *)((t_irc_channel *)channel)->topic, 0);
string2 = weechat_convert_encoding ((local_utf8) ?
cfg_look_charset_decode_iso : cfg_look_charset_decode_utf,
(cfg_look_charset_internal && cfg_look_charset_internal[0]) ?
cfg_look_charset_internal : local_charset,
(string) ? string : ((t_irc_channel *)channel)->topic);
weelist_add (&completion->completion_list,
&completion->last_completion,
string);
free (string);
(string2) ? string2 : ((t_irc_channel *)channel)->topic);
if (string)
free (string);
if (string2)
free (string2);
}
}
else