Added charset by server and channel, new command: /charset
This commit is contained in:
parent
b8662d79c2
commit
77e00d0381
@ -1,10 +1,11 @@
|
||||
WeeChat - Wee Enhanced Environment for Chat
|
||||
===========================================
|
||||
|
||||
ChangeLog - 2005-12-09
|
||||
ChangeLog - 2005-12-11
|
||||
|
||||
|
||||
Version 0.1.7 (under dev!):
|
||||
* added charset by server and channel, new command: /charset
|
||||
* added Ruby script plugin
|
||||
* added /upgrade command
|
||||
* added ETA (Estimated Time of Arrival) for DCC files
|
||||
|
@ -35,7 +35,7 @@
|
||||
|
||||
@title WeeChat - User guide
|
||||
@subtitle Fast, light and extensible IRC client
|
||||
@subtitle Documentation for WeeChat v0.1.7-cvs - December, 6 2005
|
||||
@subtitle Documentation for WeeChat v0.1.7-cvs - December, 11 2005
|
||||
|
||||
@author FlashCode <@email{flashcode@@flashtux.org, flashcode AT flashtux.org}>
|
||||
|
||||
@ -289,9 +289,6 @@ Type: boolean (values: 'on' or 'off'), default value: 'off'@*
|
||||
@item look_buffer_timestamp
|
||||
Timestamp for buffers@*
|
||||
Type: string (any string), default value: '[%H:%M:%S]'@*
|
||||
@item look_color_nicks
|
||||
Display nick names with different colors@*
|
||||
Type: boolean (values: 'on' or 'off'), default value: 'on'@*
|
||||
@item look_color_nicks_number
|
||||
Number of colors to use for nicks colors@*
|
||||
Type: integer (values: between 1 and 10), default value: 10@*
|
||||
@ -742,6 +739,15 @@ Type: boolean (values: 'on' or 'off'), default value: 'on'@*
|
||||
@item server_notify_levels
|
||||
Comma separated list of notify levels for channels of this server (format: #channel:1,..)@*
|
||||
Type: string (any string), default value: ''@*
|
||||
@item server_charset_decode_iso
|
||||
Comma separated list of charsets for server and channels, to decode ISO (format: server:charset,#channel:charset,..)@*
|
||||
Type: string (any string), default value: ''@*
|
||||
@item server_charset_decode_utf
|
||||
Comma separated list of charsets for server and channels, to decode UTF (format: server:charset,#channel:charset,..)@*
|
||||
Type: string (any string), default value: ''@*
|
||||
@item server_charset_encode
|
||||
Comma separated list of charsets for server and channels, to encode messages (format: server:charset,#channel:charset,..)@*
|
||||
Type: string (any string), default value: ''@*
|
||||
@end table
|
||||
|
||||
Colors for Curses GUI are:@*
|
||||
@ -928,6 +934,14 @@ action: action to do:@*
|
||||
server,channel: jump to buffer by server and/or channel name@*
|
||||
number: jump to buffer by number@*
|
||||
@*
|
||||
@item charset [(decode_iso | decode_utf | encode) charset]
|
||||
@*
|
||||
change charset for server or channel@*
|
||||
@*
|
||||
decode_iso: charset used for decoding ISO@*
|
||||
decode_utf: charset used for decoding UTF@*
|
||||
encode: charset used for encoding messages@*
|
||||
@*
|
||||
@item clear [-all]
|
||||
@*
|
||||
clear window(s)@*
|
||||
|
File diff suppressed because it is too large
Load Diff
@ -36,7 +36,7 @@
|
||||
|
||||
@title WeeChat - Guide utilisateur
|
||||
@subtitle Client IRC rapide, l@'eger et extensible
|
||||
@subtitle Documentation pour WeeChat v0.1.7-cvs - 6 decembre 2005
|
||||
@subtitle Documentation pour WeeChat v0.1.7-cvs - 11 decembre 2005
|
||||
|
||||
@author FlashCode <@email{flashcode@@flashtux.org, flashcode AT flashtux.org}>
|
||||
|
||||
@ -290,9 +290,6 @@ Type: bool@'een (valeurs: 'on' ou 'off'), valeur par d@'efaut: 'off'@*
|
||||
@item look_buffer_timestamp
|
||||
Format de date/heure pour les tampons@*
|
||||
Type: cha@^ine (toute cha@^ine), valeur par d@'efaut: '[%H:%M:%S]'@*
|
||||
@item look_color_nicks
|
||||
Afficher les utilisateurs avec diff@'erentes couleurs@*
|
||||
Type: bool@'een (valeurs: 'on' ou 'off'), valeur par d@'efaut: 'on'@*
|
||||
@item look_color_nicks_number
|
||||
Nombre de couleurs @`a utiliser pour les couleurs des pseudos@*
|
||||
Type: entier (valeurs: entre 1 et 10), valeur par d@'efaut: 10@*
|
||||
@ -743,6 +740,15 @@ Type: bool@'een (valeurs: 'on' ou 'off'), valeur par d@'efaut: 'on'@*
|
||||
@item server_notify_levels
|
||||
Liste des niveaux de notifications (s@'epar@'es par des virgules) pour les canaux de ce serveur (format: #canal:1,..)@*
|
||||
Type: cha@^ine (toute cha@^ine), valeur par d@'efaut: ''@*
|
||||
@item server_charset_decode_iso
|
||||
Liste des jeux de caract@`eres (s@'epar@'es par des virgules) pour le serveur et les canaux, pour d@'ecoder l'ISO (format: server:charset,#canal:charset,..)@*
|
||||
Type: cha@^ine (toute cha@^ine), valeur par d@'efaut: ''@*
|
||||
@item server_charset_decode_utf
|
||||
Liste des jeux de caract@`eres (s@'epar@'es par des virgules) pour le serveur et les canaux, pour d@'ecoder l'UTF (format: server:charset,#canal:charset,..)@*
|
||||
Type: cha@^ine (toute cha@^ine), valeur par d@'efaut: ''@*
|
||||
@item server_charset_encode
|
||||
Liste des jeux de caract@`eres (s@'epar@'es par des virgules) pour le serveur et les canaux, pour encoder les messages (format: server:charset,#canal:charset,..)@*
|
||||
Type: cha@^ine (toute cha@^ine), valeur par d@'efaut: ''@*
|
||||
@end table
|
||||
|
||||
Les couleurs pour l'interface Curses sont :@*
|
||||
@ -929,6 +935,14 @@ action: action @`a effectuer:@*
|
||||
serveur,canal: sauter au tampon par serveur et/ou nom de canal@*
|
||||
nombre: sauter au tampon qui a ce num@'ero@*
|
||||
@*
|
||||
@item charset [(decode_iso | decode_utf | encode) charset]
|
||||
@*
|
||||
changer le jeu de caract@`eres pour le serveur ou le canal@*
|
||||
@*
|
||||
decode_iso: jeu de caract@`ere utilis@'e pour d@'ecoder l'ISO@*
|
||||
decode_utf: jeu de caract@`ere utilis@'e pour d@'ecoder l'UTF@*
|
||||
encode: jeu de caract@`ere utilis@'e pour encoder les messages@*
|
||||
@*
|
||||
@item clear [-all]
|
||||
@*
|
||||
effacer la/les fen@^etre(s)@*
|
||||
@ -987,7 +1001,7 @@ associer/lib@'erer des touches@*
|
||||
touche: associer cette touche @`a une fonction interne ou une commande (commen@,{c}ant par "/")@*
|
||||
unbind: supprimer l'association @`a une touche (si "all", toutes les associations de touches par d@'efaut sont restaur@'ees)@*
|
||||
functions: lister la liste des fonctions internes pour les associations de touches@*
|
||||
reset: restaur les touches aux valeurs par d@'efaut et supprime TOUTES les touches personnelles (utiliser avec pr@'ecaution !)@*
|
||||
reset: restaure les touches aux valeurs par d@'efaut et supprime TOUTES les touches personnelles (utiliser avec pr@'ecaution !)@*
|
||||
@*
|
||||
@item plugin [load fichier] | [autoload] | [reload] | [unload]
|
||||
@*
|
||||
|
@ -36,7 +36,7 @@
|
||||
|
||||
@title WeeChat - Guia do Utilizador
|
||||
@subtitle Cliente de IRC rapido, leve e extencivel
|
||||
@subtitle Documenta@,{c}@~ao do WeeChat v0.1.7-cvs - 6 de dezembro de 2005
|
||||
@subtitle Documenta@,{c}@~ao do WeeChat v0.1.7-cvs - 11 de dezembro de 2005
|
||||
|
||||
@author FlashCode <@email{flashcode@@flashtux.org, flashcode AT flashtux.org}>
|
||||
|
||||
@ -287,9 +287,6 @@ Type: boolean (values: 'on' or 'off'), default value: 'off'@*
|
||||
@item look_buffer_timestamp
|
||||
Timestamp for buffers@*
|
||||
Type: string (any string), default value: '[%H:%M:%S]'@*
|
||||
@item look_color_nicks
|
||||
Display nick names with different colors@*
|
||||
Type: boolean (values: 'on' or 'off'), default value: 'on'@*
|
||||
@item look_color_nicks_number
|
||||
Number of colors to use for nicks colors@*
|
||||
Type: integer (values: between 1 and 10), default value: 10@*
|
||||
@ -740,6 +737,15 @@ Type: boolean (values: 'on' or 'off'), default value: 'on'@*
|
||||
@item server_notify_levels
|
||||
Comma separated list of notify levels for channels of this server (format: #channel:1,..)@*
|
||||
Type: string (any string), default value: ''@*
|
||||
@item server_charset_decode_iso
|
||||
Comma separated list of charsets for server and channels, to decode ISO (format: server:charset,#channel:charset,..)@*
|
||||
Type: string (any string), default value: ''@*
|
||||
@item server_charset_decode_utf
|
||||
Comma separated list of charsets for server and channels, to decode UTF (format: server:charset,#channel:charset,..)@*
|
||||
Type: string (any string), default value: ''@*
|
||||
@item server_charset_encode
|
||||
Comma separated list of charsets for server and channels, to encode messages (format: server:charset,#channel:charset,..)@*
|
||||
Type: string (any string), default value: ''@*
|
||||
@end table
|
||||
|
||||
Colors for Curses GUI are:@*
|
||||
@ -926,6 +932,14 @@ action: action to do:@*
|
||||
server,channel: jump to buffer by server and/or channel name@*
|
||||
number: jump to buffer by number@*
|
||||
@*
|
||||
@item charset [(decode_iso | decode_utf | encode) charset]
|
||||
@*
|
||||
change charset for server or channel@*
|
||||
@*
|
||||
decode_iso: charset used for decoding ISO@*
|
||||
decode_utf: charset used for decoding UTF@*
|
||||
encode: charset used for encoding messages@*
|
||||
@*
|
||||
@item clear [-all]
|
||||
@*
|
||||
clear window(s)@*
|
||||
|
904
po/weechat.pot
904
po/weechat.pot
File diff suppressed because it is too large
Load Diff
File diff suppressed because it is too large
Load Diff
@ -36,8 +36,8 @@ struct t_weechat_command
|
||||
char *arguments;
|
||||
char *arguments_description;
|
||||
int min_arg, max_arg;
|
||||
int (*cmd_function_args)(int, char **);
|
||||
int (*cmd_function_1arg)(char *);
|
||||
int (*cmd_function_args)(t_gui_window *, int, char **);
|
||||
int (*cmd_function_1arg)(t_gui_window *, char *);
|
||||
};
|
||||
|
||||
typedef struct t_weechat_alias t_weechat_alias;
|
||||
@ -62,27 +62,28 @@ extern t_weechat_alias *alias_new (char *, char *);
|
||||
extern void alias_free_all ();
|
||||
extern char **explode_string (char *, char *, int, int *);
|
||||
extern void free_exploded_string (char **);
|
||||
extern int exec_weechat_command (t_irc_server *, char *);
|
||||
extern void user_command (t_irc_server *, t_gui_buffer *, char *);
|
||||
extern int weechat_cmd_alias (char *);
|
||||
extern int weechat_cmd_buffer (int, char **);
|
||||
extern int weechat_cmd_clear (int, char **);
|
||||
extern int weechat_cmd_connect (int, char **);
|
||||
extern int weechat_cmd_debug (int, char **);
|
||||
extern int weechat_cmd_disconnect (int, char **);
|
||||
extern int weechat_cmd_help (int, char **);
|
||||
extern int weechat_cmd_history (int, char **);
|
||||
extern int exec_weechat_command (t_gui_window *, t_irc_server *, char *);
|
||||
extern void user_command (t_gui_window *, t_irc_server *, char *);
|
||||
extern int weechat_cmd_alias (t_gui_window *, char *);
|
||||
extern int weechat_cmd_buffer (t_gui_window *, int, char **);
|
||||
extern int weechat_cmd_charset (t_gui_window *, int, char **);
|
||||
extern int weechat_cmd_clear (t_gui_window *, int, char **);
|
||||
extern int weechat_cmd_connect (t_gui_window *, int, char **);
|
||||
extern int weechat_cmd_debug (t_gui_window *, int, char **);
|
||||
extern int weechat_cmd_disconnect (t_gui_window *, int, char **);
|
||||
extern int weechat_cmd_help (t_gui_window *, int, char **);
|
||||
extern int weechat_cmd_history (t_gui_window *, int, char **);
|
||||
extern void weechat_cmd_ignore_display (char *, t_irc_ignore *);
|
||||
extern int weechat_cmd_ignore (int, char **);
|
||||
extern int weechat_cmd_key (char *);
|
||||
extern int weechat_cmd_plugin (int, char **);
|
||||
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_unignore (int, char **);
|
||||
extern int weechat_cmd_upgrade (int, char **);
|
||||
extern int weechat_cmd_uptime (int, char **);
|
||||
extern int weechat_cmd_window (int, char **);
|
||||
extern int weechat_cmd_ignore (t_gui_window *, int, char **);
|
||||
extern int weechat_cmd_key (t_gui_window *, char *);
|
||||
extern int weechat_cmd_plugin (t_gui_window *, int, char **);
|
||||
extern int weechat_cmd_save (t_gui_window *, int, char **);
|
||||
extern int weechat_cmd_server (t_gui_window *, int, char **);
|
||||
extern int weechat_cmd_set (t_gui_window *, char *);
|
||||
extern int weechat_cmd_unalias (t_gui_window *, char *);
|
||||
extern int weechat_cmd_unignore (t_gui_window *, int, char **);
|
||||
extern int weechat_cmd_upgrade (t_gui_window *, int, char **);
|
||||
extern int weechat_cmd_uptime (t_gui_window *, int, char **);
|
||||
extern int weechat_cmd_window (t_gui_window *, int, char **);
|
||||
|
||||
#endif /* command.h */
|
||||
|
@ -101,10 +101,10 @@ completion_stop (t_completion *completion)
|
||||
*/
|
||||
|
||||
void
|
||||
completion_build_list (t_completion *completion, void *channel)
|
||||
completion_build_list (t_completion *completion, void *server, void *channel)
|
||||
{
|
||||
t_weelist *ptr_list;
|
||||
int i, j;
|
||||
int i, j, length;
|
||||
t_irc_server *ptr_server;
|
||||
t_irc_channel *ptr_channel;
|
||||
t_irc_nick *ptr_nick;
|
||||
@ -155,6 +155,82 @@ completion_build_list (t_completion *completion, void *channel)
|
||||
"notify");
|
||||
return;
|
||||
}
|
||||
if (ascii_strcasecmp (completion->base_command, "charset") == 0)
|
||||
{
|
||||
if (completion->base_command_arg == 1)
|
||||
{
|
||||
weelist_add (&completion->completion_list,
|
||||
&completion->last_completion,
|
||||
"decode_iso");
|
||||
weelist_add (&completion->completion_list,
|
||||
&completion->last_completion,
|
||||
"decode_utf");
|
||||
weelist_add (&completion->completion_list,
|
||||
&completion->last_completion,
|
||||
"encode");
|
||||
}
|
||||
else if (completion->base_command_arg == 2)
|
||||
{
|
||||
if (!server)
|
||||
{
|
||||
completion_stop (completion);
|
||||
return;
|
||||
}
|
||||
pos = strchr (completion->args, ' ');
|
||||
if (pos)
|
||||
pos[0] = '\0';
|
||||
string2 = NULL;
|
||||
if (ascii_strcasecmp (completion->args, "decode_iso") == 0)
|
||||
{
|
||||
config_option_list_get_value (&(((t_irc_server *)server)->charset_decode_iso),
|
||||
(channel) ? ((t_irc_channel *)channel)->name : "server",
|
||||
&string, &length);
|
||||
if (string && (length > 0))
|
||||
{
|
||||
string2 = strdup (string);
|
||||
string2[length] = '\0';
|
||||
}
|
||||
}
|
||||
else if (ascii_strcasecmp (completion->args, "decode_utf") == 0)
|
||||
{
|
||||
config_option_list_get_value (&(((t_irc_server *)server)->charset_decode_utf),
|
||||
(channel) ? ((t_irc_channel *)channel)->name : "server",
|
||||
&string, &length);
|
||||
if (string && (length > 0))
|
||||
{
|
||||
string2 = strdup (string);
|
||||
string2[length] = '\0';
|
||||
}
|
||||
}
|
||||
else if (ascii_strcasecmp (completion->args, "encode") == 0)
|
||||
{
|
||||
config_option_list_get_value (&(((t_irc_server *)server)->charset_encode),
|
||||
(channel) ? ((t_irc_channel *)channel)->name : "server",
|
||||
&string, &length);
|
||||
if (string && (length > 0))
|
||||
{
|
||||
string2 = strdup (string);
|
||||
string2[length] = '\0';
|
||||
}
|
||||
}
|
||||
|
||||
if (string2)
|
||||
{
|
||||
weelist_add (&completion->completion_list,
|
||||
&completion->last_completion,
|
||||
string2);
|
||||
free (string2);
|
||||
}
|
||||
else
|
||||
completion_stop (completion);
|
||||
|
||||
if (pos)
|
||||
pos[0] = ' ';
|
||||
}
|
||||
else
|
||||
completion_stop (completion);
|
||||
return;
|
||||
}
|
||||
if ((ascii_strcasecmp (completion->base_command, "clear") == 0)
|
||||
&& (completion->base_command_arg == 1))
|
||||
{
|
||||
@ -672,11 +748,9 @@ completion_build_list (t_completion *completion, void *channel)
|
||||
string = (char *)gui_color_decode_for_user_entry ((unsigned char *)((t_irc_channel *)channel)->topic);
|
||||
else
|
||||
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);
|
||||
string2 = channel_iconv_decode ((t_irc_server *)server,
|
||||
(t_irc_channel *)channel,
|
||||
(string) ? string : ((t_irc_channel *)channel)->topic);
|
||||
weelist_add (&completion->completion_list,
|
||||
&completion->last_completion,
|
||||
(string2) ? string2 : ((t_irc_channel *)channel)->topic);
|
||||
@ -697,8 +771,8 @@ completion_build_list (t_completion *completion, void *channel)
|
||||
*/
|
||||
|
||||
void
|
||||
completion_find_context (t_completion *completion, void *channel, char *buffer,
|
||||
int size, int pos)
|
||||
completion_find_context (t_completion *completion, void *server, void *channel,
|
||||
char *buffer, int size, int pos)
|
||||
{
|
||||
int i, command, command_arg, pos_start, pos_end;
|
||||
|
||||
@ -808,7 +882,7 @@ completion_find_context (t_completion *completion, void *channel, char *buffer,
|
||||
for (i = pos_start; i <= pos_end; i++)
|
||||
completion->base_command[i - pos_start] = buffer[i];
|
||||
completion->base_command[pos_end - pos_start + 1] = '\0';
|
||||
completion_build_list (completion, channel);
|
||||
completion_build_list (completion, server, channel);
|
||||
}
|
||||
}
|
||||
|
||||
@ -1066,7 +1140,7 @@ completion_nick (t_completion *completion, t_irc_channel *channel)
|
||||
*/
|
||||
|
||||
void
|
||||
completion_search (t_completion *completion, void *channel,
|
||||
completion_search (t_completion *completion, void *server, void *channel,
|
||||
char *buffer, int size, int pos)
|
||||
{
|
||||
char *old_word_found;
|
||||
@ -1075,7 +1149,7 @@ completion_search (t_completion *completion, void *channel,
|
||||
if (pos != completion->position)
|
||||
{
|
||||
completion->word_found = NULL;
|
||||
completion_find_context (completion, channel, buffer, size, pos);
|
||||
completion_find_context (completion, server, channel, buffer, size, pos);
|
||||
}
|
||||
|
||||
/* completion */
|
||||
|
@ -54,6 +54,6 @@ struct t_completion
|
||||
|
||||
extern void completion_init (t_completion *);
|
||||
extern void completion_free (t_completion *);
|
||||
extern void completion_search (t_completion *, void *, char *, int, int);
|
||||
extern void completion_search (t_completion *, void *, void *, char *, int, int);
|
||||
|
||||
#endif /* completion.h */
|
||||
|
@ -174,7 +174,8 @@ fifo_exec (char *text)
|
||||
ptr_buffer = gui_buffers;
|
||||
}
|
||||
|
||||
user_command (ptr_server, ptr_buffer, pos_msg);
|
||||
user_command (gui_buffer_find_window (ptr_buffer),
|
||||
ptr_server, pos_msg);
|
||||
}
|
||||
|
||||
/*
|
||||
|
@ -237,6 +237,9 @@ session_save_servers (FILE *file)
|
||||
rc = rc && (session_write_int (file, SESSION_SERV_LAG, ptr_server->lag));
|
||||
rc = rc && (session_write_buf (file, SESSION_SERV_LAG_CHECK_TIME, &(ptr_server->lag_check_time), sizeof (struct timeval)));
|
||||
rc = rc && (session_write_buf (file, SESSION_SERV_LAG_NEXT_CHECK, &(ptr_server->lag_next_check), sizeof (time_t)));
|
||||
rc = rc && (session_write_str (file, SESSION_SERV_CHARSET_DECODE_ISO, ptr_server->charset_decode_iso));
|
||||
rc = rc && (session_write_str (file, SESSION_SERV_CHARSET_DECODE_UTF, ptr_server->charset_decode_utf));
|
||||
rc = rc && (session_write_str (file, SESSION_SERV_CHARSET_ENCODE, ptr_server->charset_encode));
|
||||
rc = rc && (session_write_id (file, SESSION_SERV_END));
|
||||
|
||||
if (!rc)
|
||||
@ -832,6 +835,15 @@ session_load_server (FILE *file)
|
||||
case SESSION_SERV_LAG_NEXT_CHECK:
|
||||
rc = rc && (session_read_buf (file, &(session_current_server->lag_next_check), sizeof (time_t)));
|
||||
break;
|
||||
case SESSION_SERV_CHARSET_DECODE_ISO:
|
||||
rc = rc && (session_read_str (file, &(session_current_server->charset_decode_iso)));
|
||||
break;
|
||||
case SESSION_SERV_CHARSET_DECODE_UTF:
|
||||
rc = rc && (session_read_str (file, &(session_current_server->charset_decode_utf)));
|
||||
break;
|
||||
case SESSION_SERV_CHARSET_ENCODE:
|
||||
rc = rc && (session_read_str (file, &(session_current_server->charset_encode)));
|
||||
break;
|
||||
default:
|
||||
weechat_log_printf (_("session: warning: ignoring value from "
|
||||
"server (object id: %d)\n"));
|
||||
|
@ -84,7 +84,10 @@ enum t_session_server
|
||||
SESSION_SERV_AWAY_TIME,
|
||||
SESSION_SERV_LAG,
|
||||
SESSION_SERV_LAG_CHECK_TIME,
|
||||
SESSION_SERV_LAG_NEXT_CHECK
|
||||
SESSION_SERV_LAG_NEXT_CHECK,
|
||||
SESSION_SERV_CHARSET_DECODE_ISO,
|
||||
SESSION_SERV_CHARSET_DECODE_UTF,
|
||||
SESSION_SERV_CHARSET_ENCODE
|
||||
};
|
||||
|
||||
enum t_session_channel
|
||||
|
@ -209,11 +209,11 @@ weechat_log_printf (char *message, ...)
|
||||
}
|
||||
|
||||
/*
|
||||
* weechat_convert_encoding: convert string to another encoding
|
||||
* weechat_iconv: convert string to another charset
|
||||
*/
|
||||
|
||||
char *
|
||||
weechat_convert_encoding (char *from_code, char *to_code, char *string)
|
||||
weechat_iconv (char *from_code, char *to_code, char *string)
|
||||
{
|
||||
char *outbuf;
|
||||
|
||||
@ -584,7 +584,8 @@ weechat_parse_args (int argc, char *argv[])
|
||||
server_tmp.ipv6, server_tmp.ssl,
|
||||
server_tmp.password, server_tmp.nick1,
|
||||
server_tmp.nick2, server_tmp.nick3,
|
||||
NULL, NULL, NULL, 0, server_tmp.autojoin, 1, NULL))
|
||||
NULL, NULL, NULL, 0, server_tmp.autojoin, 1, NULL,
|
||||
NULL, NULL, NULL))
|
||||
fprintf (stderr, _("%s unable to create server ('%s'), ignored\n"),
|
||||
WEECHAT_WARNING, argv[i]);
|
||||
server_destroy (&server_tmp);
|
||||
|
@ -109,7 +109,7 @@ extern int ascii_strcasecmp (char *, char *);
|
||||
extern int ascii_strncasecmp (char *, char *, int);
|
||||
extern void weechat_log_printf (char *, ...);
|
||||
extern void weechat_dump (int);
|
||||
extern char *weechat_convert_encoding (char *, char *, char *);
|
||||
extern char *weechat_iconv (char *, char *, char *);
|
||||
extern long get_timeval_diff (struct timeval *, struct timeval *);
|
||||
extern void weechat_shutdown (int, int);
|
||||
|
||||
|
@ -937,6 +937,21 @@ t_config_option weechat_options_server[] =
|
||||
N_("comma separated list of notify levels for channels of this server (format: #channel:1,..)"),
|
||||
OPTION_TYPE_STRING, 0, 0, 0,
|
||||
"", NULL, NULL, &(cfg_server.notify_levels), config_change_notify_levels },
|
||||
{ "server_charset_decode_iso", N_("charset for decoding ISO on server and channels"),
|
||||
N_("comma separated list of charsets for server and channels, "
|
||||
"to decode ISO (format: server:charset,#channel:charset,..)"),
|
||||
OPTION_TYPE_STRING, 0, 0, 0,
|
||||
"", NULL, NULL, &(cfg_server.charset_decode_iso), config_change_noop },
|
||||
{ "server_charset_decode_utf", N_("charset for decoding UTF on server and channels"),
|
||||
N_("comma separated list of charsets for server and channels, "
|
||||
"to decode UTF (format: server:charset,#channel:charset,..)"),
|
||||
OPTION_TYPE_STRING, 0, 0, 0,
|
||||
"", NULL, NULL, &(cfg_server.charset_decode_utf), config_change_noop },
|
||||
{ "server_charset_encode", N_("charset for encoding messages on server and channels"),
|
||||
N_("comma separated list of charsets for server and channels, "
|
||||
"to encode messages (format: server:charset,#channel:charset,..)"),
|
||||
OPTION_TYPE_STRING, 0, 0, 0,
|
||||
"", NULL, NULL, &(cfg_server.charset_encode), config_change_noop },
|
||||
{ NULL, NULL, NULL, 0, 0, 0, 0, NULL, NULL, NULL, NULL, NULL }
|
||||
};
|
||||
|
||||
@ -951,12 +966,12 @@ t_config_option *weechat_options[CONFIG_NUMBER_SECTIONS] =
|
||||
|
||||
|
||||
/*
|
||||
* get_pos_array_values: returns position of a string in an array of values
|
||||
* returns -1 if not found, otherwise position
|
||||
* config_get_pos_array_values: return position of a string in an array of values
|
||||
* return -1 if not found, otherwise position
|
||||
*/
|
||||
|
||||
int
|
||||
get_pos_array_values (char **array, char *string)
|
||||
config_get_pos_array_values (char **array, char *string)
|
||||
{
|
||||
int i;
|
||||
|
||||
@ -1240,7 +1255,8 @@ config_option_set_value (t_config_option *option, char *value)
|
||||
*(option->ptr_int) = int_value;
|
||||
break;
|
||||
case OPTION_TYPE_INT_WITH_STRING:
|
||||
int_value = get_pos_array_values (option->array_values, value);
|
||||
int_value = config_get_pos_array_values (option->array_values,
|
||||
value);
|
||||
if (int_value < 0)
|
||||
return -1;
|
||||
*(option->ptr_int) = int_value;
|
||||
@ -1258,6 +1274,116 @@ config_option_set_value (t_config_option *option, char *value)
|
||||
return 0;
|
||||
}
|
||||
|
||||
/*
|
||||
* config_option_list_remove: remove an item from a list for an option
|
||||
* (for options with value like: "abc:1,def:blabla")
|
||||
*/
|
||||
|
||||
void
|
||||
config_option_list_remove (char **string, char *item)
|
||||
{
|
||||
char *name, *pos, *pos2;
|
||||
|
||||
if (!string || !(*string))
|
||||
return;
|
||||
|
||||
name = (char *) malloc (strlen (item) + 2);
|
||||
strcpy (name, item);
|
||||
strcat (name, ":");
|
||||
pos = strstr (*string, name);
|
||||
free (name);
|
||||
if (pos)
|
||||
{
|
||||
pos2 = pos + strlen (item);
|
||||
if (pos2[0] == ':')
|
||||
{
|
||||
pos2++;
|
||||
if (pos2[0])
|
||||
{
|
||||
while (pos2[0] && (pos2[0] != ','))
|
||||
pos2++;
|
||||
if (pos2[0] == ',')
|
||||
pos2++;
|
||||
if (!pos2[0] && (pos != (*string)))
|
||||
pos--;
|
||||
strcpy (pos, pos2);
|
||||
if (!(*string)[0])
|
||||
{
|
||||
free (*string);
|
||||
*string = NULL;
|
||||
}
|
||||
else
|
||||
(*string) = (char *) realloc (*string, strlen (*string) + 1);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
/*
|
||||
* config_option_list_set: set an item from a list for an option
|
||||
* (for options with value like: "abc:1,def:blabla")
|
||||
*/
|
||||
|
||||
void
|
||||
config_option_list_set (char **string, char *item, char *value)
|
||||
{
|
||||
config_option_list_remove (string, item);
|
||||
|
||||
if (!(*string))
|
||||
{
|
||||
(*string) = (char *) malloc (strlen (item) + 1 + strlen (value) + 1);
|
||||
(*string)[0] = '\0';
|
||||
}
|
||||
else
|
||||
(*string) = (char *) realloc (*string,
|
||||
strlen (*string) + 1 +
|
||||
strlen (item) + 1 + strlen (value) + 1);
|
||||
|
||||
if ((*string)[0])
|
||||
strcat (*string, ",");
|
||||
strcat (*string, item);
|
||||
strcat (*string, ":");
|
||||
strcat (*string, value);
|
||||
}
|
||||
|
||||
/*
|
||||
* config_option_list_get_value: return position of item value in the list
|
||||
* (for options with value like: "abc:1,def:blabla")
|
||||
*/
|
||||
|
||||
void
|
||||
config_option_list_get_value (char **string, char *item,
|
||||
char **pos_found, int *length)
|
||||
{
|
||||
char *name, *pos, *pos2, *pos_comma;
|
||||
|
||||
*pos_found = NULL;
|
||||
*length = 0;
|
||||
|
||||
if (!string || !(*string))
|
||||
return;
|
||||
|
||||
name = (char *) malloc (strlen (item) + 2);
|
||||
strcpy (name, item);
|
||||
strcat (name, ":");
|
||||
pos = strstr (*string, name);
|
||||
free (name);
|
||||
if (pos)
|
||||
{
|
||||
pos2 = pos + strlen (item);
|
||||
if (pos2[0] == ':')
|
||||
{
|
||||
pos2++;
|
||||
*pos_found = pos2;
|
||||
pos_comma = strchr (pos2, ',');
|
||||
if (pos_comma)
|
||||
*length = pos_comma - pos2;
|
||||
else
|
||||
*length = strlen (pos2);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
/*
|
||||
* config_get_server_option_ptr: get a pointer to a server config option
|
||||
*/
|
||||
@ -1303,6 +1429,12 @@ config_get_server_option_ptr (t_irc_server *server, char *option_name)
|
||||
return (void *)(&server->autorejoin);
|
||||
if (ascii_strcasecmp (option_name, "server_notify_levels") == 0)
|
||||
return (void *)(&server->notify_levels);
|
||||
if (ascii_strcasecmp (option_name, "server_charset_decode_iso") == 0)
|
||||
return (void *)(&server->charset_decode_iso);
|
||||
if (ascii_strcasecmp (option_name, "server_charset_decode_utf") == 0)
|
||||
return (void *)(&server->charset_decode_utf);
|
||||
if (ascii_strcasecmp (option_name, "server_charset_encode") == 0)
|
||||
return (void *)(&server->charset_encode);
|
||||
/* option not found */
|
||||
return NULL;
|
||||
}
|
||||
@ -1357,7 +1489,8 @@ config_set_server_value (t_irc_server *server, char *option_name,
|
||||
*((int *)(ptr_data)) = int_value;
|
||||
break;
|
||||
case OPTION_TYPE_INT_WITH_STRING:
|
||||
int_value = get_pos_array_values (ptr_option->array_values, value);
|
||||
int_value = config_get_pos_array_values (ptr_option->array_values,
|
||||
value);
|
||||
if (int_value < 0)
|
||||
return -2;
|
||||
*((int *)(ptr_data)) = int_value;
|
||||
@ -1527,7 +1660,9 @@ config_allocate_server (char *filename, int line_number)
|
||||
cfg_server.password, cfg_server.nick1, cfg_server.nick2,
|
||||
cfg_server.nick3, cfg_server.username, cfg_server.realname,
|
||||
cfg_server.command, cfg_server.command_delay, cfg_server.autojoin,
|
||||
cfg_server.autorejoin, cfg_server.notify_levels))
|
||||
cfg_server.autorejoin, cfg_server.notify_levels,
|
||||
cfg_server.charset_decode_iso, cfg_server.charset_decode_utf,
|
||||
cfg_server.charset_encode))
|
||||
{
|
||||
server_free_all ();
|
||||
gui_printf (NULL,
|
||||
@ -1566,7 +1701,7 @@ config_default_values ()
|
||||
weechat_options[i][j].default_int;
|
||||
break;
|
||||
case OPTION_TYPE_INT_WITH_STRING:
|
||||
int_value = get_pos_array_values (
|
||||
int_value = config_get_pos_array_values (
|
||||
weechat_options[i][j].array_values,
|
||||
weechat_options[i][j].default_string);
|
||||
if (int_value < 0)
|
||||
@ -2064,6 +2199,10 @@ config_create_default ()
|
||||
fprintf (file, "server_command_delay = 0\n");
|
||||
fprintf (file, "server_autojoin = \"\"\n");
|
||||
fprintf (file, "server_autorejoin = on\n");
|
||||
fprintf (file, "server_notify_levels = \"\"\n");
|
||||
fprintf (file, "server_charset_decode_iso = \"\"\n");
|
||||
fprintf (file, "server_charset_decode_utf = \"\"\n");
|
||||
fprintf (file, "server_charset_encode = \"\"\n");
|
||||
|
||||
fclose (file);
|
||||
chmod (filename, 0600);
|
||||
@ -2251,6 +2390,12 @@ config_write (char *config_name)
|
||||
(ptr_server->autorejoin) ? "on" : "off");
|
||||
fprintf (file, "server_notify_levels = \"%s\"\n",
|
||||
(ptr_server->notify_levels) ? ptr_server->notify_levels : "");
|
||||
fprintf (file, "server_charset_decode_iso = \"%s\"\n",
|
||||
(ptr_server->charset_decode_iso) ? ptr_server->charset_decode_iso : "");
|
||||
fprintf (file, "server_charset_decode_utf = \"%s\"\n",
|
||||
(ptr_server->charset_decode_utf) ? ptr_server->charset_decode_utf : "");
|
||||
fprintf (file, "server_charset_encode = \"%s\"\n",
|
||||
(ptr_server->charset_encode) ? ptr_server->charset_encode : "");
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -238,6 +238,9 @@ extern void config_change_fifo_pipe ();
|
||||
extern void config_change_notify_levels ();
|
||||
extern void config_change_log ();
|
||||
extern int config_option_set_value (t_config_option *, char *);
|
||||
extern void config_option_list_remove (char **, char *);
|
||||
extern void config_option_list_set (char **, char *, char *);
|
||||
extern void config_option_list_get_value (char **, char *, char **, int *);
|
||||
extern t_config_option *config_option_search (char *);
|
||||
extern void config_option_search_option_value (char *, t_config_option **, void **);
|
||||
extern int config_set_value (char *, char *);
|
||||
|
@ -806,11 +806,9 @@ gui_draw_buffer_title (t_gui_buffer *buffer, int erase)
|
||||
if (CHANNEL(buffer)->topic)
|
||||
{
|
||||
buf = (char *)gui_color_decode ((unsigned char *)(CHANNEL(buffer)->topic), 0);
|
||||
buf2 = 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,
|
||||
(buf) ? buf : CHANNEL(buffer)->topic);
|
||||
buf2 = channel_iconv_decode (SERVER(buffer),
|
||||
CHANNEL(buffer),
|
||||
(buf) ? buf : CHANNEL(buffer)->topic);
|
||||
mvwprintw (ptr_win->win_title, 0, 0, format, (buf2) ? buf2 : CHANNEL(buffer)->topic);
|
||||
if (buf)
|
||||
free (buf);
|
||||
@ -1519,12 +1517,10 @@ gui_draw_buffer_chat (t_gui_buffer *buffer, int erase)
|
||||
mvwprintw (ptr_win->win_chat, i, 0, "%s %-16s ",
|
||||
(ptr_dcc == dcc_selected) ? "***" : " ",
|
||||
ptr_dcc->nick);
|
||||
buf = 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,
|
||||
(DCC_IS_CHAT(ptr_dcc->type)) ?
|
||||
_(ptr_dcc->filename) : ptr_dcc->filename);
|
||||
buf = channel_iconv_decode (SERVER(buffer),
|
||||
CHANNEL(buffer),
|
||||
(DCC_IS_CHAT(ptr_dcc->type)) ?
|
||||
_(ptr_dcc->filename) : ptr_dcc->filename);
|
||||
wprintw (ptr_win->win_chat, "%s", buf);
|
||||
free (buf);
|
||||
if (DCC_IS_FILE(ptr_dcc->type))
|
||||
@ -1543,11 +1539,9 @@ gui_draw_buffer_chat (t_gui_buffer *buffer, int erase)
|
||||
(DCC_IS_RECV(ptr_dcc->type)) ? "-->>" : "<<--");
|
||||
gui_window_set_weechat_color (ptr_win->win_chat,
|
||||
COLOR_DCC_WAITING + ptr_dcc->status);
|
||||
buf = 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,
|
||||
_(dcc_status_string[ptr_dcc->status]));
|
||||
buf = channel_iconv_decode (SERVER(buffer),
|
||||
CHANNEL(buffer),
|
||||
_(dcc_status_string[ptr_dcc->status]));
|
||||
wprintw (ptr_win->win_chat, "%-10s", buf);
|
||||
free (buf);
|
||||
|
||||
@ -1604,11 +1598,9 @@ gui_draw_buffer_chat (t_gui_buffer *buffer, int erase)
|
||||
ptr_dcc->eta % 60);
|
||||
}
|
||||
sprintf (format, "%s %%s/s)", unit_format[num_unit]);
|
||||
buf = 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,
|
||||
unit_name[num_unit]);
|
||||
buf = channel_iconv_decode (SERVER(buffer),
|
||||
CHANNEL(buffer),
|
||||
unit_name[num_unit]);
|
||||
wprintw (ptr_win->win_chat, format,
|
||||
((long double) ptr_dcc->bytes_per_sec) / ((long double)(unit_divide[num_unit])),
|
||||
buf);
|
||||
|
@ -108,9 +108,7 @@ gui_action_return (t_gui_window *window)
|
||||
window->buffer->completion.position = -1;
|
||||
window->buffer->ptr_history = NULL;
|
||||
gui_draw_buffer_input (window->buffer, 0);
|
||||
user_command (SERVER(window->buffer),
|
||||
window->buffer,
|
||||
command);
|
||||
user_command (window, SERVER(window->buffer), command);
|
||||
free (command);
|
||||
}
|
||||
}
|
||||
@ -128,6 +126,7 @@ gui_action_tab (t_gui_window *window)
|
||||
if (window->buffer->has_input)
|
||||
{
|
||||
completion_search (&(window->buffer->completion),
|
||||
SERVER(window->buffer),
|
||||
CHANNEL(window->buffer),
|
||||
window->buffer->input_buffer,
|
||||
window->buffer->input_buffer_size,
|
||||
|
@ -321,6 +321,26 @@ gui_buffer_search (char *server, char *channel)
|
||||
return (ptr_buffer->dcc) ? gui_buffers : ptr_buffer;
|
||||
}
|
||||
|
||||
/*
|
||||
* gui_buffer_find_window: find a window displaying buffer
|
||||
*/
|
||||
|
||||
t_gui_window *
|
||||
gui_buffer_find_window (t_gui_buffer *buffer)
|
||||
{
|
||||
t_gui_window *ptr_win;
|
||||
|
||||
for (ptr_win = gui_windows; ptr_win;
|
||||
ptr_win = ptr_win->next_window)
|
||||
{
|
||||
if (ptr_win->buffer == buffer)
|
||||
return ptr_win;
|
||||
}
|
||||
|
||||
/* no window found */
|
||||
return NULL;
|
||||
}
|
||||
|
||||
/*
|
||||
* gui_buffer_servers_search: search servers buffer
|
||||
* (when same buffer is used for all servers)
|
||||
@ -857,7 +877,7 @@ gui_printf_internal (t_gui_buffer *buffer, int display_time, int type, char *mes
|
||||
time_t time_seconds;
|
||||
struct tm *local_time;
|
||||
int time_first_digit, time_last_digit;
|
||||
char *pos, *buf2;
|
||||
char *buf2, *pos;
|
||||
int i;
|
||||
va_list argptr;
|
||||
static time_t seconds;
|
||||
@ -898,12 +918,8 @@ gui_printf_internal (t_gui_buffer *buffer, int display_time, int type, char *mes
|
||||
if (!buf[0])
|
||||
return;
|
||||
|
||||
if (!local_utf8 || !utf8_is_valid (buf))
|
||||
buf2 = 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,
|
||||
buf);
|
||||
if (gui_init_ok)
|
||||
buf2 = channel_iconv_decode (SERVER(buffer), CHANNEL(buffer), buf);
|
||||
else
|
||||
buf2 = strdup (buf);
|
||||
|
||||
@ -1015,16 +1031,7 @@ gui_infobar_printf (int time_displayed, int color, char *message, ...)
|
||||
buf2 = (char *)gui_color_decode ((unsigned char *)buffer, 0);
|
||||
|
||||
if (buf2)
|
||||
{
|
||||
if (!local_utf8 || !utf8_is_valid (buf2))
|
||||
buf3 = 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,
|
||||
buf2);
|
||||
else
|
||||
buf3 = strdup (buf2);
|
||||
}
|
||||
buf3 = channel_iconv_decode (NULL, NULL, buf2);
|
||||
else
|
||||
buf3 = NULL;
|
||||
|
||||
|
@ -517,8 +517,8 @@ gui_key_pressed (char *key_str)
|
||||
/* exact combo found => execute function or command */
|
||||
gui_key_buffer[0] = '\0';
|
||||
if (ptr_key->command)
|
||||
user_command (SERVER(gui_current_window->buffer),
|
||||
gui_current_window->buffer,
|
||||
user_command (gui_current_window,
|
||||
SERVER(gui_current_window->buffer),
|
||||
ptr_key->command);
|
||||
else
|
||||
(void)(ptr_key->function)(gui_current_window);
|
||||
|
@ -402,6 +402,7 @@ extern void gui_window_tree_node_to_leaf (t_gui_window_tree *, t_gui_window *);
|
||||
extern void gui_window_tree_free (t_gui_window_tree **);
|
||||
extern t_gui_window *gui_window_new (t_gui_window *, int, int, int, int, int, int);
|
||||
extern t_gui_buffer *gui_buffer_search (char *, char *);
|
||||
extern t_gui_window *gui_buffer_find_window (t_gui_buffer *);
|
||||
extern t_gui_buffer *gui_buffer_new (t_gui_window *, void *, void *, int, int);
|
||||
extern void gui_buffer_clear (t_gui_buffer *);
|
||||
extern void gui_buffer_clear_all ();
|
||||
|
@ -30,6 +30,8 @@
|
||||
|
||||
#include "../common/weechat.h"
|
||||
#include "irc.h"
|
||||
#include "../common/utf8.h"
|
||||
#include "../common/weeconfig.h"
|
||||
#include "../gui/gui.h"
|
||||
|
||||
|
||||
@ -171,6 +173,143 @@ string_is_channel (char *string)
|
||||
return (strpbrk (first_char, CHANNEL_PREFIX)) ? 1 : 0;
|
||||
}
|
||||
|
||||
/*
|
||||
* channel_get_charset_decode_iso: get decode iso value for channel
|
||||
* if not found for channel, look for server
|
||||
* if not found for server, look for global
|
||||
*/
|
||||
|
||||
char *
|
||||
channel_get_charset_decode_iso (t_irc_server *server, t_irc_channel *channel)
|
||||
{
|
||||
char *pos, *result;
|
||||
int length;
|
||||
|
||||
if (!server)
|
||||
return (cfg_look_charset_decode_iso) ?
|
||||
strdup (cfg_look_charset_decode_iso) : strdup ("");
|
||||
|
||||
if (!channel)
|
||||
return server_get_charset_decode_iso (server);
|
||||
|
||||
config_option_list_get_value (&(server->charset_decode_iso),
|
||||
channel->name, &pos, &length);
|
||||
if (pos && (length > 0))
|
||||
{
|
||||
result = strdup (pos);
|
||||
result[length] = '\0';
|
||||
return result;
|
||||
}
|
||||
|
||||
return server_get_charset_decode_iso (server);
|
||||
}
|
||||
|
||||
/*
|
||||
* channel_get_charset_decode_utf: get decode utf value for channel
|
||||
* if not found for channel, look for server
|
||||
* if not found for server, look for global
|
||||
*/
|
||||
|
||||
char *
|
||||
channel_get_charset_decode_utf (t_irc_server *server, t_irc_channel *channel)
|
||||
{
|
||||
char *pos, *result;
|
||||
int length;
|
||||
|
||||
if (!server)
|
||||
return (cfg_look_charset_decode_utf) ?
|
||||
strdup (cfg_look_charset_decode_utf) : strdup ("");
|
||||
|
||||
if (!channel)
|
||||
return server_get_charset_decode_utf (server);
|
||||
|
||||
config_option_list_get_value (&(server->charset_decode_utf),
|
||||
channel->name, &pos, &length);
|
||||
if (pos && (length > 0))
|
||||
{
|
||||
result = strdup (pos);
|
||||
result[length] = '\0';
|
||||
return result;
|
||||
}
|
||||
|
||||
return server_get_charset_decode_utf (server);
|
||||
}
|
||||
|
||||
/*
|
||||
* channel_get_charset_encode: get encode value for channel
|
||||
* if not found for channel, look for server
|
||||
* if not found for server, look for global
|
||||
*/
|
||||
|
||||
char *
|
||||
channel_get_charset_encode (t_irc_server *server, t_irc_channel *channel)
|
||||
{
|
||||
char *pos, *result;
|
||||
int length;
|
||||
|
||||
if (!server)
|
||||
return (cfg_look_charset_encode) ?
|
||||
strdup (cfg_look_charset_encode) : strdup ("");
|
||||
|
||||
if (!channel)
|
||||
return server_get_charset_encode (server);
|
||||
|
||||
config_option_list_get_value (&(server->charset_encode),
|
||||
channel->name, &pos, &length);
|
||||
if (pos && (length > 0))
|
||||
{
|
||||
result = strdup (pos);
|
||||
result[length] = '\0';
|
||||
return result;
|
||||
}
|
||||
|
||||
return server_get_charset_encode (server);
|
||||
}
|
||||
|
||||
/*
|
||||
* channel_iconv_decode: convert string to local charset
|
||||
*/
|
||||
|
||||
char *
|
||||
channel_iconv_decode (t_irc_server *server, t_irc_channel *channel, char *string)
|
||||
{
|
||||
char *from_charset, *string2;
|
||||
|
||||
if (!local_utf8 || !utf8_is_valid (string))
|
||||
{
|
||||
if (local_utf8)
|
||||
from_charset = channel_get_charset_decode_iso (server, channel);
|
||||
else
|
||||
from_charset = channel_get_charset_decode_utf (server, channel);
|
||||
string2 = weechat_iconv (from_charset,
|
||||
(cfg_look_charset_internal && cfg_look_charset_internal[0]) ?
|
||||
cfg_look_charset_internal : local_charset,
|
||||
string);
|
||||
free (from_charset);
|
||||
return string2;
|
||||
}
|
||||
else
|
||||
return strdup (string);
|
||||
}
|
||||
|
||||
/*
|
||||
*
|
||||
*/
|
||||
|
||||
char *
|
||||
channel_iconv_encode (t_irc_server *server, t_irc_channel *channel, char *string)
|
||||
{
|
||||
char *to_charset, *string2;
|
||||
|
||||
to_charset = channel_get_charset_encode (server, channel);
|
||||
string2 = weechat_iconv ((cfg_look_charset_internal && cfg_look_charset_internal[0]) ?
|
||||
cfg_look_charset_internal : local_charset,
|
||||
to_charset,
|
||||
string);
|
||||
free (to_charset);
|
||||
return string2;
|
||||
}
|
||||
|
||||
/*
|
||||
* channel_remove_away: remove away for all nicks on a channel
|
||||
*/
|
||||
@ -305,44 +444,6 @@ channel_get_notify_level (t_irc_server *server, t_irc_channel *channel)
|
||||
return notify;
|
||||
}
|
||||
|
||||
/*
|
||||
* server_remove_notify_level: remove channel notify from list
|
||||
*/
|
||||
|
||||
void
|
||||
channel_remove_notify_level (t_irc_server *server, t_irc_channel *channel)
|
||||
{
|
||||
char *name, *pos, *pos2;
|
||||
|
||||
if ((!server) || (!channel))
|
||||
return;
|
||||
|
||||
name = (char *) malloc (strlen (channel->name) + 2);
|
||||
strcpy (name, channel->name);
|
||||
strcat (name, ":");
|
||||
pos = strstr (server->notify_levels, name);
|
||||
free (name);
|
||||
if (pos)
|
||||
{
|
||||
pos2 = pos + strlen (channel->name);
|
||||
if (pos2[0] == ':')
|
||||
{
|
||||
pos2++;
|
||||
if (pos2[0])
|
||||
{
|
||||
pos2++;
|
||||
if (pos2[0] == ',')
|
||||
pos2++;
|
||||
if (!pos2[0] && (pos != server->notify_levels))
|
||||
pos--;
|
||||
strcpy (pos, pos2);
|
||||
server->notify_levels = (char *) realloc (server->notify_levels,
|
||||
strlen (server->notify_levels) + 1);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
/*
|
||||
* server_set_notify_level: set channel notify level
|
||||
*/
|
||||
@ -350,52 +451,19 @@ channel_remove_notify_level (t_irc_server *server, t_irc_channel *channel)
|
||||
void
|
||||
channel_set_notify_level (t_irc_server *server, t_irc_channel *channel, int notify)
|
||||
{
|
||||
char *name, *pos, *pos2, level_string[2];
|
||||
char level_string[2];
|
||||
|
||||
if ((!server) || (!channel))
|
||||
return;
|
||||
|
||||
if (notify == NOTIFY_LEVEL_DEFAULT)
|
||||
{
|
||||
channel_remove_notify_level (server, channel);
|
||||
return;
|
||||
}
|
||||
|
||||
if (!server->notify_levels)
|
||||
{
|
||||
server->notify_levels = (char *) malloc (strlen (channel->name) + 3);
|
||||
server->notify_levels[0] = '\0';
|
||||
}
|
||||
config_option_list_remove (&(server->notify_levels), channel->name);
|
||||
else
|
||||
{
|
||||
name = (char *) malloc (strlen (channel->name) + 2);
|
||||
strcpy (name, channel->name);
|
||||
strcat (name, ":");
|
||||
pos = strstr (server->notify_levels, name);
|
||||
free (name);
|
||||
if (pos)
|
||||
{
|
||||
pos2 = pos + strlen (channel->name) + 1;
|
||||
if (pos2[0])
|
||||
{
|
||||
pos2[0] = '0' + notify;
|
||||
return;
|
||||
}
|
||||
}
|
||||
/* realloc notify list to add channel */
|
||||
server->notify_levels = (char *) realloc (server->notify_levels,
|
||||
strlen (server->notify_levels) + 1 +
|
||||
strlen (channel->name) + 2 + 1);
|
||||
level_string[0] = notify + '0';
|
||||
level_string[1] = '\0';
|
||||
config_option_list_set (&(server->notify_levels), channel->name, level_string);
|
||||
}
|
||||
|
||||
/* channel not in notify list => add it */
|
||||
if (server->notify_levels[0])
|
||||
strcat (server->notify_levels, ",");
|
||||
strcat (server->notify_levels, channel->name);
|
||||
strcat (server->notify_levels, ":");
|
||||
level_string[0] = notify + '0';
|
||||
level_string[1] = '\0';
|
||||
strcat (server->notify_levels, level_string);
|
||||
}
|
||||
|
||||
/*
|
||||
|
@ -1120,10 +1120,9 @@ dcc_chat_sendf (t_irc_dcc *ptr_dcc, char *fmt, ...)
|
||||
gui_printf (ptr_dcc->server->buffer, "[DEBUG] Sending to remote host (DCC CHAT) >>> %s\n", buffer);
|
||||
buffer[size_buf - 2] = '\r';
|
||||
#endif
|
||||
buf2 = weechat_convert_encoding ((cfg_look_charset_internal && cfg_look_charset_internal[0]) ?
|
||||
cfg_look_charset_internal : local_charset,
|
||||
cfg_look_charset_encode,
|
||||
buffer);
|
||||
buf2 = channel_iconv_encode (ptr_dcc->server,
|
||||
ptr_dcc->channel,
|
||||
buffer);
|
||||
if (dcc_chat_send (ptr_dcc, buf2, strlen (buf2)) <= 0)
|
||||
{
|
||||
irc_display_prefix (ptr_dcc->server, ptr_dcc->server->buffer,
|
||||
@ -1144,7 +1143,7 @@ void
|
||||
dcc_chat_recv (t_irc_dcc *ptr_dcc)
|
||||
{
|
||||
static char buffer[4096 + 2];
|
||||
char *buf2, *pos, *ptr_buf, *next_ptr_buf;
|
||||
char *buf2, *pos, *ptr_buf, *ptr_buf2, *next_ptr_buf;
|
||||
char *ptr_buf_color;
|
||||
int num_read;
|
||||
|
||||
@ -1196,7 +1195,11 @@ dcc_chat_recv (t_irc_dcc *ptr_dcc)
|
||||
|
||||
if (ptr_buf)
|
||||
{
|
||||
ptr_buf_color = (char *)gui_color_decode ((unsigned char *)ptr_buf,
|
||||
ptr_buf2 = channel_iconv_decode (ptr_dcc->server,
|
||||
ptr_dcc->channel,
|
||||
ptr_buf);
|
||||
ptr_buf_color = (char *)gui_color_decode ((ptr_buf2) ?
|
||||
(unsigned char *)ptr_buf2 : (unsigned char *)ptr_buf,
|
||||
cfg_irc_colors_receive);
|
||||
gui_printf_type (ptr_dcc->channel->buffer, MSG_TYPE_NICK,
|
||||
"%s<", GUI_COLOR(COLOR_WIN_CHAT_DARK));
|
||||
@ -1213,7 +1216,7 @@ dcc_chat_recv (t_irc_dcc *ptr_dcc)
|
||||
COLOR_WIN_INFOBAR_HIGHLIGHT,
|
||||
_("Private %s> %s"),
|
||||
ptr_dcc->nick,
|
||||
(ptr_buf_color) ? ptr_buf_color : ptr_buf);
|
||||
(ptr_buf_color) ? ptr_buf_color : ((ptr_buf2) ? ptr_buf2 : ptr_buf));
|
||||
}
|
||||
else
|
||||
gui_printf_type (ptr_dcc->channel->buffer, MSG_TYPE_NICK,
|
||||
@ -1228,13 +1231,15 @@ dcc_chat_recv (t_irc_dcc *ptr_dcc)
|
||||
(ptr_buf_color) ? ptr_buf_color : ptr_buf);
|
||||
if (ptr_buf_color)
|
||||
free (ptr_buf_color);
|
||||
if (ptr_buf2)
|
||||
free (ptr_buf2);
|
||||
}
|
||||
|
||||
ptr_buf = next_ptr_buf;
|
||||
}
|
||||
|
||||
if (buf2)
|
||||
free (buf2);
|
||||
free (buf2);
|
||||
}
|
||||
else
|
||||
{
|
||||
|
@ -185,27 +185,27 @@ irc_display_server (t_irc_server *server)
|
||||
_("connected") : _("not connected"),
|
||||
GUI_COLOR(COLOR_WIN_CHAT_DARK));
|
||||
|
||||
gui_printf (NULL, " server_autoconnect . . . .: %s%s\n",
|
||||
gui_printf (NULL, " server_autoconnect . . . . : %s%s\n",
|
||||
(server->autoconnect) ? _("on") : _("off"),
|
||||
(server->command_line) ?
|
||||
_(" (temporary server, will not be saved)") : "");
|
||||
gui_printf (NULL, " server_autoreconnect . . .: %s\n",
|
||||
gui_printf (NULL, " server_autoreconnect . . . : %s\n",
|
||||
(server->autoreconnect) ? _("on") : _("off"));
|
||||
gui_printf (NULL, " server_autoreconnect_delay: %d %s\n",
|
||||
gui_printf (NULL, " server_autoreconnect_delay : %d %s\n",
|
||||
server->autoreconnect_delay,
|
||||
_("seconds"));
|
||||
gui_printf (NULL, " server_address . . . . . .: %s\n",
|
||||
gui_printf (NULL, " server_address . . . . . . : %s\n",
|
||||
server->address);
|
||||
gui_printf (NULL, " server_port . . . . . . .: %d\n",
|
||||
gui_printf (NULL, " server_port . . . . . . . : %d\n",
|
||||
server->port);
|
||||
gui_printf (NULL, " server_ipv6 . . . . . . .: %s\n",
|
||||
gui_printf (NULL, " server_ipv6 . . . . . . . : %s\n",
|
||||
(server->ipv6) ? _("on") : _("off"));
|
||||
gui_printf (NULL, " server_ssl . . . . . . . .: %s\n",
|
||||
gui_printf (NULL, " server_ssl . . . . . . . . : %s\n",
|
||||
(server->ssl) ? _("on") : _("off"));
|
||||
gui_printf (NULL, " server_password . . . . .: %s\n",
|
||||
gui_printf (NULL, " server_password . . . . . : %s\n",
|
||||
(server->password && server->password[0]) ?
|
||||
_("(hidden)") : "");
|
||||
gui_printf (NULL, " server_nick1/2/3 . . . . .: %s %s/ %s%s %s/ %s%s\n",
|
||||
gui_printf (NULL, " server_nick1/2/3 . . . . . : %s %s/ %s%s %s/ %s%s\n",
|
||||
server->nick1,
|
||||
GUI_COLOR(COLOR_WIN_CHAT_DARK),
|
||||
GUI_COLOR(COLOR_WIN_CHAT),
|
||||
@ -213,20 +213,29 @@ irc_display_server (t_irc_server *server)
|
||||
GUI_COLOR(COLOR_WIN_CHAT_DARK),
|
||||
GUI_COLOR(COLOR_WIN_CHAT),
|
||||
server->nick3);
|
||||
gui_printf (NULL, " server_username . . . . .: %s\n",
|
||||
gui_printf (NULL, " server_username . . . . . : %s\n",
|
||||
server->username);
|
||||
gui_printf (NULL, " server_realname . . . . .: %s\n",
|
||||
gui_printf (NULL, " server_realname . . . . . : %s\n",
|
||||
server->realname);
|
||||
gui_printf (NULL, " server_command . . . . . .: %s\n",
|
||||
gui_printf (NULL, " server_command . . . . . . : %s\n",
|
||||
(server->command && server->command[0]) ?
|
||||
server->command : "");
|
||||
gui_printf (NULL, " server_command_delay . . .: %d %s\n",
|
||||
gui_printf (NULL, " server_command_delay . . . : %d %s\n",
|
||||
server->command_delay,
|
||||
_("seconds"));
|
||||
gui_printf (NULL, " server_autojoin . . . . .: %s\n",
|
||||
gui_printf (NULL, " server_autojoin . . . . . : %s\n",
|
||||
(server->autojoin && server->autojoin[0]) ?
|
||||
server->autojoin : "");
|
||||
gui_printf (NULL, " server_notify_levels . . .: %s\n",
|
||||
gui_printf (NULL, " server_notify_levels . . . : %s\n",
|
||||
(server->notify_levels && server->notify_levels[0]) ?
|
||||
server->notify_levels : "");
|
||||
gui_printf (NULL, " server_charset_decode_iso. : %s\n",
|
||||
(server->charset_decode_iso && server->charset_decode_iso[0]) ?
|
||||
server->charset_decode_iso : "");
|
||||
gui_printf (NULL, " server_charset_decode_utf. : %s\n",
|
||||
(server->charset_decode_utf && server->charset_decode_utf[0]) ?
|
||||
server->charset_decode_utf : "");
|
||||
gui_printf (NULL, " server_charset_encode. . . : %s\n",
|
||||
(server->charset_encode && server->charset_encode[0]) ?
|
||||
server->charset_encode : "");
|
||||
}
|
||||
|
@ -2225,14 +2225,16 @@ irc_cmd_recv_quit (t_irc_server *server, char *host, char *nick, char *arguments
|
||||
pos = strchr (host, '!');
|
||||
irc_display_prefix (server, ptr_channel->buffer, PREFIX_QUIT);
|
||||
gui_printf (ptr_channel->buffer,
|
||||
_("%s%s %s(%s%s%s)%s has quit %s(%s%s%s)\n"),
|
||||
_("%s%s %s(%s%s%s)%s has quit"),
|
||||
GUI_COLOR(COLOR_WIN_CHAT_NICK),
|
||||
nick,
|
||||
GUI_COLOR(COLOR_WIN_CHAT_DARK),
|
||||
GUI_COLOR(COLOR_WIN_CHAT_HOST),
|
||||
(pos) ? pos + 1 : "",
|
||||
GUI_COLOR(COLOR_WIN_CHAT_DARK),
|
||||
GUI_COLOR(COLOR_WIN_CHAT),
|
||||
GUI_COLOR(COLOR_WIN_CHAT));
|
||||
gui_printf (ptr_channel->buffer,
|
||||
" %s(%s%s%s)\n",
|
||||
GUI_COLOR(COLOR_WIN_CHAT_DARK),
|
||||
GUI_COLOR(COLOR_WIN_CHAT),
|
||||
arguments,
|
||||
@ -2447,7 +2449,7 @@ irc_cmd_recv_004 (t_irc_server *server, char *host, char *nick, char *arguments)
|
||||
/* execute command once connected */
|
||||
if (server->command && server->command[0])
|
||||
{
|
||||
user_command(server, NULL, server->command);
|
||||
user_command(NULL, server, server->command);
|
||||
if (server->command_delay > 0)
|
||||
sleep (server->command_delay);
|
||||
}
|
||||
|
@ -84,6 +84,9 @@ server_init (t_irc_server *server)
|
||||
server->autojoin = NULL;
|
||||
server->autorejoin = 0;
|
||||
server->notify_levels = NULL;
|
||||
server->charset_decode_iso = NULL;
|
||||
server->charset_decode_utf = NULL;
|
||||
server->charset_encode = NULL;
|
||||
|
||||
/* internal vars */
|
||||
server->child_pid = 0;
|
||||
@ -294,6 +297,12 @@ server_destroy (t_irc_server *server)
|
||||
free (server->autojoin);
|
||||
if (server->notify_levels)
|
||||
free (server->notify_levels);
|
||||
if (server->charset_decode_iso)
|
||||
free (server->charset_decode_iso);
|
||||
if (server->charset_decode_utf)
|
||||
free (server->charset_decode_utf);
|
||||
if (server->charset_encode)
|
||||
free (server->charset_encode);
|
||||
if (server->unterminated_message)
|
||||
free (server->unterminated_message);
|
||||
if (server->nick)
|
||||
@ -355,7 +364,8 @@ server_new (char *name, int autoconnect, int autoreconnect, int autoreconnect_de
|
||||
int command_line, char *address, int port, int ipv6, int ssl, char *password,
|
||||
char *nick1, char *nick2, char *nick3, char *username,
|
||||
char *realname, char *command, int command_delay, char *autojoin,
|
||||
int autorejoin, char *notify_levels)
|
||||
int autorejoin, char *notify_levels, char *charset_decode_iso,
|
||||
char *charset_decode_utf, char *charset_encode)
|
||||
{
|
||||
t_irc_server *new_server;
|
||||
|
||||
@ -365,12 +375,16 @@ server_new (char *name, int autoconnect, int autoreconnect, int autoreconnect_de
|
||||
#ifdef DEBUG
|
||||
weechat_log_printf ("Creating new server (name:%s, address:%s, port:%d, pwd:%s, "
|
||||
"nick1:%s, nick2:%s, nick3:%s, username:%s, realname:%s, "
|
||||
"command:%s, autojoin:%s, autorejoin:%s, notify_levels:%s)\n",
|
||||
"command:%s, autojoin:%s, autorejoin:%s, notify_levels:%s, "
|
||||
"decode_iso:%s, decode_utf:%s, encode:%s)\n",
|
||||
name, address, port, (password) ? password : "",
|
||||
(nick1) ? nick1 : "", (nick2) ? nick2 : "", (nick3) ? nick3 : "",
|
||||
(username) ? username : "", (realname) ? realname : "",
|
||||
(command) ? command : "", (autojoin) ? autojoin : "",
|
||||
(autorejoin) ? "on" : "off", (notify_levels) ? notify_levels : "");
|
||||
(autorejoin) ? "on" : "off", (notify_levels) ? notify_levels : "",
|
||||
(charset_decode_iso) ? charset_decode_iso : "",
|
||||
(charset_decode_utf) ? charset_decode_utf : "",
|
||||
(charset_encode) ? charset_encode : "");
|
||||
#endif
|
||||
|
||||
if ((new_server = server_alloc ()))
|
||||
@ -400,12 +414,102 @@ server_new (char *name, int autoconnect, int autoreconnect, int autoreconnect_de
|
||||
new_server->autorejoin = autorejoin;
|
||||
new_server->notify_levels =
|
||||
(notify_levels) ? strdup (notify_levels) : NULL;
|
||||
new_server->charset_decode_iso =
|
||||
(charset_decode_iso) ? strdup (charset_decode_iso) : NULL;
|
||||
new_server->charset_decode_utf =
|
||||
(charset_decode_utf) ? strdup (charset_decode_utf) : NULL;
|
||||
new_server->charset_encode =
|
||||
(charset_encode) ? strdup (charset_encode) : NULL;
|
||||
}
|
||||
else
|
||||
return NULL;
|
||||
return new_server;
|
||||
}
|
||||
|
||||
/*
|
||||
* server_get_charset_decode_iso: get decode iso value for server
|
||||
* if not found for server, look for global
|
||||
*/
|
||||
|
||||
char *
|
||||
server_get_charset_decode_iso (t_irc_server *server)
|
||||
{
|
||||
char *pos, *result;
|
||||
int length;
|
||||
|
||||
if (!server)
|
||||
return (cfg_look_charset_decode_iso) ?
|
||||
strdup (cfg_look_charset_decode_iso) : strdup ("");
|
||||
|
||||
config_option_list_get_value (&(server->charset_decode_iso),
|
||||
"server", &pos, &length);
|
||||
if (pos && (length > 0))
|
||||
{
|
||||
result = strdup (pos);
|
||||
result[length] = '\0';
|
||||
return result;
|
||||
}
|
||||
|
||||
return (cfg_look_charset_decode_iso) ?
|
||||
strdup (cfg_look_charset_decode_iso) : strdup ("");
|
||||
}
|
||||
|
||||
/*
|
||||
* server_get_charset_decode_utf: get decode utf value for server
|
||||
* if not found for server, look for global
|
||||
*/
|
||||
|
||||
char *
|
||||
server_get_charset_decode_utf (t_irc_server *server)
|
||||
{
|
||||
char *pos, *result;
|
||||
int length;
|
||||
|
||||
if (!server)
|
||||
return (cfg_look_charset_decode_utf) ?
|
||||
strdup (cfg_look_charset_decode_utf) : strdup ("");
|
||||
|
||||
config_option_list_get_value (&(server->charset_decode_utf),
|
||||
"server", &pos, &length);
|
||||
if (pos && (length > 0))
|
||||
{
|
||||
result = strdup (pos);
|
||||
result[length] = '\0';
|
||||
return result;
|
||||
}
|
||||
|
||||
return (cfg_look_charset_decode_utf) ?
|
||||
strdup (cfg_look_charset_decode_utf) : strdup ("");
|
||||
}
|
||||
|
||||
/*
|
||||
* server_get_charset_encode: get encode value for server
|
||||
* if not found for server, look for global
|
||||
*/
|
||||
|
||||
char *
|
||||
server_get_charset_encode (t_irc_server *server)
|
||||
{
|
||||
char *pos, *result;
|
||||
int length;
|
||||
|
||||
if (!server)
|
||||
return (cfg_look_charset_encode) ?
|
||||
strdup (cfg_look_charset_encode) : strdup ("");
|
||||
|
||||
config_option_list_get_value (&(server->charset_encode),
|
||||
"server", &pos, &length);
|
||||
if (pos && (length > 0))
|
||||
{
|
||||
result = strdup (pos);
|
||||
result[length] = '\0';
|
||||
return result;
|
||||
}
|
||||
|
||||
return (cfg_look_charset_encode) ?
|
||||
strdup (cfg_look_charset_encode) : strdup ("");
|
||||
}
|
||||
|
||||
/*
|
||||
* server_send: send data to IRC server
|
||||
*/
|
||||
@ -433,7 +537,6 @@ server_sendf (t_irc_server *server, char *fmt, ...)
|
||||
{
|
||||
va_list args;
|
||||
static char buffer[4096];
|
||||
char *buf2;
|
||||
int size_buf;
|
||||
|
||||
if (!server)
|
||||
@ -454,17 +557,12 @@ server_sendf (t_irc_server *server, char *fmt, ...)
|
||||
gui_printf (server->buffer, "[DEBUG] Sending to server >>> %s\n", buffer);
|
||||
buffer[size_buf - 2] = '\r';
|
||||
#endif
|
||||
buf2 = weechat_convert_encoding ((cfg_look_charset_internal && cfg_look_charset_internal[0]) ?
|
||||
cfg_look_charset_internal : local_charset,
|
||||
cfg_look_charset_encode,
|
||||
buffer);
|
||||
if (server_send (server, buf2, strlen (buf2)) <= 0)
|
||||
if (server_send (server, buffer, strlen (buffer)) <= 0)
|
||||
{
|
||||
irc_display_prefix (server, server->buffer, PREFIX_ERROR);
|
||||
gui_printf (server->buffer, _("%s error sending data to IRC server\n"),
|
||||
WEECHAT_ERROR);
|
||||
}
|
||||
free (buf2);
|
||||
}
|
||||
|
||||
/*
|
||||
@ -1782,6 +1880,9 @@ server_print_log (t_irc_server *server)
|
||||
weechat_log_printf (" autojoin. . . . . . : '%s'\n", server->autojoin);
|
||||
weechat_log_printf (" autorejoin. . . . . : %d\n", server->autorejoin);
|
||||
weechat_log_printf (" notify_levels . . . : %s\n", server->notify_levels);
|
||||
weechat_log_printf (" charset_decode_iso. : %s\n", server->charset_decode_iso);
|
||||
weechat_log_printf (" charset_decode_utf. : %s\n", server->charset_decode_utf);
|
||||
weechat_log_printf (" charset_encode. . . : %s\n", server->charset_encode);
|
||||
weechat_log_printf (" child_pid . . . . . : %d\n", server->child_pid);
|
||||
weechat_log_printf (" child_read . . . . : %d\n", server->child_read);
|
||||
weechat_log_printf (" child_write . . . . : %d\n", server->child_write);
|
||||
|
@ -143,6 +143,9 @@ struct t_irc_server
|
||||
char *autojoin; /* channels to automatically join */
|
||||
int autorejoin; /* auto rejoin channels when kicked */
|
||||
char *notify_levels; /* channels notify levels */
|
||||
char *charset_decode_iso; /* channels charsets for decoding ISO */
|
||||
char *charset_decode_utf; /* channels charsets for decoding UTF */
|
||||
char *charset_encode; /* channels charsets for encoding msgs */
|
||||
|
||||
/* internal vars */
|
||||
pid_t child_pid; /* pid of child process (connecting) */
|
||||
@ -301,7 +304,11 @@ extern void server_free (t_irc_server *);
|
||||
extern void server_free_all ();
|
||||
extern t_irc_server *server_new (char *, int, int, int, int, char *, int, int, int,
|
||||
char *, char *, char *, char *, char *, char *,
|
||||
char *, int, char *, int, char *);
|
||||
char *, int, char *, int, char *, char *, char *,
|
||||
char *);
|
||||
extern char *server_get_charset_decode_iso (t_irc_server *);
|
||||
extern char *server_get_charset_decode_utf (t_irc_server *);
|
||||
extern char *server_get_charset_encode (t_irc_server *);
|
||||
extern int server_send (t_irc_server *, char *, int);
|
||||
extern void server_sendf (t_irc_server *, char *, ...);
|
||||
extern void server_recv (t_irc_server *);
|
||||
@ -336,13 +343,17 @@ extern void channel_free (t_irc_server *, t_irc_channel *);
|
||||
extern void channel_free_all (t_irc_server *);
|
||||
extern t_irc_channel *channel_search (t_irc_server *, char *);
|
||||
extern int string_is_channel (char *);
|
||||
extern char *channel_get_charset_decode_iso (t_irc_server *, t_irc_channel *);
|
||||
extern char *channel_get_charset_decode_utf (t_irc_server *, t_irc_channel *);
|
||||
extern char *channel_get_charset_encode (t_irc_server *, t_irc_channel *);
|
||||
extern char *channel_iconv_decode (t_irc_server *, t_irc_channel *, char *);
|
||||
extern char *channel_iconv_encode (t_irc_server *, t_irc_channel *, char *);
|
||||
extern void channel_remove_away (t_irc_channel *);
|
||||
extern void channel_check_away (t_irc_server *, t_irc_channel *);
|
||||
extern void channel_set_away (t_irc_channel *, char *, int);
|
||||
extern int channel_create_dcc (t_irc_dcc *);
|
||||
extern void channel_remove_dcc (t_irc_dcc *);
|
||||
extern int channel_get_notify_level (t_irc_server *, t_irc_channel *);
|
||||
extern void channel_remove_notify_level (t_irc_server *, t_irc_channel *);
|
||||
extern void channel_set_notify_level (t_irc_server *, t_irc_channel *, int);
|
||||
extern void channel_print_log (t_irc_channel *);
|
||||
|
||||
@ -387,12 +398,9 @@ extern void irc_display_mode (t_irc_server *, t_gui_buffer *, char *, char,
|
||||
char *, char *, char *, char *);
|
||||
extern void irc_display_server (t_irc_server *ptr_server);
|
||||
|
||||
/* IRC protocol (irc-commands.c) */
|
||||
/* IRC commands issued by user (irc-send.c) */
|
||||
|
||||
extern int irc_is_highlight (char *, char *);
|
||||
extern int irc_recv_command (t_irc_server *, char *, char *, char *, char *);
|
||||
extern void irc_login (t_irc_server *);
|
||||
/* IRC commands issued by user */
|
||||
extern int irc_cmd_send_admin (t_irc_server *, char *);
|
||||
extern int irc_cmd_send_ame (t_irc_server *, char *);
|
||||
extern int irc_cmd_send_amsg (t_irc_server *, char *);
|
||||
@ -452,7 +460,11 @@ extern int irc_cmd_send_wallops (t_irc_server *, char *);
|
||||
extern int irc_cmd_send_who (t_irc_server *, char *);
|
||||
extern int irc_cmd_send_whois (t_irc_server *, char *);
|
||||
extern int irc_cmd_send_whowas (t_irc_server *, char *);
|
||||
/* IRC commands executed when received from server */
|
||||
|
||||
/* IRC commands executed when received from server (irc-recv.c) */
|
||||
|
||||
extern int irc_is_highlight (char *, char *);
|
||||
extern int irc_recv_command (t_irc_server *, char *, char *, char *, char *);
|
||||
extern int irc_cmd_recv_error (t_irc_server *, char *, char *, char *);
|
||||
extern int irc_cmd_recv_invite (t_irc_server *, char *, char *, char *);
|
||||
extern int irc_cmd_recv_join (t_irc_server *, char *, char *, char *);
|
||||
|
@ -288,11 +288,14 @@ weechat_plugin_exec_command (t_weechat_plugin *plugin,
|
||||
|
||||
plugin_find_server_channel (server, channel, &ptr_server, &ptr_channel);
|
||||
if (ptr_server && ptr_channel)
|
||||
user_command (ptr_server, ptr_channel->buffer, command);
|
||||
user_command (gui_buffer_find_window (ptr_channel->buffer),
|
||||
ptr_server, command);
|
||||
else if (ptr_server && (ptr_server->buffer))
|
||||
user_command (ptr_server, ptr_server->buffer, command);
|
||||
user_command (gui_buffer_find_window (ptr_server->buffer),
|
||||
ptr_server, command);
|
||||
else
|
||||
user_command (NULL, gui_buffers, command);
|
||||
user_command (gui_buffer_find_window (gui_buffers),
|
||||
NULL, command);
|
||||
}
|
||||
|
||||
/*
|
||||
|
@ -1,10 +1,11 @@
|
||||
WeeChat - Wee Enhanced Environment for Chat
|
||||
===========================================
|
||||
|
||||
ChangeLog - 2005-12-09
|
||||
ChangeLog - 2005-12-11
|
||||
|
||||
|
||||
Version 0.1.7 (under dev!):
|
||||
* added charset by server and channel, new command: /charset
|
||||
* added Ruby script plugin
|
||||
* added /upgrade command
|
||||
* added ETA (Estimated Time of Arrival) for DCC files
|
||||
|
@ -35,7 +35,7 @@
|
||||
|
||||
@title WeeChat - User guide
|
||||
@subtitle Fast, light and extensible IRC client
|
||||
@subtitle Documentation for WeeChat v0.1.7-cvs - December, 6 2005
|
||||
@subtitle Documentation for WeeChat v0.1.7-cvs - December, 11 2005
|
||||
|
||||
@author FlashCode <@email{flashcode@@flashtux.org, flashcode AT flashtux.org}>
|
||||
|
||||
@ -289,9 +289,6 @@ Type: boolean (values: 'on' or 'off'), default value: 'off'@*
|
||||
@item look_buffer_timestamp
|
||||
Timestamp for buffers@*
|
||||
Type: string (any string), default value: '[%H:%M:%S]'@*
|
||||
@item look_color_nicks
|
||||
Display nick names with different colors@*
|
||||
Type: boolean (values: 'on' or 'off'), default value: 'on'@*
|
||||
@item look_color_nicks_number
|
||||
Number of colors to use for nicks colors@*
|
||||
Type: integer (values: between 1 and 10), default value: 10@*
|
||||
@ -742,6 +739,15 @@ Type: boolean (values: 'on' or 'off'), default value: 'on'@*
|
||||
@item server_notify_levels
|
||||
Comma separated list of notify levels for channels of this server (format: #channel:1,..)@*
|
||||
Type: string (any string), default value: ''@*
|
||||
@item server_charset_decode_iso
|
||||
Comma separated list of charsets for server and channels, to decode ISO (format: server:charset,#channel:charset,..)@*
|
||||
Type: string (any string), default value: ''@*
|
||||
@item server_charset_decode_utf
|
||||
Comma separated list of charsets for server and channels, to decode UTF (format: server:charset,#channel:charset,..)@*
|
||||
Type: string (any string), default value: ''@*
|
||||
@item server_charset_encode
|
||||
Comma separated list of charsets for server and channels, to encode messages (format: server:charset,#channel:charset,..)@*
|
||||
Type: string (any string), default value: ''@*
|
||||
@end table
|
||||
|
||||
Colors for Curses GUI are:@*
|
||||
@ -928,6 +934,14 @@ action: action to do:@*
|
||||
server,channel: jump to buffer by server and/or channel name@*
|
||||
number: jump to buffer by number@*
|
||||
@*
|
||||
@item charset [(decode_iso | decode_utf | encode) charset]
|
||||
@*
|
||||
change charset for server or channel@*
|
||||
@*
|
||||
decode_iso: charset used for decoding ISO@*
|
||||
decode_utf: charset used for decoding UTF@*
|
||||
encode: charset used for encoding messages@*
|
||||
@*
|
||||
@item clear [-all]
|
||||
@*
|
||||
clear window(s)@*
|
||||
|
File diff suppressed because it is too large
Load Diff
@ -36,7 +36,7 @@
|
||||
|
||||
@title WeeChat - Guide utilisateur
|
||||
@subtitle Client IRC rapide, l@'eger et extensible
|
||||
@subtitle Documentation pour WeeChat v0.1.7-cvs - 6 decembre 2005
|
||||
@subtitle Documentation pour WeeChat v0.1.7-cvs - 11 decembre 2005
|
||||
|
||||
@author FlashCode <@email{flashcode@@flashtux.org, flashcode AT flashtux.org}>
|
||||
|
||||
@ -290,9 +290,6 @@ Type: bool@'een (valeurs: 'on' ou 'off'), valeur par d@'efaut: 'off'@*
|
||||
@item look_buffer_timestamp
|
||||
Format de date/heure pour les tampons@*
|
||||
Type: cha@^ine (toute cha@^ine), valeur par d@'efaut: '[%H:%M:%S]'@*
|
||||
@item look_color_nicks
|
||||
Afficher les utilisateurs avec diff@'erentes couleurs@*
|
||||
Type: bool@'een (valeurs: 'on' ou 'off'), valeur par d@'efaut: 'on'@*
|
||||
@item look_color_nicks_number
|
||||
Nombre de couleurs @`a utiliser pour les couleurs des pseudos@*
|
||||
Type: entier (valeurs: entre 1 et 10), valeur par d@'efaut: 10@*
|
||||
@ -743,6 +740,15 @@ Type: bool@'een (valeurs: 'on' ou 'off'), valeur par d@'efaut: 'on'@*
|
||||
@item server_notify_levels
|
||||
Liste des niveaux de notifications (s@'epar@'es par des virgules) pour les canaux de ce serveur (format: #canal:1,..)@*
|
||||
Type: cha@^ine (toute cha@^ine), valeur par d@'efaut: ''@*
|
||||
@item server_charset_decode_iso
|
||||
Liste des jeux de caract@`eres (s@'epar@'es par des virgules) pour le serveur et les canaux, pour d@'ecoder l'ISO (format: server:charset,#canal:charset,..)@*
|
||||
Type: cha@^ine (toute cha@^ine), valeur par d@'efaut: ''@*
|
||||
@item server_charset_decode_utf
|
||||
Liste des jeux de caract@`eres (s@'epar@'es par des virgules) pour le serveur et les canaux, pour d@'ecoder l'UTF (format: server:charset,#canal:charset,..)@*
|
||||
Type: cha@^ine (toute cha@^ine), valeur par d@'efaut: ''@*
|
||||
@item server_charset_encode
|
||||
Liste des jeux de caract@`eres (s@'epar@'es par des virgules) pour le serveur et les canaux, pour encoder les messages (format: server:charset,#canal:charset,..)@*
|
||||
Type: cha@^ine (toute cha@^ine), valeur par d@'efaut: ''@*
|
||||
@end table
|
||||
|
||||
Les couleurs pour l'interface Curses sont :@*
|
||||
@ -929,6 +935,14 @@ action: action @`a effectuer:@*
|
||||
serveur,canal: sauter au tampon par serveur et/ou nom de canal@*
|
||||
nombre: sauter au tampon qui a ce num@'ero@*
|
||||
@*
|
||||
@item charset [(decode_iso | decode_utf | encode) charset]
|
||||
@*
|
||||
changer le jeu de caract@`eres pour le serveur ou le canal@*
|
||||
@*
|
||||
decode_iso: jeu de caract@`ere utilis@'e pour d@'ecoder l'ISO@*
|
||||
decode_utf: jeu de caract@`ere utilis@'e pour d@'ecoder l'UTF@*
|
||||
encode: jeu de caract@`ere utilis@'e pour encoder les messages@*
|
||||
@*
|
||||
@item clear [-all]
|
||||
@*
|
||||
effacer la/les fen@^etre(s)@*
|
||||
@ -987,7 +1001,7 @@ associer/lib@'erer des touches@*
|
||||
touche: associer cette touche @`a une fonction interne ou une commande (commen@,{c}ant par "/")@*
|
||||
unbind: supprimer l'association @`a une touche (si "all", toutes les associations de touches par d@'efaut sont restaur@'ees)@*
|
||||
functions: lister la liste des fonctions internes pour les associations de touches@*
|
||||
reset: restaur les touches aux valeurs par d@'efaut et supprime TOUTES les touches personnelles (utiliser avec pr@'ecaution !)@*
|
||||
reset: restaure les touches aux valeurs par d@'efaut et supprime TOUTES les touches personnelles (utiliser avec pr@'ecaution !)@*
|
||||
@*
|
||||
@item plugin [load fichier] | [autoload] | [reload] | [unload]
|
||||
@*
|
||||
|
@ -36,7 +36,7 @@
|
||||
|
||||
@title WeeChat - Guia do Utilizador
|
||||
@subtitle Cliente de IRC rapido, leve e extencivel
|
||||
@subtitle Documenta@,{c}@~ao do WeeChat v0.1.7-cvs - 6 de dezembro de 2005
|
||||
@subtitle Documenta@,{c}@~ao do WeeChat v0.1.7-cvs - 11 de dezembro de 2005
|
||||
|
||||
@author FlashCode <@email{flashcode@@flashtux.org, flashcode AT flashtux.org}>
|
||||
|
||||
@ -287,9 +287,6 @@ Type: boolean (values: 'on' or 'off'), default value: 'off'@*
|
||||
@item look_buffer_timestamp
|
||||
Timestamp for buffers@*
|
||||
Type: string (any string), default value: '[%H:%M:%S]'@*
|
||||
@item look_color_nicks
|
||||
Display nick names with different colors@*
|
||||
Type: boolean (values: 'on' or 'off'), default value: 'on'@*
|
||||
@item look_color_nicks_number
|
||||
Number of colors to use for nicks colors@*
|
||||
Type: integer (values: between 1 and 10), default value: 10@*
|
||||
@ -740,6 +737,15 @@ Type: boolean (values: 'on' or 'off'), default value: 'on'@*
|
||||
@item server_notify_levels
|
||||
Comma separated list of notify levels for channels of this server (format: #channel:1,..)@*
|
||||
Type: string (any string), default value: ''@*
|
||||
@item server_charset_decode_iso
|
||||
Comma separated list of charsets for server and channels, to decode ISO (format: server:charset,#channel:charset,..)@*
|
||||
Type: string (any string), default value: ''@*
|
||||
@item server_charset_decode_utf
|
||||
Comma separated list of charsets for server and channels, to decode UTF (format: server:charset,#channel:charset,..)@*
|
||||
Type: string (any string), default value: ''@*
|
||||
@item server_charset_encode
|
||||
Comma separated list of charsets for server and channels, to encode messages (format: server:charset,#channel:charset,..)@*
|
||||
Type: string (any string), default value: ''@*
|
||||
@end table
|
||||
|
||||
Colors for Curses GUI are:@*
|
||||
@ -926,6 +932,14 @@ action: action to do:@*
|
||||
server,channel: jump to buffer by server and/or channel name@*
|
||||
number: jump to buffer by number@*
|
||||
@*
|
||||
@item charset [(decode_iso | decode_utf | encode) charset]
|
||||
@*
|
||||
change charset for server or channel@*
|
||||
@*
|
||||
decode_iso: charset used for decoding ISO@*
|
||||
decode_utf: charset used for decoding UTF@*
|
||||
encode: charset used for encoding messages@*
|
||||
@*
|
||||
@item clear [-all]
|
||||
@*
|
||||
clear window(s)@*
|
||||
|
1037
weechat/po/cs.po
1037
weechat/po/cs.po
File diff suppressed because it is too large
Load Diff
849
weechat/po/es.po
849
weechat/po/es.po
File diff suppressed because it is too large
Load Diff
855
weechat/po/fr.po
855
weechat/po/fr.po
File diff suppressed because it is too large
Load Diff
File diff suppressed because it is too large
Load Diff
File diff suppressed because it is too large
Load Diff
@ -36,8 +36,8 @@ struct t_weechat_command
|
||||
char *arguments;
|
||||
char *arguments_description;
|
||||
int min_arg, max_arg;
|
||||
int (*cmd_function_args)(int, char **);
|
||||
int (*cmd_function_1arg)(char *);
|
||||
int (*cmd_function_args)(t_gui_window *, int, char **);
|
||||
int (*cmd_function_1arg)(t_gui_window *, char *);
|
||||
};
|
||||
|
||||
typedef struct t_weechat_alias t_weechat_alias;
|
||||
@ -62,27 +62,28 @@ extern t_weechat_alias *alias_new (char *, char *);
|
||||
extern void alias_free_all ();
|
||||
extern char **explode_string (char *, char *, int, int *);
|
||||
extern void free_exploded_string (char **);
|
||||
extern int exec_weechat_command (t_irc_server *, char *);
|
||||
extern void user_command (t_irc_server *, t_gui_buffer *, char *);
|
||||
extern int weechat_cmd_alias (char *);
|
||||
extern int weechat_cmd_buffer (int, char **);
|
||||
extern int weechat_cmd_clear (int, char **);
|
||||
extern int weechat_cmd_connect (int, char **);
|
||||
extern int weechat_cmd_debug (int, char **);
|
||||
extern int weechat_cmd_disconnect (int, char **);
|
||||
extern int weechat_cmd_help (int, char **);
|
||||
extern int weechat_cmd_history (int, char **);
|
||||
extern int exec_weechat_command (t_gui_window *, t_irc_server *, char *);
|
||||
extern void user_command (t_gui_window *, t_irc_server *, char *);
|
||||
extern int weechat_cmd_alias (t_gui_window *, char *);
|
||||
extern int weechat_cmd_buffer (t_gui_window *, int, char **);
|
||||
extern int weechat_cmd_charset (t_gui_window *, int, char **);
|
||||
extern int weechat_cmd_clear (t_gui_window *, int, char **);
|
||||
extern int weechat_cmd_connect (t_gui_window *, int, char **);
|
||||
extern int weechat_cmd_debug (t_gui_window *, int, char **);
|
||||
extern int weechat_cmd_disconnect (t_gui_window *, int, char **);
|
||||
extern int weechat_cmd_help (t_gui_window *, int, char **);
|
||||
extern int weechat_cmd_history (t_gui_window *, int, char **);
|
||||
extern void weechat_cmd_ignore_display (char *, t_irc_ignore *);
|
||||
extern int weechat_cmd_ignore (int, char **);
|
||||
extern int weechat_cmd_key (char *);
|
||||
extern int weechat_cmd_plugin (int, char **);
|
||||
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_unignore (int, char **);
|
||||
extern int weechat_cmd_upgrade (int, char **);
|
||||
extern int weechat_cmd_uptime (int, char **);
|
||||
extern int weechat_cmd_window (int, char **);
|
||||
extern int weechat_cmd_ignore (t_gui_window *, int, char **);
|
||||
extern int weechat_cmd_key (t_gui_window *, char *);
|
||||
extern int weechat_cmd_plugin (t_gui_window *, int, char **);
|
||||
extern int weechat_cmd_save (t_gui_window *, int, char **);
|
||||
extern int weechat_cmd_server (t_gui_window *, int, char **);
|
||||
extern int weechat_cmd_set (t_gui_window *, char *);
|
||||
extern int weechat_cmd_unalias (t_gui_window *, char *);
|
||||
extern int weechat_cmd_unignore (t_gui_window *, int, char **);
|
||||
extern int weechat_cmd_upgrade (t_gui_window *, int, char **);
|
||||
extern int weechat_cmd_uptime (t_gui_window *, int, char **);
|
||||
extern int weechat_cmd_window (t_gui_window *, int, char **);
|
||||
|
||||
#endif /* command.h */
|
||||
|
@ -101,10 +101,10 @@ completion_stop (t_completion *completion)
|
||||
*/
|
||||
|
||||
void
|
||||
completion_build_list (t_completion *completion, void *channel)
|
||||
completion_build_list (t_completion *completion, void *server, void *channel)
|
||||
{
|
||||
t_weelist *ptr_list;
|
||||
int i, j;
|
||||
int i, j, length;
|
||||
t_irc_server *ptr_server;
|
||||
t_irc_channel *ptr_channel;
|
||||
t_irc_nick *ptr_nick;
|
||||
@ -155,6 +155,82 @@ completion_build_list (t_completion *completion, void *channel)
|
||||
"notify");
|
||||
return;
|
||||
}
|
||||
if (ascii_strcasecmp (completion->base_command, "charset") == 0)
|
||||
{
|
||||
if (completion->base_command_arg == 1)
|
||||
{
|
||||
weelist_add (&completion->completion_list,
|
||||
&completion->last_completion,
|
||||
"decode_iso");
|
||||
weelist_add (&completion->completion_list,
|
||||
&completion->last_completion,
|
||||
"decode_utf");
|
||||
weelist_add (&completion->completion_list,
|
||||
&completion->last_completion,
|
||||
"encode");
|
||||
}
|
||||
else if (completion->base_command_arg == 2)
|
||||
{
|
||||
if (!server)
|
||||
{
|
||||
completion_stop (completion);
|
||||
return;
|
||||
}
|
||||
pos = strchr (completion->args, ' ');
|
||||
if (pos)
|
||||
pos[0] = '\0';
|
||||
string2 = NULL;
|
||||
if (ascii_strcasecmp (completion->args, "decode_iso") == 0)
|
||||
{
|
||||
config_option_list_get_value (&(((t_irc_server *)server)->charset_decode_iso),
|
||||
(channel) ? ((t_irc_channel *)channel)->name : "server",
|
||||
&string, &length);
|
||||
if (string && (length > 0))
|
||||
{
|
||||
string2 = strdup (string);
|
||||
string2[length] = '\0';
|
||||
}
|
||||
}
|
||||
else if (ascii_strcasecmp (completion->args, "decode_utf") == 0)
|
||||
{
|
||||
config_option_list_get_value (&(((t_irc_server *)server)->charset_decode_utf),
|
||||
(channel) ? ((t_irc_channel *)channel)->name : "server",
|
||||
&string, &length);
|
||||
if (string && (length > 0))
|
||||
{
|
||||
string2 = strdup (string);
|
||||
string2[length] = '\0';
|
||||
}
|
||||
}
|
||||
else if (ascii_strcasecmp (completion->args, "encode") == 0)
|
||||
{
|
||||
config_option_list_get_value (&(((t_irc_server *)server)->charset_encode),
|
||||
(channel) ? ((t_irc_channel *)channel)->name : "server",
|
||||
&string, &length);
|
||||
if (string && (length > 0))
|
||||
{
|
||||
string2 = strdup (string);
|
||||
string2[length] = '\0';
|
||||
}
|
||||
}
|
||||
|
||||
if (string2)
|
||||
{
|
||||
weelist_add (&completion->completion_list,
|
||||
&completion->last_completion,
|
||||
string2);
|
||||
free (string2);
|
||||
}
|
||||
else
|
||||
completion_stop (completion);
|
||||
|
||||
if (pos)
|
||||
pos[0] = ' ';
|
||||
}
|
||||
else
|
||||
completion_stop (completion);
|
||||
return;
|
||||
}
|
||||
if ((ascii_strcasecmp (completion->base_command, "clear") == 0)
|
||||
&& (completion->base_command_arg == 1))
|
||||
{
|
||||
@ -672,11 +748,9 @@ completion_build_list (t_completion *completion, void *channel)
|
||||
string = (char *)gui_color_decode_for_user_entry ((unsigned char *)((t_irc_channel *)channel)->topic);
|
||||
else
|
||||
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);
|
||||
string2 = channel_iconv_decode ((t_irc_server *)server,
|
||||
(t_irc_channel *)channel,
|
||||
(string) ? string : ((t_irc_channel *)channel)->topic);
|
||||
weelist_add (&completion->completion_list,
|
||||
&completion->last_completion,
|
||||
(string2) ? string2 : ((t_irc_channel *)channel)->topic);
|
||||
@ -697,8 +771,8 @@ completion_build_list (t_completion *completion, void *channel)
|
||||
*/
|
||||
|
||||
void
|
||||
completion_find_context (t_completion *completion, void *channel, char *buffer,
|
||||
int size, int pos)
|
||||
completion_find_context (t_completion *completion, void *server, void *channel,
|
||||
char *buffer, int size, int pos)
|
||||
{
|
||||
int i, command, command_arg, pos_start, pos_end;
|
||||
|
||||
@ -808,7 +882,7 @@ completion_find_context (t_completion *completion, void *channel, char *buffer,
|
||||
for (i = pos_start; i <= pos_end; i++)
|
||||
completion->base_command[i - pos_start] = buffer[i];
|
||||
completion->base_command[pos_end - pos_start + 1] = '\0';
|
||||
completion_build_list (completion, channel);
|
||||
completion_build_list (completion, server, channel);
|
||||
}
|
||||
}
|
||||
|
||||
@ -1066,7 +1140,7 @@ completion_nick (t_completion *completion, t_irc_channel *channel)
|
||||
*/
|
||||
|
||||
void
|
||||
completion_search (t_completion *completion, void *channel,
|
||||
completion_search (t_completion *completion, void *server, void *channel,
|
||||
char *buffer, int size, int pos)
|
||||
{
|
||||
char *old_word_found;
|
||||
@ -1075,7 +1149,7 @@ completion_search (t_completion *completion, void *channel,
|
||||
if (pos != completion->position)
|
||||
{
|
||||
completion->word_found = NULL;
|
||||
completion_find_context (completion, channel, buffer, size, pos);
|
||||
completion_find_context (completion, server, channel, buffer, size, pos);
|
||||
}
|
||||
|
||||
/* completion */
|
||||
|
@ -54,6 +54,6 @@ struct t_completion
|
||||
|
||||
extern void completion_init (t_completion *);
|
||||
extern void completion_free (t_completion *);
|
||||
extern void completion_search (t_completion *, void *, char *, int, int);
|
||||
extern void completion_search (t_completion *, void *, void *, char *, int, int);
|
||||
|
||||
#endif /* completion.h */
|
||||
|
@ -174,7 +174,8 @@ fifo_exec (char *text)
|
||||
ptr_buffer = gui_buffers;
|
||||
}
|
||||
|
||||
user_command (ptr_server, ptr_buffer, pos_msg);
|
||||
user_command (gui_buffer_find_window (ptr_buffer),
|
||||
ptr_server, pos_msg);
|
||||
}
|
||||
|
||||
/*
|
||||
|
@ -237,6 +237,9 @@ session_save_servers (FILE *file)
|
||||
rc = rc && (session_write_int (file, SESSION_SERV_LAG, ptr_server->lag));
|
||||
rc = rc && (session_write_buf (file, SESSION_SERV_LAG_CHECK_TIME, &(ptr_server->lag_check_time), sizeof (struct timeval)));
|
||||
rc = rc && (session_write_buf (file, SESSION_SERV_LAG_NEXT_CHECK, &(ptr_server->lag_next_check), sizeof (time_t)));
|
||||
rc = rc && (session_write_str (file, SESSION_SERV_CHARSET_DECODE_ISO, ptr_server->charset_decode_iso));
|
||||
rc = rc && (session_write_str (file, SESSION_SERV_CHARSET_DECODE_UTF, ptr_server->charset_decode_utf));
|
||||
rc = rc && (session_write_str (file, SESSION_SERV_CHARSET_ENCODE, ptr_server->charset_encode));
|
||||
rc = rc && (session_write_id (file, SESSION_SERV_END));
|
||||
|
||||
if (!rc)
|
||||
@ -832,6 +835,15 @@ session_load_server (FILE *file)
|
||||
case SESSION_SERV_LAG_NEXT_CHECK:
|
||||
rc = rc && (session_read_buf (file, &(session_current_server->lag_next_check), sizeof (time_t)));
|
||||
break;
|
||||
case SESSION_SERV_CHARSET_DECODE_ISO:
|
||||
rc = rc && (session_read_str (file, &(session_current_server->charset_decode_iso)));
|
||||
break;
|
||||
case SESSION_SERV_CHARSET_DECODE_UTF:
|
||||
rc = rc && (session_read_str (file, &(session_current_server->charset_decode_utf)));
|
||||
break;
|
||||
case SESSION_SERV_CHARSET_ENCODE:
|
||||
rc = rc && (session_read_str (file, &(session_current_server->charset_encode)));
|
||||
break;
|
||||
default:
|
||||
weechat_log_printf (_("session: warning: ignoring value from "
|
||||
"server (object id: %d)\n"));
|
||||
|
@ -84,7 +84,10 @@ enum t_session_server
|
||||
SESSION_SERV_AWAY_TIME,
|
||||
SESSION_SERV_LAG,
|
||||
SESSION_SERV_LAG_CHECK_TIME,
|
||||
SESSION_SERV_LAG_NEXT_CHECK
|
||||
SESSION_SERV_LAG_NEXT_CHECK,
|
||||
SESSION_SERV_CHARSET_DECODE_ISO,
|
||||
SESSION_SERV_CHARSET_DECODE_UTF,
|
||||
SESSION_SERV_CHARSET_ENCODE
|
||||
};
|
||||
|
||||
enum t_session_channel
|
||||
|
@ -209,11 +209,11 @@ weechat_log_printf (char *message, ...)
|
||||
}
|
||||
|
||||
/*
|
||||
* weechat_convert_encoding: convert string to another encoding
|
||||
* weechat_iconv: convert string to another charset
|
||||
*/
|
||||
|
||||
char *
|
||||
weechat_convert_encoding (char *from_code, char *to_code, char *string)
|
||||
weechat_iconv (char *from_code, char *to_code, char *string)
|
||||
{
|
||||
char *outbuf;
|
||||
|
||||
@ -584,7 +584,8 @@ weechat_parse_args (int argc, char *argv[])
|
||||
server_tmp.ipv6, server_tmp.ssl,
|
||||
server_tmp.password, server_tmp.nick1,
|
||||
server_tmp.nick2, server_tmp.nick3,
|
||||
NULL, NULL, NULL, 0, server_tmp.autojoin, 1, NULL))
|
||||
NULL, NULL, NULL, 0, server_tmp.autojoin, 1, NULL,
|
||||
NULL, NULL, NULL))
|
||||
fprintf (stderr, _("%s unable to create server ('%s'), ignored\n"),
|
||||
WEECHAT_WARNING, argv[i]);
|
||||
server_destroy (&server_tmp);
|
||||
|
@ -109,7 +109,7 @@ extern int ascii_strcasecmp (char *, char *);
|
||||
extern int ascii_strncasecmp (char *, char *, int);
|
||||
extern void weechat_log_printf (char *, ...);
|
||||
extern void weechat_dump (int);
|
||||
extern char *weechat_convert_encoding (char *, char *, char *);
|
||||
extern char *weechat_iconv (char *, char *, char *);
|
||||
extern long get_timeval_diff (struct timeval *, struct timeval *);
|
||||
extern void weechat_shutdown (int, int);
|
||||
|
||||
|
@ -937,6 +937,21 @@ t_config_option weechat_options_server[] =
|
||||
N_("comma separated list of notify levels for channels of this server (format: #channel:1,..)"),
|
||||
OPTION_TYPE_STRING, 0, 0, 0,
|
||||
"", NULL, NULL, &(cfg_server.notify_levels), config_change_notify_levels },
|
||||
{ "server_charset_decode_iso", N_("charset for decoding ISO on server and channels"),
|
||||
N_("comma separated list of charsets for server and channels, "
|
||||
"to decode ISO (format: server:charset,#channel:charset,..)"),
|
||||
OPTION_TYPE_STRING, 0, 0, 0,
|
||||
"", NULL, NULL, &(cfg_server.charset_decode_iso), config_change_noop },
|
||||
{ "server_charset_decode_utf", N_("charset for decoding UTF on server and channels"),
|
||||
N_("comma separated list of charsets for server and channels, "
|
||||
"to decode UTF (format: server:charset,#channel:charset,..)"),
|
||||
OPTION_TYPE_STRING, 0, 0, 0,
|
||||
"", NULL, NULL, &(cfg_server.charset_decode_utf), config_change_noop },
|
||||
{ "server_charset_encode", N_("charset for encoding messages on server and channels"),
|
||||
N_("comma separated list of charsets for server and channels, "
|
||||
"to encode messages (format: server:charset,#channel:charset,..)"),
|
||||
OPTION_TYPE_STRING, 0, 0, 0,
|
||||
"", NULL, NULL, &(cfg_server.charset_encode), config_change_noop },
|
||||
{ NULL, NULL, NULL, 0, 0, 0, 0, NULL, NULL, NULL, NULL, NULL }
|
||||
};
|
||||
|
||||
@ -951,12 +966,12 @@ t_config_option *weechat_options[CONFIG_NUMBER_SECTIONS] =
|
||||
|
||||
|
||||
/*
|
||||
* get_pos_array_values: returns position of a string in an array of values
|
||||
* returns -1 if not found, otherwise position
|
||||
* config_get_pos_array_values: return position of a string in an array of values
|
||||
* return -1 if not found, otherwise position
|
||||
*/
|
||||
|
||||
int
|
||||
get_pos_array_values (char **array, char *string)
|
||||
config_get_pos_array_values (char **array, char *string)
|
||||
{
|
||||
int i;
|
||||
|
||||
@ -1240,7 +1255,8 @@ config_option_set_value (t_config_option *option, char *value)
|
||||
*(option->ptr_int) = int_value;
|
||||
break;
|
||||
case OPTION_TYPE_INT_WITH_STRING:
|
||||
int_value = get_pos_array_values (option->array_values, value);
|
||||
int_value = config_get_pos_array_values (option->array_values,
|
||||
value);
|
||||
if (int_value < 0)
|
||||
return -1;
|
||||
*(option->ptr_int) = int_value;
|
||||
@ -1258,6 +1274,116 @@ config_option_set_value (t_config_option *option, char *value)
|
||||
return 0;
|
||||
}
|
||||
|
||||
/*
|
||||
* config_option_list_remove: remove an item from a list for an option
|
||||
* (for options with value like: "abc:1,def:blabla")
|
||||
*/
|
||||
|
||||
void
|
||||
config_option_list_remove (char **string, char *item)
|
||||
{
|
||||
char *name, *pos, *pos2;
|
||||
|
||||
if (!string || !(*string))
|
||||
return;
|
||||
|
||||
name = (char *) malloc (strlen (item) + 2);
|
||||
strcpy (name, item);
|
||||
strcat (name, ":");
|
||||
pos = strstr (*string, name);
|
||||
free (name);
|
||||
if (pos)
|
||||
{
|
||||
pos2 = pos + strlen (item);
|
||||
if (pos2[0] == ':')
|
||||
{
|
||||
pos2++;
|
||||
if (pos2[0])
|
||||
{
|
||||
while (pos2[0] && (pos2[0] != ','))
|
||||
pos2++;
|
||||
if (pos2[0] == ',')
|
||||
pos2++;
|
||||
if (!pos2[0] && (pos != (*string)))
|
||||
pos--;
|
||||
strcpy (pos, pos2);
|
||||
if (!(*string)[0])
|
||||
{
|
||||
free (*string);
|
||||
*string = NULL;
|
||||
}
|
||||
else
|
||||
(*string) = (char *) realloc (*string, strlen (*string) + 1);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
/*
|
||||
* config_option_list_set: set an item from a list for an option
|
||||
* (for options with value like: "abc:1,def:blabla")
|
||||
*/
|
||||
|
||||
void
|
||||
config_option_list_set (char **string, char *item, char *value)
|
||||
{
|
||||
config_option_list_remove (string, item);
|
||||
|
||||
if (!(*string))
|
||||
{
|
||||
(*string) = (char *) malloc (strlen (item) + 1 + strlen (value) + 1);
|
||||
(*string)[0] = '\0';
|
||||
}
|
||||
else
|
||||
(*string) = (char *) realloc (*string,
|
||||
strlen (*string) + 1 +
|
||||
strlen (item) + 1 + strlen (value) + 1);
|
||||
|
||||
if ((*string)[0])
|
||||
strcat (*string, ",");
|
||||
strcat (*string, item);
|
||||
strcat (*string, ":");
|
||||
strcat (*string, value);
|
||||
}
|
||||
|
||||
/*
|
||||
* config_option_list_get_value: return position of item value in the list
|
||||
* (for options with value like: "abc:1,def:blabla")
|
||||
*/
|
||||
|
||||
void
|
||||
config_option_list_get_value (char **string, char *item,
|
||||
char **pos_found, int *length)
|
||||
{
|
||||
char *name, *pos, *pos2, *pos_comma;
|
||||
|
||||
*pos_found = NULL;
|
||||
*length = 0;
|
||||
|
||||
if (!string || !(*string))
|
||||
return;
|
||||
|
||||
name = (char *) malloc (strlen (item) + 2);
|
||||
strcpy (name, item);
|
||||
strcat (name, ":");
|
||||
pos = strstr (*string, name);
|
||||
free (name);
|
||||
if (pos)
|
||||
{
|
||||
pos2 = pos + strlen (item);
|
||||
if (pos2[0] == ':')
|
||||
{
|
||||
pos2++;
|
||||
*pos_found = pos2;
|
||||
pos_comma = strchr (pos2, ',');
|
||||
if (pos_comma)
|
||||
*length = pos_comma - pos2;
|
||||
else
|
||||
*length = strlen (pos2);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
/*
|
||||
* config_get_server_option_ptr: get a pointer to a server config option
|
||||
*/
|
||||
@ -1303,6 +1429,12 @@ config_get_server_option_ptr (t_irc_server *server, char *option_name)
|
||||
return (void *)(&server->autorejoin);
|
||||
if (ascii_strcasecmp (option_name, "server_notify_levels") == 0)
|
||||
return (void *)(&server->notify_levels);
|
||||
if (ascii_strcasecmp (option_name, "server_charset_decode_iso") == 0)
|
||||
return (void *)(&server->charset_decode_iso);
|
||||
if (ascii_strcasecmp (option_name, "server_charset_decode_utf") == 0)
|
||||
return (void *)(&server->charset_decode_utf);
|
||||
if (ascii_strcasecmp (option_name, "server_charset_encode") == 0)
|
||||
return (void *)(&server->charset_encode);
|
||||
/* option not found */
|
||||
return NULL;
|
||||
}
|
||||
@ -1357,7 +1489,8 @@ config_set_server_value (t_irc_server *server, char *option_name,
|
||||
*((int *)(ptr_data)) = int_value;
|
||||
break;
|
||||
case OPTION_TYPE_INT_WITH_STRING:
|
||||
int_value = get_pos_array_values (ptr_option->array_values, value);
|
||||
int_value = config_get_pos_array_values (ptr_option->array_values,
|
||||
value);
|
||||
if (int_value < 0)
|
||||
return -2;
|
||||
*((int *)(ptr_data)) = int_value;
|
||||
@ -1527,7 +1660,9 @@ config_allocate_server (char *filename, int line_number)
|
||||
cfg_server.password, cfg_server.nick1, cfg_server.nick2,
|
||||
cfg_server.nick3, cfg_server.username, cfg_server.realname,
|
||||
cfg_server.command, cfg_server.command_delay, cfg_server.autojoin,
|
||||
cfg_server.autorejoin, cfg_server.notify_levels))
|
||||
cfg_server.autorejoin, cfg_server.notify_levels,
|
||||
cfg_server.charset_decode_iso, cfg_server.charset_decode_utf,
|
||||
cfg_server.charset_encode))
|
||||
{
|
||||
server_free_all ();
|
||||
gui_printf (NULL,
|
||||
@ -1566,7 +1701,7 @@ config_default_values ()
|
||||
weechat_options[i][j].default_int;
|
||||
break;
|
||||
case OPTION_TYPE_INT_WITH_STRING:
|
||||
int_value = get_pos_array_values (
|
||||
int_value = config_get_pos_array_values (
|
||||
weechat_options[i][j].array_values,
|
||||
weechat_options[i][j].default_string);
|
||||
if (int_value < 0)
|
||||
@ -2064,6 +2199,10 @@ config_create_default ()
|
||||
fprintf (file, "server_command_delay = 0\n");
|
||||
fprintf (file, "server_autojoin = \"\"\n");
|
||||
fprintf (file, "server_autorejoin = on\n");
|
||||
fprintf (file, "server_notify_levels = \"\"\n");
|
||||
fprintf (file, "server_charset_decode_iso = \"\"\n");
|
||||
fprintf (file, "server_charset_decode_utf = \"\"\n");
|
||||
fprintf (file, "server_charset_encode = \"\"\n");
|
||||
|
||||
fclose (file);
|
||||
chmod (filename, 0600);
|
||||
@ -2251,6 +2390,12 @@ config_write (char *config_name)
|
||||
(ptr_server->autorejoin) ? "on" : "off");
|
||||
fprintf (file, "server_notify_levels = \"%s\"\n",
|
||||
(ptr_server->notify_levels) ? ptr_server->notify_levels : "");
|
||||
fprintf (file, "server_charset_decode_iso = \"%s\"\n",
|
||||
(ptr_server->charset_decode_iso) ? ptr_server->charset_decode_iso : "");
|
||||
fprintf (file, "server_charset_decode_utf = \"%s\"\n",
|
||||
(ptr_server->charset_decode_utf) ? ptr_server->charset_decode_utf : "");
|
||||
fprintf (file, "server_charset_encode = \"%s\"\n",
|
||||
(ptr_server->charset_encode) ? ptr_server->charset_encode : "");
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -238,6 +238,9 @@ extern void config_change_fifo_pipe ();
|
||||
extern void config_change_notify_levels ();
|
||||
extern void config_change_log ();
|
||||
extern int config_option_set_value (t_config_option *, char *);
|
||||
extern void config_option_list_remove (char **, char *);
|
||||
extern void config_option_list_set (char **, char *, char *);
|
||||
extern void config_option_list_get_value (char **, char *, char **, int *);
|
||||
extern t_config_option *config_option_search (char *);
|
||||
extern void config_option_search_option_value (char *, t_config_option **, void **);
|
||||
extern int config_set_value (char *, char *);
|
||||
|
@ -806,11 +806,9 @@ gui_draw_buffer_title (t_gui_buffer *buffer, int erase)
|
||||
if (CHANNEL(buffer)->topic)
|
||||
{
|
||||
buf = (char *)gui_color_decode ((unsigned char *)(CHANNEL(buffer)->topic), 0);
|
||||
buf2 = 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,
|
||||
(buf) ? buf : CHANNEL(buffer)->topic);
|
||||
buf2 = channel_iconv_decode (SERVER(buffer),
|
||||
CHANNEL(buffer),
|
||||
(buf) ? buf : CHANNEL(buffer)->topic);
|
||||
mvwprintw (ptr_win->win_title, 0, 0, format, (buf2) ? buf2 : CHANNEL(buffer)->topic);
|
||||
if (buf)
|
||||
free (buf);
|
||||
@ -1519,12 +1517,10 @@ gui_draw_buffer_chat (t_gui_buffer *buffer, int erase)
|
||||
mvwprintw (ptr_win->win_chat, i, 0, "%s %-16s ",
|
||||
(ptr_dcc == dcc_selected) ? "***" : " ",
|
||||
ptr_dcc->nick);
|
||||
buf = 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,
|
||||
(DCC_IS_CHAT(ptr_dcc->type)) ?
|
||||
_(ptr_dcc->filename) : ptr_dcc->filename);
|
||||
buf = channel_iconv_decode (SERVER(buffer),
|
||||
CHANNEL(buffer),
|
||||
(DCC_IS_CHAT(ptr_dcc->type)) ?
|
||||
_(ptr_dcc->filename) : ptr_dcc->filename);
|
||||
wprintw (ptr_win->win_chat, "%s", buf);
|
||||
free (buf);
|
||||
if (DCC_IS_FILE(ptr_dcc->type))
|
||||
@ -1543,11 +1539,9 @@ gui_draw_buffer_chat (t_gui_buffer *buffer, int erase)
|
||||
(DCC_IS_RECV(ptr_dcc->type)) ? "-->>" : "<<--");
|
||||
gui_window_set_weechat_color (ptr_win->win_chat,
|
||||
COLOR_DCC_WAITING + ptr_dcc->status);
|
||||
buf = 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,
|
||||
_(dcc_status_string[ptr_dcc->status]));
|
||||
buf = channel_iconv_decode (SERVER(buffer),
|
||||
CHANNEL(buffer),
|
||||
_(dcc_status_string[ptr_dcc->status]));
|
||||
wprintw (ptr_win->win_chat, "%-10s", buf);
|
||||
free (buf);
|
||||
|
||||
@ -1604,11 +1598,9 @@ gui_draw_buffer_chat (t_gui_buffer *buffer, int erase)
|
||||
ptr_dcc->eta % 60);
|
||||
}
|
||||
sprintf (format, "%s %%s/s)", unit_format[num_unit]);
|
||||
buf = 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,
|
||||
unit_name[num_unit]);
|
||||
buf = channel_iconv_decode (SERVER(buffer),
|
||||
CHANNEL(buffer),
|
||||
unit_name[num_unit]);
|
||||
wprintw (ptr_win->win_chat, format,
|
||||
((long double) ptr_dcc->bytes_per_sec) / ((long double)(unit_divide[num_unit])),
|
||||
buf);
|
||||
|
@ -108,9 +108,7 @@ gui_action_return (t_gui_window *window)
|
||||
window->buffer->completion.position = -1;
|
||||
window->buffer->ptr_history = NULL;
|
||||
gui_draw_buffer_input (window->buffer, 0);
|
||||
user_command (SERVER(window->buffer),
|
||||
window->buffer,
|
||||
command);
|
||||
user_command (window, SERVER(window->buffer), command);
|
||||
free (command);
|
||||
}
|
||||
}
|
||||
@ -128,6 +126,7 @@ gui_action_tab (t_gui_window *window)
|
||||
if (window->buffer->has_input)
|
||||
{
|
||||
completion_search (&(window->buffer->completion),
|
||||
SERVER(window->buffer),
|
||||
CHANNEL(window->buffer),
|
||||
window->buffer->input_buffer,
|
||||
window->buffer->input_buffer_size,
|
||||
|
@ -321,6 +321,26 @@ gui_buffer_search (char *server, char *channel)
|
||||
return (ptr_buffer->dcc) ? gui_buffers : ptr_buffer;
|
||||
}
|
||||
|
||||
/*
|
||||
* gui_buffer_find_window: find a window displaying buffer
|
||||
*/
|
||||
|
||||
t_gui_window *
|
||||
gui_buffer_find_window (t_gui_buffer *buffer)
|
||||
{
|
||||
t_gui_window *ptr_win;
|
||||
|
||||
for (ptr_win = gui_windows; ptr_win;
|
||||
ptr_win = ptr_win->next_window)
|
||||
{
|
||||
if (ptr_win->buffer == buffer)
|
||||
return ptr_win;
|
||||
}
|
||||
|
||||
/* no window found */
|
||||
return NULL;
|
||||
}
|
||||
|
||||
/*
|
||||
* gui_buffer_servers_search: search servers buffer
|
||||
* (when same buffer is used for all servers)
|
||||
@ -857,7 +877,7 @@ gui_printf_internal (t_gui_buffer *buffer, int display_time, int type, char *mes
|
||||
time_t time_seconds;
|
||||
struct tm *local_time;
|
||||
int time_first_digit, time_last_digit;
|
||||
char *pos, *buf2;
|
||||
char *buf2, *pos;
|
||||
int i;
|
||||
va_list argptr;
|
||||
static time_t seconds;
|
||||
@ -898,12 +918,8 @@ gui_printf_internal (t_gui_buffer *buffer, int display_time, int type, char *mes
|
||||
if (!buf[0])
|
||||
return;
|
||||
|
||||
if (!local_utf8 || !utf8_is_valid (buf))
|
||||
buf2 = 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,
|
||||
buf);
|
||||
if (gui_init_ok)
|
||||
buf2 = channel_iconv_decode (SERVER(buffer), CHANNEL(buffer), buf);
|
||||
else
|
||||
buf2 = strdup (buf);
|
||||
|
||||
@ -1015,16 +1031,7 @@ gui_infobar_printf (int time_displayed, int color, char *message, ...)
|
||||
buf2 = (char *)gui_color_decode ((unsigned char *)buffer, 0);
|
||||
|
||||
if (buf2)
|
||||
{
|
||||
if (!local_utf8 || !utf8_is_valid (buf2))
|
||||
buf3 = 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,
|
||||
buf2);
|
||||
else
|
||||
buf3 = strdup (buf2);
|
||||
}
|
||||
buf3 = channel_iconv_decode (NULL, NULL, buf2);
|
||||
else
|
||||
buf3 = NULL;
|
||||
|
||||
|
@ -517,8 +517,8 @@ gui_key_pressed (char *key_str)
|
||||
/* exact combo found => execute function or command */
|
||||
gui_key_buffer[0] = '\0';
|
||||
if (ptr_key->command)
|
||||
user_command (SERVER(gui_current_window->buffer),
|
||||
gui_current_window->buffer,
|
||||
user_command (gui_current_window,
|
||||
SERVER(gui_current_window->buffer),
|
||||
ptr_key->command);
|
||||
else
|
||||
(void)(ptr_key->function)(gui_current_window);
|
||||
|
@ -402,6 +402,7 @@ extern void gui_window_tree_node_to_leaf (t_gui_window_tree *, t_gui_window *);
|
||||
extern void gui_window_tree_free (t_gui_window_tree **);
|
||||
extern t_gui_window *gui_window_new (t_gui_window *, int, int, int, int, int, int);
|
||||
extern t_gui_buffer *gui_buffer_search (char *, char *);
|
||||
extern t_gui_window *gui_buffer_find_window (t_gui_buffer *);
|
||||
extern t_gui_buffer *gui_buffer_new (t_gui_window *, void *, void *, int, int);
|
||||
extern void gui_buffer_clear (t_gui_buffer *);
|
||||
extern void gui_buffer_clear_all ();
|
||||
|
@ -30,6 +30,8 @@
|
||||
|
||||
#include "../common/weechat.h"
|
||||
#include "irc.h"
|
||||
#include "../common/utf8.h"
|
||||
#include "../common/weeconfig.h"
|
||||
#include "../gui/gui.h"
|
||||
|
||||
|
||||
@ -171,6 +173,143 @@ string_is_channel (char *string)
|
||||
return (strpbrk (first_char, CHANNEL_PREFIX)) ? 1 : 0;
|
||||
}
|
||||
|
||||
/*
|
||||
* channel_get_charset_decode_iso: get decode iso value for channel
|
||||
* if not found for channel, look for server
|
||||
* if not found for server, look for global
|
||||
*/
|
||||
|
||||
char *
|
||||
channel_get_charset_decode_iso (t_irc_server *server, t_irc_channel *channel)
|
||||
{
|
||||
char *pos, *result;
|
||||
int length;
|
||||
|
||||
if (!server)
|
||||
return (cfg_look_charset_decode_iso) ?
|
||||
strdup (cfg_look_charset_decode_iso) : strdup ("");
|
||||
|
||||
if (!channel)
|
||||
return server_get_charset_decode_iso (server);
|
||||
|
||||
config_option_list_get_value (&(server->charset_decode_iso),
|
||||
channel->name, &pos, &length);
|
||||
if (pos && (length > 0))
|
||||
{
|
||||
result = strdup (pos);
|
||||
result[length] = '\0';
|
||||
return result;
|
||||
}
|
||||
|
||||
return server_get_charset_decode_iso (server);
|
||||
}
|
||||
|
||||
/*
|
||||
* channel_get_charset_decode_utf: get decode utf value for channel
|
||||
* if not found for channel, look for server
|
||||
* if not found for server, look for global
|
||||
*/
|
||||
|
||||
char *
|
||||
channel_get_charset_decode_utf (t_irc_server *server, t_irc_channel *channel)
|
||||
{
|
||||
char *pos, *result;
|
||||
int length;
|
||||
|
||||
if (!server)
|
||||
return (cfg_look_charset_decode_utf) ?
|
||||
strdup (cfg_look_charset_decode_utf) : strdup ("");
|
||||
|
||||
if (!channel)
|
||||
return server_get_charset_decode_utf (server);
|
||||
|
||||
config_option_list_get_value (&(server->charset_decode_utf),
|
||||
channel->name, &pos, &length);
|
||||
if (pos && (length > 0))
|
||||
{
|
||||
result = strdup (pos);
|
||||
result[length] = '\0';
|
||||
return result;
|
||||
}
|
||||
|
||||
return server_get_charset_decode_utf (server);
|
||||
}
|
||||
|
||||
/*
|
||||
* channel_get_charset_encode: get encode value for channel
|
||||
* if not found for channel, look for server
|
||||
* if not found for server, look for global
|
||||
*/
|
||||
|
||||
char *
|
||||
channel_get_charset_encode (t_irc_server *server, t_irc_channel *channel)
|
||||
{
|
||||
char *pos, *result;
|
||||
int length;
|
||||
|
||||
if (!server)
|
||||
return (cfg_look_charset_encode) ?
|
||||
strdup (cfg_look_charset_encode) : strdup ("");
|
||||
|
||||
if (!channel)
|
||||
return server_get_charset_encode (server);
|
||||
|
||||
config_option_list_get_value (&(server->charset_encode),
|
||||
channel->name, &pos, &length);
|
||||
if (pos && (length > 0))
|
||||
{
|
||||
result = strdup (pos);
|
||||
result[length] = '\0';
|
||||
return result;
|
||||
}
|
||||
|
||||
return server_get_charset_encode (server);
|
||||
}
|
||||
|
||||
/*
|
||||
* channel_iconv_decode: convert string to local charset
|
||||
*/
|
||||
|
||||
char *
|
||||
channel_iconv_decode (t_irc_server *server, t_irc_channel *channel, char *string)
|
||||
{
|
||||
char *from_charset, *string2;
|
||||
|
||||
if (!local_utf8 || !utf8_is_valid (string))
|
||||
{
|
||||
if (local_utf8)
|
||||
from_charset = channel_get_charset_decode_iso (server, channel);
|
||||
else
|
||||
from_charset = channel_get_charset_decode_utf (server, channel);
|
||||
string2 = weechat_iconv (from_charset,
|
||||
(cfg_look_charset_internal && cfg_look_charset_internal[0]) ?
|
||||
cfg_look_charset_internal : local_charset,
|
||||
string);
|
||||
free (from_charset);
|
||||
return string2;
|
||||
}
|
||||
else
|
||||
return strdup (string);
|
||||
}
|
||||
|
||||
/*
|
||||
*
|
||||
*/
|
||||
|
||||
char *
|
||||
channel_iconv_encode (t_irc_server *server, t_irc_channel *channel, char *string)
|
||||
{
|
||||
char *to_charset, *string2;
|
||||
|
||||
to_charset = channel_get_charset_encode (server, channel);
|
||||
string2 = weechat_iconv ((cfg_look_charset_internal && cfg_look_charset_internal[0]) ?
|
||||
cfg_look_charset_internal : local_charset,
|
||||
to_charset,
|
||||
string);
|
||||
free (to_charset);
|
||||
return string2;
|
||||
}
|
||||
|
||||
/*
|
||||
* channel_remove_away: remove away for all nicks on a channel
|
||||
*/
|
||||
@ -305,44 +444,6 @@ channel_get_notify_level (t_irc_server *server, t_irc_channel *channel)
|
||||
return notify;
|
||||
}
|
||||
|
||||
/*
|
||||
* server_remove_notify_level: remove channel notify from list
|
||||
*/
|
||||
|
||||
void
|
||||
channel_remove_notify_level (t_irc_server *server, t_irc_channel *channel)
|
||||
{
|
||||
char *name, *pos, *pos2;
|
||||
|
||||
if ((!server) || (!channel))
|
||||
return;
|
||||
|
||||
name = (char *) malloc (strlen (channel->name) + 2);
|
||||
strcpy (name, channel->name);
|
||||
strcat (name, ":");
|
||||
pos = strstr (server->notify_levels, name);
|
||||
free (name);
|
||||
if (pos)
|
||||
{
|
||||
pos2 = pos + strlen (channel->name);
|
||||
if (pos2[0] == ':')
|
||||
{
|
||||
pos2++;
|
||||
if (pos2[0])
|
||||
{
|
||||
pos2++;
|
||||
if (pos2[0] == ',')
|
||||
pos2++;
|
||||
if (!pos2[0] && (pos != server->notify_levels))
|
||||
pos--;
|
||||
strcpy (pos, pos2);
|
||||
server->notify_levels = (char *) realloc (server->notify_levels,
|
||||
strlen (server->notify_levels) + 1);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
/*
|
||||
* server_set_notify_level: set channel notify level
|
||||
*/
|
||||
@ -350,52 +451,19 @@ channel_remove_notify_level (t_irc_server *server, t_irc_channel *channel)
|
||||
void
|
||||
channel_set_notify_level (t_irc_server *server, t_irc_channel *channel, int notify)
|
||||
{
|
||||
char *name, *pos, *pos2, level_string[2];
|
||||
char level_string[2];
|
||||
|
||||
if ((!server) || (!channel))
|
||||
return;
|
||||
|
||||
if (notify == NOTIFY_LEVEL_DEFAULT)
|
||||
{
|
||||
channel_remove_notify_level (server, channel);
|
||||
return;
|
||||
}
|
||||
|
||||
if (!server->notify_levels)
|
||||
{
|
||||
server->notify_levels = (char *) malloc (strlen (channel->name) + 3);
|
||||
server->notify_levels[0] = '\0';
|
||||
}
|
||||
config_option_list_remove (&(server->notify_levels), channel->name);
|
||||
else
|
||||
{
|
||||
name = (char *) malloc (strlen (channel->name) + 2);
|
||||
strcpy (name, channel->name);
|
||||
strcat (name, ":");
|
||||
pos = strstr (server->notify_levels, name);
|
||||
free (name);
|
||||
if (pos)
|
||||
{
|
||||
pos2 = pos + strlen (channel->name) + 1;
|
||||
if (pos2[0])
|
||||
{
|
||||
pos2[0] = '0' + notify;
|
||||
return;
|
||||
}
|
||||
}
|
||||
/* realloc notify list to add channel */
|
||||
server->notify_levels = (char *) realloc (server->notify_levels,
|
||||
strlen (server->notify_levels) + 1 +
|
||||
strlen (channel->name) + 2 + 1);
|
||||
level_string[0] = notify + '0';
|
||||
level_string[1] = '\0';
|
||||
config_option_list_set (&(server->notify_levels), channel->name, level_string);
|
||||
}
|
||||
|
||||
/* channel not in notify list => add it */
|
||||
if (server->notify_levels[0])
|
||||
strcat (server->notify_levels, ",");
|
||||
strcat (server->notify_levels, channel->name);
|
||||
strcat (server->notify_levels, ":");
|
||||
level_string[0] = notify + '0';
|
||||
level_string[1] = '\0';
|
||||
strcat (server->notify_levels, level_string);
|
||||
}
|
||||
|
||||
/*
|
||||
|
@ -1120,10 +1120,9 @@ dcc_chat_sendf (t_irc_dcc *ptr_dcc, char *fmt, ...)
|
||||
gui_printf (ptr_dcc->server->buffer, "[DEBUG] Sending to remote host (DCC CHAT) >>> %s\n", buffer);
|
||||
buffer[size_buf - 2] = '\r';
|
||||
#endif
|
||||
buf2 = weechat_convert_encoding ((cfg_look_charset_internal && cfg_look_charset_internal[0]) ?
|
||||
cfg_look_charset_internal : local_charset,
|
||||
cfg_look_charset_encode,
|
||||
buffer);
|
||||
buf2 = channel_iconv_encode (ptr_dcc->server,
|
||||
ptr_dcc->channel,
|
||||
buffer);
|
||||
if (dcc_chat_send (ptr_dcc, buf2, strlen (buf2)) <= 0)
|
||||
{
|
||||
irc_display_prefix (ptr_dcc->server, ptr_dcc->server->buffer,
|
||||
@ -1144,7 +1143,7 @@ void
|
||||
dcc_chat_recv (t_irc_dcc *ptr_dcc)
|
||||
{
|
||||
static char buffer[4096 + 2];
|
||||
char *buf2, *pos, *ptr_buf, *next_ptr_buf;
|
||||
char *buf2, *pos, *ptr_buf, *ptr_buf2, *next_ptr_buf;
|
||||
char *ptr_buf_color;
|
||||
int num_read;
|
||||
|
||||
@ -1196,7 +1195,11 @@ dcc_chat_recv (t_irc_dcc *ptr_dcc)
|
||||
|
||||
if (ptr_buf)
|
||||
{
|
||||
ptr_buf_color = (char *)gui_color_decode ((unsigned char *)ptr_buf,
|
||||
ptr_buf2 = channel_iconv_decode (ptr_dcc->server,
|
||||
ptr_dcc->channel,
|
||||
ptr_buf);
|
||||
ptr_buf_color = (char *)gui_color_decode ((ptr_buf2) ?
|
||||
(unsigned char *)ptr_buf2 : (unsigned char *)ptr_buf,
|
||||
cfg_irc_colors_receive);
|
||||
gui_printf_type (ptr_dcc->channel->buffer, MSG_TYPE_NICK,
|
||||
"%s<", GUI_COLOR(COLOR_WIN_CHAT_DARK));
|
||||
@ -1213,7 +1216,7 @@ dcc_chat_recv (t_irc_dcc *ptr_dcc)
|
||||
COLOR_WIN_INFOBAR_HIGHLIGHT,
|
||||
_("Private %s> %s"),
|
||||
ptr_dcc->nick,
|
||||
(ptr_buf_color) ? ptr_buf_color : ptr_buf);
|
||||
(ptr_buf_color) ? ptr_buf_color : ((ptr_buf2) ? ptr_buf2 : ptr_buf));
|
||||
}
|
||||
else
|
||||
gui_printf_type (ptr_dcc->channel->buffer, MSG_TYPE_NICK,
|
||||
@ -1228,13 +1231,15 @@ dcc_chat_recv (t_irc_dcc *ptr_dcc)
|
||||
(ptr_buf_color) ? ptr_buf_color : ptr_buf);
|
||||
if (ptr_buf_color)
|
||||
free (ptr_buf_color);
|
||||
if (ptr_buf2)
|
||||
free (ptr_buf2);
|
||||
}
|
||||
|
||||
ptr_buf = next_ptr_buf;
|
||||
}
|
||||
|
||||
if (buf2)
|
||||
free (buf2);
|
||||
free (buf2);
|
||||
}
|
||||
else
|
||||
{
|
||||
|
@ -185,27 +185,27 @@ irc_display_server (t_irc_server *server)
|
||||
_("connected") : _("not connected"),
|
||||
GUI_COLOR(COLOR_WIN_CHAT_DARK));
|
||||
|
||||
gui_printf (NULL, " server_autoconnect . . . .: %s%s\n",
|
||||
gui_printf (NULL, " server_autoconnect . . . . : %s%s\n",
|
||||
(server->autoconnect) ? _("on") : _("off"),
|
||||
(server->command_line) ?
|
||||
_(" (temporary server, will not be saved)") : "");
|
||||
gui_printf (NULL, " server_autoreconnect . . .: %s\n",
|
||||
gui_printf (NULL, " server_autoreconnect . . . : %s\n",
|
||||
(server->autoreconnect) ? _("on") : _("off"));
|
||||
gui_printf (NULL, " server_autoreconnect_delay: %d %s\n",
|
||||
gui_printf (NULL, " server_autoreconnect_delay : %d %s\n",
|
||||
server->autoreconnect_delay,
|
||||
_("seconds"));
|
||||
gui_printf (NULL, " server_address . . . . . .: %s\n",
|
||||
gui_printf (NULL, " server_address . . . . . . : %s\n",
|
||||
server->address);
|
||||
gui_printf (NULL, " server_port . . . . . . .: %d\n",
|
||||
gui_printf (NULL, " server_port . . . . . . . : %d\n",
|
||||
server->port);
|
||||
gui_printf (NULL, " server_ipv6 . . . . . . .: %s\n",
|
||||
gui_printf (NULL, " server_ipv6 . . . . . . . : %s\n",
|
||||
(server->ipv6) ? _("on") : _("off"));
|
||||
gui_printf (NULL, " server_ssl . . . . . . . .: %s\n",
|
||||
gui_printf (NULL, " server_ssl . . . . . . . . : %s\n",
|
||||
(server->ssl) ? _("on") : _("off"));
|
||||
gui_printf (NULL, " server_password . . . . .: %s\n",
|
||||
gui_printf (NULL, " server_password . . . . . : %s\n",
|
||||
(server->password && server->password[0]) ?
|
||||
_("(hidden)") : "");
|
||||
gui_printf (NULL, " server_nick1/2/3 . . . . .: %s %s/ %s%s %s/ %s%s\n",
|
||||
gui_printf (NULL, " server_nick1/2/3 . . . . . : %s %s/ %s%s %s/ %s%s\n",
|
||||
server->nick1,
|
||||
GUI_COLOR(COLOR_WIN_CHAT_DARK),
|
||||
GUI_COLOR(COLOR_WIN_CHAT),
|
||||
@ -213,20 +213,29 @@ irc_display_server (t_irc_server *server)
|
||||
GUI_COLOR(COLOR_WIN_CHAT_DARK),
|
||||
GUI_COLOR(COLOR_WIN_CHAT),
|
||||
server->nick3);
|
||||
gui_printf (NULL, " server_username . . . . .: %s\n",
|
||||
gui_printf (NULL, " server_username . . . . . : %s\n",
|
||||
server->username);
|
||||
gui_printf (NULL, " server_realname . . . . .: %s\n",
|
||||
gui_printf (NULL, " server_realname . . . . . : %s\n",
|
||||
server->realname);
|
||||
gui_printf (NULL, " server_command . . . . . .: %s\n",
|
||||
gui_printf (NULL, " server_command . . . . . . : %s\n",
|
||||
(server->command && server->command[0]) ?
|
||||
server->command : "");
|
||||
gui_printf (NULL, " server_command_delay . . .: %d %s\n",
|
||||
gui_printf (NULL, " server_command_delay . . . : %d %s\n",
|
||||
server->command_delay,
|
||||
_("seconds"));
|
||||
gui_printf (NULL, " server_autojoin . . . . .: %s\n",
|
||||
gui_printf (NULL, " server_autojoin . . . . . : %s\n",
|
||||
(server->autojoin && server->autojoin[0]) ?
|
||||
server->autojoin : "");
|
||||
gui_printf (NULL, " server_notify_levels . . .: %s\n",
|
||||
gui_printf (NULL, " server_notify_levels . . . : %s\n",
|
||||
(server->notify_levels && server->notify_levels[0]) ?
|
||||
server->notify_levels : "");
|
||||
gui_printf (NULL, " server_charset_decode_iso. : %s\n",
|
||||
(server->charset_decode_iso && server->charset_decode_iso[0]) ?
|
||||
server->charset_decode_iso : "");
|
||||
gui_printf (NULL, " server_charset_decode_utf. : %s\n",
|
||||
(server->charset_decode_utf && server->charset_decode_utf[0]) ?
|
||||
server->charset_decode_utf : "");
|
||||
gui_printf (NULL, " server_charset_encode. . . : %s\n",
|
||||
(server->charset_encode && server->charset_encode[0]) ?
|
||||
server->charset_encode : "");
|
||||
}
|
||||
|
@ -2225,14 +2225,16 @@ irc_cmd_recv_quit (t_irc_server *server, char *host, char *nick, char *arguments
|
||||
pos = strchr (host, '!');
|
||||
irc_display_prefix (server, ptr_channel->buffer, PREFIX_QUIT);
|
||||
gui_printf (ptr_channel->buffer,
|
||||
_("%s%s %s(%s%s%s)%s has quit %s(%s%s%s)\n"),
|
||||
_("%s%s %s(%s%s%s)%s has quit"),
|
||||
GUI_COLOR(COLOR_WIN_CHAT_NICK),
|
||||
nick,
|
||||
GUI_COLOR(COLOR_WIN_CHAT_DARK),
|
||||
GUI_COLOR(COLOR_WIN_CHAT_HOST),
|
||||
(pos) ? pos + 1 : "",
|
||||
GUI_COLOR(COLOR_WIN_CHAT_DARK),
|
||||
GUI_COLOR(COLOR_WIN_CHAT),
|
||||
GUI_COLOR(COLOR_WIN_CHAT));
|
||||
gui_printf (ptr_channel->buffer,
|
||||
" %s(%s%s%s)\n",
|
||||
GUI_COLOR(COLOR_WIN_CHAT_DARK),
|
||||
GUI_COLOR(COLOR_WIN_CHAT),
|
||||
arguments,
|
||||
@ -2447,7 +2449,7 @@ irc_cmd_recv_004 (t_irc_server *server, char *host, char *nick, char *arguments)
|
||||
/* execute command once connected */
|
||||
if (server->command && server->command[0])
|
||||
{
|
||||
user_command(server, NULL, server->command);
|
||||
user_command(NULL, server, server->command);
|
||||
if (server->command_delay > 0)
|
||||
sleep (server->command_delay);
|
||||
}
|
||||
|
@ -84,6 +84,9 @@ server_init (t_irc_server *server)
|
||||
server->autojoin = NULL;
|
||||
server->autorejoin = 0;
|
||||
server->notify_levels = NULL;
|
||||
server->charset_decode_iso = NULL;
|
||||
server->charset_decode_utf = NULL;
|
||||
server->charset_encode = NULL;
|
||||
|
||||
/* internal vars */
|
||||
server->child_pid = 0;
|
||||
@ -294,6 +297,12 @@ server_destroy (t_irc_server *server)
|
||||
free (server->autojoin);
|
||||
if (server->notify_levels)
|
||||
free (server->notify_levels);
|
||||
if (server->charset_decode_iso)
|
||||
free (server->charset_decode_iso);
|
||||
if (server->charset_decode_utf)
|
||||
free (server->charset_decode_utf);
|
||||
if (server->charset_encode)
|
||||
free (server->charset_encode);
|
||||
if (server->unterminated_message)
|
||||
free (server->unterminated_message);
|
||||
if (server->nick)
|
||||
@ -355,7 +364,8 @@ server_new (char *name, int autoconnect, int autoreconnect, int autoreconnect_de
|
||||
int command_line, char *address, int port, int ipv6, int ssl, char *password,
|
||||
char *nick1, char *nick2, char *nick3, char *username,
|
||||
char *realname, char *command, int command_delay, char *autojoin,
|
||||
int autorejoin, char *notify_levels)
|
||||
int autorejoin, char *notify_levels, char *charset_decode_iso,
|
||||
char *charset_decode_utf, char *charset_encode)
|
||||
{
|
||||
t_irc_server *new_server;
|
||||
|
||||
@ -365,12 +375,16 @@ server_new (char *name, int autoconnect, int autoreconnect, int autoreconnect_de
|
||||
#ifdef DEBUG
|
||||
weechat_log_printf ("Creating new server (name:%s, address:%s, port:%d, pwd:%s, "
|
||||
"nick1:%s, nick2:%s, nick3:%s, username:%s, realname:%s, "
|
||||
"command:%s, autojoin:%s, autorejoin:%s, notify_levels:%s)\n",
|
||||
"command:%s, autojoin:%s, autorejoin:%s, notify_levels:%s, "
|
||||
"decode_iso:%s, decode_utf:%s, encode:%s)\n",
|
||||
name, address, port, (password) ? password : "",
|
||||
(nick1) ? nick1 : "", (nick2) ? nick2 : "", (nick3) ? nick3 : "",
|
||||
(username) ? username : "", (realname) ? realname : "",
|
||||
(command) ? command : "", (autojoin) ? autojoin : "",
|
||||
(autorejoin) ? "on" : "off", (notify_levels) ? notify_levels : "");
|
||||
(autorejoin) ? "on" : "off", (notify_levels) ? notify_levels : "",
|
||||
(charset_decode_iso) ? charset_decode_iso : "",
|
||||
(charset_decode_utf) ? charset_decode_utf : "",
|
||||
(charset_encode) ? charset_encode : "");
|
||||
#endif
|
||||
|
||||
if ((new_server = server_alloc ()))
|
||||
@ -400,12 +414,102 @@ server_new (char *name, int autoconnect, int autoreconnect, int autoreconnect_de
|
||||
new_server->autorejoin = autorejoin;
|
||||
new_server->notify_levels =
|
||||
(notify_levels) ? strdup (notify_levels) : NULL;
|
||||
new_server->charset_decode_iso =
|
||||
(charset_decode_iso) ? strdup (charset_decode_iso) : NULL;
|
||||
new_server->charset_decode_utf =
|
||||
(charset_decode_utf) ? strdup (charset_decode_utf) : NULL;
|
||||
new_server->charset_encode =
|
||||
(charset_encode) ? strdup (charset_encode) : NULL;
|
||||
}
|
||||
else
|
||||
return NULL;
|
||||
return new_server;
|
||||
}
|
||||
|
||||
/*
|
||||
* server_get_charset_decode_iso: get decode iso value for server
|
||||
* if not found for server, look for global
|
||||
*/
|
||||
|
||||
char *
|
||||
server_get_charset_decode_iso (t_irc_server *server)
|
||||
{
|
||||
char *pos, *result;
|
||||
int length;
|
||||
|
||||
if (!server)
|
||||
return (cfg_look_charset_decode_iso) ?
|
||||
strdup (cfg_look_charset_decode_iso) : strdup ("");
|
||||
|
||||
config_option_list_get_value (&(server->charset_decode_iso),
|
||||
"server", &pos, &length);
|
||||
if (pos && (length > 0))
|
||||
{
|
||||
result = strdup (pos);
|
||||
result[length] = '\0';
|
||||
return result;
|
||||
}
|
||||
|
||||
return (cfg_look_charset_decode_iso) ?
|
||||
strdup (cfg_look_charset_decode_iso) : strdup ("");
|
||||
}
|
||||
|
||||
/*
|
||||
* server_get_charset_decode_utf: get decode utf value for server
|
||||
* if not found for server, look for global
|
||||
*/
|
||||
|
||||
char *
|
||||
server_get_charset_decode_utf (t_irc_server *server)
|
||||
{
|
||||
char *pos, *result;
|
||||
int length;
|
||||
|
||||
if (!server)
|
||||
return (cfg_look_charset_decode_utf) ?
|
||||
strdup (cfg_look_charset_decode_utf) : strdup ("");
|
||||
|
||||
config_option_list_get_value (&(server->charset_decode_utf),
|
||||
"server", &pos, &length);
|
||||
if (pos && (length > 0))
|
||||
{
|
||||
result = strdup (pos);
|
||||
result[length] = '\0';
|
||||
return result;
|
||||
}
|
||||
|
||||
return (cfg_look_charset_decode_utf) ?
|
||||
strdup (cfg_look_charset_decode_utf) : strdup ("");
|
||||
}
|
||||
|
||||
/*
|
||||
* server_get_charset_encode: get encode value for server
|
||||
* if not found for server, look for global
|
||||
*/
|
||||
|
||||
char *
|
||||
server_get_charset_encode (t_irc_server *server)
|
||||
{
|
||||
char *pos, *result;
|
||||
int length;
|
||||
|
||||
if (!server)
|
||||
return (cfg_look_charset_encode) ?
|
||||
strdup (cfg_look_charset_encode) : strdup ("");
|
||||
|
||||
config_option_list_get_value (&(server->charset_encode),
|
||||
"server", &pos, &length);
|
||||
if (pos && (length > 0))
|
||||
{
|
||||
result = strdup (pos);
|
||||
result[length] = '\0';
|
||||
return result;
|
||||
}
|
||||
|
||||
return (cfg_look_charset_encode) ?
|
||||
strdup (cfg_look_charset_encode) : strdup ("");
|
||||
}
|
||||
|
||||
/*
|
||||
* server_send: send data to IRC server
|
||||
*/
|
||||
@ -433,7 +537,6 @@ server_sendf (t_irc_server *server, char *fmt, ...)
|
||||
{
|
||||
va_list args;
|
||||
static char buffer[4096];
|
||||
char *buf2;
|
||||
int size_buf;
|
||||
|
||||
if (!server)
|
||||
@ -454,17 +557,12 @@ server_sendf (t_irc_server *server, char *fmt, ...)
|
||||
gui_printf (server->buffer, "[DEBUG] Sending to server >>> %s\n", buffer);
|
||||
buffer[size_buf - 2] = '\r';
|
||||
#endif
|
||||
buf2 = weechat_convert_encoding ((cfg_look_charset_internal && cfg_look_charset_internal[0]) ?
|
||||
cfg_look_charset_internal : local_charset,
|
||||
cfg_look_charset_encode,
|
||||
buffer);
|
||||
if (server_send (server, buf2, strlen (buf2)) <= 0)
|
||||
if (server_send (server, buffer, strlen (buffer)) <= 0)
|
||||
{
|
||||
irc_display_prefix (server, server->buffer, PREFIX_ERROR);
|
||||
gui_printf (server->buffer, _("%s error sending data to IRC server\n"),
|
||||
WEECHAT_ERROR);
|
||||
}
|
||||
free (buf2);
|
||||
}
|
||||
|
||||
/*
|
||||
@ -1782,6 +1880,9 @@ server_print_log (t_irc_server *server)
|
||||
weechat_log_printf (" autojoin. . . . . . : '%s'\n", server->autojoin);
|
||||
weechat_log_printf (" autorejoin. . . . . : %d\n", server->autorejoin);
|
||||
weechat_log_printf (" notify_levels . . . : %s\n", server->notify_levels);
|
||||
weechat_log_printf (" charset_decode_iso. : %s\n", server->charset_decode_iso);
|
||||
weechat_log_printf (" charset_decode_utf. : %s\n", server->charset_decode_utf);
|
||||
weechat_log_printf (" charset_encode. . . : %s\n", server->charset_encode);
|
||||
weechat_log_printf (" child_pid . . . . . : %d\n", server->child_pid);
|
||||
weechat_log_printf (" child_read . . . . : %d\n", server->child_read);
|
||||
weechat_log_printf (" child_write . . . . : %d\n", server->child_write);
|
||||
|
@ -143,6 +143,9 @@ struct t_irc_server
|
||||
char *autojoin; /* channels to automatically join */
|
||||
int autorejoin; /* auto rejoin channels when kicked */
|
||||
char *notify_levels; /* channels notify levels */
|
||||
char *charset_decode_iso; /* channels charsets for decoding ISO */
|
||||
char *charset_decode_utf; /* channels charsets for decoding UTF */
|
||||
char *charset_encode; /* channels charsets for encoding msgs */
|
||||
|
||||
/* internal vars */
|
||||
pid_t child_pid; /* pid of child process (connecting) */
|
||||
@ -301,7 +304,11 @@ extern void server_free (t_irc_server *);
|
||||
extern void server_free_all ();
|
||||
extern t_irc_server *server_new (char *, int, int, int, int, char *, int, int, int,
|
||||
char *, char *, char *, char *, char *, char *,
|
||||
char *, int, char *, int, char *);
|
||||
char *, int, char *, int, char *, char *, char *,
|
||||
char *);
|
||||
extern char *server_get_charset_decode_iso (t_irc_server *);
|
||||
extern char *server_get_charset_decode_utf (t_irc_server *);
|
||||
extern char *server_get_charset_encode (t_irc_server *);
|
||||
extern int server_send (t_irc_server *, char *, int);
|
||||
extern void server_sendf (t_irc_server *, char *, ...);
|
||||
extern void server_recv (t_irc_server *);
|
||||
@ -336,13 +343,17 @@ extern void channel_free (t_irc_server *, t_irc_channel *);
|
||||
extern void channel_free_all (t_irc_server *);
|
||||
extern t_irc_channel *channel_search (t_irc_server *, char *);
|
||||
extern int string_is_channel (char *);
|
||||
extern char *channel_get_charset_decode_iso (t_irc_server *, t_irc_channel *);
|
||||
extern char *channel_get_charset_decode_utf (t_irc_server *, t_irc_channel *);
|
||||
extern char *channel_get_charset_encode (t_irc_server *, t_irc_channel *);
|
||||
extern char *channel_iconv_decode (t_irc_server *, t_irc_channel *, char *);
|
||||
extern char *channel_iconv_encode (t_irc_server *, t_irc_channel *, char *);
|
||||
extern void channel_remove_away (t_irc_channel *);
|
||||
extern void channel_check_away (t_irc_server *, t_irc_channel *);
|
||||
extern void channel_set_away (t_irc_channel *, char *, int);
|
||||
extern int channel_create_dcc (t_irc_dcc *);
|
||||
extern void channel_remove_dcc (t_irc_dcc *);
|
||||
extern int channel_get_notify_level (t_irc_server *, t_irc_channel *);
|
||||
extern void channel_remove_notify_level (t_irc_server *, t_irc_channel *);
|
||||
extern void channel_set_notify_level (t_irc_server *, t_irc_channel *, int);
|
||||
extern void channel_print_log (t_irc_channel *);
|
||||
|
||||
@ -387,12 +398,9 @@ extern void irc_display_mode (t_irc_server *, t_gui_buffer *, char *, char,
|
||||
char *, char *, char *, char *);
|
||||
extern void irc_display_server (t_irc_server *ptr_server);
|
||||
|
||||
/* IRC protocol (irc-commands.c) */
|
||||
/* IRC commands issued by user (irc-send.c) */
|
||||
|
||||
extern int irc_is_highlight (char *, char *);
|
||||
extern int irc_recv_command (t_irc_server *, char *, char *, char *, char *);
|
||||
extern void irc_login (t_irc_server *);
|
||||
/* IRC commands issued by user */
|
||||
extern int irc_cmd_send_admin (t_irc_server *, char *);
|
||||
extern int irc_cmd_send_ame (t_irc_server *, char *);
|
||||
extern int irc_cmd_send_amsg (t_irc_server *, char *);
|
||||
@ -452,7 +460,11 @@ extern int irc_cmd_send_wallops (t_irc_server *, char *);
|
||||
extern int irc_cmd_send_who (t_irc_server *, char *);
|
||||
extern int irc_cmd_send_whois (t_irc_server *, char *);
|
||||
extern int irc_cmd_send_whowas (t_irc_server *, char *);
|
||||
/* IRC commands executed when received from server */
|
||||
|
||||
/* IRC commands executed when received from server (irc-recv.c) */
|
||||
|
||||
extern int irc_is_highlight (char *, char *);
|
||||
extern int irc_recv_command (t_irc_server *, char *, char *, char *, char *);
|
||||
extern int irc_cmd_recv_error (t_irc_server *, char *, char *, char *);
|
||||
extern int irc_cmd_recv_invite (t_irc_server *, char *, char *, char *);
|
||||
extern int irc_cmd_recv_join (t_irc_server *, char *, char *, char *);
|
||||
|
@ -288,11 +288,14 @@ weechat_plugin_exec_command (t_weechat_plugin *plugin,
|
||||
|
||||
plugin_find_server_channel (server, channel, &ptr_server, &ptr_channel);
|
||||
if (ptr_server && ptr_channel)
|
||||
user_command (ptr_server, ptr_channel->buffer, command);
|
||||
user_command (gui_buffer_find_window (ptr_channel->buffer),
|
||||
ptr_server, command);
|
||||
else if (ptr_server && (ptr_server->buffer))
|
||||
user_command (ptr_server, ptr_server->buffer, command);
|
||||
user_command (gui_buffer_find_window (ptr_server->buffer),
|
||||
ptr_server, command);
|
||||
else
|
||||
user_command (NULL, gui_buffers, command);
|
||||
user_command (gui_buffer_find_window (gui_buffers),
|
||||
NULL, command);
|
||||
}
|
||||
|
||||
/*
|
||||
|
Loading…
x
Reference in New Issue
Block a user