Added new options look_charset_decode/look_charset_encode and /unset command.
This commit is contained in:
parent
9adb547b36
commit
b2c5317e17
@ -1,9 +1,13 @@
|
||||
WeeChat - Wee Enhanced Environment for Chat
|
||||
===========================================
|
||||
|
||||
ChangeLog - 2005-01-01
|
||||
ChangeLog - 2005-01-02
|
||||
|
||||
|
||||
Version 0.1.0 (under dev!):
|
||||
* added new options for charset: look_charset_decode and look_charset_encode
|
||||
* added /unset command (to remove string value for a config option)
|
||||
|
||||
Version 0.0.9 (2005-01-01):
|
||||
* auto-reconnection to server (new options: server_autoreconnect (on/off),
|
||||
server_autoreconnect_delay (in seconds))
|
||||
|
5
TODO
5
TODO
@ -1,7 +1,7 @@
|
||||
WeeChat - Wee Enhanced Environment for Chat
|
||||
===========================================
|
||||
|
||||
TODO - 2005-01-01
|
||||
TODO - 2005-01-02
|
||||
|
||||
Legend:
|
||||
# done
|
||||
@ -10,7 +10,7 @@ Legend:
|
||||
? is this really necessary?
|
||||
|
||||
|
||||
v0.0.9:
|
||||
v0.1.0:
|
||||
------
|
||||
|
||||
* General:
|
||||
@ -19,6 +19,7 @@ v0.0.9:
|
||||
|
||||
* IRC protocol:
|
||||
+ "/dcc" command (for chat and sending/receiving files)
|
||||
- lets user configure his CTCP version reply (partially)
|
||||
|
||||
* Interface:
|
||||
+ "/window" command, split terminal in multiple windows
|
||||
|
674
po/weechat.pot
674
po/weechat.pot
File diff suppressed because it is too large
Load Diff
@ -97,6 +97,9 @@ t_weechat_command weechat_commands[] =
|
||||
{ "unalias", N_("remove an alias"),
|
||||
N_("alias_name"), N_("alias_name: name of alias to remove"),
|
||||
1, 1, NULL, weechat_cmd_unalias },
|
||||
{ "unset", N_("reset config parameters"),
|
||||
N_("option"), N_("option: name of an option"),
|
||||
1, 1, NULL, weechat_cmd_unset },
|
||||
{ "window", N_("manage windows"),
|
||||
N_("[action]"),
|
||||
N_("action: action to do:\n"
|
||||
@ -1835,6 +1838,46 @@ weechat_cmd_unalias (char *arguments)
|
||||
return 0;
|
||||
}
|
||||
|
||||
/*
|
||||
* weechat_cmd_unset: reset options
|
||||
*/
|
||||
|
||||
int
|
||||
weechat_cmd_unset (char *arguments)
|
||||
{
|
||||
t_config_option *ptr_option;
|
||||
|
||||
ptr_option = config_option_search (arguments);
|
||||
if (ptr_option)
|
||||
{
|
||||
if (ptr_option->handler_change == NULL)
|
||||
{
|
||||
gui_printf (NULL,
|
||||
_("%s option \"%s\" can not be changed while WeeChat is running\n"),
|
||||
WEECHAT_ERROR, arguments);
|
||||
}
|
||||
else
|
||||
{
|
||||
if (config_option_set_value (ptr_option, "") == 0)
|
||||
{
|
||||
(void) (ptr_option->handler_change());
|
||||
gui_printf (NULL, "[%s]\n", config_get_section (ptr_option));
|
||||
gui_printf (NULL, " %s =\n", arguments);
|
||||
}
|
||||
else
|
||||
gui_printf (NULL, _("%s option \"%s\" can not be reset (use "
|
||||
"/set command to change this option)\n"),
|
||||
WEECHAT_ERROR, arguments);
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
gui_printf (NULL, _("%s config option \"%s\" not found\n"),
|
||||
WEECHAT_ERROR, arguments);
|
||||
}
|
||||
return 0;
|
||||
}
|
||||
|
||||
/*
|
||||
* weechat_cmd_window: manage windows
|
||||
*/
|
||||
|
@ -77,6 +77,7 @@ extern int weechat_cmd_save (int, char **);
|
||||
extern int weechat_cmd_server (int, char **);
|
||||
extern int weechat_cmd_set (char *);
|
||||
extern int weechat_cmd_unalias (char *);
|
||||
extern int weechat_cmd_unset (char *);
|
||||
extern int weechat_cmd_window (int, char **);
|
||||
|
||||
#endif /* command.h */
|
||||
|
@ -49,6 +49,8 @@
|
||||
#include <sys/stat.h>
|
||||
#include <time.h>
|
||||
#include <signal.h>
|
||||
#include <iconv.h>
|
||||
#include <langinfo.h>
|
||||
|
||||
#include "weechat.h"
|
||||
#include "weeconfig.h"
|
||||
@ -62,6 +64,8 @@ int quit_weechat; /* = 1 if quit request from user... why ? :'( */
|
||||
char *weechat_home; /* WeeChat home dir. (example: /home/toto/.weechat) */
|
||||
FILE *weechat_log_file; /* WeeChat log file (~/.weechat/weechat.log) */
|
||||
|
||||
char *local_charset = NULL; /* local charset, for example: ISO-8859-1 */
|
||||
|
||||
int server_cmd_line; /* at least one server on WeeChat command line */
|
||||
|
||||
|
||||
@ -76,6 +80,49 @@ my_sigint ()
|
||||
/* do nothing */
|
||||
}
|
||||
|
||||
/*
|
||||
* weechat_convert_encoding: convert string to another encoding
|
||||
*/
|
||||
|
||||
char *
|
||||
weechat_convert_encoding (char *from_code, char *to_code, char *string)
|
||||
{
|
||||
iconv_t cd;
|
||||
char *inbuf, *ptr_inbuf, *outbuf, *ptr_outbuf;
|
||||
int inbytesleft, outbytesleft;
|
||||
|
||||
if (from_code && from_code[0] && to_code && to_code[0]
|
||||
&& (strcasecmp(from_code, to_code) != 0))
|
||||
{
|
||||
cd = iconv_open (to_code, from_code);
|
||||
if (cd == (iconv_t)(-1))
|
||||
outbuf = strdup (string);
|
||||
else
|
||||
{
|
||||
inbuf = strdup (string);
|
||||
ptr_inbuf = inbuf;
|
||||
inbytesleft = strlen (inbuf);
|
||||
outbytesleft = inbytesleft * 4;
|
||||
outbuf = (char *) malloc (outbytesleft + 2);
|
||||
ptr_outbuf = outbuf;
|
||||
iconv (cd, &ptr_inbuf, &inbytesleft, &ptr_outbuf, &outbytesleft);
|
||||
if (inbytesleft != 0)
|
||||
{
|
||||
free (outbuf);
|
||||
outbuf = strdup (string);
|
||||
}
|
||||
else
|
||||
ptr_outbuf[0] = '\0';
|
||||
free (inbuf);
|
||||
iconv_close (cd);
|
||||
}
|
||||
}
|
||||
else
|
||||
outbuf = strdup (string);
|
||||
|
||||
return outbuf;
|
||||
}
|
||||
|
||||
/*
|
||||
* wee_log_printf: displays a message in WeeChat log (~/.weechat/weechat.log)
|
||||
*/
|
||||
@ -469,6 +516,8 @@ main (int argc, char *argv[])
|
||||
textdomain (PACKAGE);
|
||||
#endif
|
||||
|
||||
local_charset = strdup (nl_langinfo (CODESET));
|
||||
|
||||
signal (SIGINT, my_sigint); /* ignore SIGINT signal */
|
||||
gui_pre_init (&argc, &argv); /* pre-initiliaze interface */
|
||||
wee_init_vars (); /* initialize some variables */
|
||||
|
@ -102,7 +102,9 @@
|
||||
|
||||
extern int quit_weechat;
|
||||
extern char *weechat_home;
|
||||
extern char *local_charset;
|
||||
|
||||
extern char *weechat_convert_encoding (char *, char *, char *);
|
||||
extern void wee_log_printf (char *, ...);
|
||||
extern void wee_shutdown ();
|
||||
|
||||
|
@ -60,6 +60,8 @@ int cfg_look_set_title;
|
||||
int cfg_look_startup_logo;
|
||||
int cfg_look_startup_version;
|
||||
char *cfg_look_weechat_slogan;
|
||||
char *cfg_look_charset_decode;
|
||||
char *cfg_look_charset_encode;
|
||||
int cfg_look_color_nicks;
|
||||
int cfg_look_color_actions;
|
||||
int cfg_look_remove_colors_from_msgs;
|
||||
@ -95,6 +97,14 @@ t_config_option weechat_options_look[] =
|
||||
N_("WeeChat slogan (if empty, slogan is not used)"),
|
||||
OPTION_TYPE_STRING, 0, 0, 0,
|
||||
"the geekest IRC client!", NULL, NULL, &cfg_look_weechat_slogan, config_change_noop },
|
||||
{ "look_charset_decode", N_("charset for decoding messages from server"),
|
||||
N_("charset for decoding messages from server, examples: UTF-8, ISO-8859-1 (if empty, messages are not converted)"),
|
||||
OPTION_TYPE_STRING, 0, 0, 0,
|
||||
"", NULL, NULL, &cfg_look_charset_decode, config_change_buffer_content },
|
||||
{ "look_charset_encode", N_("charset for encoding messages sent to server"),
|
||||
N_("charset for encoding messages sent to server, examples: UFT-8, ISO-8859-1 (if empty, local charset is used)"),
|
||||
OPTION_TYPE_STRING, 0, 0, 0,
|
||||
"", NULL, NULL, &cfg_look_charset_encode, config_change_buffer_content },
|
||||
{ "look_color_nicks", N_("display nick names with different colors"),
|
||||
N_("display nick names with different colors"),
|
||||
OPTION_TYPE_BOOLEAN, BOOL_FALSE, BOOL_TRUE, BOOL_TRUE,
|
||||
|
@ -77,6 +77,8 @@ extern int cfg_look_set_title;
|
||||
extern int cfg_look_startup_logo;
|
||||
extern int cfg_look_startup_version;
|
||||
extern char *cfg_look_weechat_slogan;
|
||||
extern char *cfg_look_charset_decode;
|
||||
extern char *cfg_look_charset_encode;
|
||||
extern int cfg_look_color_nicks;
|
||||
extern int cfg_look_color_actions;
|
||||
extern int cfg_look_remove_colors_from_msgs;
|
||||
|
@ -307,7 +307,7 @@ void
|
||||
gui_draw_buffer_title (t_gui_buffer *buffer, int erase)
|
||||
{
|
||||
t_gui_window *ptr_win;
|
||||
char format[32];
|
||||
char format[32], *buf;
|
||||
|
||||
if (!gui_ok)
|
||||
return;
|
||||
@ -330,8 +330,13 @@ gui_draw_buffer_title (t_gui_buffer *buffer, int erase)
|
||||
{
|
||||
snprintf (format, 32, "%%-%ds", ptr_win->win_width);
|
||||
if (CHANNEL(buffer)->topic)
|
||||
mvwprintw (ptr_win->win_title, 0, 0, format,
|
||||
CHANNEL(buffer)->topic);
|
||||
{
|
||||
buf = weechat_convert_encoding (cfg_look_charset_decode,
|
||||
local_charset,
|
||||
CHANNEL(buffer)->topic);
|
||||
mvwprintw (ptr_win->win_title, 0, 0, format, buf);
|
||||
free (buf);
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
@ -1993,7 +1998,7 @@ gui_printf_color_type (t_gui_buffer *buffer, int type, int color, char *message,
|
||||
{
|
||||
static char buf[8192];
|
||||
char timestamp[16];
|
||||
char *pos, *buf2;
|
||||
char *pos, *buf2, *buf3;
|
||||
int i, j;
|
||||
va_list argptr;
|
||||
static time_t seconds;
|
||||
@ -2051,12 +2056,14 @@ gui_printf_color_type (t_gui_buffer *buffer, int type, int color, char *message,
|
||||
else
|
||||
buf2 = strdup (buf);
|
||||
|
||||
buf3 = weechat_convert_encoding (cfg_look_charset_decode, local_charset, buf2);
|
||||
|
||||
if (gui_init_ok)
|
||||
{
|
||||
seconds = time (NULL);
|
||||
date_tmp = localtime (&seconds);
|
||||
|
||||
pos = buf2 - 1;
|
||||
pos = buf3 - 1;
|
||||
while (pos)
|
||||
{
|
||||
/* TODO: read timestamp format from config! */
|
||||
@ -2087,7 +2094,8 @@ gui_printf_color_type (t_gui_buffer *buffer, int type, int color, char *message,
|
||||
refresh ();*/
|
||||
}
|
||||
else
|
||||
printf ("%s", buf2);
|
||||
printf ("%s", buf3);
|
||||
|
||||
free (buf2);
|
||||
free (buf3);
|
||||
}
|
||||
|
@ -39,6 +39,7 @@
|
||||
|
||||
#include "../common/weechat.h"
|
||||
#include "irc.h"
|
||||
#include "../common/weeconfig.h"
|
||||
#include "../gui/gui.h"
|
||||
|
||||
|
||||
@ -369,6 +370,7 @@ server_sendf (t_irc_server * server, char *fmt, ...)
|
||||
{
|
||||
va_list args;
|
||||
static char buffer[1024];
|
||||
char *buf2;
|
||||
int size_buf;
|
||||
|
||||
if (!server)
|
||||
@ -384,14 +386,16 @@ server_sendf (t_irc_server * server, char *fmt, ...)
|
||||
buffer[sizeof (buffer) - 1] = '\0';
|
||||
if ((size_buf < 0) || (size_buf > (int) (sizeof (buffer) - 1)))
|
||||
size_buf = strlen (buffer);
|
||||
buffer[size_buf - 2] = '\0';
|
||||
#ifdef DEBUG
|
||||
buffer[size_buf - 2] = '\0';
|
||||
gui_printf (server->buffer, "[DEBUG] Sending to server >>> %s\n", buffer);
|
||||
#endif
|
||||
buffer[size_buf - 2] = '\r';
|
||||
if (server_send (server, buffer, size_buf) <= 0)
|
||||
#endif
|
||||
buf2 = weechat_convert_encoding (local_charset, cfg_look_charset_encode, buffer);
|
||||
if (server_send (server, buf2, strlen (buf2)) <= 0)
|
||||
gui_printf (server->buffer, _("%s error sending data to IRC server\n"),
|
||||
WEECHAT_ERROR);
|
||||
free (buf2);
|
||||
}
|
||||
|
||||
/*
|
||||
|
@ -1,9 +1,13 @@
|
||||
WeeChat - Wee Enhanced Environment for Chat
|
||||
===========================================
|
||||
|
||||
ChangeLog - 2005-01-01
|
||||
ChangeLog - 2005-01-02
|
||||
|
||||
|
||||
Version 0.1.0 (under dev!):
|
||||
* added new options for charset: look_charset_decode and look_charset_encode
|
||||
* added /unset command (to remove string value for a config option)
|
||||
|
||||
Version 0.0.9 (2005-01-01):
|
||||
* auto-reconnection to server (new options: server_autoreconnect (on/off),
|
||||
server_autoreconnect_delay (in seconds))
|
||||
|
@ -1,7 +1,7 @@
|
||||
WeeChat - Wee Enhanced Environment for Chat
|
||||
===========================================
|
||||
|
||||
TODO - 2005-01-01
|
||||
TODO - 2005-01-02
|
||||
|
||||
Legend:
|
||||
# done
|
||||
@ -10,7 +10,7 @@ Legend:
|
||||
? is this really necessary?
|
||||
|
||||
|
||||
v0.0.9:
|
||||
v0.1.0:
|
||||
------
|
||||
|
||||
* General:
|
||||
@ -19,6 +19,7 @@ v0.0.9:
|
||||
|
||||
* IRC protocol:
|
||||
+ "/dcc" command (for chat and sending/receiving files)
|
||||
- lets user configure his CTCP version reply (partially)
|
||||
|
||||
* Interface:
|
||||
+ "/window" command, split terminal in multiple windows
|
||||
|
680
weechat/po/fr.po
680
weechat/po/fr.po
File diff suppressed because it is too large
Load Diff
File diff suppressed because it is too large
Load Diff
@ -97,6 +97,9 @@ t_weechat_command weechat_commands[] =
|
||||
{ "unalias", N_("remove an alias"),
|
||||
N_("alias_name"), N_("alias_name: name of alias to remove"),
|
||||
1, 1, NULL, weechat_cmd_unalias },
|
||||
{ "unset", N_("reset config parameters"),
|
||||
N_("option"), N_("option: name of an option"),
|
||||
1, 1, NULL, weechat_cmd_unset },
|
||||
{ "window", N_("manage windows"),
|
||||
N_("[action]"),
|
||||
N_("action: action to do:\n"
|
||||
@ -1835,6 +1838,46 @@ weechat_cmd_unalias (char *arguments)
|
||||
return 0;
|
||||
}
|
||||
|
||||
/*
|
||||
* weechat_cmd_unset: reset options
|
||||
*/
|
||||
|
||||
int
|
||||
weechat_cmd_unset (char *arguments)
|
||||
{
|
||||
t_config_option *ptr_option;
|
||||
|
||||
ptr_option = config_option_search (arguments);
|
||||
if (ptr_option)
|
||||
{
|
||||
if (ptr_option->handler_change == NULL)
|
||||
{
|
||||
gui_printf (NULL,
|
||||
_("%s option \"%s\" can not be changed while WeeChat is running\n"),
|
||||
WEECHAT_ERROR, arguments);
|
||||
}
|
||||
else
|
||||
{
|
||||
if (config_option_set_value (ptr_option, "") == 0)
|
||||
{
|
||||
(void) (ptr_option->handler_change());
|
||||
gui_printf (NULL, "[%s]\n", config_get_section (ptr_option));
|
||||
gui_printf (NULL, " %s =\n", arguments);
|
||||
}
|
||||
else
|
||||
gui_printf (NULL, _("%s option \"%s\" can not be reset (use "
|
||||
"/set command to change this option)\n"),
|
||||
WEECHAT_ERROR, arguments);
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
gui_printf (NULL, _("%s config option \"%s\" not found\n"),
|
||||
WEECHAT_ERROR, arguments);
|
||||
}
|
||||
return 0;
|
||||
}
|
||||
|
||||
/*
|
||||
* weechat_cmd_window: manage windows
|
||||
*/
|
||||
|
@ -77,6 +77,7 @@ extern int weechat_cmd_save (int, char **);
|
||||
extern int weechat_cmd_server (int, char **);
|
||||
extern int weechat_cmd_set (char *);
|
||||
extern int weechat_cmd_unalias (char *);
|
||||
extern int weechat_cmd_unset (char *);
|
||||
extern int weechat_cmd_window (int, char **);
|
||||
|
||||
#endif /* command.h */
|
||||
|
@ -49,6 +49,8 @@
|
||||
#include <sys/stat.h>
|
||||
#include <time.h>
|
||||
#include <signal.h>
|
||||
#include <iconv.h>
|
||||
#include <langinfo.h>
|
||||
|
||||
#include "weechat.h"
|
||||
#include "weeconfig.h"
|
||||
@ -62,6 +64,8 @@ int quit_weechat; /* = 1 if quit request from user... why ? :'( */
|
||||
char *weechat_home; /* WeeChat home dir. (example: /home/toto/.weechat) */
|
||||
FILE *weechat_log_file; /* WeeChat log file (~/.weechat/weechat.log) */
|
||||
|
||||
char *local_charset = NULL; /* local charset, for example: ISO-8859-1 */
|
||||
|
||||
int server_cmd_line; /* at least one server on WeeChat command line */
|
||||
|
||||
|
||||
@ -76,6 +80,49 @@ my_sigint ()
|
||||
/* do nothing */
|
||||
}
|
||||
|
||||
/*
|
||||
* weechat_convert_encoding: convert string to another encoding
|
||||
*/
|
||||
|
||||
char *
|
||||
weechat_convert_encoding (char *from_code, char *to_code, char *string)
|
||||
{
|
||||
iconv_t cd;
|
||||
char *inbuf, *ptr_inbuf, *outbuf, *ptr_outbuf;
|
||||
int inbytesleft, outbytesleft;
|
||||
|
||||
if (from_code && from_code[0] && to_code && to_code[0]
|
||||
&& (strcasecmp(from_code, to_code) != 0))
|
||||
{
|
||||
cd = iconv_open (to_code, from_code);
|
||||
if (cd == (iconv_t)(-1))
|
||||
outbuf = strdup (string);
|
||||
else
|
||||
{
|
||||
inbuf = strdup (string);
|
||||
ptr_inbuf = inbuf;
|
||||
inbytesleft = strlen (inbuf);
|
||||
outbytesleft = inbytesleft * 4;
|
||||
outbuf = (char *) malloc (outbytesleft + 2);
|
||||
ptr_outbuf = outbuf;
|
||||
iconv (cd, &ptr_inbuf, &inbytesleft, &ptr_outbuf, &outbytesleft);
|
||||
if (inbytesleft != 0)
|
||||
{
|
||||
free (outbuf);
|
||||
outbuf = strdup (string);
|
||||
}
|
||||
else
|
||||
ptr_outbuf[0] = '\0';
|
||||
free (inbuf);
|
||||
iconv_close (cd);
|
||||
}
|
||||
}
|
||||
else
|
||||
outbuf = strdup (string);
|
||||
|
||||
return outbuf;
|
||||
}
|
||||
|
||||
/*
|
||||
* wee_log_printf: displays a message in WeeChat log (~/.weechat/weechat.log)
|
||||
*/
|
||||
@ -469,6 +516,8 @@ main (int argc, char *argv[])
|
||||
textdomain (PACKAGE);
|
||||
#endif
|
||||
|
||||
local_charset = strdup (nl_langinfo (CODESET));
|
||||
|
||||
signal (SIGINT, my_sigint); /* ignore SIGINT signal */
|
||||
gui_pre_init (&argc, &argv); /* pre-initiliaze interface */
|
||||
wee_init_vars (); /* initialize some variables */
|
||||
|
@ -102,7 +102,9 @@
|
||||
|
||||
extern int quit_weechat;
|
||||
extern char *weechat_home;
|
||||
extern char *local_charset;
|
||||
|
||||
extern char *weechat_convert_encoding (char *, char *, char *);
|
||||
extern void wee_log_printf (char *, ...);
|
||||
extern void wee_shutdown ();
|
||||
|
||||
|
@ -60,6 +60,8 @@ int cfg_look_set_title;
|
||||
int cfg_look_startup_logo;
|
||||
int cfg_look_startup_version;
|
||||
char *cfg_look_weechat_slogan;
|
||||
char *cfg_look_charset_decode;
|
||||
char *cfg_look_charset_encode;
|
||||
int cfg_look_color_nicks;
|
||||
int cfg_look_color_actions;
|
||||
int cfg_look_remove_colors_from_msgs;
|
||||
@ -95,6 +97,14 @@ t_config_option weechat_options_look[] =
|
||||
N_("WeeChat slogan (if empty, slogan is not used)"),
|
||||
OPTION_TYPE_STRING, 0, 0, 0,
|
||||
"the geekest IRC client!", NULL, NULL, &cfg_look_weechat_slogan, config_change_noop },
|
||||
{ "look_charset_decode", N_("charset for decoding messages from server"),
|
||||
N_("charset for decoding messages from server, examples: UTF-8, ISO-8859-1 (if empty, messages are not converted)"),
|
||||
OPTION_TYPE_STRING, 0, 0, 0,
|
||||
"", NULL, NULL, &cfg_look_charset_decode, config_change_buffer_content },
|
||||
{ "look_charset_encode", N_("charset for encoding messages sent to server"),
|
||||
N_("charset for encoding messages sent to server, examples: UFT-8, ISO-8859-1 (if empty, local charset is used)"),
|
||||
OPTION_TYPE_STRING, 0, 0, 0,
|
||||
"", NULL, NULL, &cfg_look_charset_encode, config_change_buffer_content },
|
||||
{ "look_color_nicks", N_("display nick names with different colors"),
|
||||
N_("display nick names with different colors"),
|
||||
OPTION_TYPE_BOOLEAN, BOOL_FALSE, BOOL_TRUE, BOOL_TRUE,
|
||||
|
@ -77,6 +77,8 @@ extern int cfg_look_set_title;
|
||||
extern int cfg_look_startup_logo;
|
||||
extern int cfg_look_startup_version;
|
||||
extern char *cfg_look_weechat_slogan;
|
||||
extern char *cfg_look_charset_decode;
|
||||
extern char *cfg_look_charset_encode;
|
||||
extern int cfg_look_color_nicks;
|
||||
extern int cfg_look_color_actions;
|
||||
extern int cfg_look_remove_colors_from_msgs;
|
||||
|
@ -307,7 +307,7 @@ void
|
||||
gui_draw_buffer_title (t_gui_buffer *buffer, int erase)
|
||||
{
|
||||
t_gui_window *ptr_win;
|
||||
char format[32];
|
||||
char format[32], *buf;
|
||||
|
||||
if (!gui_ok)
|
||||
return;
|
||||
@ -330,8 +330,13 @@ gui_draw_buffer_title (t_gui_buffer *buffer, int erase)
|
||||
{
|
||||
snprintf (format, 32, "%%-%ds", ptr_win->win_width);
|
||||
if (CHANNEL(buffer)->topic)
|
||||
mvwprintw (ptr_win->win_title, 0, 0, format,
|
||||
CHANNEL(buffer)->topic);
|
||||
{
|
||||
buf = weechat_convert_encoding (cfg_look_charset_decode,
|
||||
local_charset,
|
||||
CHANNEL(buffer)->topic);
|
||||
mvwprintw (ptr_win->win_title, 0, 0, format, buf);
|
||||
free (buf);
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
@ -1993,7 +1998,7 @@ gui_printf_color_type (t_gui_buffer *buffer, int type, int color, char *message,
|
||||
{
|
||||
static char buf[8192];
|
||||
char timestamp[16];
|
||||
char *pos, *buf2;
|
||||
char *pos, *buf2, *buf3;
|
||||
int i, j;
|
||||
va_list argptr;
|
||||
static time_t seconds;
|
||||
@ -2051,12 +2056,14 @@ gui_printf_color_type (t_gui_buffer *buffer, int type, int color, char *message,
|
||||
else
|
||||
buf2 = strdup (buf);
|
||||
|
||||
buf3 = weechat_convert_encoding (cfg_look_charset_decode, local_charset, buf2);
|
||||
|
||||
if (gui_init_ok)
|
||||
{
|
||||
seconds = time (NULL);
|
||||
date_tmp = localtime (&seconds);
|
||||
|
||||
pos = buf2 - 1;
|
||||
pos = buf3 - 1;
|
||||
while (pos)
|
||||
{
|
||||
/* TODO: read timestamp format from config! */
|
||||
@ -2087,7 +2094,8 @@ gui_printf_color_type (t_gui_buffer *buffer, int type, int color, char *message,
|
||||
refresh ();*/
|
||||
}
|
||||
else
|
||||
printf ("%s", buf2);
|
||||
printf ("%s", buf3);
|
||||
|
||||
free (buf2);
|
||||
free (buf3);
|
||||
}
|
||||
|
@ -39,6 +39,7 @@
|
||||
|
||||
#include "../common/weechat.h"
|
||||
#include "irc.h"
|
||||
#include "../common/weeconfig.h"
|
||||
#include "../gui/gui.h"
|
||||
|
||||
|
||||
@ -369,6 +370,7 @@ server_sendf (t_irc_server * server, char *fmt, ...)
|
||||
{
|
||||
va_list args;
|
||||
static char buffer[1024];
|
||||
char *buf2;
|
||||
int size_buf;
|
||||
|
||||
if (!server)
|
||||
@ -384,14 +386,16 @@ server_sendf (t_irc_server * server, char *fmt, ...)
|
||||
buffer[sizeof (buffer) - 1] = '\0';
|
||||
if ((size_buf < 0) || (size_buf > (int) (sizeof (buffer) - 1)))
|
||||
size_buf = strlen (buffer);
|
||||
buffer[size_buf - 2] = '\0';
|
||||
#ifdef DEBUG
|
||||
buffer[size_buf - 2] = '\0';
|
||||
gui_printf (server->buffer, "[DEBUG] Sending to server >>> %s\n", buffer);
|
||||
#endif
|
||||
buffer[size_buf - 2] = '\r';
|
||||
if (server_send (server, buffer, size_buf) <= 0)
|
||||
#endif
|
||||
buf2 = weechat_convert_encoding (local_charset, cfg_look_charset_encode, buffer);
|
||||
if (server_send (server, buf2, strlen (buf2)) <= 0)
|
||||
gui_printf (server->buffer, _("%s error sending data to IRC server\n"),
|
||||
WEECHAT_ERROR);
|
||||
free (buf2);
|
||||
}
|
||||
|
||||
/*
|
||||
|
Loading…
x
Reference in New Issue
Block a user