mirror of
https://github.com/weechat/weechat.git
synced 2026-07-08 10:43:13 +02:00
Added charset by server and channel, new command: /charset
This commit is contained in:
+373
-140
File diff suppressed because it is too large
Load Diff
+24
-23
@@ -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 */
|
||||
|
||||
+86
-12
@@ -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 */
|
||||
|
||||
+2
-1
@@ -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);
|
||||
|
||||
|
||||
+152
-7
@@ -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 *);
|
||||
|
||||
Reference in New Issue
Block a user