Add "const" keyword for some "char *" function arguments (core and plugins API)

v2.8-utf8proc
Sebastien Helleu 2008-06-03 10:56:51 +02:00
parent 2b1d7df86c
commit 3a53257032
123 changed files with 1598 additions and 1487 deletions

View File

@ -1103,8 +1103,8 @@ msgstr "la cadena mostrada tras la finalización de los nombres de usuario"
#, fuzzy
msgid "use a marker (line or char) on buffers to show first unread line"
msgstr ""
"usar un marcador en los servidores/canales para mostrar la primera línea sin "
"leer"
"usar un marcador en los servidores/canales para mostrar la primera línea "
"sin leer"
#, fuzzy
msgid "save configuration file on exit"
@ -1599,8 +1599,8 @@ msgid ""
"support.\n"
"Be careful, private info may be in these files.\n"
msgstr ""
"Por favor, envía %s/%s, %s/%s y los mensajes de arriba a los desarrolladores "
"de Weechat para el soporte.\n"
"Por favor, envía %s/%s, %s/%s y los mensajes de arriba a los "
"desarrolladores de Weechat para el soporte.\n"
"Sé cuidadoso, puede que haya información privada en estos ficheros.\n"
#, c-format
@ -5374,8 +5374,8 @@ msgstr "%s falta un argumento para la opción --dir\n"
#~ "maximum number of lines in history for one server/channel/private window "
#~ "(0 = unlimited)"
#~ msgstr ""
#~ "número máximo de líneas en el histórico para un servidor/canal/privado "
#~ "(0 = ilimitado)"
#~ "número máximo de líneas en el histórico para un servidor/canal/"
#~ "privado (0 = ilimitado)"
#, fuzzy
#~ msgid "log messages from plugins"
@ -5569,8 +5569,8 @@ msgstr "%s falta un argumento para la opción --dir\n"
#~ "max size for aligning nick and other messages (should be >= to "
#~ "look_align_size)"
#~ msgstr ""
#~ "tamaño máximo para la alineación de nick y otros mensajes (debería ser "
#~ ">= a look_align_size)"
#~ "tamaño máximo para la alineación de nick y otros mensajes (debería "
#~ "ser >= a look_align_size)"
#~ msgid "server name not found"
#~ msgstr "nombre de servidor no encontrado"
@ -6357,7 +6357,8 @@ msgstr "%s falta un argumento para la opción --dir\n"
#~ msgid "color for chan owner symbol (specific to unrealircd)"
#~ msgstr ""
#~ "color para el símbolo de propietario de canal (especificado en unrealircd)"
#~ "color para el símbolo de propietario de canal (especificado en "
#~ "unrealircd)"
#~ msgid "color for chan admin symbol"
#~ msgstr "color para el símbolo de administrador de canal"

View File

@ -50,7 +50,7 @@
*/
void
weechat_backtrace_printf (char *message, ...)
weechat_backtrace_printf (const char *message, ...)
{
static char buffer[4096];
va_list argptr;
@ -69,7 +69,7 @@ weechat_backtrace_printf (char *message, ...)
*/
void
weechat_backtrace_addr2line (int number, void *address, char *symbol)
weechat_backtrace_addr2line (int number, void *address, const char *symbol)
{
#ifdef HAVE_BACKTRACE
int rc;

View File

@ -1362,7 +1362,7 @@ command_key (void *data, struct t_gui_buffer *buffer,
*/
void
command_plugin_list (char *name, int full)
command_plugin_list (const char *name, int full)
{
struct t_weechat_plugin *ptr_plugin;
struct t_hook *ptr_hook;
@ -1851,7 +1851,7 @@ command_set_display_section (struct t_config_file *config_file,
void
command_set_display_option (struct t_config_option *option,
char *message)
const char *message)
{
char *color_name;
@ -1926,7 +1926,7 @@ command_set_display_option (struct t_config_option *option,
*/
int
command_set_display_option_list (char *message, char *search)
command_set_display_option_list (const char *message, const char *search)
{
int number_found, section_displayed, length;
struct t_config_file *ptr_config;

View File

@ -54,7 +54,7 @@ char *config_boolean_false[] = { "off", "no", "n", "false", "f", "0", NULL };
*/
struct t_config_file *
config_file_search (char *name)
config_file_search (const char *name)
{
struct t_config_file *ptr_config;
@ -77,7 +77,7 @@ config_file_search (char *name)
*/
struct t_config_file *
config_file_new (struct t_weechat_plugin *plugin, char *name,
config_file_new (struct t_weechat_plugin *plugin, const char *name,
int (*callback_reload)(void *data,
struct t_config_file *config_file),
void *callback_reload_data)
@ -149,27 +149,27 @@ config_file_valid_for_plugin (struct t_weechat_plugin *plugin,
*/
struct t_config_section *
config_file_new_section (struct t_config_file *config_file, char *name,
config_file_new_section (struct t_config_file *config_file, const char *name,
int user_can_add_options, int user_can_delete_options,
int (*callback_read)(void *data,
struct t_config_file *config_file,
struct t_config_section *section,
char *option_name,
char *value),
const char *option_name,
const char *value),
void *callback_read_data,
void (*callback_write)(void *data,
struct t_config_file *config_file,
char *section_name),
const char *section_name),
void *callback_write_data,
void (*callback_write_default)(void *data,
struct t_config_file *config_file,
char *section_name),
const char *section_name),
void *callback_write_default_data,
int (*callback_create_option)(void *data,
struct t_config_file *config_file,
struct t_config_section *section,
char *option_name,
char *value),
const char *option_name,
const char *value),
void *callback_create_option_data)
{
struct t_config_section *new_section;
@ -215,7 +215,7 @@ config_file_new_section (struct t_config_file *config_file, char *name,
struct t_config_section *
config_file_search_section (struct t_config_file *config_file,
char *section_name)
const char *section_name)
{
struct t_config_section *ptr_section;
@ -270,7 +270,7 @@ config_file_section_valid_for_plugin (struct t_weechat_plugin *plugin,
*/
struct t_config_option *
config_file_option_find_pos (struct t_config_section *section, char *name)
config_file_option_find_pos (struct t_config_section *section, const char *name)
{
struct t_config_option *ptr_option;
@ -338,13 +338,13 @@ config_file_option_insert_in_section (struct t_config_option *option)
struct t_config_option *
config_file_new_option (struct t_config_file *config_file,
struct t_config_section *section, char *name,
char *type, char *description,
char *string_values, int min, int max,
char *default_value,
struct t_config_section *section, const char *name,
const char *type, const char *description,
const char *string_values, int min, int max,
const char *default_value,
int (*callback_check_value)(void *data,
struct t_config_option *option,
char *value),
const char *value),
void *callback_check_value_data,
void (*callback_change)(void *data,
struct t_config_option *option),
@ -491,7 +491,7 @@ config_file_new_option (struct t_config_file *config_file,
struct t_config_option *
config_file_search_option (struct t_config_file *config_file,
struct t_config_section *section,
char *option_name)
const char *option_name)
{
struct t_config_section *ptr_section;
struct t_config_option *ptr_option;
@ -531,7 +531,7 @@ config_file_search_option (struct t_config_file *config_file,
void
config_file_search_section_option (struct t_config_file *config_file,
struct t_config_section *section,
char *option_name,
const char *option_name,
struct t_config_section **section_found,
struct t_config_option **option_found)
{
@ -579,7 +579,7 @@ config_file_search_section_option (struct t_config_file *config_file,
*/
void
config_file_search_with_string (char *option_name,
config_file_search_with_string (const char *option_name,
struct t_config_file **config_file,
struct t_config_section **section,
struct t_config_option **option,
@ -688,7 +688,7 @@ config_file_option_valid_for_plugin (struct t_weechat_plugin *plugin,
*/
int
config_file_string_boolean_is_valid (char *text)
config_file_string_boolean_is_valid (const char *text)
{
int i;
@ -717,7 +717,7 @@ config_file_string_boolean_is_valid (char *text)
*/
int
config_file_string_to_boolean (char *text)
config_file_string_to_boolean (const char *text)
{
int i;
@ -859,7 +859,7 @@ config_file_option_reset (struct t_config_option *option, int run_callback)
*/
int
config_file_option_set (struct t_config_option *option, char *value,
config_file_option_set (struct t_config_option *option, const char *value,
int run_callback)
{
int value_int, i, rc, length_option, new_value_ok;
@ -1151,7 +1151,8 @@ config_file_option_unset (struct t_config_option *option)
*/
void
config_file_option_rename (struct t_config_option *option, char *new_name)
config_file_option_rename (struct t_config_option *option,
const char *new_name)
{
if (!new_name || !new_name[0])
return;
@ -1184,7 +1185,8 @@ config_file_option_rename (struct t_config_option *option, char *new_name)
*/
void *
config_file_option_get_pointer (struct t_config_option *option, char *property)
config_file_option_get_pointer (struct t_config_option *option,
const char *property)
{
if (string_strcasecmp (property, "config_file") == 0)
return option->config_file;
@ -1225,7 +1227,7 @@ config_file_option_get_pointer (struct t_config_option *option, char *property)
*/
int
config_file_option_set_with_string (char *option_name, char *value)
config_file_option_set_with_string (const char *option_name, const char *value)
{
int rc;
struct t_config_file *ptr_config;
@ -1275,7 +1277,7 @@ config_file_option_set_with_string (char *option_name, char *value)
*/
int
config_file_option_unset_with_string (char *option_name)
config_file_option_unset_with_string (const char *option_name)
{
struct t_config_option *ptr_option;
int rc;
@ -1437,7 +1439,7 @@ config_file_write_option (struct t_config_file *config_file,
void
config_file_write_line (struct t_config_file *config_file,
char *option_name, char *value, ...)
const char *option_name, const char *value, ...)
{
char buf[4096];
va_list argptr;

View File

@ -63,24 +63,25 @@ struct t_config_section
(void *data, /* config file (only for some */
struct t_config_file *config_file, /* special sections) */
struct t_config_section *section,
char *option_name,
char *value);
const char *option_name,
const char *value);
void *callback_read_data; /* data sent to read callback */
void (*callback_write) /* called to write options */
(void *data, /* in config file (only for some */
struct t_config_file *config_file, /* special sections) */
char *section_name);
const char *section_name);
void *callback_write_data; /* data sent to write callback */
void (*callback_write_default) /* called to write default */
(void *data, /* options in config file */
struct t_config_file *config_file,
char *section_name);
const char *section_name);
void *callback_write_default_data; /* data sent to write def. callb.*/
int (*callback_create_option) /* called to create option in */
(void *data, /* section */
struct t_config_file *config_file,
struct t_config_section *section,
char *option_name, char *value);
const char *option_name,
const char *value);
void *callback_create_option_data; /* data sent to create callback */
struct t_config_option *options; /* options in section */
struct t_config_option *last_option; /* last option in section */
@ -112,7 +113,7 @@ struct t_config_option
int (*callback_check_value) /* called to check value before */
(void *data, /* assiging new value */
struct t_config_option *option,
char *value);
const char *value);
void *callback_check_value_data; /* data sent to check callback */
void (*callback_change) /* called when value is changed */
(void *data,
@ -130,52 +131,52 @@ struct t_config_option
extern struct t_config_file *config_files;
extern struct t_config_file *last_config_file;
extern struct t_config_file *config_file_search (char *name);
extern struct t_config_file *config_file_search (const char *name);
extern struct t_config_file *config_file_new (struct t_weechat_plugin *plugin,
char *name,
const char *name,
int (*callback_reload)(void *data,
struct t_config_file *config_file),
void *callback_data);
extern int config_file_valid_for_plugin (struct t_weechat_plugin *plugin,
struct t_config_file *config_file);
extern struct t_config_section *config_file_new_section (struct t_config_file *config_file,
char *name,
const char *name,
int user_can_add_options,
int user_can_delete_options,
int (*callback_read)(void *data,
struct t_config_file *config_file,
struct t_config_section *section,
char *option_name,
char *value),
const char *option_name,
const char *value),
void *callback_read_data,
void (*callback_write)(void *data,
struct t_config_file *config_file,
char *section_name),
const char *section_name),
void *callback_write_data,
void (*callback_write_default)(void *data,
struct t_config_file *config_file,
char *section_name),
const char *section_name),
void *callback_write_default_data,
int (*callback_create_option)(void *data,
struct t_config_file *config_file,
struct t_config_section *section,
char *option_name,
char *value),
const char *option_name,
const char *value),
void *callback_create_option_data);
extern struct t_config_section *config_file_search_section (struct t_config_file *config_file,
char *section_name);
const char *section_name);
extern int config_file_section_valid_for_plugin (struct t_weechat_plugin *plugin,
struct t_config_section *);
extern struct t_config_option *config_file_new_option (struct t_config_file *config_file,
struct t_config_section *section,
char *name, char *type,
char *description,
char *string_values,
const char *name, const char *type,
const char *description,
const char *string_values,
int min, int max,
char *default_value,
const char *default_value,
int (*callback_check_value)(void *data,
struct t_config_option *option,
char *value),
const char *value),
void *callback_check_value_data,
void (*callback_change)(void *data,
struct t_config_option *option),
@ -185,38 +186,38 @@ extern struct t_config_option *config_file_new_option (struct t_config_file *con
void *callback_delete_data);
extern struct t_config_option *config_file_search_option (struct t_config_file *config_file,
struct t_config_section *section,
char *option_name);
const char *option_name);
extern void config_file_search_section_option (struct t_config_file *config_file,
struct t_config_section *section,
char *option_name,
const char *option_name,
struct t_config_section **section_found,
struct t_config_option **option_found);
extern void config_file_search_with_string (char *option_name,
extern void config_file_search_with_string (const char *option_name,
struct t_config_file **config_file,
struct t_config_section **section,
struct t_config_option **option,
char **pos_option_name);
extern int config_file_option_valid_for_plugin (struct t_weechat_plugin *plugin,
struct t_config_option *option);
extern int config_file_string_to_boolean (char *text);
extern int config_file_string_to_boolean (const char *text);
extern int config_file_option_reset (struct t_config_option *option,
int run_callback);
extern int config_file_option_set (struct t_config_option *option,
char *value, int run_callback);
const char *value, int run_callback);
extern int config_file_option_unset (struct t_config_option *option);
extern void config_file_option_rename (struct t_config_option *option,
char *new_name);
const char *new_name);
extern void *config_file_option_get_pointer (struct t_config_option *option,
char *property);
extern int config_file_option_set_with_string (char *option_name, char *value);
extern int config_file_option_unset_with_string (char *option_name);
const char *property);
extern int config_file_option_set_with_string (const char *option_name, const char *value);
extern int config_file_option_unset_with_string (const char *option_name);
extern int config_file_option_boolean (struct t_config_option *option);
extern int config_file_option_integer (struct t_config_option *option);
extern char *config_file_option_string (struct t_config_option *option);
extern int config_file_option_color (struct t_config_option *option);
extern void config_file_write_line (struct t_config_file *config_file,
char *option_name, char *value, ...);
const char *option_name, const char *value, ...);
extern int config_file_write (struct t_config_file *config_files);
extern int config_file_read (struct t_config_file *config_file);
extern int config_file_reload (struct t_config_file *config_file);

View File

@ -528,7 +528,7 @@ config_weechat_reload (void *data, struct t_config_file *config_file)
int
config_weechat_bar_read (void *data, struct t_config_file *config_file,
struct t_config_section *section,
char *option_name, char *value)
const char *option_name, const char *value)
{
char *pos_option, *bar_name;
struct t_gui_bar *ptr_temp_bar;
@ -599,7 +599,7 @@ int
config_weechat_filter_read (void *data,
struct t_config_file *config_file,
struct t_config_section *section,
char *option_name, char *value)
const char *option_name, const char *value)
{
char **argv, **argv_eol;
int argc;
@ -635,7 +635,7 @@ config_weechat_filter_read (void *data,
void
config_weechat_filter_write (void *data, struct t_config_file *config_file,
char *section_name)
const char *section_name)
{
struct t_gui_filter *ptr_filter;
@ -664,7 +664,7 @@ config_weechat_filter_write (void *data, struct t_config_file *config_file,
int
config_weechat_key_read (void *data, struct t_config_file *config_file,
struct t_config_section *section,
char *option_name, char *value)
const char *option_name, const char *value)
{
/* make C compiler happy */
(void) data;
@ -694,7 +694,7 @@ config_weechat_key_read (void *data, struct t_config_file *config_file,
void
config_weechat_key_write (void *data, struct t_config_file *config_file,
char *section_name)
const char *section_name)
{
struct t_gui_key *ptr_key;
char *expanded_name;

View File

@ -99,7 +99,8 @@ debug_dump (int crash)
*/
int
debug_dump_cb (void *data, char *signal, char *type_data, void *signal_data)
debug_dump_cb (void *data, const char *signal, const char *type_data,
void *signal_data)
{
/* make C compiler happy */
(void) data;
@ -150,7 +151,8 @@ debug_sigsegv ()
*/
int
debug_buffer_cb (void *data, char *signal, char *type_data, void *signal_data)
debug_buffer_cb (void *data, const char *signal, const char *type_data,
void *signal_data)
{
/* make C compiler happy */
(void) data;
@ -229,7 +231,8 @@ debug_windows_tree ()
*/
int
debug_windows_cb (void *data, char *signal, char *type_data, void *signal_data)
debug_windows_cb (void *data, const char *signal, const char *type_data,
void *signal_data)
{
/* make C compiler happy */
(void) data;

View File

@ -293,7 +293,7 @@ hook_exec_end ()
*/
struct t_hook *
hook_search_command (char *command)
hook_search_command (const char *command)
{
struct t_hook *ptr_hook;
@ -314,8 +314,10 @@ hook_search_command (char *command)
*/
struct t_hook *
hook_command (struct t_weechat_plugin *plugin, char *command, char *description,
char *args, char *args_description, char *completion,
hook_command (struct t_weechat_plugin *plugin, const char *command,
const char *description,
const char *args, const char *args_description,
const char *completion,
t_hook_callback_command *callback, void *callback_data)
{
struct t_hook *ptr_hook,*new_hook;
@ -382,7 +384,7 @@ hook_command (struct t_weechat_plugin *plugin, char *command, char *description,
int
hook_command_exec (struct t_gui_buffer *buffer, int any_plugin,
struct t_weechat_plugin *plugin, char *string)
struct t_weechat_plugin *plugin, const char *string)
{
struct t_hook *ptr_hook, *next_hook;
struct t_hook *hook_for_plugin, *hook_for_other_plugin;
@ -791,8 +793,8 @@ hook_fd_exec (fd_set *read_fds, fd_set *write_fds, fd_set *exception_fds)
*/
struct t_hook *
hook_connect (struct t_weechat_plugin *plugin, char *address, int port,
int sock, int ipv6, void *gnutls_sess, char *local_hostname,
hook_connect (struct t_weechat_plugin *plugin, const char *address, int port,
int sock, int ipv6, void *gnutls_sess, const char *local_hostname,
t_hook_callback_connect *callback, void *callback_data)
{
struct t_hook *new_hook;
@ -847,7 +849,7 @@ hook_connect (struct t_weechat_plugin *plugin, char *address, int port,
struct t_hook *
hook_print (struct t_weechat_plugin *plugin, struct t_gui_buffer *buffer,
char *tags, char *message, int strip_colors,
const char *tags, const char *message, int strip_colors,
t_hook_callback_print *callback, void *callback_data)
{
struct t_hook *new_hook;
@ -892,7 +894,7 @@ hook_print (struct t_weechat_plugin *plugin, struct t_gui_buffer *buffer,
void
hook_print_exec (struct t_gui_buffer *buffer, time_t date, int tags_count,
char **tags_array, char *prefix, char *message)
char **tags_array, const char *prefix, const char *message)
{
struct t_hook *ptr_hook, *next_hook;
char *prefix_no_color, *message_no_color;
@ -987,7 +989,7 @@ hook_print_exec (struct t_gui_buffer *buffer, time_t date, int tags_count,
*/
struct t_hook *
hook_signal (struct t_weechat_plugin *plugin, char *signal,
hook_signal (struct t_weechat_plugin *plugin, const char *signal,
t_hook_callback_signal *callback, void *callback_data)
{
struct t_hook *new_hook;
@ -1022,7 +1024,7 @@ hook_signal (struct t_weechat_plugin *plugin, char *signal,
*/
void
hook_signal_send (char *signal, char *type_data, void *signal_data)
hook_signal_send (const char *signal, const char *type_data, void *signal_data)
{
struct t_hook *ptr_hook, *next_hook;
@ -1054,7 +1056,7 @@ hook_signal_send (char *signal, char *type_data, void *signal_data)
*/
struct t_hook *
hook_config (struct t_weechat_plugin *plugin, char *option,
hook_config (struct t_weechat_plugin *plugin, const char *option,
t_hook_callback_config *callback, void *callback_data)
{
struct t_hook *new_hook;
@ -1086,7 +1088,7 @@ hook_config (struct t_weechat_plugin *plugin, char *option,
*/
void
hook_config_exec (char *option, char *value)
hook_config_exec (const char *option, const char *value)
{
struct t_hook *ptr_hook, *next_hook;
@ -1119,7 +1121,7 @@ hook_config_exec (char *option, char *value)
*/
struct t_hook *
hook_completion (struct t_weechat_plugin *plugin, char *completion,
hook_completion (struct t_weechat_plugin *plugin, const char *completion,
t_hook_callback_completion *callback, void *callback_data)
{
struct t_hook *new_hook;
@ -1154,7 +1156,7 @@ hook_completion (struct t_weechat_plugin *plugin, char *completion,
*/
void
hook_completion_exec (struct t_weechat_plugin *plugin, char *completion,
hook_completion_exec (struct t_weechat_plugin *plugin, const char *completion,
struct t_gui_buffer *buffer, struct t_weelist *list)
{
struct t_hook *ptr_hook, *next_hook;
@ -1191,7 +1193,7 @@ hook_completion_exec (struct t_weechat_plugin *plugin, char *completion,
*/
struct t_hook *
hook_modifier (struct t_weechat_plugin *plugin, char *modifier,
hook_modifier (struct t_weechat_plugin *plugin, const char *modifier,
t_hook_callback_modifier *callback, void *callback_data)
{
struct t_hook *new_hook;
@ -1226,8 +1228,8 @@ hook_modifier (struct t_weechat_plugin *plugin, char *modifier,
*/
char *
hook_modifier_exec (struct t_weechat_plugin *plugin, char *modifier,
char *modifier_data, char *string)
hook_modifier_exec (struct t_weechat_plugin *plugin, const char *modifier,
const char *modifier_data, const char *string)
{
struct t_hook *ptr_hook, *next_hook;
char *new_msg, *message_modified;

View File

@ -135,8 +135,8 @@ struct t_hook_connect
typedef int (t_hook_callback_print)(void *data, struct t_gui_buffer *buffer,
time_t date, int tags_count,
char **tags, char *prefix,
char *message);
char **tags, const char *prefix,
const char *message);
struct t_hook_print
{
@ -148,8 +148,8 @@ struct t_hook_print
int strip_colors; /* strip colors in msg for callback? */
};
typedef int (t_hook_callback_signal)(void *data, char *signal,
char *type_data, void *signal_data);
typedef int (t_hook_callback_signal)(void *data, const char *signal,
const char *type_data, void *signal_data);
struct t_hook_signal
{
@ -158,7 +158,8 @@ struct t_hook_signal
/* with "*", "*" == any signal) */
};
typedef int (t_hook_callback_config)(void *data, char *option, char *value);
typedef int (t_hook_callback_config)(void *data, const char *option,
const char *value);
struct t_hook_config
{
@ -167,7 +168,7 @@ struct t_hook_config
/* (NULL = hook for all options) */
};
typedef int (t_hook_callback_completion)(void *data, char *completion,
typedef int (t_hook_callback_completion)(void *data, const char *completion,
struct t_gui_buffer *buffer,
struct t_weelist *list);
@ -177,8 +178,9 @@ struct t_hook_completion
char *completion; /* name of completion */
};
typedef char *(t_hook_callback_modifier)(void *data, char *modifier,
char *modifier_data, char *string);
typedef char *(t_hook_callback_modifier)(void *data, const char *modifier,
const char *modifier_data,
const char *string);
struct t_hook_modifier
{
@ -198,13 +200,13 @@ extern int hook_valid (struct t_hook *hook);
extern int hook_valid_for_plugin (struct t_weechat_plugin *plugin,
struct t_hook *hook);
extern struct t_hook *hook_command (struct t_weechat_plugin *plugin,
char *command, char *description,
char *args, char *args_description,
char *completion,
const char *command, const char *description,
const char *args, const char *args_description,
const char *completion,
t_hook_callback_command *callback,
void *callback_data);
extern int hook_command_exec (struct t_gui_buffer *buffer, int any_plugin,
struct t_weechat_plugin *plugin, char *string);
struct t_weechat_plugin *plugin, const char *string);
extern struct t_hook *hook_timer (struct t_weechat_plugin *plugin,
long interval, int align_second,
int max_calls,
@ -222,46 +224,47 @@ extern int hook_fd_set (fd_set *read_fds, fd_set *write_fds,
extern void hook_fd_exec (fd_set *read_fds, fd_set *write_fds,
fd_set *exception_fds);
extern struct t_hook *hook_connect (struct t_weechat_plugin *plugin,
char *address, int port,
const char *address, int port,
int sock, int ipv6, void *gnutls_session,
char *local_hostname,
const char *local_hostname,
t_hook_callback_connect * callback,
void *callback_data);
extern struct t_hook *hook_print (struct t_weechat_plugin *plugin,
struct t_gui_buffer *buffer,
char *tags, char *message,
const char *tags, const char *message,
int strip_colors,
t_hook_callback_print *callback,
void *callback_data);
extern void hook_print_exec (struct t_gui_buffer *buffer,
time_t date, int tags_count,
char **tags_array, char *prefix,
char *message);
char **tags_array, const char *prefix,
const char *message);
extern struct t_hook *hook_signal (struct t_weechat_plugin *plugin,
char *signal,
const char *signal,
t_hook_callback_signal *callback,
void *callback_data);
extern void hook_signal_send (char *signal, char *type_data,
extern void hook_signal_send (const char *signal, const char *type_data,
void *signal_data);
extern struct t_hook *hook_config (struct t_weechat_plugin *, char *option,
extern struct t_hook *hook_config (struct t_weechat_plugin *, const char *option,
t_hook_callback_config *callback,
void *callback_data);
extern void hook_config_exec (char *option, char *value);
extern void hook_config_exec (const char *option, const char *value);
extern struct t_hook *hook_completion (struct t_weechat_plugin *plugin,
char *completion,
const char *completion,
t_hook_callback_completion *callback,
void *callback_data);
extern void hook_completion_exec (struct t_weechat_plugin *plugin,
char *completion,
const char *completion,
struct t_gui_buffer *buffer,
struct t_weelist *list);
extern struct t_hook *hook_modifier (struct t_weechat_plugin *plugin,
char *modifier,
const char *modifier,
t_hook_callback_modifier *callback,
void *callback_data);
extern char *hook_modifier_exec (struct t_weechat_plugin *plugin,
char *modifier, char *modifier_data,
char *string);
const char *modifier,
const char *modifier_data,
const char *string);
extern void unhook (struct t_hook *hook);
extern void unhook_all_plugin (struct t_weechat_plugin *plugin);
extern void unhook_all ();

View File

@ -42,7 +42,7 @@
*/
int
input_is_command (char *line)
input_is_command (const char *line)
{
char *pos_slash, *pos_space;
@ -69,7 +69,7 @@ int
input_exec_command (struct t_gui_buffer *buffer,
int any_plugin,
struct t_weechat_plugin *plugin,
char *string)
const char *string)
{
int rc;
char *command, *pos, *ptr_args;
@ -136,9 +136,10 @@ input_exec_command (struct t_gui_buffer *buffer,
*/
void
input_data (struct t_gui_buffer *buffer, char *data)
input_data (struct t_gui_buffer *buffer, const char *data)
{
char *new_data, *ptr_data, *pos;
char *new_data, *pos;
const char *ptr_data;
if (!buffer || !data || !data[0] || (data[0] == '\r') || (data[0] == '\n'))
return;

View File

@ -26,7 +26,7 @@ struct t_weechat_plugin;
extern int input_exec_command (struct t_gui_buffer *buffer,
int any_plugin,
struct t_weechat_plugin *plugin,
char *string);
extern void input_data (struct t_gui_buffer *buffer, char *data);
const char *string);
extern void input_data (struct t_gui_buffer *buffer, const char *data);
#endif /* wee-input.h */

View File

@ -56,7 +56,7 @@ weelist_new ()
*/
struct t_weelist_item *
weelist_find_pos (struct t_weelist *weelist, char *data)
weelist_find_pos (struct t_weelist *weelist, const char *data)
{
struct t_weelist_item *ptr_item;
@ -79,7 +79,7 @@ weelist_find_pos (struct t_weelist *weelist, char *data)
void
weelist_insert (struct t_weelist *weelist, struct t_weelist_item *item,
char *where)
const char *where)
{
struct t_weelist_item *pos_item;
@ -139,7 +139,7 @@ weelist_insert (struct t_weelist *weelist, struct t_weelist_item *item,
*/
struct t_weelist_item *
weelist_add (struct t_weelist *weelist, char *data, char *where)
weelist_add (struct t_weelist *weelist, const char *data, const char *where)
{
struct t_weelist_item *new_item;
@ -161,7 +161,7 @@ weelist_add (struct t_weelist *weelist, char *data, char *where)
*/
struct t_weelist_item *
weelist_search (struct t_weelist *weelist, char *data)
weelist_search (struct t_weelist *weelist, const char *data)
{
struct t_weelist_item *ptr_item;
@ -183,7 +183,7 @@ weelist_search (struct t_weelist *weelist, char *data)
*/
struct t_weelist_item *
weelist_casesearch (struct t_weelist *weelist, char *data)
weelist_casesearch (struct t_weelist *weelist, const char *data)
{
struct t_weelist_item *ptr_item;
@ -231,7 +231,7 @@ weelist_get (struct t_weelist *weelist, int position)
*/
void
weelist_set (struct t_weelist_item *item, char *value)
weelist_set (struct t_weelist_item *item, const char *value)
{
if (!item || !value)
return;
@ -363,7 +363,7 @@ weelist_free (struct t_weelist *weelist)
*/
void
weelist_print_log (struct t_weelist *weelist, char *name)
weelist_print_log (struct t_weelist *weelist, const char *name)
{
struct t_weelist_item *ptr_item;

View File

@ -36,14 +36,14 @@ struct t_weelist
extern struct t_weelist *weelist_new ();
extern struct t_weelist_item *weelist_add (struct t_weelist *weelist,
char *data, char *where);
const char *data, const char *where);
extern struct t_weelist_item *weelist_search (struct t_weelist *weelist,
char *data);
const char *data);
extern struct t_weelist_item *weelist_casesearch (struct t_weelist *weelist,
char *data);
const char *data);
extern struct t_weelist_item *weelist_get (struct t_weelist *weelist,
int position);
extern void weelist_set (struct t_weelist_item *item, char *value);
extern void weelist_set (struct t_weelist_item *item, const char *value);
extern struct t_weelist_item *weelist_next (struct t_weelist_item *item);
extern struct t_weelist_item *weelist_prev (struct t_weelist_item *item);
extern char *weelist_string (struct t_weelist_item *item);
@ -52,6 +52,6 @@ extern void weelist_remove (struct t_weelist *weelist,
struct t_weelist_item *item);
extern void weelist_remove_all (struct t_weelist *weelist);
extern void weelist_free (struct t_weelist *weelist);
extern void weelist_print_log (struct t_weelist *weelist, char *name);
extern void weelist_print_log (struct t_weelist *weelist, const char *name);
#endif /* wee-list.h */

View File

@ -50,7 +50,7 @@ FILE *weechat_log_file = NULL; /* WeeChat log file */
*/
int
log_open (char *filename, char *mode)
log_open (const char *filename, const char *mode)
{
int filename_length;
@ -117,7 +117,7 @@ log_init ()
*/
void
log_printf (char *message, ...)
log_printf (const char *message, ...)
{
static char buffer[4096];
char *ptr_buffer;

View File

@ -25,7 +25,7 @@ extern FILE *weechat_log_file;
extern void log_init ();
extern void log_close ();
extern void log_printf (char *message, ...);
extern void log_printf (const char *message, ...);
extern int log_crash_rename ();
#endif /* wee-log.h */

View File

@ -90,7 +90,7 @@ network_end ()
*/
void
network_convbase64_8x3_to_6x4 (char *from, char *to)
network_convbase64_8x3_to_6x4 (const char *from, char *to)
{
unsigned char base64_table[] = "ABCDEFGHIJKLMNOPQRSTUVWXYZ"
"abcdefghijklmnopqrstuvwxyz0123456789+/";
@ -106,9 +106,10 @@ network_convbase64_8x3_to_6x4 (char *from, char *to)
*/
void
network_base64encode (char *from, char *to)
network_base64encode (const char *from, char *to)
{
char *f, *t;
const char *f;
char *t;
int from_len;
from_len = strlen (from);
@ -153,9 +154,8 @@ network_base64encode (char *from, char *to)
*/
int
network_pass_httpproxy (int sock, char *address, int port)
network_pass_httpproxy (int sock, const char *address, int port)
{
char buffer[256], authbuf[128], authbuf_base64[196];
int n, m;
@ -204,7 +204,7 @@ network_pass_httpproxy (int sock, char *address, int port)
*/
int
network_resolve (char *hostname, char *ip, int *version)
network_resolve (const char *hostname, char *ip, int *version)
{
char ipbuffer[NI_MAXHOST];
struct addrinfo *res;
@ -248,7 +248,7 @@ network_resolve (char *hostname, char *ip, int *version)
*/
int
network_pass_socks4proxy (int sock, char *address, int port)
network_pass_socks4proxy (int sock, const char *address, int port)
{
/*
* socks4 protocol is explained here:
@ -294,7 +294,7 @@ network_pass_socks4proxy (int sock, char *address, int port)
*/
int
network_pass_socks5proxy (int sock, char *address, int port)
network_pass_socks5proxy (int sock, const char *address, int port)
{
/*
* socks5 protocol is explained in RFC 1928
@ -440,7 +440,7 @@ network_pass_socks5proxy (int sock, char *address, int port)
*/
int
network_pass_proxy (int sock, char *address, int port)
network_pass_proxy (int sock, const char *address, int port)
{
int rc;

View File

@ -24,7 +24,7 @@ struct t_hook;
extern void network_init ();
extern void network_end ();
extern int network_pass_proxy (int sock, char *address, int port);
extern int network_pass_proxy (int sock, const char *address, int port);
extern int network_connect_to (int sock, unsigned long address, int port);
extern void network_connect_with_fork (struct t_hook *);

View File

@ -59,7 +59,7 @@
*/
char *
string_strndup (char *string, int length)
string_strndup (const char *string, int length)
{
char *result;
@ -111,7 +111,7 @@ string_toupper (char *string)
*/
int
string_strcasecmp (char *string1, char *string2)
string_strcasecmp (const char *string1, const char *string2)
{
int diff;
@ -137,7 +137,7 @@ string_strcasecmp (char *string1, char *string2)
*/
int
string_strncasecmp (char *string1, char *string2, int max)
string_strncasecmp (const char *string1, const char *string2, int max)
{
int count, diff;
@ -167,8 +167,8 @@ string_strncasecmp (char *string1, char *string2, int max)
*/
int
string_strcmp_ignore_chars (char *string1, char *string2, char *chars_ignored,
int case_sensitive)
string_strcmp_ignore_chars (const char *string1, const char *string2,
const char *chars_ignored, int case_sensitive)
{
int diff;
@ -230,7 +230,7 @@ string_strcmp_ignore_chars (char *string1, char *string2, char *chars_ignored,
*/
char *
string_strcasestr (char *string, char *search)
string_strcasestr (const char *string, const char *search)
{
int length_search;
@ -242,7 +242,7 @@ string_strcasestr (char *string, char *search)
while (string[0])
{
if (string_strncasecmp (string, search, length_search) == 0)
return string;
return (char *)string;
string++;
}
@ -257,7 +257,7 @@ string_strcasestr (char *string, char *search)
*/
int
string_match (char *string, char *mask, int case_sensitive)
string_match (const char *string, const char *mask, int case_sensitive)
{
char last, *mask2;
int len_string, len_mask, rc;
@ -340,9 +340,10 @@ string_match (char *string, char *mask, int case_sensitive)
*/
char *
string_replace (char *string, char *search, char *replace)
string_replace (const char *string, const char *search, const char *replace)
{
char *pos, *new_string;
const char *pos;
char *new_string;
int length1, length2, length_new, count;
if (!string || !search || !replace)
@ -398,10 +399,10 @@ string_replace (char *string, char *search, char *replace)
*/
char *
string_remove_quotes (char *string, char *quotes)
string_remove_quotes (const char *string, const char *quotes)
{
int length;
char *pos_start, *pos_end;
const char *pos_start, *pos_end;
if (!string || !quotes)
return NULL;
@ -435,12 +436,13 @@ string_remove_quotes (char *string, char *quotes)
/*
* string_strip: strip chars at beginning and/or end of string
* note: returned value has to be free() after use
*/
char *
string_strip (char *string, int left, int right, char *chars)
string_strip (const char *string, int left, int right, const char *chars)
{
char *ptr_start, *ptr_end;
const char *ptr_start, *ptr_end;
if (!string)
return NULL;
@ -476,10 +478,11 @@ string_strip (char *string, int left, int right, char *chars)
/*
* string_convert_hex_chars: convert hex chars (\x??) to value
* note: returned value has to be free() after use
*/
char *
string_convert_hex_chars (char *string)
string_convert_hex_chars (const char *string)
{
char *output, hex_str[8], *error;
int pos_output;
@ -550,7 +553,7 @@ string_convert_hex_chars (char *string)
*/
wint_t
string_get_wide_char (char *string)
string_get_wide_char (const char *string)
{
int char_size;
wint_t result;
@ -590,7 +593,7 @@ string_get_wide_char (char *string)
*/
int
string_is_word_char (char *string)
string_is_word_char (const char *string)
{
wint_t c = string_get_wide_char (string);
@ -619,7 +622,7 @@ string_is_word_char (char *string)
*/
int
string_has_highlight (char *string, char *highlight_words)
string_has_highlight (const char *string, const char *highlight_words)
{
char *msg, *highlight, *match, *match_pre, *match_post, *msg_pos, *pos, *pos_end;
int end, length, startswith, endswith, wildcard_start, wildcard_end;
@ -728,7 +731,7 @@ string_has_highlight (char *string, char *highlight_words)
*/
char **
string_explode (char *string, char *separators, int keep_eol,
string_explode (const char *string, const char *separators, int keep_eol,
int num_items_max, int *num_items)
{
int i, n_items;
@ -851,7 +854,7 @@ string_free_exploded (char **exploded_string)
*/
char *
string_build_with_exploded (char **exploded_string, char *separator)
string_build_with_exploded (char **exploded_string, const char *separator)
{
int i, length, length_separator;
char *result;
@ -889,11 +892,12 @@ string_build_with_exploded (char **exploded_string, char *separator)
*/
char **
string_split_command (char *command, char separator)
string_split_command (const char *command, char separator)
{
int nb_substr, arr_idx, str_idx, type;
char **array;
char *buffer, *ptr, *p;
char *buffer, *p;
const char *ptr;
if (!command || !command[0])
return NULL;
@ -985,10 +989,12 @@ string_free_splitted_command (char **splitted_command)
/*
* string_iconv: convert string to another charset
* note: returned value has to be free() after use
*/
char *
string_iconv (int from_utf8, char *from_code, char *to_code, char *string)
string_iconv (int from_utf8, const char *from_code, const char *to_code,
const char *string)
{
char *outbuf;
@ -1090,10 +1096,11 @@ string_iconv (int from_utf8, char *from_code, char *to_code, char *string)
/*
* string_iconv_to_internal: convert user string (input, script, ..) to
* WeeChat internal storage charset
* note: returned value has to be free() after use
*/
char *
string_iconv_to_internal (char *charset, char *string)
string_iconv_to_internal (const char *charset, const char *string)
{
char *input, *output;
@ -1127,10 +1134,11 @@ string_iconv_to_internal (char *charset, char *string)
/*
* string_iconv_from_internal: convert internal string to terminal charset,
* for display
* note: returned value has to be free() after use
*/
char *
string_iconv_from_internal (char *charset, char *string)
string_iconv_from_internal (const char *charset, const char *string)
{
char *input, *output;
@ -1163,7 +1171,7 @@ string_iconv_from_internal (char *charset, char *string)
*/
void
string_iconv_fprintf (FILE *file, char *data, ...)
string_iconv_fprintf (FILE *file, const char *data, ...)
{
va_list argptr;
char *buf, *buf2;

View File

@ -20,31 +20,39 @@
#ifndef __WEECHAT_STRING_H
#define __WEECHAT_STRING_H 1
extern char *string_strndup (char *string, int length);
extern char *string_strndup (const char *string, int length);
extern void string_tolower (char *string);
extern void string_toupper (char *string);
extern int string_strcasecmp (char *string1, char *string2);
extern int string_strncasecmp (char *string1, char *string2, int max);
extern int string_strcmp_ignore_chars (char *string1, char *string2,
char *chars_ignored, int case_sensitive);
extern char *string_strcasestr (char *string, char *search);
extern int string_match (char *string, char *mask, int case_sensitive);
extern char *string_replace (char *string, char *search, char *replace);
extern char *string_remove_quotes (char *string, char *quotes);
extern char *string_strip (char *string, int left, int right, char *chars);
extern char *string_convert_hex_chars (char *string);
extern int string_has_highlight (char *string, char *highlight_words);
extern char **string_explode (char *string, char *separators, int keep_eol,
int num_items_max, int *num_items);
extern int string_strcasecmp (const char *string1, const char *string2);
extern int string_strncasecmp (const char *string1, const char *string2,
int max);
extern int string_strcmp_ignore_chars (const char *string1,
const char *string2,
const char *chars_ignored,
int case_sensitive);
extern char *string_strcasestr (const char *string, const char *search);
extern int string_match (const char *string, const char *mask,
int case_sensitive);
extern char *string_replace (const char *string, const char *search,
const char *replace);
extern char *string_remove_quotes (const char *string, const char *quotes);
extern char *string_strip (const char *string, int left, int right,
const char *chars);
extern char *string_convert_hex_chars (const char *string);
extern int string_has_highlight (const char *string,
const char *highlight_words);
extern char **string_explode (const char *string, const char *separators,
int keep_eol, int num_items_max, int *num_items);
extern void string_free_exploded (char **exploded_string);
extern char *string_build_with_exploded (char **exploded_string,
char *separator);
extern char **string_split_command (char *command, char separator);
const char *separator);
extern char **string_split_command (const char *command, char separator);
extern void string_free_splitted_command (char **splitted_command);
extern char *string_iconv (int from_utf8, char *from_code, char *to_code,
char *string);
extern char *string_iconv_to_internal (char *charset, char *string);
extern char *string_iconv_from_internal (char *charset, char *string);
extern void string_iconv_fprintf (FILE *file, char *data, ...);
extern char *string_iconv (int from_utf8, const char *from_code,
const char *to_code, const char *string);
extern char *string_iconv_to_internal (const char *charset, const char *string);
extern char *string_iconv_from_internal (const char *charset,
const char *string);
extern void string_iconv_fprintf (FILE *file, const char *data, ...);
#endif /* wee-string.h */

View File

@ -86,7 +86,7 @@ session_write_int (FILE *file, int id, int value)
*/
int
session_write_str (FILE *file, int id, char *string)
session_write_str (FILE *file, int id, const char *string)
{
char type;
int length;
@ -470,7 +470,7 @@ session_save_hotlist (FILE *file)
*/
/*int
session_save (char *filename)
session_save (const char *filename)
{
FILE *file;
int rc;
@ -499,7 +499,7 @@ session_save (char *filename)
*/
void
session_crash (FILE *file, char *message, ...)
session_crash (FILE *file, const char *message, ...)
{
char buf[4096];
va_list argptr;
@ -1718,7 +1718,7 @@ session_load_hotlist (FILE *file)
*/
/*int
session_load (char *filename)
session_load (const char *filename)
{
FILE *file;
char *signature;

View File

@ -199,7 +199,7 @@ enum t_session_hotlist
SESSION_HOTL_CREATION_TIME
};
int session_save (char *filename);
int session_load (char *filename);
int session_save (const char *filename);
int session_load (const char *filename);
#endif /* wee-upgrade.h */

View File

@ -49,7 +49,7 @@ utf8_init ()
*/
int
utf8_has_8bits (char *string)
utf8_has_8bits (const char *string)
{
while (string && string[0])
{
@ -67,7 +67,7 @@ utf8_has_8bits (char *string)
*/
int
utf8_is_valid (char *string, char **error)
utf8_is_valid (const char *string, char **error)
{
while (string && string[0])
{
@ -77,7 +77,7 @@ utf8_is_valid (char *string, char **error)
if (!string[1] || (((unsigned char)(string[1]) & 0xC0) != 0x80))
{
if (error)
*error = string;
*error = (char *)string;
return 0;
}
string += 2;
@ -90,7 +90,7 @@ utf8_is_valid (char *string, char **error)
|| (((unsigned char)(string[2]) & 0xC0) != 0x80))
{
if (error)
*error = string;
*error = (char *)string;
return 0;
}
string += 3;
@ -104,7 +104,7 @@ utf8_is_valid (char *string, char **error)
|| (((unsigned char)(string[3]) & 0xC0) != 0x80))
{
if (error)
*error = string;
*error = (char *)string;
return 0;
}
string += 4;
@ -113,7 +113,7 @@ utf8_is_valid (char *string, char **error)
else if ((unsigned char)(string[0]) >= 0x80)
{
if (error)
*error = string;
*error = (char *)string;
return 0;
}
else
@ -130,7 +130,7 @@ utf8_is_valid (char *string, char **error)
*/
void
utf8_normalize (char *string, char replacement)
utf8_normalize (const char *string, char replacement)
{
char *error;
@ -148,7 +148,7 @@ utf8_normalize (char *string, char replacement)
*/
char *
utf8_prev_char (char *string_start, char *string)
utf8_prev_char (const char *string_start, const char *string)
{
if (!string || (string <= string_start))
return NULL;
@ -160,28 +160,28 @@ utf8_prev_char (char *string_start, char *string)
/* UTF-8, at least 2 bytes */
string--;
if (string < string_start)
return string + 1;
return (char *)string + 1;
if (((unsigned char)(string[0]) & 0xC0) == 0x80)
{
/* UTF-8, at least 3 bytes */
string--;
if (string < string_start)
return string + 1;
return (char *)string + 1;
if (((unsigned char)(string[0]) & 0xC0) == 0x80)
{
/* UTF-8, 4 bytes */
string--;
if (string < string_start)
return string + 1;
return string;
return (char *)string + 1;
return (char *)string;
}
else
return string;
return (char *)string;
}
else
return string;
return (char *)string;
}
return string;
return (char *)string;
}
/*
@ -189,7 +189,7 @@ utf8_prev_char (char *string_start, char *string)
*/
char *
utf8_next_char (char *string)
utf8_next_char (const char *string)
{
if (!string)
return NULL;
@ -198,31 +198,31 @@ utf8_next_char (char *string)
if (((unsigned char)(string[0]) & 0xE0) == 0xC0)
{
if (!string[1])
return string + 1;
return string + 2;
return (char *)string + 1;
return (char *)string + 2;
}
/* UTF-8, 3 bytes: 1110vvvv 10vvvvvv 10vvvvvv */
else if (((unsigned char)(string[0]) & 0xF0) == 0xE0)
{
if (!string[1])
return string + 1;
return (char *)string + 1;
if (!string[2])
return string + 2;
return string + 3;
return (char *)string + 2;
return (char *)string + 3;
}
/* UTF-8, 4 bytes: 11110vvv 10vvvvvv 10vvvvvv 10vvvvvv */
else if (((unsigned char)(string[0]) & 0xF8) == 0xF0)
{
if (!string[1])
return string + 1;
return (char *)string + 1;
if (!string[2])
return string + 2;
return (char *)string + 2;
if (!string[3])
return string + 3;
return string + 4;
return (char *)string + 3;
return (char *)string + 4;
}
/* UTF-8, 1 byte: 0vvvvvvv */
return string + 1;
return (char *)string + 1;
}
/*
@ -230,7 +230,7 @@ utf8_next_char (char *string)
*/
int
utf8_char_size (char *string)
utf8_char_size (const char *string)
{
if (!string)
return 0;
@ -243,7 +243,7 @@ utf8_char_size (char *string)
*/
int
utf8_strlen (char *string)
utf8_strlen (const char *string)
{
int length;
@ -264,7 +264,7 @@ utf8_strlen (char *string)
*/
int
utf8_strnlen (char *string, int bytes)
utf8_strnlen (const char *string, int bytes)
{
char *start;
int length;
@ -272,7 +272,7 @@ utf8_strnlen (char *string, int bytes)
if (!string)
return 0;
start = string;
start = (char *)string;
length = 0;
while (string && string[0] && (string - start < bytes))
{
@ -288,7 +288,7 @@ utf8_strnlen (char *string, int bytes)
*/
int
utf8_strlen_screen (char *string)
utf8_strlen_screen (const char *string)
{
int length, num_char;
wchar_t *wstring;
@ -320,7 +320,7 @@ utf8_strlen_screen (char *string)
*/
int
utf8_charcasecmp (char *string1, char *string2)
utf8_charcasecmp (const char *string1, const char *string2)
{
int length1, length2, i, char1, char2, diff;
@ -367,7 +367,7 @@ utf8_charcasecmp (char *string1, char *string2)
*/
int
utf8_char_size_screen (char *string)
utf8_char_size_screen (const char *string)
{
int char_size;
char utf_char[16];
@ -390,12 +390,12 @@ utf8_char_size_screen (char *string)
*/
char *
utf8_add_offset (char *string, int offset)
utf8_add_offset (const char *string, int offset)
{
int count;
if (!string)
return string;
return NULL;
count = 0;
while (string && string[0] && (count < offset))
@ -403,7 +403,7 @@ utf8_add_offset (char *string, int offset)
string = utf8_next_char (string);
count++;
}
return string;
return (char *)string;
}
/*
@ -412,7 +412,7 @@ utf8_add_offset (char *string, int offset)
*/
int
utf8_real_pos (char *string, int pos)
utf8_real_pos (const char *string, int pos)
{
int count, real_pos;
char *next_char;
@ -438,7 +438,7 @@ utf8_real_pos (char *string, int pos)
*/
int
utf8_pos (char *string, int real_pos)
utf8_pos (const char *string, int real_pos)
{
int count;
char *limit;
@ -447,7 +447,7 @@ utf8_pos (char *string, int real_pos)
return real_pos;
count = 0;
limit = string + real_pos;
limit = (char *)string + real_pos;
while (string && string[0] && (string < limit))
{
string = utf8_next_char (string);

View File

@ -33,19 +33,19 @@
extern int local_utf8;
extern void utf8_init ();
extern int utf8_has_8bits (char *string);
extern int utf8_is_valid (char *string, char **error);
extern void utf8_normalize (char *string, char replacement);
extern char *utf8_prev_char (char *string_start, char *string);
extern char *utf8_next_char (char *string);
extern int utf8_char_size (char *string);
extern int utf8_strlen (char *string);
extern int utf8_strnlen (char *string, int bytes);
extern int utf8_strlen_screen (char *string);
extern int utf8_charcasecmp (char *string1, char *string2);
extern int utf8_char_size_screen (char *string);
extern char *utf8_add_offset (char *string, int offset);
extern int utf8_real_pos (char *string, int pos);
extern int utf8_pos (char *string, int real_pos);
extern int utf8_has_8bits (const char *string);
extern int utf8_is_valid (const char *string, char **error);
extern void utf8_normalize (const char *string, char replacement);
extern char *utf8_prev_char (const char *string_start, const char *string);
extern char *utf8_next_char (const char *string);
extern int utf8_char_size (const char *string);
extern int utf8_strlen (const char *string);
extern int utf8_strnlen (const char *string, int bytes);
extern int utf8_strlen_screen (const char *string);
extern int utf8_charcasecmp (const char *string1, const char *string2);
extern int utf8_char_size_screen (const char *string);
extern char *utf8_add_offset (const char *string, int offset);
extern int utf8_real_pos (const char *string, int pos);
extern int utf8_pos (const char *string, int real_pos);
#endif /* wee-utf8.h */

View File

@ -106,7 +106,7 @@ util_timeval_add (struct timeval *tv, long interval)
*/
int
util_get_time_length (char *time_format)
util_get_time_length (const char *time_format)
{
time_t date;
struct tm *local_time;
@ -144,7 +144,7 @@ util_catch_signal (int signum, void (*handler)(int))
*/
int
util_create_dir (char *directory, int permissions)
util_create_dir (const char *directory, int permissions)
{
if (mkdir (directory, 0755) < 0)
{
@ -169,8 +169,8 @@ util_create_dir (char *directory, int permissions)
*/
void
util_exec_on_files (char *directory, void *data,
int (*callback)(void *data, char *filename))
util_exec_on_files (const char *directory, void *data,
int (*callback)(void *data, const char *filename))
{
char complete_filename[1024];
DIR *dir;
@ -209,7 +209,7 @@ util_exec_on_files (char *directory, void *data,
*/
char *
util_search_full_lib_name (char *filename, char *sys_directory)
util_search_full_lib_name (const char *filename, const char *sys_directory)
{
char *name_with_ext, *final_name;
int length;
@ -279,7 +279,7 @@ util_search_full_lib_name (char *filename, char *sys_directory)
*/
int
util_weechat_version_cmp (char *version1, char *version2)
util_weechat_version_cmp (const char *version1, const char *version2)
{
char *v1, *v2, *ptr_v1, *ptr_v2, *pos1, *pos2, *next1, *next2;
char *error1, *error2;

View File

@ -23,12 +23,15 @@
extern int util_timeval_cmp (struct timeval *tv1, struct timeval *tv2);
extern long util_timeval_diff (struct timeval *tv1, struct timeval *tv2);
extern void util_timeval_add (struct timeval *tv, long interval);
extern int util_get_time_length (char *time_format);
extern int util_get_time_length (const char *time_format);
extern void util_catch_signal (int signum, void (*handler)(int));
extern int util_create_dir (char *directory, int permissions);
extern void util_exec_on_files (char *directory, void *data,
int (*callback)(void *data, char *filename));
extern char *util_search_full_lib_name (char *filename, char *sys_directory);
extern int util_weechat_version_cmp (char *version1, char *version2);
extern int util_create_dir (const char *directory, int permissions);
extern void util_exec_on_files (const char *directory, void *data,
int (*callback)(void *data,
const char *filename));
extern char *util_search_full_lib_name (const char *filename,
const char *sys_directory);
extern int util_weechat_version_cmp (const char *version1,
const char *version2);
#endif /* wee-util.h */

View File

@ -574,7 +574,7 @@ gui_bar_window_add_missing_bars (struct t_gui_window *window)
void
gui_bar_window_print_string (struct t_gui_bar_window *bar_window,
int *x, int *y, char *string)
int *x, int *y, const char *string)
{
int weechat_color, size_on_screen, fg, bg;
char str_fg[3], str_bg[3], utf_char[16], *next_char, *output;

View File

@ -213,8 +213,8 @@ gui_chat_display_horizontal_line (struct t_gui_window *window, int simulate)
*/
char *
gui_chat_string_next_char (struct t_gui_window *window, unsigned char *string,
int apply_style)
gui_chat_string_next_char (struct t_gui_window *window,
const unsigned char *string, int apply_style)
{
char str_fg[3], str_bg[3];
int weechat_color, fg, bg;
@ -375,7 +375,7 @@ gui_chat_string_next_char (struct t_gui_window *window, unsigned char *string,
*/
void
gui_chat_display_word_raw (struct t_gui_window *window, char *string,
gui_chat_display_word_raw (struct t_gui_window *window, const char *string,
int max_chars_on_screen, int display)
{
char *next_char, *output, utf_char[16], chars_displayed, size_on_screen;

View File

@ -62,7 +62,7 @@ struct t_gui_color gui_weechat_colors[GUI_CURSES_NUM_WEECHAT_COLORS + 1] =
*/
int
gui_color_search (char *color_name)
gui_color_search (const char *color_name)
{
int i;
@ -82,7 +82,7 @@ gui_color_search (char *color_name)
*/
/*void
gui_color_get_fg_bg (char *string, char **fg, char **bg)
gui_color_get_fg_bg (const char *string, const char **fg, const char **bg)
{
char *pos, *pos_end_fg;
@ -124,7 +124,7 @@ gui_color_get_fg_bg (char *string, char **fg, char **bg)
*/
int
gui_color_assign (int *color, char *color_name)
gui_color_assign (int *color, const char *color_name)
{
int i;
@ -149,7 +149,7 @@ gui_color_assign (int *color, char *color_name)
*/
/*void
gui_color_assign (t_gui_color **color, char *fg_and_bg)
gui_color_assign (t_gui_color **color, const char *fg_and_bg)
{
char *color_fg, *color_bg, *color_fg2, *color_bg2;
int value_fg, value_bg;

View File

@ -158,7 +158,7 @@ gui_window_objects_free (struct t_gui_window *window, int free_separator,
*/
int
gui_window_utf_char_valid (char *utf_char)
gui_window_utf_char_valid (const char *utf_char)
{
/* 146 or 0x7F are not valid */
if ((((unsigned char)(utf_char[0]) == 146)
@ -175,7 +175,7 @@ gui_window_utf_char_valid (char *utf_char)
*/
void
gui_window_wprintw (WINDOW *window, char *data, ...)
gui_window_wprintw (WINDOW *window, const char *data, ...)
{
va_list argptr;
static char buf[4096];

View File

@ -90,8 +90,8 @@ extern void gui_keyboard_default_bindings ();
extern int gui_keyboard_read_cb (void *data);
/* window functions */
extern int gui_window_utf_char_valid (char *utf_char);
extern void gui_window_wprintw (WINDOW *window, char *data, ...);
extern int gui_window_utf_char_valid (const char *utf_char);
extern void gui_window_wprintw (WINDOW *window, const char *data, ...);
extern void gui_window_clear_weechat (WINDOW *window, int num_color);
extern void gui_window_clear (WINDOW *window, int bg);
extern void gui_window_reset_style (WINDOW *window, int num_color);

View File

@ -296,7 +296,7 @@ gui_bar_window_add_missing_bars (struct t_gui_window *window)
int
gui_bar_window_print_string (struct t_gui_bar_window *bar_window,
char *string, int max_chars)
const char *string, int max_chars)
{
(void) bar_window;
(void) string;

View File

@ -194,8 +194,8 @@ gui_chat_draw_title (struct t_gui_buffer *buffer, int erase)
*/
char *
gui_chat_string_next_char (struct t_gui_window *window, unsigned char *string,
int apply_style)
gui_chat_string_next_char (struct t_gui_window *window,
const unsigned char *string, int apply_style)
{
char str_fg[3];
int weechat_color;
@ -294,7 +294,7 @@ gui_chat_string_next_char (struct t_gui_window *window, unsigned char *string,
*/
void
gui_chat_display_word_raw (struct t_gui_window *window, char *string)
gui_chat_display_word_raw (struct t_gui_window *window, const char *string)
{
/*char *prev_char, *next_char, saved_char;*/
@ -310,8 +310,8 @@ gui_chat_display_word_raw (struct t_gui_window *window, char *string)
void
gui_chat_display_word (struct t_gui_window *window,
struct t_gui_line *line,
char *data,
char *end_offset,
const char *data,
const char *end_offset,
int num_lines, int count, int *lines_displayed, int simulate)
{
/*char *end_line, saved_char_end, saved_char;

View File

@ -61,7 +61,7 @@ struct t_gui_color gui_weechat_colors[] =
*/
int
gui_color_search (char *color_name)
gui_color_search (const char *color_name)
{
int i;
@ -80,7 +80,7 @@ gui_color_search (char *color_name)
*/
int
gui_color_assign (int *color, char *color_name)
gui_color_assign (int *color, const char *color_name)
{
int i;

View File

@ -53,7 +53,7 @@ gui_input_set_color (struct t_gui_window *window, int irc_color)
*/
void
gui_input_draw_prompt (struct t_gui_window *window, char *nick)
gui_input_draw_prompt (struct t_gui_window *window, const char *nick)
{
/*char *pos, saved_char, *modes;
int char_size, mode_found;*/

View File

@ -57,7 +57,7 @@ struct t_hook *gui_bar_item_timer = NULL;
*/
struct t_gui_bar_item *
gui_bar_item_search (char *name)
gui_bar_item_search (const char *name)
{
struct t_gui_bar_item *ptr_item;
@ -79,7 +79,7 @@ gui_bar_item_search (char *name)
*/
struct t_gui_bar_item *
gui_bar_item_search_with_plugin (struct t_weechat_plugin *plugin, char *name)
gui_bar_item_search_with_plugin (struct t_weechat_plugin *plugin, const char *name)
{
struct t_gui_bar_item *ptr_item;
@ -102,7 +102,7 @@ gui_bar_item_search_with_plugin (struct t_weechat_plugin *plugin, char *name)
*/
struct t_gui_bar_item *
gui_bar_item_new (struct t_weechat_plugin *plugin, char *name,
gui_bar_item_new (struct t_weechat_plugin *plugin, const char *name,
char *(*build_callback)(void *data,
struct t_gui_bar_item *item,
struct t_gui_window *window,
@ -148,7 +148,7 @@ gui_bar_item_new (struct t_weechat_plugin *plugin, char *name,
*/
int
gui_bar_contains_item (struct t_gui_bar *bar, char *name)
gui_bar_contains_item (struct t_gui_bar *bar, const char *name)
{
int i;
@ -170,7 +170,7 @@ gui_bar_contains_item (struct t_gui_bar *bar, char *name)
*/
void
gui_bar_item_update (char *name)
gui_bar_item_update (const char *name)
{
struct t_gui_bar *ptr_bar;
@ -585,8 +585,8 @@ gui_bar_item_timer_cb (void *data)
*/
int
gui_bar_item_signal_cb (void *data, char *signal,
char *type_data, void *signal_data)
gui_bar_item_signal_cb (void *data, const char *signal,
const char *type_data, void *signal_data)
{
/* make C compiler happy */
(void) signal;
@ -603,7 +603,7 @@ gui_bar_item_signal_cb (void *data, char *signal,
*/
void
gui_bar_item_hook (char *signal, char *item)
gui_bar_item_hook (const char *signal, const char *item)
{
struct t_gui_bar_item_hook *bar_item_hook;
@ -611,7 +611,8 @@ gui_bar_item_hook (char *signal, char *item)
if (bar_item_hook)
{
bar_item_hook->hook = hook_signal (NULL, signal,
&gui_bar_item_signal_cb, item);
&gui_bar_item_signal_cb,
(void *)item);
bar_item_hook->next_hook = gui_bar_item_hooks;
gui_bar_item_hooks = bar_item_hook;
}

View File

@ -63,15 +63,15 @@ extern struct t_gui_bar_item *last_gui_bar_item;
/* functions */
extern struct t_gui_bar_item *gui_bar_item_search (char *name);
extern struct t_gui_bar_item *gui_bar_item_search (const char *name);
extern struct t_gui_bar_item *gui_bar_item_new (struct t_weechat_plugin *plugin,
char *name,
const char *name,
char *(*build_callback)(void *data,
struct t_gui_bar_item *item,
struct t_gui_window *window,
int max_width, int max_height),
void *build_callback_data);
extern void gui_bar_item_update (char *name);
extern void gui_bar_item_update (const char *name);
extern void gui_bar_item_free (struct t_gui_bar_item *item);
extern void gui_bar_item_free_all ();
extern void gui_bar_item_free_all_plugin (struct t_weechat_plugin *plugin);

View File

@ -62,7 +62,7 @@ struct t_gui_bar *last_gui_temp_bar = NULL;
*/
int
gui_bar_search_option (char *option_name)
gui_bar_search_option (const char *option_name)
{
int i;
@ -85,7 +85,7 @@ gui_bar_search_option (char *option_name)
*/
int
gui_bar_search_type (char *type)
gui_bar_search_type (const char *type)
{
int i;
@ -105,7 +105,7 @@ gui_bar_search_type (char *type)
*/
int
gui_bar_search_position (char *position)
gui_bar_search_position (const char *position)
{
int i;
@ -247,7 +247,7 @@ gui_bar_root_get_size (struct t_gui_bar *bar, enum t_gui_bar_position position)
*/
struct t_gui_bar *
gui_bar_search (char *name)
gui_bar_search (const char *name)
{
struct t_gui_bar *ptr_bar;
@ -270,7 +270,7 @@ gui_bar_search (char *name)
*/
struct t_gui_bar *
gui_bar_search_with_option_name (char *option_name)
gui_bar_search_with_option_name (const char *option_name)
{
char *bar_name, *pos_option;
struct t_gui_bar *ptr_bar;
@ -322,7 +322,7 @@ gui_bar_refresh (struct t_gui_bar *bar)
int
gui_bar_config_check_type (void *data, struct t_config_option *option,
char *value)
const char *value)
{
/* make C compiler happy */
(void) data;
@ -414,7 +414,7 @@ gui_bar_config_change_filling (void *data, struct t_config_option *option)
int
gui_bar_config_check_size (void *data, struct t_config_option *option,
char *value)
const char *value)
{
struct t_gui_bar *ptr_bar;
long number;
@ -581,7 +581,7 @@ gui_bar_config_change_items (void *data, struct t_config_option *option)
*/
void
gui_bar_set_name (struct t_gui_bar *bar, char *name)
gui_bar_set_name (struct t_gui_bar *bar, const char *name)
{
int length;
char *option_name;
@ -629,7 +629,7 @@ gui_bar_set_name (struct t_gui_bar *bar, char *name)
*/
void
gui_bar_set_priority (struct t_gui_bar *bar, char *priority)
gui_bar_set_priority (struct t_gui_bar *bar, const char *priority)
{
long number;
char *error;
@ -689,7 +689,7 @@ gui_bar_set_priority (struct t_gui_bar *bar, char *priority)
*/
void
gui_bar_set_position (struct t_gui_bar *bar, char *position)
gui_bar_set_position (struct t_gui_bar *bar, const char *position)
{
int position_value;
@ -708,7 +708,7 @@ gui_bar_set_position (struct t_gui_bar *bar, char *position)
*/
void
gui_bar_set_size (struct t_gui_bar *bar, char *size)
gui_bar_set_size (struct t_gui_bar *bar, const char *size)
{
long number;
char *error, value[32];
@ -753,7 +753,7 @@ gui_bar_set_size (struct t_gui_bar *bar, char *size)
*/
void
gui_bar_set_size_max (struct t_gui_bar *bar, char *size)
gui_bar_set_size_max (struct t_gui_bar *bar, const char *size)
{
long number;
char *error, value[32];
@ -781,7 +781,7 @@ gui_bar_set_size_max (struct t_gui_bar *bar, char *size)
*/
int
gui_bar_set (struct t_gui_bar *bar, char *property, char *value)
gui_bar_set (struct t_gui_bar *bar, const char *property, const char *value)
{
if (!bar || !property || !value)
return 0;
@ -860,7 +860,7 @@ gui_bar_set (struct t_gui_bar *bar, char *property, char *value)
*/
struct t_config_option *
gui_bar_create_option (char *bar_name, int index_option, char *value)
gui_bar_create_option (const char *bar_name, int index_option, const char *value)
{
struct t_config_option *ptr_option;
int length;
@ -991,7 +991,7 @@ gui_bar_create_option (char *bar_name, int index_option, char *value)
void
gui_bar_create_option_temp (struct t_gui_bar *temp_bar, int index_option,
char *value)
const char *value)
{
struct t_config_option *new_option;
@ -1044,7 +1044,7 @@ gui_bar_create_option_temp (struct t_gui_bar *temp_bar, int index_option,
*/
struct t_gui_bar *
gui_bar_alloc (char *name)
gui_bar_alloc (const char *name)
{
struct t_gui_bar *new_bar;
@ -1081,7 +1081,7 @@ gui_bar_alloc (char *name)
*/
struct t_gui_bar *
gui_bar_new_with_options (struct t_weechat_plugin *plugin, char *name,
gui_bar_new_with_options (struct t_weechat_plugin *plugin, const char *name,
struct t_config_option *priority,
struct t_config_option *type,
struct t_config_option *conditions,
@ -1166,10 +1166,11 @@ gui_bar_new_with_options (struct t_weechat_plugin *plugin, char *name,
*/
struct t_gui_bar *
gui_bar_new (struct t_weechat_plugin *plugin, char *name,
char *priority, char *type, char *conditions, char *position,
char *filling, char *size, char *size_max, char *color_fg,
char *color_bg, char *separators, char *items)
gui_bar_new (struct t_weechat_plugin *plugin, const char *name,
const char *priority, const char *type, const char *conditions,
const char *position, const char *filling, const char *size,
const char *size_max, const char *color_fg, const char *color_bg,
const char *separators, const char *items)
{
struct t_config_option *option_priority, *option_type, *option_conditions;
struct t_config_option *option_position, *option_filling, *option_size;
@ -1417,7 +1418,7 @@ gui_bar_use_temp_bars ()
*/
void
gui_bar_update (char *name)
gui_bar_update (const char *name)
{
struct t_gui_bar *ptr_bar;

View File

@ -106,28 +106,31 @@ extern struct t_gui_bar *last_gui_temp_bar;
/* functions */
extern int gui_bar_search_option (char *option_name);
extern int gui_bar_search_type (char *type);
extern int gui_bar_search_position (char *position);
extern int gui_bar_search_option (const char *option_name);
extern int gui_bar_search_type (const char *type);
extern int gui_bar_search_position (const char *position);
extern int gui_bar_check_conditions_for_window (struct t_gui_bar *bar,
struct t_gui_window *window);
extern int gui_bar_root_get_size (struct t_gui_bar *bar,
enum t_gui_bar_position position);
extern struct t_gui_bar *gui_bar_search (char *name);
extern struct t_gui_bar *gui_bar_search (const char *name);
extern void gui_bar_set_current_size (struct t_gui_bar *bar, int current_size);
extern int gui_bar_set (struct t_gui_bar *bar, char *property, char *value);
extern int gui_bar_set (struct t_gui_bar *bar, const char *property, const char *value);
extern void gui_bar_create_option_temp (struct t_gui_bar *temp_bar,
int index_option, char *value);
extern struct t_gui_bar *gui_bar_alloc (char *name);
int index_option, const char *value);
extern struct t_gui_bar *gui_bar_alloc (const char *name);
extern struct t_gui_bar *gui_bar_new (struct t_weechat_plugin *plugin,
char *name, char *priority, char *type,
char *conditions, char *position,
char *filling, char *size,
char *size_max, char *color_fg,
char *color_bg, char *separator,
char *items);
const char *name, const char *priority,
const char *type, const char *conditions,
const char *position,
const char *filling, const char *size,
const char *size_max,
const char *color_fg,
const char *color_bg,
const char *separator,
const char *items);
extern void gui_bar_use_temp_bars ();
extern void gui_bar_update (char *name);
extern void gui_bar_update (const char *name);
extern void gui_bar_free (struct t_gui_bar *bar);
extern void gui_bar_free_all ();
extern void gui_bar_free_all_plugin (struct t_weechat_plugin *plugin);

View File

@ -63,10 +63,11 @@ struct t_gui_buffer *gui_previous_buffer = NULL; /* previous buffer */
*/
struct t_gui_buffer *
gui_buffer_new (struct t_weechat_plugin *plugin, char *category, char *name,
gui_buffer_new (struct t_weechat_plugin *plugin,
const char *category, const char *name,
int (*input_callback)(void *data,
struct t_gui_buffer *buffer,
char *input_data),
const char *input_data),
void *input_callback_data,
int (*close_callback)(void *data,
struct t_gui_buffer *buffer),
@ -234,7 +235,7 @@ gui_buffer_valid (struct t_gui_buffer *buffer)
*/
char *
gui_buffer_get_string (struct t_gui_buffer *buffer, char *property)
gui_buffer_get_string (struct t_gui_buffer *buffer, const char *property)
{
static char value[32];
@ -262,7 +263,7 @@ gui_buffer_get_string (struct t_gui_buffer *buffer, char *property)
*/
void *
gui_buffer_get_pointer (struct t_gui_buffer *buffer, char *property)
gui_buffer_get_pointer (struct t_gui_buffer *buffer, const char *property)
{
if (string_strcasecmp (property, "plugin") == 0)
return buffer->plugin;
@ -319,7 +320,7 @@ gui_buffer_ask_input_refresh (struct t_gui_buffer *buffer, int refresh)
*/
void
gui_buffer_set_category (struct t_gui_buffer *buffer, char *category)
gui_buffer_set_category (struct t_gui_buffer *buffer, const char *category)
{
if (category && category[0])
{
@ -338,7 +339,7 @@ gui_buffer_set_category (struct t_gui_buffer *buffer, char *category)
*/
void
gui_buffer_set_name (struct t_gui_buffer *buffer, char *name)
gui_buffer_set_name (struct t_gui_buffer *buffer, const char *name)
{
if (name && name[0])
{
@ -374,7 +375,7 @@ gui_buffer_set_type (struct t_gui_buffer *buffer, enum t_gui_buffer_type type)
*/
void
gui_buffer_set_title (struct t_gui_buffer *buffer, char *new_title)
gui_buffer_set_title (struct t_gui_buffer *buffer, const char *new_title)
{
if (buffer->title)
free (buffer->title);
@ -423,7 +424,7 @@ gui_buffer_set_nicklist_display_groups (struct t_gui_buffer *buffer,
*/
void
gui_buffer_set_nick (struct t_gui_buffer *buffer, char *new_nick)
gui_buffer_set_nick (struct t_gui_buffer *buffer, const char *new_nick)
{
if (buffer->input_nick)
free (buffer->input_nick);
@ -437,7 +438,7 @@ gui_buffer_set_nick (struct t_gui_buffer *buffer, char *new_nick)
void
gui_buffer_set_highlight_words (struct t_gui_buffer *buffer,
char *new_highlight_words)
const char *new_highlight_words)
{
if (buffer->highlight_words)
free (buffer->highlight_words);
@ -451,7 +452,7 @@ gui_buffer_set_highlight_words (struct t_gui_buffer *buffer,
void
gui_buffer_set_highlight_tags (struct t_gui_buffer *buffer,
char *new_highlight_tags)
const char *new_highlight_tags)
{
if (buffer->highlight_tags_array)
string_free_exploded (buffer->highlight_tags_array);
@ -474,7 +475,8 @@ gui_buffer_set_highlight_tags (struct t_gui_buffer *buffer,
*/
void
gui_buffer_set (struct t_gui_buffer *buffer, char *property, char *value)
gui_buffer_set (struct t_gui_buffer *buffer, const char *property,
const char *value)
{
long number;
char *error;
@ -598,7 +600,7 @@ gui_buffer_search_main ()
*/
struct t_gui_buffer *
gui_buffer_search_by_category_name (char *category, char *name)
gui_buffer_search_by_category_name (const char *category, const char *name)
{
struct t_gui_buffer *ptr_buffer;
@ -709,10 +711,11 @@ gui_buffer_is_scrolled (struct t_gui_buffer *buffer)
*/
int
gui_buffer_match_category_name (struct t_gui_buffer *buffer, char *mask,
gui_buffer_match_category_name (struct t_gui_buffer *buffer, const char *mask,
int case_sensitive)
{
char *pos_point, *category, *pos_name;
char *pos_point, *category;
const char *pos_name;
int rc;
if (!mask || !mask[0])

View File

@ -104,7 +104,7 @@ struct t_gui_buffer
int input; /* = 1 if input is enabled */
int (*input_callback)(void *data, /* called when user send data */
struct t_gui_buffer *buffer,
char *input_data);
const char *input_data);
void *input_callback_data; /* data for callback */
/* to this buffer */
char *input_nick; /* self nick */
@ -156,19 +156,19 @@ extern struct t_gui_buffer *gui_previous_buffer;
/* buffer functions */
extern struct t_gui_buffer *gui_buffer_new (struct t_weechat_plugin *plugin,
char *category, char *name,
const char *category, const char *name,
int (*input_callback)(void *data,
struct t_gui_buffer *buffer,
char *input_data),
const char *input_data),
void *input_callback_data,
int (*close_callback)(void *data,
struct t_gui_buffer *buffer),
void *close_callback_data);
extern int gui_buffer_valid (struct t_gui_buffer *buffer);
extern char *gui_buffer_get_string (struct t_gui_buffer *buffer,
char *property);
const char *property);
extern void *gui_buffer_get_pointer (struct t_gui_buffer *buffer,
char *property);
const char *property);
extern void gui_buffer_ask_title_refresh (struct t_gui_buffer *buffer,
int refresh);
extern void gui_buffer_ask_chat_refresh (struct t_gui_buffer *buffer,
@ -178,25 +178,26 @@ extern void gui_buffer_ask_nicklist_refresh (struct t_gui_buffer *buffer,
extern void gui_buffer_ask_input_refresh (struct t_gui_buffer *buffer,
int refresh);
extern void gui_buffer_set_category (struct t_gui_buffer *buffer,
char *category);
extern void gui_buffer_set_name (struct t_gui_buffer *buffer, char *name);
const char *category);
extern void gui_buffer_set_name (struct t_gui_buffer *buffer, const char *name);
extern void gui_buffer_set_title (struct t_gui_buffer *buffer,
char *new_title);
const char *new_title);
extern void gui_buffer_set_nicklist (struct t_gui_buffer *buffer,
int nicklist);
extern void gui_buffer_set_nicklist_case_sensitive (struct t_gui_buffer * buffer,
int case_sensitive);
extern void gui_buffer_set_nick (struct t_gui_buffer *buffer, char *new_nick);
extern void gui_buffer_set (struct t_gui_buffer *buffer, char *property,
char *value);
extern void gui_buffer_set_nick (struct t_gui_buffer *buffer, const char *new_nick);
extern void gui_buffer_set (struct t_gui_buffer *buffer, const char *property,
const char *value);
extern struct t_gui_buffer *gui_buffer_search_main ();
extern struct t_gui_buffer *gui_buffer_search_by_category_name (char *category,
char *name);
extern struct t_gui_buffer *gui_buffer_search_by_category_name (const char *category,
const char *name);
extern struct t_gui_buffer *gui_buffer_search_by_number (int number);
extern struct t_gui_window *gui_buffer_find_window (struct t_gui_buffer *buffer);
extern int gui_buffer_is_scrolled (struct t_gui_buffer *buffer);
extern int gui_buffer_match_category_name (struct t_gui_buffer *buffer,
char *mask, int case_sensitive);
const char *mask,
int case_sensitive);
extern void gui_buffer_clear (struct t_gui_buffer *buffer);
extern void gui_buffer_clear_all ();
extern void gui_buffer_close (struct t_gui_buffer *buffer,

View File

@ -119,7 +119,7 @@ gui_chat_prefix_build ()
*/
int
gui_chat_strlen_screen (char *string)
gui_chat_strlen_screen (const char *string)
{
int length;
@ -142,9 +142,9 @@ gui_chat_strlen_screen (char *string)
*/
int
gui_chat_string_real_pos (char *string, int pos)
gui_chat_string_real_pos (const char *string, int pos)
{
char *ptr_string, *real_pos;
const char *real_pos, *ptr_string;
if (pos <= 0)
return 0;
@ -172,11 +172,12 @@ gui_chat_string_real_pos (char *string, int pos)
void
gui_chat_get_word_info (struct t_gui_window *window,
char *data,
const char *data,
int *word_start_offset, int *word_end_offset,
int *word_length_with_spaces, int *word_length)
{
char *start_data, *next_char, *next_char2;
const char *start_data;
char *next_char, *next_char2;
int leading_spaces, char_size;
*word_start_offset = 0;
@ -465,7 +466,8 @@ gui_chat_get_next_line_displayed (struct t_gui_line *line)
*/
int
gui_chat_line_search (struct t_gui_line *line, char *text, int case_sensitive)
gui_chat_line_search (struct t_gui_line *line, const char *text,
int case_sensitive)
{
char *message;
int rc;
@ -670,8 +672,8 @@ gui_chat_line_free_all (struct t_gui_buffer *buffer)
void
gui_chat_line_add (struct t_gui_buffer *buffer, time_t date,
time_t date_printed, char *tags,
char *prefix, char *message)
time_t date_printed, const char *tags,
const char *prefix, const char *message)
{
struct t_gui_line *new_line;
@ -745,7 +747,7 @@ gui_chat_line_add (struct t_gui_buffer *buffer, time_t date,
*/
void
gui_chat_line_add_y (struct t_gui_buffer *buffer, int y, char *message)
gui_chat_line_add_y (struct t_gui_buffer *buffer, int y, const char *message)
{
struct t_gui_line *ptr_line, *new_line;
@ -839,7 +841,7 @@ gui_chat_line_add_y (struct t_gui_buffer *buffer, int y, char *message)
void
gui_chat_printf_date_tags (struct t_gui_buffer *buffer, time_t date,
char *tags, char *message, ...)
const char *tags, const char *message, ...)
{
char *buf;
va_list argptr;
@ -958,7 +960,7 @@ gui_chat_printf_date_tags (struct t_gui_buffer *buffer, time_t date,
*/
void
gui_chat_printf_y (struct t_gui_buffer *buffer, int y, char *message, ...)
gui_chat_printf_y (struct t_gui_buffer *buffer, int y, const char *message, ...)
{
char *buf;
va_list argptr;

View File

@ -50,10 +50,10 @@ extern int gui_chat_time_length;
extern void gui_chat_prefix_build_empty ();
extern void gui_chat_prefix_build ();
extern int gui_chat_strlen_screen (char *string);
extern int gui_chat_string_real_pos (char *string, int pos);
extern int gui_chat_strlen_screen (const char *string);
extern int gui_chat_string_real_pos (const char *string, int pos);
extern void gui_chat_get_word_info (struct t_gui_window *window,
char *data, int *word_start_offset,
const char *data, int *word_start_offset,
int *word_end_offset,
int *word_length_with_spaces,
int *word_length);
@ -66,7 +66,7 @@ extern struct t_gui_line *gui_chat_get_first_line_displayed (struct t_gui_buffer
extern struct t_gui_line *gui_chat_get_last_line_displayed (struct t_gui_buffer *buffer);
extern struct t_gui_line *gui_chat_get_prev_line_displayed (struct t_gui_line *line);
extern struct t_gui_line *gui_chat_get_next_line_displayed (struct t_gui_line *line);
extern int gui_chat_line_search (struct t_gui_line *line, char *text,
extern int gui_chat_line_search (struct t_gui_line *line, const char *text,
int case_sensitive);
extern int gui_chat_line_match_regex (struct t_gui_line *line,
regex_t *regex_prefix,
@ -77,16 +77,16 @@ extern void gui_chat_line_free (struct t_gui_buffer *buffer,
struct t_gui_line *line);
extern void gui_chat_line_free_all (struct t_gui_buffer *buffer);
extern void gui_chat_printf_date_tags (struct t_gui_buffer *buffer,
time_t date, char *tags,
char *message, ...);
time_t date, const char *tags,
const char *message, ...);
extern void gui_chat_printf_y (struct t_gui_buffer *buffer, int y,
char *message, ...);
const char *message, ...);
/* chat functions (GUI dependent) */
extern void gui_chat_draw_title (struct t_gui_buffer *buffer, int erase);
extern char *gui_chat_string_next_char (struct t_gui_window *window,
unsigned char *string,
const unsigned char *string,
int apply_style);
extern void gui_chat_draw (struct t_gui_buffer *buffer, int erase);
extern void gui_chat_draw_line (struct t_gui_buffer *buffer,

View File

@ -48,7 +48,7 @@ struct t_gui_color *gui_color[GUI_COLOR_NUM_COLORS]; /* GUI colors */
*/
int
gui_color_search_config_int (char *color_name)
gui_color_search_config_int (const char *color_name)
{
struct t_config_section *ptr_section;
struct t_config_option *ptr_option;
@ -105,7 +105,7 @@ gui_color_search_config_str (int color_number)
*/
unsigned char *
gui_color_decode (unsigned char *string)
gui_color_decode (const unsigned char *string)
{
unsigned char *out;
int out_length, out_pos, length;

View File

@ -137,15 +137,15 @@ extern struct t_gui_color *gui_color[];
/* color functions */
extern int gui_color_search_config_int (char *color_name);
extern int gui_color_search_config_int (const char *color_name);
extern char *gui_color_search_config_str (int color_number);
extern unsigned char *gui_color_decode (unsigned char *string);
extern unsigned char *gui_color_decode (const unsigned char *string);
extern void gui_color_free (struct t_gui_color *color);
/* color functions (GUI dependent) */
extern int gui_color_search (char *color_name);
extern int gui_color_assign (int *color, char *color_name);
extern int gui_color_search (const char *color_name);
extern int gui_color_assign (int *color, char const *color_name);
extern int gui_color_get_number ();
extern char *gui_color_get_name (int num_color);
extern void gui_color_init_pairs ();

View File

@ -159,7 +159,7 @@ gui_completion_search_command (struct t_gui_completion *completion)
*/
int
gui_completion_is_only_alphanum (char *string)
gui_completion_is_only_alphanum (const char *string)
{
while (string[0])
{
@ -176,7 +176,7 @@ gui_completion_is_only_alphanum (char *string)
*/
char *
gui_completion_strdup_alphanum (char *string)
gui_completion_strdup_alphanum (const char *string)
{
char *result, *pos;
@ -202,7 +202,7 @@ gui_completion_strdup_alphanum (char *string)
*/
int
gui_completion_nickncmp (char *base_word, char *nick, int max)
gui_completion_nickncmp (const char *base_word, const char *nick, int max)
{
char *base_word2, *nick2;
int return_cmp;
@ -229,8 +229,8 @@ gui_completion_nickncmp (char *base_word, char *nick, int max)
*/
void
gui_completion_list_add (struct t_gui_completion *completion, char *word,
int nick_completion, char *where)
gui_completion_list_add (struct t_gui_completion *completion, const char *word,
int nick_completion, const char *where)
{
if (!word || !word[0])
return;
@ -805,7 +805,7 @@ gui_completion_list_add_weechat_cmd (struct t_gui_completion *completion)
void
gui_completion_custom (struct t_gui_completion *completion,
char *custom_completion,
const char *custom_completion,
struct t_weechat_plugin *plugin)
{
hook_completion_exec (plugin,
@ -820,10 +820,11 @@ gui_completion_custom (struct t_gui_completion *completion,
void
gui_completion_build_list_template (struct t_gui_completion *completion,
char *template,
const char *template,
struct t_weechat_plugin *plugin)
{
char *word, *pos, *pos_end, *custom_completion;
char *word, *custom_completion;
const char *pos, *pos_end;
int word_offset;
word = strdup (template);
@ -999,7 +1000,7 @@ gui_completion_build_list (struct t_gui_completion *completion)
*/
void
gui_completion_find_context (struct t_gui_completion *completion, char *data,
gui_completion_find_context (struct t_gui_completion *completion, const char *data,
int size, int pos)
{
int i, command, command_arg, pos_start, pos_end;
@ -1406,7 +1407,7 @@ gui_completion_auto (struct t_gui_completion *completion)
void
gui_completion_search (struct t_gui_completion *completion, int direction,
char *data, int size, int pos)
const char *data, int size, int pos)
{
char *old_word_found;

View File

@ -57,7 +57,7 @@ extern void gui_completion_init (struct t_gui_completion *completion,
struct t_gui_buffer *buffer);
extern void gui_completion_free (struct t_gui_completion *completion);
extern void gui_completion_search (struct t_gui_completion *completion,
int direction, char *data, int size,
int direction, const char *data, int size,
int pos);
extern void gui_completion_print_log (struct t_gui_completion *completion);

View File

@ -175,7 +175,7 @@ gui_filter_disable ()
*/
struct t_gui_filter *
gui_filter_search (char *buffer, char *tags, char *regex)
gui_filter_search (const char *buffer, const char *tags, const char *regex)
{
struct t_gui_filter *ptr_filter;
@ -220,11 +220,12 @@ gui_filter_search_by_number (int number)
*/
struct t_gui_filter *
gui_filter_new (char *buffer, char *tags, char *regex)
gui_filter_new (const char *buffer, const char *tags, const char *regex)
{
struct t_gui_filter *new_filter;
regex_t *regex1, *regex2;
char *pos_tab, *regex_prefix, *pos_regex_message;
char *pos_tab, *regex_prefix;
const char *pos_regex_message;
if (!buffer || !tags || !regex)
return NULL;

View File

@ -51,11 +51,13 @@ extern int gui_filter_check_line (struct t_gui_buffer *buffer,
struct t_gui_line *line);
extern void gui_filter_enable ();
extern void gui_filter_disable ();
extern struct t_gui_filter *gui_filter_search (char *buffer, char *tags,
char *regex);
extern struct t_gui_filter *gui_filter_search (const char *buffer,
const char *tags,
const char *regex);
extern struct t_gui_filter *gui_filter_search_by_number (int number);
extern struct t_gui_filter *gui_filter_new (char *buffer, char *tags,
char *regex);
extern struct t_gui_filter *gui_filter_new (const char *buffer,
const char *tags,
const char *regex);
extern void gui_filter_free (struct t_gui_filter *filter);
extern void gui_filter_free_all ();
extern void gui_filter_print_log ();

View File

@ -44,7 +44,7 @@ int num_history_global = 0;
*/
void
gui_history_buffer_add (struct t_gui_buffer *buffer, char *string)
gui_history_buffer_add (struct t_gui_buffer *buffer, const char *string)
{
struct t_gui_history *new_history, *ptr_history;
@ -94,7 +94,7 @@ gui_history_buffer_add (struct t_gui_buffer *buffer, char *string)
*/
void
gui_history_global_add (char *string)
gui_history_global_add (const char *string)
{
struct t_gui_history *new_history, *ptr_history;

View File

@ -34,8 +34,8 @@ extern struct t_gui_history *history_global_last;
extern struct t_gui_history *history_global_ptr;
/* history functions (gui-history.c) */
extern void gui_history_buffer_add (struct t_gui_buffer *buffer, char *string);
extern void gui_history_global_add (char *string);
extern void gui_history_buffer_add (struct t_gui_buffer *buffer, const char *string);
extern void gui_history_global_add (const char *string);
extern void gui_history_global_free ();
extern void gui_history_buffer_free (struct t_gui_buffer *buffer);

View File

@ -45,7 +45,7 @@ struct t_hook *gui_infobar_highlight_timer = NULL; /* highlight timer */
*/
void
gui_infobar_printf (int delay, int color, char *message, ...)
gui_infobar_printf (int delay, int color, const char *message, ...)
{
static char buf[1024];
va_list argptr;

View File

@ -38,7 +38,8 @@ extern struct t_hook *gui_infobar_highlight_timer;
/* infobar functions */
extern void gui_infobar_printf (int delay, int color, char *message, ...);
extern void gui_infobar_printf (int delay, int color,
const char *message, ...);
extern void gui_infobar_remove ();
extern void gui_infobar_remove_all ();

View File

@ -93,7 +93,7 @@ gui_input_init_color_mask (struct t_gui_buffer *buffer)
*/
void
gui_input_move (struct t_gui_buffer *buffer, char *target, char *source,
gui_input_move (struct t_gui_buffer *buffer, char *target, const char *source,
int size)
{
int pos_source, pos_target;
@ -114,7 +114,8 @@ gui_input_move (struct t_gui_buffer *buffer, char *target, char *source,
*/
int
gui_input_insert_string (struct t_gui_buffer *buffer, char *string, int pos)
gui_input_insert_string (struct t_gui_buffer *buffer, const char *string,
int pos)
{
int i, pos_start, size, length;
char *ptr_start;
@ -255,7 +256,7 @@ gui_input_get_prompt_length (struct t_gui_buffer *buffer)
*/
void
gui_input_clipboard_copy (char *buffer, int size)
gui_input_clipboard_copy (const char *buffer, int size)
{
if (size <= 0)
return;
@ -710,7 +711,7 @@ gui_input_delete_beginning_of_line ()
*/
void
gui_input_delete_end_of_line (char *args)
gui_input_delete_end_of_line (const char *args)
{
char *start;
int size_deleted, length_deleted, pos_start;
@ -1344,7 +1345,7 @@ gui_input_set_unread_current_buffer ()
*/
void
gui_input_insert (char *args)
gui_input_insert (const char *args)
{
char *args2;

View File

@ -31,9 +31,9 @@ extern char *gui_input_clipboard;
extern void gui_input_optimize_size (struct t_gui_buffer *buffer);
extern void gui_input_init_color_mask (struct t_gui_buffer *buffer);
extern void gui_input_move (struct t_gui_buffer *buffer, char *target,
char *source, int size);
extern int gui_input_insert_string (struct t_gui_buffer *buffer, char *string,
int pos);
const char *source, int size);
extern int gui_input_insert_string (struct t_gui_buffer *buffer,
const char *string, int pos);
extern int gui_input_get_prompt_length (struct t_gui_buffer *buffer);
extern void gui_input_return ();
extern void gui_input_clipboard_paste ();

View File

@ -132,7 +132,7 @@ gui_keyboard_grab_end ()
*/
char *
gui_keyboard_get_internal_code (char *key)
gui_keyboard_get_internal_code (const char *key)
{
char *result;
@ -175,7 +175,7 @@ gui_keyboard_get_internal_code (char *key)
*/
char *
gui_keyboard_get_expanded_name (char *key)
gui_keyboard_get_expanded_name (const char *key)
{
char *result;
@ -279,7 +279,8 @@ gui_keyboard_insert_sorted (struct t_gui_key **keys, struct t_gui_key **last_key
*/
struct t_gui_key *
gui_keyboard_new (struct t_gui_buffer *buffer, char *key, char *command)
gui_keyboard_new (struct t_gui_buffer *buffer, const char *key,
const char *command)
{
struct t_gui_key *new_key;
char *internal_code;
@ -308,7 +309,7 @@ gui_keyboard_new (struct t_gui_buffer *buffer, char *key, char *command)
*/
struct t_gui_key *
gui_keyboard_search (struct t_gui_buffer *buffer, char *key)
gui_keyboard_search (struct t_gui_buffer *buffer, const char *key)
{
struct t_gui_key *ptr_key;
@ -328,7 +329,7 @@ gui_keyboard_search (struct t_gui_buffer *buffer, char *key)
*/
int
gui_keyboard_cmp (char *key, char *search)
gui_keyboard_cmp (const char *key, const char *search)
{
while (search[0])
{
@ -346,7 +347,7 @@ gui_keyboard_cmp (char *key, char *search)
*/
struct t_gui_key *
gui_keyboard_search_part (struct t_gui_buffer *buffer, char *key)
gui_keyboard_search_part (struct t_gui_buffer *buffer, const char *key)
{
struct t_gui_key *ptr_key;
@ -368,7 +369,7 @@ gui_keyboard_search_part (struct t_gui_buffer *buffer, char *key)
*/
struct t_gui_key *
gui_keyboard_bind (struct t_gui_buffer *buffer, char *key, char *command)
gui_keyboard_bind (struct t_gui_buffer *buffer, const char *key, const char *command)
{
struct t_gui_key *new_key;
@ -395,7 +396,7 @@ gui_keyboard_bind (struct t_gui_buffer *buffer, char *key, char *command)
*/
int
gui_keyboard_unbind (struct t_gui_buffer *buffer, char *key)
gui_keyboard_unbind (struct t_gui_buffer *buffer, const char *key)
{
struct t_gui_key *ptr_key;
char *internal_code;
@ -424,7 +425,7 @@ gui_keyboard_unbind (struct t_gui_buffer *buffer, char *key)
*/
int
gui_keyboard_pressed (char *key_str)
gui_keyboard_pressed (const char *key_str)
{
int first_key;
struct t_gui_key *ptr_key;

View File

@ -49,14 +49,15 @@ extern time_t gui_keyboard_last_activity_time;
extern void gui_keyboard_init ();
extern void gui_keyboard_grab_init ();
extern void gui_keyboard_grab_end ();
extern char *gui_keyboard_get_internal_code (char *key);
extern char *gui_keyboard_get_expanded_name (char *key);
extern char *gui_keyboard_get_internal_code (const char *key);
extern char *gui_keyboard_get_expanded_name (const char *key);
extern struct t_gui_key *gui_keyboard_search (struct t_gui_buffer *buffer,
char *key);
const char *key);
extern struct t_gui_key *gui_keyboard_bind (struct t_gui_buffer *buffer,
char *key, char *command);
extern int gui_keyboard_unbind (struct t_gui_buffer *buffer, char *key);
extern int gui_keyboard_pressed (char *key_str);
const char *key,
const char *command);
extern int gui_keyboard_unbind (struct t_gui_buffer *buffer, const char *key);
extern int gui_keyboard_pressed (const char *key_str);
extern void gui_keyboard_free (struct t_gui_key **keys,
struct t_gui_key **last_key,
struct t_gui_key *key);

View File

@ -113,7 +113,7 @@ gui_nicklist_insert_group_sorted (struct t_gui_nick_group **groups,
struct t_gui_nick_group *
gui_nicklist_search_group (struct t_gui_buffer *buffer,
struct t_gui_nick_group *from_group,
char *name)
const char *name)
{
struct t_gui_nick_group *ptr_group;
@ -148,8 +148,8 @@ gui_nicklist_search_group (struct t_gui_buffer *buffer,
struct t_gui_nick_group *
gui_nicklist_add_group (struct t_gui_buffer *buffer,
struct t_gui_nick_group *parent_group, char *name,
char *color, int visible)
struct t_gui_nick_group *parent_group, const char *name,
const char *color, int visible)
{
struct t_gui_nick_group *new_group;
int num_color;
@ -273,7 +273,7 @@ gui_nicklist_insert_nick_sorted (struct t_gui_nick_group *group,
struct t_gui_nick *
gui_nicklist_search_nick (struct t_gui_buffer *buffer,
struct t_gui_nick_group *from_group,
char *name)
const char *name)
{
struct t_gui_nick *ptr_nick;
@ -294,8 +294,8 @@ gui_nicklist_search_nick (struct t_gui_buffer *buffer,
struct t_gui_nick *
gui_nicklist_add_nick (struct t_gui_buffer *buffer,
struct t_gui_nick_group *group, char *name,
char *color, char prefix, char *prefix_color,
struct t_gui_nick_group *group, const char *name,
const char *color, char prefix, const char *prefix_color,
int visible)
{
struct t_gui_nick *new_nick;
@ -529,9 +529,9 @@ gui_nicklist_get_next_item (struct t_gui_buffer *buffer,
*/
char *
gui_nicklist_get_group_start (char *name)
gui_nicklist_get_group_start (const char *name)
{
char *ptr_name;
const char *ptr_name;
ptr_name = name;
while (isdigit (ptr_name[0]))
@ -541,9 +541,9 @@ gui_nicklist_get_group_start (char *name)
ptr_name++;
}
if ((ptr_name[0] == '|') && (ptr_name != name))
return ptr_name + 1;
return (char *)ptr_name + 1;
else
return name;
return (char *)name;
}
/*

View File

@ -53,18 +53,18 @@ struct t_gui_nick
extern struct t_gui_nick_group *gui_nicklist_search_group (struct t_gui_buffer *buffer,
struct t_gui_nick_group *from_group,
char *name);
const char *name);
extern struct t_gui_nick_group *gui_nicklist_add_group (struct t_gui_buffer *buffer,
struct t_gui_nick_group *parent_group,
char *name, char *color,
const char *name, const char *color,
int visible);
extern struct t_gui_nick *gui_nicklist_search_nick (struct t_gui_buffer *buffer,
struct t_gui_nick_group *from_group,
char *name);
const char *name);
extern struct t_gui_nick *gui_nicklist_add_nick (struct t_gui_buffer *buffer,
struct t_gui_nick_group *group,
char *name, char *color,
char prefix, char *prefix_color,
const char *name, const char *color,
char prefix, const char *prefix_color,
int visible);
extern void gui_nicklist_remove_group (struct t_gui_buffer *buffer,
struct t_gui_nick_group *group);
@ -74,7 +74,7 @@ extern void gui_nicklist_remove_all (struct t_gui_buffer *buffer);
extern void gui_nicklist_get_next_item (struct t_gui_buffer *buffer,
struct t_gui_nick_group **group,
struct t_gui_nick **nick);
extern char *gui_nicklist_get_group_start (char *name);
extern char *gui_nicklist_get_group_start (const char *name);
extern int gui_nicklist_get_max_length (struct t_gui_buffer *buffer,
struct t_gui_nick_group *group);
extern void gui_nicklist_compute_visible_count (struct t_gui_buffer *buffer,

View File

@ -469,7 +469,7 @@ gui_window_scroll (struct t_gui_window *window, char *scroll)
int direction, stop, count_msg;
char time_letter, saved_char;
time_t old_date, diff_date;
char *error;
char *pos, *error;
long number;
struct t_gui_line *ptr_line;
struct tm *date_tmp, line_date, old_line_date;
@ -493,7 +493,7 @@ gui_window_scroll (struct t_gui_window *window, char *scroll)
}
/* search number and letter */
char *pos = scroll;
pos = scroll;
while (pos && pos[0] && isdigit (pos[0]))
{
pos++;

View File

@ -51,7 +51,7 @@ struct t_alias *last_alias = NULL;
*/
struct t_alias *
alias_search (char *alias_name)
alias_search (const char *alias_name)
{
struct t_alias *ptr_alias;
@ -70,7 +70,7 @@ alias_search (char *alias_name)
*/
void
alias_add_word (char **alias, int *length, char *word)
alias_add_word (char **alias, int *length, const char *word)
{
int length_word;
@ -99,9 +99,10 @@ alias_add_word (char **alias, int *length, char *word)
*/
char *
alias_replace_args (char *alias_args, char *user_args)
alias_replace_args (const char *alias_args, const char *user_args)
{
char **argv, *start, *pos, *res;
char **argv, *res, *word;
const char *start, *pos;
int argc, length_res, args_count;
argv = weechat_string_explode (user_args, " ", 0, 0, &argc);
@ -115,10 +116,13 @@ alias_replace_args (char *alias_args, char *user_args)
{
if ((pos[0] == '\\') && (pos[1] == '$'))
{
pos[0] = '\0';
alias_add_word (&res, &length_res, start);
word = weechat_strndup (start, pos - start);
if (word)
{
alias_add_word (&res, &length_res, word);
free (word);
}
alias_add_word (&res, &length_res, "$");
pos[0] = '\\';
start = pos + 2;
pos = start;
}
@ -129,10 +133,13 @@ alias_replace_args (char *alias_args, char *user_args)
if (pos[1] == '*')
{
args_count++;
pos[0] = '\0';
alias_add_word (&res, &length_res, start);
word = weechat_strndup (start, pos - start);
if (word)
{
alias_add_word (&res, &length_res, word);
free (word);
}
alias_add_word (&res, &length_res, user_args);
pos[0] = '$';
start = pos + 2;
pos = start;
}
@ -141,11 +148,14 @@ alias_replace_args (char *alias_args, char *user_args)
if ((pos[1] >= '1') && (pos[1] <= '9'))
{
args_count++;
pos[0] = '\0';
alias_add_word (&res, &length_res, start);
word = weechat_strndup (start, pos - start);
if (word)
{
alias_add_word (&res, &length_res, start);
free (word);
}
if (pos[1] - '0' <= argc)
alias_add_word (&res, &length_res, argv[pos[1] - '1']);
pos[0] = '$';
start = pos + 2;
pos = start;
}
@ -293,7 +303,7 @@ alias_cb (void *data, struct t_gui_buffer *buffer, int argc, char **argv,
*/
struct t_alias *
alias_find_pos (char *name)
alias_find_pos (const char *name)
{
struct t_alias *ptr_alias;
@ -312,7 +322,7 @@ alias_find_pos (char *name)
*/
struct t_alias *
alias_new (char *name, char *command)
alias_new (const char *name, const char *command)
{
struct t_alias *new_alias, *ptr_alias, *pos_alias;
struct t_hook *new_hook;
@ -524,7 +534,7 @@ alias_config_reload (void *data, struct t_config_file *config_file)
void
alias_config_write_default (void *data,
struct t_config_file *config_file,
char *section_name)
const char *section_name)
{
/* make C compiler happy */
(void) data;
@ -565,7 +575,7 @@ alias_config_write_default (void *data,
int
alias_config_create_option (void *data, struct t_config_file *config_file,
struct t_config_section *section,
char *option_name, char *value)
const char *option_name, const char *value)
{
struct t_alias *ptr_alias;
int rc;
@ -795,8 +805,8 @@ unalias_command_cb (void *data, struct t_gui_buffer *buffer, int argc,
*/
int
alias_completion_cb (void *data, char *completion, struct t_gui_buffer *buffer,
struct t_weelist *list)
alias_completion_cb (void *data, const char *completion,
struct t_gui_buffer *buffer, struct t_weelist *list)
{
struct t_alias *ptr_alias;

View File

@ -59,7 +59,8 @@ int charset_debug = 0;
*/
int
charset_debug_cb (void *data, char *signal, char *type_data, void *signal_data)
charset_debug_cb (void *data, const char *signal, const char *type_data,
void *signal_data)
{
/* make C compiler happy */
(void) data;
@ -104,7 +105,7 @@ charset_config_reload (void *data, struct t_config_file *config_file)
int
charset_config_create_option (void *data, struct t_config_file *config_file,
struct t_config_section *section,
char *option_name, char *value)
const char *option_name, const char *value)
{
struct t_config_option *ptr_option;
int rc;
@ -256,7 +257,7 @@ charset_config_write ()
*/
int
charset_check (char *charset)
charset_check (const char *charset)
{
iconv_t cd;
@ -278,7 +279,7 @@ charset_check (char *charset)
*/
char *
charset_get (struct t_config_section *section, char *name,
charset_get (struct t_config_section *section, const char *name,
struct t_config_option *default_charset)
{
char *option_name, *ptr_end;
@ -326,12 +327,12 @@ charset_get (struct t_config_section *section, char *name,
}
/*
* charset_decode: decode a string with a charset to internal charset
* charset_decode_cb: decode a string with a charset to internal charset
*/
char *
charset_decode (void *data, char *modifier, char *modifier_data,
char *string)
charset_decode_cb (void *data, const char *modifier, const char *modifier_data,
const char *string)
{
char *charset;
@ -355,12 +356,12 @@ charset_decode (void *data, char *modifier, char *modifier_data,
}
/*
* charset_encode: encode a string from internal charset to another one
* charset_encode_cb: encode a string from internal charset to another one
*/
char *
charset_encode (void *data, char *modifier, char *modifier_data,
char *string)
charset_encode_cb (void *data, const char *modifier, const char *modifier_data,
const char *string)
{
char *charset;
@ -388,8 +389,8 @@ charset_encode (void *data, char *modifier, char *modifier_data,
*/
void
charset_set (struct t_config_section *section, char *type,
char *name, char *value)
charset_set (struct t_config_section *section, const char *type,
const char *name, const char *value)
{
if (charset_config_create_option (NULL,
charset_config_file,
@ -552,8 +553,8 @@ weechat_plugin_init (struct t_weechat_plugin *plugin, int argc, char *argv[])
&charset_command_cb, NULL);
/* modifiers hooks */
weechat_hook_modifier ("charset_decode", &charset_decode, NULL);
weechat_hook_modifier ("charset_encode", &charset_encode, NULL);
weechat_hook_modifier ("charset_decode", &charset_decode_cb, NULL);
weechat_hook_modifier ("charset_encode", &charset_encode_cb, NULL);
/* callback for debug */
weechat_hook_signal ("debug", &charset_debug_cb, NULL);

View File

@ -49,8 +49,8 @@ int demo_debug = 0;
*/
int
demo_debug_signal_debug_cb (void *data, char *signal, char *type_data,
void *signal_data)
demo_debug_signal_debug_cb (void *data, const char *signal,
const char *type_data, void *signal_data)
{
/* make C compiler happy */
(void) data;
@ -132,7 +132,7 @@ demo_infobar_command_cb (void *data, struct t_gui_buffer *buffer, int argc,
int
demo_buffer_input_data_cb (void *data, struct t_gui_buffer *buffer,
char *input_data)
const char *input_data)
{
/* make C compiler happy */
(void) data;
@ -223,7 +223,7 @@ demo_buffer_set_command_cb (void *data, struct t_gui_buffer *buffer, int argc,
*/
void
demo_infolist_print (struct t_plugin_infolist *infolist, char *item_name)
demo_infolist_print (struct t_plugin_infolist *infolist, const char *item_name)
{
char *fields, **argv;
int i, j, argc;
@ -357,7 +357,8 @@ demo_info_command_cb (void *data, struct t_gui_buffer *buffer, int argc,
*/
int
demo_signal_cb (void *data, char *signal, char *type_data, void *signal_data)
demo_signal_cb (void *data, const char *signal, const char *type_data,
void *signal_data)
{
/* make C compiler happy */
(void) data;

View File

@ -157,52 +157,57 @@ fifo_remove ()
*/
void
fifo_exec (char *text)
fifo_exec (const char *text)
{
char *pos_msg, *pos;
char *text2, *pos_msg, *pos;
struct t_gui_buffer *ptr_buffer;
text2 = strdup (text);
if (!text2)
return;
pos = NULL;
ptr_buffer = NULL;
/* look for category/name at beginning of text
text may be: "category,name *text" or "name *text" or "*text" */
if (text[0] == '*')
if (text2[0] == '*')
{
pos_msg = text + 1;
pos_msg = text2 + 1;
ptr_buffer = weechat_buffer_search (NULL, NULL);
if (!ptr_buffer)
ptr_buffer = weechat_current_buffer;
}
else
{
pos_msg = strstr (text, " *");
pos_msg = strstr (text2, " *");
if (!pos_msg)
{
weechat_printf (NULL,
_("%s%s: error, invalid text received on pipe"),
weechat_prefix ("error"), "fifo");
free (text2);
return;
}
pos_msg[0] = '\0';
pos = pos_msg - 1;
pos_msg += 2;
while ((pos >= text) && (pos[0] == ' '))
while ((pos >= text2) && (pos[0] == ' '))
{
pos[0] = '\0';
pos--;
}
if (text[0])
if (text2[0])
{
pos = strchr (text, ',');
pos = strchr (text2, ',');
if (pos)
{
pos[0] = '\0';
ptr_buffer = weechat_buffer_search (text, pos + 1);
ptr_buffer = weechat_buffer_search (text2, pos + 1);
}
else
ptr_buffer = weechat_buffer_search (NULL, text);
ptr_buffer = weechat_buffer_search (NULL, text2);
if (!ptr_buffer)
ptr_buffer = weechat_current_buffer;
}
@ -213,10 +218,13 @@ fifo_exec (char *text)
weechat_printf (NULL,
_("%s%s: error, buffer not found for pipe data"),
weechat_prefix ("error"), "fifo");
free (text2);
return;
}
weechat_command (ptr_buffer, pos_msg);
free (text2);
}
/*
@ -320,7 +328,7 @@ fifo_read ()
*/
int
fifo_config_cb (void *data, char *option, char *value)
fifo_config_cb (void *data, const char *option, const char *value)
{
/* make C compiler happy */
(void) data;

View File

@ -40,7 +40,7 @@
struct t_irc_channel *
irc_channel_new (struct t_irc_server *server, int channel_type,
char *channel_name, int switch_to_channel)
const char *channel_name, int switch_to_channel)
{
struct t_irc_channel *new_channel;
struct t_gui_buffer *new_buffer;
@ -188,7 +188,7 @@ irc_channel_free_all (struct t_irc_server *server)
*/
struct t_irc_channel *
irc_channel_search (struct t_irc_server *server, char *channel_name)
irc_channel_search (struct t_irc_server *server, const char *channel_name)
{
struct t_irc_channel *ptr_channel;
@ -209,7 +209,7 @@ irc_channel_search (struct t_irc_server *server, char *channel_name)
*/
struct t_irc_channel *
irc_channel_search_any (struct t_irc_server *server, char *channel_name)
irc_channel_search_any (struct t_irc_server *server, const char *channel_name)
{
struct t_irc_channel *ptr_channel;
@ -232,7 +232,7 @@ irc_channel_search_any (struct t_irc_server *server, char *channel_name)
struct t_irc_channel *
irc_channel_search_any_without_buffer (struct t_irc_server *server,
char *channel_name)
const char *channel_name)
{
struct t_irc_channel *ptr_channel;
@ -254,7 +254,7 @@ irc_channel_search_any_without_buffer (struct t_irc_server *server,
*/
int
irc_channel_is_channel (char *string)
irc_channel_is_channel (const char *string)
{
char first_char[2];
@ -311,7 +311,7 @@ irc_channel_check_away (struct t_irc_server *server,
*/
void
irc_channel_set_away (struct t_irc_channel *channel, char *nick, int is_away)
irc_channel_set_away (struct t_irc_channel *channel, const char *nick, int is_away)
{
(void) channel;
(void) nick;
@ -404,7 +404,7 @@ irc_channel_set_notify_level (struct t_irc_server *server,
*/
void
irc_channel_add_nick_speaking (struct t_irc_channel *channel, char *nick)
irc_channel_add_nick_speaking (struct t_irc_channel *channel, const char *nick)
{
int size, to_remove, i;

View File

@ -56,22 +56,22 @@ struct t_irc_channel
extern struct t_irc_channel *irc_channel_new (struct t_irc_server *server,
int channel_type,
char *channel_name,
const char *channel_name,
int switch_to_channel);
extern void irc_channel_free (struct t_irc_server *server,
struct t_irc_channel *channel);
extern void irc_channel_free_all (struct t_irc_server *server);
extern struct t_irc_channel *irc_channel_search (struct t_irc_server *server,
char *channel_name);
const char *channel_name);
extern struct t_irc_channel *irc_channel_search_any (struct t_irc_server *server,
char *channel_name);
const char *channel_name);
extern struct t_irc_channel *irc_channel_search_any_without_buffer (struct t_irc_server *server,
char *channel_name);
extern int irc_channel_is_channel (char *string);
const char *channel_name);
extern int irc_channel_is_channel (const char *string);
extern void irc_channel_remove_away (struct t_irc_channel *channel);
extern void irc_channel_check_away (struct t_irc_server *server,
struct t_irc_channel *channel, int force);
extern void irc_channel_set_away (struct t_irc_channel *channel, char *nick,
extern void irc_channel_set_away (struct t_irc_channel *channel, const char *nick,
int is_away);
extern int irc_channel_get_notify_level (struct t_irc_server *server,
struct t_irc_channel *channel);
@ -79,7 +79,7 @@ extern void irc_channel_set_notify_level (struct t_irc_server *server,
struct t_irc_channel *channel,
int notify);
extern void irc_channel_add_nick_speaking (struct t_irc_channel *channel,
char *nick);
const char *nick);
extern void irc_channel_print_log (struct t_irc_channel *channel);
#endif /* irc-channel.h */

View File

@ -58,7 +58,7 @@ char *irc_color_to_weechat[IRC_NUM_COLORS] =
*/
char *
irc_color_decode (char *string, int keep_colors)
irc_color_decode (const char *string, int keep_colors)
{
unsigned char *out, *ptr_string;
int out_length, length, out_pos;
@ -184,7 +184,7 @@ irc_color_decode (char *string, int keep_colors)
*/
char *
irc_color_decode_for_user_entry (char *string)
irc_color_decode_for_user_entry (const char *string)
{
unsigned char *out, *ptr_string;
int out_length, out_pos, length;
@ -252,7 +252,7 @@ irc_color_decode_for_user_entry (char *string)
*/
char *
irc_color_encode (char *string, int keep_colors)
irc_color_encode (const char *string, int keep_colors)
{
unsigned char *out, *ptr_string;
int out_length, out_pos, length;

View File

@ -53,8 +53,8 @@
#define IRC_COLOR_UNDERLINE_CHAR '\x1F'
#define IRC_COLOR_UNDERLINE_STR "\x1F"
extern char *irc_color_decode (char *string, int keep_colors);
extern char *irc_color_decode_for_user_entry (char *string);
extern char *irc_color_encode (char *string, int keep_colors);
extern char *irc_color_decode (const char *string, int keep_colors);
extern char *irc_color_decode_for_user_entry (const char *string);
extern char *irc_color_encode (const char *string, int keep_colors);
#endif /* irc-color.h */

View File

@ -71,7 +71,7 @@ irc_command_admin (void *data, struct t_gui_buffer *buffer, int argc,
void
irc_command_me_channel (struct t_irc_server *server,
struct t_irc_channel *channel,
char *arguments)
const char *arguments)
{
char *string;
@ -97,7 +97,7 @@ irc_command_me_channel (struct t_irc_server *server,
*/
void
irc_command_me_all_channels (struct t_irc_server *server, char *arguments)
irc_command_me_all_channels (struct t_irc_server *server, const char *arguments)
{
struct t_irc_channel *ptr_channel;
@ -114,8 +114,8 @@ irc_command_me_all_channels (struct t_irc_server *server, char *arguments)
*/
void
irc_command_mode_nicks (struct t_irc_server *server, char *channel,
char *set, char *mode, int argc, char **argv)
irc_command_mode_nicks (struct t_irc_server *server, const char *channel,
const char *set, const char *mode, int argc, char **argv)
{
int i, length;
char *command;
@ -248,7 +248,7 @@ irc_command_amsg (void *data, struct t_gui_buffer *buffer, int argc,
*/
void
irc_command_away_server (struct t_irc_server *server, char *arguments)
irc_command_away_server (struct t_irc_server *server, const char *arguments)
{
char *string, buffer[4096];
time_t time_now, elapsed;
@ -1098,9 +1098,10 @@ irc_command_die (void *data, struct t_gui_buffer *buffer, int argc,
*/
void
irc_command_quit_server (struct t_irc_server *server, char *arguments)
irc_command_quit_server (struct t_irc_server *server, const char *arguments)
{
char *ptr_arg, *buf, *version;
const char *ptr_arg;
char *buf, *version;
if (!server)
return;
@ -1348,7 +1349,7 @@ irc_command_ison (void *data, struct t_gui_buffer *buffer, int argc,
*/
void
irc_command_join_server (struct t_irc_server *server, char *arguments)
irc_command_join_server (struct t_irc_server *server, const char *arguments)
{
if (irc_channel_is_channel (arguments))
irc_server_sendf (server, "JOIN %s", arguments);
@ -1708,7 +1709,7 @@ irc_command_me (void *data, struct t_gui_buffer *buffer, int argc, char **argv,
*/
void
irc_command_mode_server (struct t_irc_server *server, char *arguments)
irc_command_mode_server (struct t_irc_server *server, const char *arguments)
{
irc_server_sendf (server, "MODE %s", arguments);
}
@ -1967,7 +1968,7 @@ irc_command_names (void *data, struct t_gui_buffer *buffer, int argc,
*/
void
irc_send_nick_server (struct t_irc_server *server, char *nickname)
irc_send_nick_server (struct t_irc_server *server, const char *nickname)
{
if (!server)
return;
@ -2133,10 +2134,11 @@ irc_command_oper (void *data, struct t_gui_buffer *buffer, int argc,
*/
void
irc_command_part_channel (struct t_irc_server *server, char *channel_name,
char *part_message)
irc_command_part_channel (struct t_irc_server *server, const char *channel_name,
const char *part_message)
{
char *ptr_arg, *buf, *version;
const char *ptr_arg;
char *buf, *version;
ptr_arg = (part_message) ? part_message :
(weechat_config_string (irc_config_network_default_msg_part)

View File

@ -30,16 +30,16 @@ struct t_irc_server;
extern void irc_command_away_server (struct t_irc_server *server,
char *arguments);
const char *arguments);
extern void irc_command_join_server (struct t_irc_server *server,
char *arguments);
const char *arguments);
extern void irc_command_mode_server (struct t_irc_server *server,
char *arguments);
const char *arguments);
extern void irc_command_part_channel (struct t_irc_server *server,
char *channel_name,
char *part_message);
const char *channel_name,
const char *part_message);
extern void irc_command_quit_server (struct t_irc_server *server,
char *arguments);
const char *arguments);
extern void irc_command_init ();
#endif /* irc-command.h */

View File

@ -38,7 +38,7 @@
*/
int
irc_completion_server_cb (void *data, char *completion,
irc_completion_server_cb (void *data, const char *completion,
struct t_gui_buffer *buffer, struct t_weelist *list)
{
IRC_GET_SERVER(buffer);
@ -59,7 +59,7 @@ irc_completion_server_cb (void *data, char *completion,
*/
int
irc_completion_server_nicks_cb (void *data, char *completion,
irc_completion_server_nicks_cb (void *data, const char *completion,
struct t_gui_buffer *buffer,
struct t_weelist *list)
{
@ -101,7 +101,7 @@ irc_completion_server_nicks_cb (void *data, char *completion,
*/
int
irc_completion_servers_cb (void *data, char *completion,
irc_completion_servers_cb (void *data, const char *completion,
struct t_gui_buffer *buffer, struct t_weelist *list)
{
struct t_irc_server *ptr_server;
@ -125,7 +125,7 @@ irc_completion_servers_cb (void *data, char *completion,
*/
int
irc_completion_channel_cb (void *data, char *completion,
irc_completion_channel_cb (void *data, const char *completion,
struct t_gui_buffer *buffer, struct t_weelist *list)
{
IRC_GET_SERVER_CHANNEL(buffer);
@ -146,7 +146,7 @@ irc_completion_channel_cb (void *data, char *completion,
*/
int
irc_completion_channel_nicks_cb (void *data, char *completion,
irc_completion_channel_nicks_cb (void *data, const char *completion,
struct t_gui_buffer *buffer,
struct t_weelist *list)
{
@ -206,7 +206,7 @@ irc_completion_channel_nicks_cb (void *data, char *completion,
*/
int
irc_completion_channel_nicks_hosts_cb (void *data, char *completion,
irc_completion_channel_nicks_hosts_cb (void *data, const char *completion,
struct t_gui_buffer *buffer,
struct t_weelist *list)
{
@ -259,7 +259,7 @@ irc_completion_channel_nicks_hosts_cb (void *data, char *completion,
*/
int
irc_completion_channel_topic_cb (void *data, char *completion,
irc_completion_channel_topic_cb (void *data, const char *completion,
struct t_gui_buffer *buffer,
struct t_weelist *list)
{
@ -289,7 +289,7 @@ irc_completion_channel_topic_cb (void *data, char *completion,
*/
int
irc_completion_channels_cb (void *data, char *completion,
irc_completion_channels_cb (void *data, const char *completion,
struct t_gui_buffer *buffer, struct t_weelist *list)
{
struct t_irc_server *ptr_server;
@ -318,7 +318,7 @@ irc_completion_channels_cb (void *data, char *completion,
*/
int
irc_completion_msg_part_cb (void *data, char *completion,
irc_completion_msg_part_cb (void *data, const char *completion,
struct t_gui_buffer *buffer, struct t_weelist *list)
{
/* make C compiler happy */

View File

@ -92,7 +92,7 @@ struct t_config_option *irc_config_server_default[IRC_CONFIG_NUM_SERVER_OPTIONS]
*/
int
irc_config_search_server_option (char *option_name)
irc_config_search_server_option (const char *option_name)
{
int i;
@ -111,7 +111,7 @@ irc_config_search_server_option (char *option_name)
}
struct t_irc_server *
irc_config_get_server_from_option_name (char *name)
irc_config_get_server_from_option_name (const char *name)
{
struct t_irc_server *ptr_server;
char *pos_option, *server_name;
@ -492,7 +492,7 @@ irc_config_reload (void *data, struct t_config_file *config_file)
void
irc_config_server_write_default (void *data, struct t_config_file *config_file,
char *section_name)
const char *section_name)
{
/* make C compiler happy */
(void) data;
@ -511,7 +511,7 @@ struct t_config_option *
irc_config_server_new_option (struct t_config_file *config_file,
struct t_config_section *section,
int index_option,
char *option_name, char *value,
const char *option_name, const char *value,
void *callback_change,
void *callback_change_data,
void *callback_delete,
@ -688,7 +688,7 @@ irc_config_server_new_option (struct t_config_file *config_file,
int
irc_config_server_create_option (void *data, struct t_config_file *config_file,
struct t_config_section *section,
char *option_name, char *value)
const char *option_name, const char *value)
{
struct t_config_option *ptr_option;
struct t_irc_server *ptr_server;

View File

@ -54,7 +54,7 @@ irc_debug_buffer_close_cb (void *data, struct t_gui_buffer *buffer)
void
irc_debug_printf (struct t_irc_server *server, int send, int modified,
char *message)
const char *message)
{
char *buf;
@ -100,8 +100,8 @@ irc_debug_printf (struct t_irc_server *server, int send, int modified,
*/
int
irc_debug_signal_debug_cb (void *data, char *signal, char *type_data,
void *signal_data)
irc_debug_signal_debug_cb (void *data, const char *signal,
const char *type_data, void *signal_data)
{
/* make C compiler happy */
(void) data;
@ -127,8 +127,8 @@ irc_debug_signal_debug_cb (void *data, char *signal, char *type_data,
*/
int
irc_debug_signal_debug_dump_cb (void *data, char *signal, char *type_data,
void *signal_data)
irc_debug_signal_debug_dump_cb (void *data, const char *signal,
const char *type_data, void *signal_data)
{
/* make C compiler happy */
(void) data;

View File

@ -28,7 +28,7 @@
struct t_irc_server;
extern void irc_debug_printf (struct t_irc_server *server, int send,
int modified, char *message);
int modified, const char *message);
extern void irc_debug_init ();
#endif /* irc-debug.h */

View File

@ -90,7 +90,7 @@ irc_display_hide_password (char *string, int look_for_nickserv)
*/
void
irc_display_away (struct t_irc_server *server, char *string1, char *string2)
irc_display_away (struct t_irc_server *server, const char *string1, const char *string2)
{
struct t_irc_channel *ptr_channel;
@ -118,8 +118,9 @@ irc_display_away (struct t_irc_server *server, char *string1, char *string2)
void
irc_display_mode (struct t_gui_buffer *buffer,
char *channel_name, char *nick_name, char set_flag,
char *symbol, char *nick_host, char *message, char *param)
const char *channel_name, const char *nick_name,
char set_flag, const char *symbol, const char *nick_host,
const char *message, const char *param)
{
weechat_printf (buffer,
"%s[%s%s%s/%s%c%s%s] %s%s %s%s%s%s%s",

View File

@ -22,14 +22,16 @@
extern void irc_display_hide_password (char *string, int look_for_nickserv);
extern void irc_display_nick (struct t_gui_buffer *buffer,
struct t_irc_nick *nick, char *nickname,
int type, int display_around, char *force_color,
int no_nickmode);
extern void irc_display_away (struct t_irc_server *server, char *string1,
char *string2);
extern void irc_display_mode (struct t_gui_buffer *buffer, char *channel_name,
char *nick_name, char set_flag, char *symbol,
char *nick_host, char *message, char *param);
struct t_irc_nick *nick, const char *nickname,
int type, int display_around,
const char *force_color, int no_nickmode);
extern void irc_display_away (struct t_irc_server *server, const char *string1,
const char *string2);
extern void irc_display_mode (struct t_gui_buffer *buffer,
const char *channel_name, const char *nick_name,
char set_flag, const char *symbol,
const char *nick_host, const char *message,
const char *param);
extern void irc_display_server (struct t_irc_server *server, int with_detail);
#endif /* irc-display.h */

View File

@ -36,7 +36,7 @@
*/
void
irc_input_user_message_display (struct t_gui_buffer *buffer, char *text)
irc_input_user_message_display (struct t_gui_buffer *buffer, const char *text)
{
struct t_irc_nick *ptr_nick;
char *text_decoded;
@ -84,13 +84,15 @@ irc_input_user_message_display (struct t_gui_buffer *buffer, char *text)
/*
* irc_input_send_user_message: send a PRIVMSG message, and split it
* if > 512 bytes
* warning: this function makes temporarirly
* changes in "text"
*/
void
irc_input_send_user_message (struct t_gui_buffer *buffer, char *text)
{
int max_length;
char *pos, *pos_next, *pos_max, *next, saved_char, *last_space;
char *pos, *pos_max, *last_space, *pos_next, *next, saved_char;
IRC_GET_SERVER_CHANNEL(buffer);
@ -151,9 +153,10 @@ irc_input_send_user_message (struct t_gui_buffer *buffer, char *text)
*/
int
irc_input_data_cb (void *data, struct t_gui_buffer *buffer, char *input_data)
irc_input_data_cb (void *data, struct t_gui_buffer *buffer,
const char *input_data)
{
char *data_with_colors;
char *data_with_colors, *msg;
/* make C compiler happy */
(void) data;
@ -164,9 +167,13 @@ irc_input_data_cb (void *data, struct t_gui_buffer *buffer, char *input_data)
{
data_with_colors = irc_color_encode (input_data,
weechat_config_boolean (irc_config_network_colors_send));
irc_input_send_user_message (buffer,
(data_with_colors) ? data_with_colors : input_data);
msg = strdup ((data_with_colors) ? data_with_colors : input_data);
if (msg)
{
irc_input_send_user_message (buffer, msg);
free (msg);
}
if (data_with_colors)
free (data_with_colors);

View File

@ -21,6 +21,6 @@
#define __WEECHAT_IRC_INPUT_H 1
extern int irc_input_data_cb (void *data, struct t_gui_buffer *buffer,
char *input_data);
const char *input_data);
#endif /* irc-input.h */

View File

@ -35,7 +35,7 @@
*/
void
irc_mode_channel_set_nick (struct t_irc_channel *channel, char *nick,
irc_mode_channel_set_nick (struct t_irc_channel *channel, const char *nick,
char set_flag, int flag)
{
struct t_irc_nick *ptr_nick;
@ -53,13 +53,13 @@ irc_mode_channel_set_nick (struct t_irc_channel *channel, char *nick,
*/
char
irc_mode_channel_get_flag (char *str, char *pos)
irc_mode_channel_get_flag (const char *string, const char *pos)
{
char set_flag;
set_flag = '+';
pos--;
while (pos >= str)
while (pos >= string)
{
if (pos[0] == '-')
return '-';
@ -76,7 +76,7 @@ irc_mode_channel_get_flag (char *str, char *pos)
void
irc_mode_channel_set (struct t_irc_server *server,
struct t_irc_channel *channel, char *modes)
struct t_irc_channel *channel, const char *modes)
{
char *pos_args, *str_modes, set_flag, **argv, *pos, *ptr_arg;
int argc, current_arg;
@ -269,7 +269,7 @@ irc_mode_user_remove (struct t_irc_server *server, char mode)
*/
void
irc_mode_user_set (struct t_irc_server *server, char *modes)
irc_mode_user_set (struct t_irc_server *server, const char *modes)
{
char set_flag;

View File

@ -24,8 +24,9 @@ struct t_irc_server;
struct t_irc_channel;
extern void irc_mode_channel_set (struct t_irc_server *server,
struct t_irc_channel *channel, char *modes);
extern void irc_mode_user_set (struct t_irc_server *server, char *modes);
struct t_irc_channel *channel,
const char *modes);
extern void irc_mode_user_set (struct t_irc_server *server, const char *modes);
extern int irc_mode_nick_prefix_allowed (struct t_irc_server *server,
char prefix);

View File

@ -155,7 +155,7 @@ irc_nick_get_gui_infos (struct t_irc_nick *nick,
struct t_irc_nick *
irc_nick_new (struct t_irc_server *server, struct t_irc_channel *channel,
char *nick_name, int is_chanowner, int is_chanadmin,
const char *nick_name, int is_chanowner, int is_chanadmin,
int is_chanadmin2, int is_op, int is_halfop, int has_voice,
int is_chanuser)
{
@ -251,7 +251,7 @@ irc_nick_new (struct t_irc_server *server, struct t_irc_channel *channel,
void
irc_nick_change (struct t_irc_server *server, struct t_irc_channel *channel,
struct t_irc_nick *nick, char *new_nick)
struct t_irc_nick *nick, const char *new_nick)
{
int nick_is_me, prefix_color;
struct t_gui_nick_group *ptr_group;
@ -402,7 +402,7 @@ irc_nick_free_all (struct t_irc_channel *channel)
*/
struct t_irc_nick *
irc_nick_search (struct t_irc_channel *channel, char *nickname)
irc_nick_search (struct t_irc_channel *channel, const char *nickname)
{
struct t_irc_nick *ptr_nick;
@ -500,7 +500,8 @@ irc_nick_set_away (struct t_irc_channel *channel, struct t_irc_nick *nick,
*/
char *
irc_nick_as_prefix (struct t_irc_nick *nick, char *nickname, char *force_color)
irc_nick_as_prefix (struct t_irc_nick *nick, const char *nickname,
const char *force_color)
{
static char result[256];
char prefix[2], str_prefix_color[64];

View File

@ -58,27 +58,27 @@ struct t_irc_nick
extern struct t_irc_nick *irc_nick_new (struct t_irc_server *server,
struct t_irc_channel *channel,
char *nick_name, int is_chanowner,
const char *nick_name, int is_chanowner,
int is_chanadmin, int is_chanadmin2,
int is_op, int is_halfop,
int has_voice, int is_chanuser);
extern void irc_nick_change (struct t_irc_server *server,
struct t_irc_channel *channel,
struct t_irc_nick *nick, char *new_nick);
struct t_irc_nick *nick, const char *new_nick);
extern void irc_nick_set (struct t_irc_channel *channel,
struct t_irc_nick *nick, int set, int flag);
extern void irc_nick_free (struct t_irc_channel *channel,
struct t_irc_nick *nick);
extern void irc_nick_free_all (struct t_irc_channel *channel);
extern struct t_irc_nick *irc_nick_search (struct t_irc_channel *channel,
char *nickname);
const char *nickname);
extern void irc_nick_count (struct t_irc_channel *channel, int *total,
int *count_op, int *count_halfop, int *count_voice,
int *count_normal);
extern void irc_nick_set_away (struct t_irc_channel *channel,
struct t_irc_nick *nick, int is_away);
extern char *irc_nick_as_prefix (struct t_irc_nick *nick, char *nickname,
char *force_color);
extern char *irc_nick_as_prefix (struct t_irc_nick *nick, const char *nickname,
const char *force_color);
extern void irc_nick_print_log (struct t_irc_nick *nick);
#endif /* irc-nick.h */

View File

@ -48,7 +48,7 @@
*/
char *
irc_protocol_get_nick_from_host (char *host)
irc_protocol_get_nick_from_host (const char *host)
{
static char nick[128];
char *pos;
@ -75,7 +75,7 @@ irc_protocol_get_nick_from_host (char *host)
*/
char *
irc_protocol_get_address_from_host (char *host)
irc_protocol_get_address_from_host (const char *host)
{
static char address[256];
char *pos;
@ -99,7 +99,7 @@ irc_protocol_get_address_from_host (char *host)
*/
char *
irc_protocol_tags (char *command, char *tags)
irc_protocol_tags (const char *command, const char *tags)
{
static char string[256];
@ -132,7 +132,7 @@ irc_protocol_tags (char *command, char *tags)
char *
irc_protocol_replace_vars (struct t_irc_server *server,
struct t_irc_channel *channel, char *string)
struct t_irc_channel *channel, const char *string)
{
char *var_nick, *var_channel, *var_server;
char empty_string[1] = { '\0' };
@ -171,7 +171,7 @@ irc_protocol_replace_vars (struct t_irc_server *server,
*/
int
irc_protocol_cmd_error (struct t_irc_server *server, char *command,
irc_protocol_cmd_error (struct t_irc_server *server, const char *command,
int argc, char **argv, char **argv_eol)
{
int first_arg;
@ -216,7 +216,7 @@ irc_protocol_cmd_error (struct t_irc_server *server, char *command,
*/
int
irc_protocol_cmd_invite (struct t_irc_server *server, char *command,
irc_protocol_cmd_invite (struct t_irc_server *server, const char *command,
int argc, char **argv, char **argv_eol)
{
/* INVITE message looks like:
@ -251,7 +251,7 @@ irc_protocol_cmd_invite (struct t_irc_server *server, char *command,
*/
int
irc_protocol_cmd_join (struct t_irc_server *server, char *command,
irc_protocol_cmd_join (struct t_irc_server *server, const char *command,
int argc, char **argv, char **argv_eol)
{
struct t_irc_channel *ptr_channel;
@ -325,7 +325,7 @@ irc_protocol_cmd_join (struct t_irc_server *server, char *command,
*/
int
irc_protocol_cmd_kick (struct t_irc_server *server, char *command,
irc_protocol_cmd_kick (struct t_irc_server *server, const char *command,
int argc, char **argv, char **argv_eol)
{
char *pos_comment;
@ -414,7 +414,7 @@ irc_protocol_cmd_kick (struct t_irc_server *server, char *command,
*/
int
irc_protocol_cmd_kill (struct t_irc_server *server, char *command,
irc_protocol_cmd_kill (struct t_irc_server *server, const char *command,
int argc, char **argv, char **argv_eol)
{
char *pos_comment;
@ -481,7 +481,7 @@ irc_protocol_cmd_kill (struct t_irc_server *server, char *command,
*/
int
irc_protocol_cmd_mode (struct t_irc_server *server, char *command,
irc_protocol_cmd_mode (struct t_irc_server *server, const char *command,
int argc, char **argv, char **argv_eol)
{
char *pos_modes;
@ -543,7 +543,7 @@ irc_protocol_cmd_mode (struct t_irc_server *server, char *command,
*/
int
irc_protocol_cmd_nick (struct t_irc_server *server, char *command,
irc_protocol_cmd_nick (struct t_irc_server *server, const char *command,
int argc, char **argv, char **argv_eol)
{
struct t_irc_channel *ptr_channel;
@ -632,7 +632,7 @@ irc_protocol_cmd_nick (struct t_irc_server *server, char *command,
*/
int
irc_protocol_cmd_notice (struct t_irc_server *server, char *command,
irc_protocol_cmd_notice (struct t_irc_server *server, const char *command,
int argc, char **argv, char **argv_eol)
{
char *nick, *host, *pos_args, *pos_end, *pos_usec;
@ -820,7 +820,7 @@ irc_protocol_cmd_notice (struct t_irc_server *server, char *command,
*/
int
irc_protocol_cmd_part (struct t_irc_server *server, char *command,
irc_protocol_cmd_part (struct t_irc_server *server, const char *command,
int argc, char **argv, char **argv_eol)
{
char *nick, *host, *pos_comment, *join_string;
@ -929,7 +929,7 @@ irc_protocol_cmd_part (struct t_irc_server *server, char *command,
*/
int
irc_protocol_cmd_ping (struct t_irc_server *server, char *command,
irc_protocol_cmd_ping (struct t_irc_server *server, const char *command,
int argc, char **argv, char **argv_eol)
{
/* PING message looks like:
@ -952,7 +952,7 @@ irc_protocol_cmd_ping (struct t_irc_server *server, char *command,
*/
int
irc_protocol_cmd_pong (struct t_irc_server *server, char *command,
irc_protocol_cmd_pong (struct t_irc_server *server, const char *command,
int argc, char **argv, char **argv_eol)
{
struct timeval tv;
@ -990,8 +990,8 @@ irc_protocol_cmd_pong (struct t_irc_server *server, char *command,
void
irc_protocol_reply_version (struct t_irc_server *server,
struct t_irc_channel *channel, char *nick,
char *message, char *str_version)
struct t_irc_channel *channel, const char *nick,
const char *message, const char *str_version)
{
char *pos, *version, *date;
struct t_gui_buffer *ptr_buffer;
@ -1043,7 +1043,7 @@ irc_protocol_reply_version (struct t_irc_server *server,
}
weechat_hook_signal_send ("irc_ctcp",
WEECHAT_HOOK_SIGNAL_STRING,
message);
(void *)message);
}
/*
@ -1051,7 +1051,7 @@ irc_protocol_reply_version (struct t_irc_server *server,
*/
int
irc_protocol_cmd_privmsg (struct t_irc_server *server, char *command,
irc_protocol_cmd_privmsg (struct t_irc_server *server, const char *command,
int argc, char **argv, char **argv_eol)
{
char *nick, *host, *pos_args, *pos_end_01, *pos, *pos_message;
@ -1911,7 +1911,7 @@ irc_protocol_cmd_privmsg (struct t_irc_server *server, char *command,
*/
int
irc_protocol_cmd_quit (struct t_irc_server *server, char *command,
irc_protocol_cmd_quit (struct t_irc_server *server, const char *command,
int argc, char **argv, char **argv_eol)
{
char *nick, *host, *pos_comment;
@ -1988,7 +1988,7 @@ irc_protocol_cmd_quit (struct t_irc_server *server, char *command,
*/
int
irc_protocol_cmd_server_mode_reason (struct t_irc_server *server, char *command,
irc_protocol_cmd_server_mode_reason (struct t_irc_server *server, const char *command,
int argc, char **argv, char **argv_eol)
{
char *pos_mode, *pos_args;
@ -2022,7 +2022,7 @@ irc_protocol_cmd_server_mode_reason (struct t_irc_server *server, char *command,
*/
int
irc_protocol_cmd_numeric (struct t_irc_server *server, char *command,
irc_protocol_cmd_numeric (struct t_irc_server *server, const char *command,
int argc, char **argv, char **argv_eol)
{
char *pos_args;
@ -2056,7 +2056,7 @@ irc_protocol_cmd_numeric (struct t_irc_server *server, char *command,
*/
int
irc_protocol_cmd_topic (struct t_irc_server *server, char *command,
irc_protocol_cmd_topic (struct t_irc_server *server, const char *command,
int argc, char **argv, char **argv_eol)
{
char *pos_topic, *topic_color;
@ -2135,7 +2135,7 @@ irc_protocol_cmd_topic (struct t_irc_server *server, char *command,
*/
int
irc_protocol_cmd_wallops (struct t_irc_server *server, char *command,
irc_protocol_cmd_wallops (struct t_irc_server *server, const char *command,
int argc, char **argv, char **argv_eol)
{
/* WALLOPS message looks like:
@ -2165,7 +2165,7 @@ irc_protocol_cmd_wallops (struct t_irc_server *server, char *command,
*/
int
irc_protocol_cmd_001 (struct t_irc_server *server, char *command,
irc_protocol_cmd_001 (struct t_irc_server *server, const char *command,
int argc, char **argv, char **argv_eol)
{
char **commands, **ptr_cmd, *vars_replaced;
@ -2233,7 +2233,7 @@ irc_protocol_cmd_001 (struct t_irc_server *server, char *command,
*/
int
irc_protocol_cmd_005 (struct t_irc_server *server, char *command,
irc_protocol_cmd_005 (struct t_irc_server *server, const char *command,
int argc, char **argv, char **argv_eol)
{
char *pos, *pos2;
@ -2278,7 +2278,7 @@ irc_protocol_cmd_005 (struct t_irc_server *server, char *command,
*/
int
irc_protocol_cmd_221 (struct t_irc_server *server, char *command,
irc_protocol_cmd_221 (struct t_irc_server *server, const char *command,
int argc, char **argv, char **argv_eol)
{
/* 221 message looks like:
@ -2309,7 +2309,7 @@ irc_protocol_cmd_221 (struct t_irc_server *server, char *command,
*/
int
irc_protocol_cmd_301 (struct t_irc_server *server, char *command,
irc_protocol_cmd_301 (struct t_irc_server *server, const char *command,
int argc, char **argv, char **argv_eol)
{
char *pos_away_msg;
@ -2361,7 +2361,7 @@ irc_protocol_cmd_301 (struct t_irc_server *server, char *command,
*/
int
irc_protocol_cmd_303 (struct t_irc_server *server, char *command,
irc_protocol_cmd_303 (struct t_irc_server *server, const char *command,
int argc, char **argv, char **argv_eol)
{
/* 301 message looks like:
@ -2388,7 +2388,7 @@ irc_protocol_cmd_303 (struct t_irc_server *server, char *command,
*/
int
irc_protocol_cmd_305 (struct t_irc_server *server, char *command,
irc_protocol_cmd_305 (struct t_irc_server *server, const char *command,
int argc, char **argv, char **argv_eol)
{
/* 305 message looks like:
@ -2430,7 +2430,7 @@ irc_protocol_cmd_305 (struct t_irc_server *server, char *command,
*/
int
irc_protocol_cmd_306 (struct t_irc_server *server, char *command,
irc_protocol_cmd_306 (struct t_irc_server *server, const char *command,
int argc, char **argv, char **argv_eol)
{
/* 306 message looks like:
@ -2478,7 +2478,7 @@ irc_protocol_cmd_306 (struct t_irc_server *server, char *command,
*/
int
irc_protocol_cmd_whois_nick_msg (struct t_irc_server *server, char *command,
irc_protocol_cmd_whois_nick_msg (struct t_irc_server *server, const char *command,
int argc, char **argv, char **argv_eol)
{
/* messages look like:
@ -2506,7 +2506,7 @@ irc_protocol_cmd_whois_nick_msg (struct t_irc_server *server, char *command,
*/
int
irc_protocol_cmd_311 (struct t_irc_server *server, char *command,
irc_protocol_cmd_311 (struct t_irc_server *server, const char *command,
int argc, char **argv, char **argv_eol)
{
/* 311 message looks like:
@ -2538,7 +2538,7 @@ irc_protocol_cmd_311 (struct t_irc_server *server, char *command,
*/
int
irc_protocol_cmd_312 (struct t_irc_server *server, char *command,
irc_protocol_cmd_312 (struct t_irc_server *server, const char *command,
int argc, char **argv, char **argv_eol)
{
/* 312 message looks like:
@ -2570,7 +2570,7 @@ irc_protocol_cmd_312 (struct t_irc_server *server, char *command,
*/
int
irc_protocol_cmd_314 (struct t_irc_server *server, char *command,
irc_protocol_cmd_314 (struct t_irc_server *server, const char *command,
int argc, char **argv, char **argv_eol)
{
/* 314 message looks like:
@ -2601,7 +2601,7 @@ irc_protocol_cmd_314 (struct t_irc_server *server, char *command,
*/
int
irc_protocol_cmd_315 (struct t_irc_server *server, char *command,
irc_protocol_cmd_315 (struct t_irc_server *server, const char *command,
int argc, char **argv, char **argv_eol)
{
/* 315 message looks like:
@ -2639,7 +2639,7 @@ irc_protocol_cmd_315 (struct t_irc_server *server, char *command,
*/
int
irc_protocol_cmd_317 (struct t_irc_server *server, char *command,
irc_protocol_cmd_317 (struct t_irc_server *server, const char *command,
int argc, char **argv, char **argv_eol)
{
int idle_time, day, hour, min, sec;
@ -2731,7 +2731,7 @@ irc_protocol_cmd_317 (struct t_irc_server *server, char *command,
*/
int
irc_protocol_cmd_321 (struct t_irc_server *server, char *command,
irc_protocol_cmd_321 (struct t_irc_server *server, const char *command,
int argc, char **argv, char **argv_eol)
{
char *pos_args;
@ -2761,7 +2761,7 @@ irc_protocol_cmd_321 (struct t_irc_server *server, char *command,
*/
int
irc_protocol_cmd_322 (struct t_irc_server *server, char *command,
irc_protocol_cmd_322 (struct t_irc_server *server, const char *command,
int argc, char **argv, char **argv_eol)
{
char *pos_topic;
@ -2801,7 +2801,7 @@ irc_protocol_cmd_322 (struct t_irc_server *server, char *command,
*/
int
irc_protocol_cmd_323 (struct t_irc_server *server, char *command,
irc_protocol_cmd_323 (struct t_irc_server *server, const char *command,
int argc, char **argv, char **argv_eol)
{
char *pos_args;
@ -2832,7 +2832,7 @@ irc_protocol_cmd_323 (struct t_irc_server *server, char *command,
*/
int
irc_protocol_cmd_324 (struct t_irc_server *server, char *command,
irc_protocol_cmd_324 (struct t_irc_server *server, const char *command,
int argc, char **argv, char **argv_eol)
{
struct t_irc_channel *ptr_channel;
@ -2875,7 +2875,7 @@ irc_protocol_cmd_324 (struct t_irc_server *server, char *command,
*/
int
irc_protocol_cmd_327 (struct t_irc_server *server, char *command,
irc_protocol_cmd_327 (struct t_irc_server *server, const char *command,
int argc, char **argv, char **argv_eol)
{
char *pos_realname;
@ -2930,7 +2930,7 @@ irc_protocol_cmd_327 (struct t_irc_server *server, char *command,
*/
int
irc_protocol_cmd_329 (struct t_irc_server *server, char *command,
irc_protocol_cmd_329 (struct t_irc_server *server, const char *command,
int argc, char **argv, char **argv_eol)
{
struct t_irc_channel *ptr_channel;
@ -2979,7 +2979,7 @@ irc_protocol_cmd_329 (struct t_irc_server *server, char *command,
*/
int
irc_protocol_cmd_331 (struct t_irc_server *server, char *command,
irc_protocol_cmd_331 (struct t_irc_server *server, const char *command,
int argc, char **argv, char **argv_eol)
{
struct t_irc_channel *ptr_channel;
@ -3010,7 +3010,7 @@ irc_protocol_cmd_331 (struct t_irc_server *server, char *command,
*/
int
irc_protocol_cmd_332 (struct t_irc_server *server, char *command,
irc_protocol_cmd_332 (struct t_irc_server *server, const char *command,
int argc, char **argv, char **argv_eol)
{
char *pos_topic;
@ -3053,7 +3053,7 @@ irc_protocol_cmd_332 (struct t_irc_server *server, char *command,
*/
int
irc_protocol_cmd_333 (struct t_irc_server *server, char *command,
irc_protocol_cmd_333 (struct t_irc_server *server, const char *command,
int argc, char **argv, char **argv_eol)
{
struct t_irc_channel *ptr_channel;
@ -3102,7 +3102,7 @@ irc_protocol_cmd_333 (struct t_irc_server *server, char *command,
*/
int
irc_protocol_cmd_338 (struct t_irc_server *server, char *command,
irc_protocol_cmd_338 (struct t_irc_server *server, const char *command,
int argc, char **argv, char **argv_eol)
{
/* 338 message looks like:
@ -3132,7 +3132,7 @@ irc_protocol_cmd_338 (struct t_irc_server *server, char *command,
*/
int
irc_protocol_cmd_341 (struct t_irc_server *server, char *command,
irc_protocol_cmd_341 (struct t_irc_server *server, const char *command,
int argc, char **argv, char **argv_eol)
{
/* 341 message looks like:
@ -3165,7 +3165,7 @@ irc_protocol_cmd_341 (struct t_irc_server *server, char *command,
*/
int
irc_protocol_cmd_344 (struct t_irc_server *server, char *command,
irc_protocol_cmd_344 (struct t_irc_server *server, const char *command,
int argc, char **argv, char **argv_eol)
{
/* 344 message looks like:
@ -3192,7 +3192,7 @@ irc_protocol_cmd_344 (struct t_irc_server *server, char *command,
*/
int
irc_protocol_cmd_345 (struct t_irc_server *server, char *command,
irc_protocol_cmd_345 (struct t_irc_server *server, const char *command,
int argc, char **argv, char **argv_eol)
{
/* 345 message looks like:
@ -3218,7 +3218,7 @@ irc_protocol_cmd_345 (struct t_irc_server *server, char *command,
*/
int
irc_protocol_cmd_348 (struct t_irc_server *server, char *command,
irc_protocol_cmd_348 (struct t_irc_server *server, const char *command,
int argc, char **argv, char **argv_eol)
{
struct t_irc_channel *ptr_channel;
@ -3285,7 +3285,7 @@ irc_protocol_cmd_348 (struct t_irc_server *server, char *command,
*/
int
irc_protocol_cmd_349 (struct t_irc_server *server, char *command,
irc_protocol_cmd_349 (struct t_irc_server *server, const char *command,
int argc, char **argv, char **argv_eol)
{
char *pos_args;
@ -3322,7 +3322,7 @@ irc_protocol_cmd_349 (struct t_irc_server *server, char *command,
*/
int
irc_protocol_cmd_351 (struct t_irc_server *server, char *command,
irc_protocol_cmd_351 (struct t_irc_server *server, const char *command,
int argc, char **argv, char **argv_eol)
{
/* 351 message looks like:
@ -3359,7 +3359,7 @@ irc_protocol_cmd_351 (struct t_irc_server *server, char *command,
*/
int
irc_protocol_cmd_352 (struct t_irc_server *server, char *command,
irc_protocol_cmd_352 (struct t_irc_server *server, const char *command,
int argc, char **argv, char **argv_eol)
{
char *pos_attr, *pos_hopcount, *pos_realname;
@ -3441,7 +3441,7 @@ irc_protocol_cmd_352 (struct t_irc_server *server, char *command,
*/
int
irc_protocol_cmd_353 (struct t_irc_server *server, char *command,
irc_protocol_cmd_353 (struct t_irc_server *server, const char *command,
int argc, char **argv, char **argv_eol)
{
char *pos_channel, *pos_nick, *color;
@ -3568,7 +3568,7 @@ irc_protocol_cmd_353 (struct t_irc_server *server, char *command,
*/
int
irc_protocol_cmd_366 (struct t_irc_server *server, char *command,
irc_protocol_cmd_366 (struct t_irc_server *server, const char *command,
int argc, char **argv, char **argv_eol)
{
struct t_irc_channel *ptr_channel;
@ -3699,7 +3699,7 @@ irc_protocol_cmd_366 (struct t_irc_server *server, char *command,
*/
int
irc_protocol_cmd_367 (struct t_irc_server *server, char *command,
irc_protocol_cmd_367 (struct t_irc_server *server, const char *command,
int argc, char **argv, char **argv_eol)
{
struct t_irc_channel *ptr_channel;
@ -3771,7 +3771,7 @@ irc_protocol_cmd_367 (struct t_irc_server *server, char *command,
*/
int
irc_protocol_cmd_368 (struct t_irc_server *server, char *command,
irc_protocol_cmd_368 (struct t_irc_server *server, const char *command,
int argc, char **argv, char **argv_eol)
{
char *pos_args;
@ -3808,7 +3808,7 @@ irc_protocol_cmd_368 (struct t_irc_server *server, char *command,
*/
int
irc_protocol_cmd_432 (struct t_irc_server *server, char *command,
irc_protocol_cmd_432 (struct t_irc_server *server, const char *command,
int argc, char **argv, char **argv_eol)
{
int i, nick_found, nick_to_use;
@ -3864,7 +3864,7 @@ irc_protocol_cmd_432 (struct t_irc_server *server, char *command,
*/
int
irc_protocol_cmd_433 (struct t_irc_server *server, char *command,
irc_protocol_cmd_433 (struct t_irc_server *server, const char *command,
int argc, char **argv, char **argv_eol)
{
int i, nick_found, nick_to_use;
@ -3922,7 +3922,7 @@ irc_protocol_cmd_433 (struct t_irc_server *server, char *command,
*/
int
irc_protocol_cmd_438 (struct t_irc_server *server, char *command,
irc_protocol_cmd_438 (struct t_irc_server *server, const char *command,
int argc, char **argv, char **argv_eol)
{
/* 438 message looks like:
@ -3959,7 +3959,7 @@ irc_protocol_cmd_438 (struct t_irc_server *server, char *command,
*/
int
irc_protocol_is_numeric_command (char *str)
irc_protocol_is_numeric_command (const char *str)
{
while (str && str[0])
{
@ -3979,14 +3979,16 @@ irc_protocol_is_numeric_command (char *str)
*/
void
irc_protocol_recv_command (struct t_irc_server *server, char *entire_line,
char *host, char *command, char *arguments)
irc_protocol_recv_command (struct t_irc_server *server, const char *entire_line,
const char *host, const char *command,
const char *arguments)
{
int i, cmd_found, return_code, argc, decode_color;
char *pos, *nick;
char *dup_entire_line, *dup_host, *dup_arguments, *irc_message;
t_irc_recv_func *cmd_recv_func;
char *cmd_name, **argv, **argv_eol;
const char *cmd_name;
char **argv, **argv_eol;
struct t_irc_protocol_msg irc_protocol_messages[] =
{ { "error", N_("error received from IRC server"), 1, &irc_protocol_cmd_error },
{ "invite", N_("invite a nick on a channel"), 1, &irc_protocol_cmd_invite },

View File

@ -44,7 +44,7 @@
struct t_irc_server;
typedef int (t_irc_recv_func)(struct t_irc_server *server, char *comand,
typedef int (t_irc_recv_func)(struct t_irc_server *server, const char *comand,
int argc, char **argv, char **argv_eol);
struct t_irc_protocol_msg
@ -56,7 +56,8 @@ struct t_irc_protocol_msg
};
extern void irc_protocol_recv_command (struct t_irc_server *server,
char *entire_line, char *host,
char *command, char *arguments);
const char *entire_line,
const char *host, const char *command,
const char *arguments);
#endif /* irc-protocol.h */

View File

@ -53,7 +53,7 @@ struct t_irc_message *irc_msgq_last_msg = NULL;
*/
void
irc_server_set_addresses (struct t_irc_server *server, char *addresses)
irc_server_set_addresses (struct t_irc_server *server, const char *addresses)
{
int i;
char *pos, *error;
@ -113,7 +113,7 @@ irc_server_set_addresses (struct t_irc_server *server, char *addresses)
*/
void
irc_server_set_nicks (struct t_irc_server *server, char *nicks)
irc_server_set_nicks (struct t_irc_server *server, const char *nicks)
{
/* free data */
if (server->nicks)
@ -224,7 +224,7 @@ irc_server_set_with_option (struct t_irc_server *server,
*/
void
irc_server_set_nick (struct t_irc_server *server, char *nick)
irc_server_set_nick (struct t_irc_server *server, const char *nick)
{
struct t_irc_channel *ptr_channel;
@ -323,7 +323,7 @@ irc_server_init (struct t_irc_server *server)
*/
struct t_irc_server *
irc_server_alloc (char *name)
irc_server_alloc (const char *name)
{
struct t_irc_server *new_server;
@ -363,41 +363,51 @@ irc_server_alloc (char *name)
*/
int
irc_server_alloc_with_url (char *irc_url)
irc_server_alloc_with_url (const char *irc_url)
{
char *url, *pos_server, *pos_channel, *pos, *pos2;
char *irc_url2, *url, *pos_server, *pos_channel, *pos, *pos2;
char *password, *nick1, *nicks, *autojoin;
int ipv6, ssl, length;
struct t_irc_server *ptr_server;
irc_url2 = strdup (irc_url);
if (!irc_url2)
return 0;
ipv6 = 0;
ssl = 0;
password = NULL;
nick1 = NULL;
autojoin = NULL;
if (weechat_strncasecmp (irc_url, "irc6://", 7) == 0)
if (weechat_strncasecmp (irc_url2, "irc6://", 7) == 0)
{
pos = irc_url + 7;
pos = irc_url2 + 7;
ipv6 = 1;
}
else if (weechat_strncasecmp (irc_url, "ircs://", 7) == 0)
else if (weechat_strncasecmp (irc_url2, "ircs://", 7) == 0)
{
pos = irc_url + 7;
pos = irc_url2 + 7;
ssl = 1;
}
else if ((weechat_strncasecmp (irc_url, "irc6s://", 8) == 0)
|| (weechat_strncasecmp (irc_url, "ircs6://", 8) == 0))
else if ((weechat_strncasecmp (irc_url2, "irc6s://", 8) == 0)
|| (weechat_strncasecmp (irc_url2, "ircs6://", 8) == 0))
{
pos = irc_url + 8;
pos = irc_url2 + 8;
ipv6 = 1;
ssl = 1;
}
else if (weechat_strncasecmp (irc_url, "irc://", 6) == 0)
else if (weechat_strncasecmp (irc_url2, "irc://", 6) == 0)
{
pos = irc_url + 6;
pos = irc_url2 + 6;
}
else
{
free (irc_url2);
return 0;
}
free (irc_url2);
url = strdup (pos);
pos_server = strchr (url, '@');
@ -487,8 +497,8 @@ irc_server_alloc_with_url (char *irc_url)
*/
void
irc_server_outqueue_add (struct t_irc_server *server, char *msg1, char *msg2,
int modified)
irc_server_outqueue_add (struct t_irc_server *server, const char *msg1,
const char *msg2, int modified)
{
struct t_irc_outqueue *new_outqueue;
@ -657,12 +667,12 @@ irc_server_free_all ()
*/
struct t_irc_server *
irc_server_new (char *name, int autoconnect, int autoreconnect,
int autoreconnect_delay, int temp_server, char *addresses,
int ipv6, int ssl, char *password, char *nicks,
char *username, char *realname, char *local_hostname,
char *command, int command_delay, char *autojoin,
int autorejoin, char *notify_levels)
irc_server_new (const char *name, int autoconnect, int autoreconnect,
int autoreconnect_delay, int temp_server, const char *addresses,
int ipv6, int ssl, const char *password, const char *nicks,
const char *username, const char *realname, const char *local_hostname,
const char *command, int command_delay, const char *autojoin,
int autorejoin, const char *notify_levels)
{
struct t_irc_server *new_server;
@ -725,7 +735,7 @@ irc_server_new (char *name, int autoconnect, int autoreconnect,
*/
struct t_irc_server *
irc_server_duplicate (struct t_irc_server *server, char *new_name)
irc_server_duplicate (struct t_irc_server *server, const char *new_name)
{
struct t_irc_server *new_server;
@ -762,7 +772,7 @@ irc_server_duplicate (struct t_irc_server *server, char *new_name)
*/
int
irc_server_rename (struct t_irc_server *server, char *new_name)
irc_server_rename (struct t_irc_server *server, const char *new_name)
{
int length;
char *option_name, *name, *pos_option;
@ -820,7 +830,7 @@ irc_server_rename (struct t_irc_server *server, char *new_name)
*/
int
irc_server_send (struct t_irc_server *server, char *buffer, int size_buf)
irc_server_send (struct t_irc_server *server, const char *buffer, int size_buf)
{
int rc;
@ -912,10 +922,10 @@ irc_server_outqueue_send (struct t_irc_server *server)
*/
void
irc_server_parse_message (char *message, char **nick, char **host,
irc_server_parse_message (const char *message, char **nick, char **host,
char **command, char **channel, char **arguments)
{
char *pos, *pos2, *pos3, *pos4;
const char *pos, *pos2, *pos3, *pos4;
if (nick)
*nick = NULL;
@ -1029,10 +1039,11 @@ irc_server_parse_message (char *message, char **nick, char **host,
*/
int
irc_server_send_one_msg (struct t_irc_server *server, char *message)
irc_server_send_one_msg (struct t_irc_server *server, const char *message)
{
static char buffer[4096];
char *new_msg, *ptr_msg, *pos, *nick, *command, *channel;
const char *ptr_msg;
char *new_msg, *pos, *nick, *command, *channel;
char *ptr_chan_nick, *msg_encoded;
char str_modifier[64], modifier_data[256];
int rc, queue, first_message;
@ -1160,7 +1171,7 @@ irc_server_send_one_msg (struct t_irc_server *server, char *message)
*/
void
irc_server_sendf (struct t_irc_server *server, char *format, ...)
irc_server_sendf (struct t_irc_server *server, const char *format, ...)
{
va_list args;
static char buffer[4096];
@ -1189,7 +1200,7 @@ irc_server_sendf (struct t_irc_server *server, char *format, ...)
*/
void
irc_server_msgq_add_msg (struct t_irc_server *server, char *msg)
irc_server_msgq_add_msg (struct t_irc_server *server, const char *msg)
{
struct t_irc_message *message;
@ -1246,7 +1257,7 @@ irc_server_msgq_add_msg (struct t_irc_server *server, char *msg)
*/
void
irc_server_msgq_add_unterminated (struct t_irc_server *server, char *string)
irc_server_msgq_add_unterminated (struct t_irc_server *server, const char *string)
{
if (!string[0])
return;
@ -1285,7 +1296,7 @@ irc_server_msgq_add_unterminated (struct t_irc_server *server, char *string)
*/
void
irc_server_msgq_add_buffer (struct t_irc_server *server, char *buffer)
irc_server_msgq_add_buffer (struct t_irc_server *server, const char *buffer)
{
char *pos_cr, *pos_lf;
@ -2135,7 +2146,7 @@ irc_server_autojoin_channels (struct t_irc_server *server)
*/
struct t_irc_server *
irc_server_search (char *server_name)
irc_server_search (const char *server_name)
{
struct t_irc_server *ptr_server;
@ -2286,7 +2297,7 @@ irc_server_check_away ()
*/
void
irc_server_set_away (struct t_irc_server *server, char *nick, int is_away)
irc_server_set_away (struct t_irc_server *server, const char *nick, int is_away)
{
struct t_irc_channel *ptr_channel;
@ -2364,8 +2375,8 @@ irc_server_set_default_notify_level (struct t_irc_server *server, int notify)
*/
int
irc_server_xfer_send_ready_cb (void *data, char *signal, char *type_data,
void *signal_data)
irc_server_xfer_send_ready_cb (void *data, const char *signal,
const char *type_data, void *signal_data)
{
struct t_plugin_infolist *infolist;
struct t_irc_server *server, *ptr_server;
@ -2437,8 +2448,8 @@ irc_server_xfer_send_ready_cb (void *data, char *signal, char *type_data,
*/
int
irc_server_xfer_resume_ready_cb (void *data, char *signal, char *type_data,
void *signal_data)
irc_server_xfer_resume_ready_cb (void *data, const char *signal,
const char *type_data, void *signal_data)
{
struct t_plugin_infolist *infolist;
struct t_irc_server *server, *ptr_server;
@ -2493,8 +2504,9 @@ irc_server_xfer_resume_ready_cb (void *data, char *signal, char *type_data,
*/
int
irc_server_xfer_send_accept_resume_cb (void *data, char *signal,
char *type_data, void *signal_data)
irc_server_xfer_send_accept_resume_cb (void *data, const char *signal,
const char *type_data,
void *signal_data)
{
struct t_plugin_infolist *infolist;
struct t_irc_server *server, *ptr_server;

View File

@ -137,41 +137,41 @@ extern struct t_irc_message *irc_recv_msgq, *irc_msgq_last_msg;
extern void irc_server_set_addresses (struct t_irc_server *server,
char *addresses);
extern void irc_server_set_nicks (struct t_irc_server *server, char *nicks);
const char *addresses);
extern void irc_server_set_nicks (struct t_irc_server *server, const char *nicks);
extern void irc_server_set_with_option (struct t_irc_server *server,
int index_option,
struct t_config_option *option);
extern void irc_server_init (struct t_irc_server *server);
extern struct t_irc_server *irc_server_alloc (char *name);
extern int irc_server_alloc_with_url (char *irc_url);
extern struct t_irc_server *irc_server_new (char *name, int autoconnect,
extern struct t_irc_server *irc_server_alloc (const char *name);
extern int irc_server_alloc_with_url (const char *irc_url);
extern struct t_irc_server *irc_server_new (const char *name, int autoconnect,
int autoreconnect,
int autoreconnect_delay,
int temp_server, char *addresses,
int temp_server, const char *addresses,
int ipv6, int ssl,
char *password, char *nicks,
char *username, char *realname,
char *hostname, char *command,
int command_delay, char *autojoin,
const char *password, const char *nicks,
const char *username, const char *realname,
const char *hostname, const char *command,
int command_delay, const char *autojoin,
int autorejoin,
char *notify_levels);
const char *notify_levels);
extern struct t_irc_server *irc_server_duplicate (struct t_irc_server *server,
char *new_name);
extern int irc_server_rename (struct t_irc_server *server, char *new_name);
extern void irc_server_set_nick (struct t_irc_server *server, char *nick);
extern struct t_irc_server *irc_server_search (char *server_name);
const char *new_name);
extern int irc_server_rename (struct t_irc_server *server, const char *new_name);
extern void irc_server_set_nick (struct t_irc_server *server, const char *nick);
extern struct t_irc_server *irc_server_search (const char *server_name);
extern void irc_server_free_all ();
extern int irc_server_connect (struct t_irc_server *server,
int disable_autojoin);
extern void irc_server_auto_connect (int auto_connect, int temp_server);
extern void irc_server_autojoin_channels ();
extern int irc_server_timer_cb (void *data);
extern void irc_server_sendf (struct t_irc_server *server, char *format, ...);
extern void irc_server_sendf (struct t_irc_server *server, const char *format, ...);
extern void irc_server_outqueue_free_all (struct t_irc_server *server);
extern int irc_server_get_channel_count (struct t_irc_server *server);
extern int irc_server_get_pv_count (struct t_irc_server *server);
extern void irc_server_set_away (struct t_irc_server *server, char *nick,
extern void irc_server_set_away (struct t_irc_server *server, const char *nick,
int is_away);
extern void irc_server_remove_away ();
extern void irc_server_check_away ();
@ -180,12 +180,12 @@ extern void irc_server_disconnect (struct t_irc_server *server, int reconnect);
extern void irc_server_disconnect_all ();
extern void irc_server_free (struct t_irc_server *server);
extern void irc_server_free_data (struct t_irc_server *server);
extern int irc_server_xfer_send_ready_cb (void *data, char *signal,
char *type_data, void *signal_data);
extern int irc_server_xfer_resume_ready_cb (void *data, char *signal,
char *type_data, void *signal_data);
extern int irc_server_xfer_send_accept_resume_cb (void *data, char *signal,
char *type_data,
extern int irc_server_xfer_send_ready_cb (void *data, const char *signal,
const char *type_data, void *signal_data);
extern int irc_server_xfer_resume_ready_cb (void *data, const char *signal,
const char *type_data, void *signal_data);
extern int irc_server_xfer_send_accept_resume_cb (void *data, const char *signal,
const char *type_data,
void *signal_data);
extern void irc_server_print_log ();

View File

@ -51,7 +51,7 @@ struct t_hook *irc_hook_timer_check_away = NULL;
*/
int
irc_signal_quit_cb (void *data, char *signal, char *type_data,
irc_signal_quit_cb (void *data, const char *signal, const char *type_data,
void *signal_data)
{
struct t_irc_server *ptr_server;

View File

@ -39,7 +39,7 @@ struct t_logger_buffer *last_logger_buffer = NULL;
*/
struct t_logger_buffer *
logger_buffer_add (struct t_gui_buffer *buffer, char *log_filename)
logger_buffer_add (struct t_gui_buffer *buffer, const char *log_filename)
{
struct t_logger_buffer *new_logger_buffer;

View File

@ -34,7 +34,7 @@ extern struct t_logger_buffer *logger_buffers;
extern struct t_logger_buffer *last_logger_buffer;
extern struct t_logger_buffer *logger_buffer_add (struct t_gui_buffer *,
char *log_filename);
const char *log_filename);
extern struct t_logger_buffer *logger_buffer_search (struct t_gui_buffer *buffer);
extern void logger_buffer_free (struct t_logger_buffer *logger_buffer);
extern void logger_buffer_free_all ();

View File

@ -42,12 +42,12 @@
*/
char *
logger_tail_last_eol (char *string_start, char *string_ptr)
logger_tail_last_eol (const char *string_start, const char *string_ptr)
{
while (string_ptr >= string_start)
{
if ((string_ptr[0] == '\n') || (string_ptr[0] == '\r'))
return string_ptr;
return (char *)string_ptr;
string_ptr--;
}
@ -60,7 +60,7 @@ logger_tail_last_eol (char *string_start, char *string_ptr)
*/
struct t_logger_line *
logger_tail_file (char *filename, int n_lines)
logger_tail_file (const char *filename, int n_lines)
{
int fd;
off_t file_length, file_pos;

View File

@ -26,7 +26,8 @@ struct t_logger_line
struct t_logger_line *next_line; /* link to next line */
};
extern struct t_logger_line *logger_tail_file (char *filename, int n_lines);
extern struct t_logger_line *logger_tail_file (const char *filename,
int n_lines);
extern void logger_tail_free (struct t_logger_line *lines);
#endif /* logger-tail.h */

View File

@ -280,7 +280,8 @@ logger_get_filename (struct t_gui_buffer *buffer)
*/
void
logger_write_line (struct t_logger_buffer *logger_buffer, char *format, ...)
logger_write_line (struct t_logger_buffer *logger_buffer,
const char *format, ...)
{
va_list argptr;
char *buf, *charset, *message;
@ -460,8 +461,8 @@ logger_stop_all ()
*/
int
logger_buffer_open_signal_cb (void *data, char *signal, char *type_data,
void *signal_data)
logger_buffer_open_signal_cb (void *data, const char *signal,
const char *type_data, void *signal_data)
{
/* make C compiler happy */
(void) data;
@ -478,8 +479,8 @@ logger_buffer_open_signal_cb (void *data, char *signal, char *type_data,
*/
int
logger_buffer_closing_signal_cb (void *data, char *signal, char *type_data,
void *signal_data)
logger_buffer_closing_signal_cb (void *data, const char *signal,
const char *type_data, void *signal_data)
{
/* make C compiler happy */
(void) data;
@ -496,7 +497,7 @@ logger_buffer_closing_signal_cb (void *data, char *signal, char *type_data,
*/
void
logger_backlog (struct t_gui_buffer *buffer, char *filename, int lines)
logger_backlog (struct t_gui_buffer *buffer, const char *filename, int lines)
{
struct t_logger_line *last_lines, *ptr_lines;
char *pos_message, *error;
@ -547,8 +548,8 @@ logger_backlog (struct t_gui_buffer *buffer, char *filename, int lines)
*/
int
logger_backlog_signal_cb (void *data, char *signal, char *type_data,
void *signal_data)
logger_backlog_signal_cb (void *data, const char *signal,
const char *type_data, void *signal_data)
{
struct t_logger_buffer *ptr_logger_buffer;
@ -581,7 +582,7 @@ logger_backlog_signal_cb (void *data, char *signal, char *type_data,
*/
int
logger_start_signal_cb (void *data, char *signal, char *type_data,
logger_start_signal_cb (void *data, const char *signal, const char *type_data,
void *signal_data)
{
/* make C compiler happy */
@ -599,7 +600,7 @@ logger_start_signal_cb (void *data, char *signal, char *type_data,
*/
int
logger_stop_signal_cb (void *data, char *signal, char *type_data,
logger_stop_signal_cb (void *data, const char *signal, const char *type_data,
void *signal_data)
{
struct t_logger_buffer *ptr_logger_buffer;
@ -623,7 +624,7 @@ logger_stop_signal_cb (void *data, char *signal, char *type_data,
int
logger_print_cb (void *data, struct t_gui_buffer *buffer, time_t date,
int tags_count, char **tags,
char *prefix, char *message)
const char *prefix, const char *message)
{
struct t_logger_buffer *ptr_logger_buffer;
struct tm *date_tmp;
@ -661,7 +662,7 @@ logger_print_cb (void *data, struct t_gui_buffer *buffer, time_t date,
*/
int
logger_config_cb (void *data, char *option, char *value)
logger_config_cb (void *data, const char *option, const char *value)
{
/* make C compiler happy */
(void) data;

View File

@ -54,7 +54,7 @@
*/
void
plugin_api_charset_set (struct t_weechat_plugin *plugin, char *charset)
plugin_api_charset_set (struct t_weechat_plugin *plugin, const char *charset)
{
if (!plugin || !charset)
return;
@ -70,7 +70,7 @@ plugin_api_charset_set (struct t_weechat_plugin *plugin, char *charset)
*/
char *
plugin_api_gettext (char *string)
plugin_api_gettext (const char *string)
{
return _(string);
}
@ -80,7 +80,7 @@ plugin_api_gettext (char *string)
*/
char *
plugin_api_ngettext (char *single, char *plural, int count)
plugin_api_ngettext (const char *single, const char *plural, int count)
{
return NG_(single, plural, count);
}
@ -91,7 +91,7 @@ plugin_api_ngettext (char *single, char *plural, int count)
*/
int
plugin_api_mkdir_home (char *directory, int mode)
plugin_api_mkdir_home (const char *directory, int mode)
{
char *dir_name;
int dir_length;
@ -126,7 +126,7 @@ plugin_api_mkdir_home (char *directory, int mode)
*/
int
plugin_api_mkdir (char *directory, int mode)
plugin_api_mkdir (const char *directory, int mode)
{
if (!directory)
return 0;
@ -145,7 +145,7 @@ plugin_api_mkdir (char *directory, int mode)
*/
struct t_config_option *
plugin_api_config_get (char *option_name)
plugin_api_config_get (const char *option_name)
{
struct t_config_option *ptr_option;
@ -160,7 +160,7 @@ plugin_api_config_get (char *option_name)
char *
plugin_api_config_get_plugin (struct t_weechat_plugin *plugin,
char *option_name)
const char *option_name)
{
struct t_config_option *ptr_option;
@ -181,7 +181,7 @@ plugin_api_config_get_plugin (struct t_weechat_plugin *plugin,
int
plugin_api_config_set_plugin (struct t_weechat_plugin *plugin,
char *option_name, char *value)
const char *option_name, const char *value)
{
if (!plugin || !option_name)
return 0;
@ -197,7 +197,7 @@ plugin_api_config_set_plugin (struct t_weechat_plugin *plugin,
*/
char *
plugin_api_prefix (char *prefix)
plugin_api_prefix (const char *prefix)
{
if (!prefix)
return gui_chat_prefix_empty;
@ -221,7 +221,7 @@ plugin_api_prefix (char *prefix)
*/
char *
plugin_api_color (char *color_name)
plugin_api_color (const char *color_name)
{
int num_color, fg, bg;
static char color[20][16];
@ -328,7 +328,7 @@ plugin_api_color (char *color_name)
void
plugin_api_infobar_printf (struct t_weechat_plugin *plugin, int delay,
char *color_name, char *format, ...)
const char *color_name, const char *format, ...)
{
va_list argptr;
static char buf[1024];
@ -385,7 +385,7 @@ plugin_api_infobar_remove (int how_many)
void
plugin_api_command (struct t_weechat_plugin *plugin,
struct t_gui_buffer *buffer, char *command)
struct t_gui_buffer *buffer, const char *command)
{
char *command2;
@ -405,7 +405,7 @@ plugin_api_command (struct t_weechat_plugin *plugin,
*/
char *
plugin_api_info_get (struct t_weechat_plugin *plugin, char *info)
plugin_api_info_get (struct t_weechat_plugin *plugin, const char *info)
{
time_t inactivity;
static char value[32];
@ -730,7 +730,7 @@ plugin_api_infolist_get_add_window (struct t_plugin_infolist *infolist,
int
plugin_api_infolist_get_add_options (struct t_plugin_infolist *infolist,
char *option_name)
const char *option_name)
{
struct t_config_file *ptr_config;
struct t_config_section *ptr_section;
@ -930,7 +930,7 @@ plugin_api_infolist_get_add_options (struct t_plugin_infolist *infolist,
*/
struct t_plugin_infolist *
plugin_api_infolist_get (char *name, void *pointer, char *arguments)
plugin_api_infolist_get (const char *name, void *pointer, const char *arguments)
{
struct t_plugin_infolist *ptr_infolist;
struct t_gui_buffer *ptr_buffer;
@ -1140,7 +1140,7 @@ plugin_api_infolist_fields (struct t_plugin_infolist *infolist)
*/
int
plugin_api_infolist_integer (struct t_plugin_infolist *infolist, char *var)
plugin_api_infolist_integer (struct t_plugin_infolist *infolist, const char *var)
{
if (!infolist || !plugin_infolist_valid (infolist)
|| !((struct t_plugin_infolist *)infolist)->ptr_item)
@ -1154,7 +1154,7 @@ plugin_api_infolist_integer (struct t_plugin_infolist *infolist, char *var)
*/
char *
plugin_api_infolist_string (struct t_plugin_infolist *infolist, char *var)
plugin_api_infolist_string (struct t_plugin_infolist *infolist, const char *var)
{
if (!infolist || !plugin_infolist_valid (infolist)
|| !((struct t_plugin_infolist *)infolist)->ptr_item)
@ -1168,7 +1168,7 @@ plugin_api_infolist_string (struct t_plugin_infolist *infolist, char *var)
*/
void *
plugin_api_infolist_pointer (struct t_plugin_infolist *infolist, char *var)
plugin_api_infolist_pointer (struct t_plugin_infolist *infolist, const char *var)
{
if (!infolist || !plugin_infolist_valid (infolist)
|| !((struct t_plugin_infolist *)infolist)->ptr_item)
@ -1182,7 +1182,7 @@ plugin_api_infolist_pointer (struct t_plugin_infolist *infolist, char *var)
*/
time_t
plugin_api_infolist_time (struct t_plugin_infolist *infolist, char *var)
plugin_api_infolist_time (struct t_plugin_infolist *infolist, const char *var)
{
if (!infolist || !plugin_infolist_valid (infolist)
|| !((struct t_plugin_infolist *)infolist)->ptr_item)

View File

@ -22,51 +22,52 @@
/* strings */
extern void plugin_api_charset_set (struct t_weechat_plugin *plugin,
char *charset);
extern char *plugin_api_gettext (char *string);
extern char *plugin_api_ngettext (char *single, char *plural, int count);
const char *charset);
extern char *plugin_api_gettext (const char *string);
extern char *plugin_api_ngettext (const char *single, const char *plural,
int count);
/* directories */
extern int plugin_api_mkdir_home (char *directory, int mode);
extern int plugin_api_mkdir (char *directory, int mode);
extern int plugin_api_mkdir_home (const char *directory, int mode);
extern int plugin_api_mkdir (const char *directory, int mode);
/* config */
extern struct t_config_option *plugin_api_config_get (char *option_name);
extern struct t_config_option *plugin_api_config_get (const char *option_name);
extern char *plugin_api_config_get_plugin (struct t_weechat_plugin *plugin,
char *option_name);
const char *option_name);
extern int plugin_api_config_set_plugin (struct t_weechat_plugin *plugin,
char *option_name, char *value);
const char *option_name, const char *value);
/* display */
extern char *plugin_api_prefix (char *prefix);
extern char *plugin_api_color (char *color_name);
extern char *plugin_api_prefix (const char *prefix);
extern char *plugin_api_color (const char *color_name);
extern void plugin_api_infobar_printf (struct t_weechat_plugin *plugin,
int delay, char *color_name,
char *format, ...);
int delay, const char *color_name,
const char *format, ...);
extern void plugin_api_infobar_remove (int how_many);
/* command */
extern void plugin_api_command (struct t_weechat_plugin *plugin,
struct t_gui_buffer *buffer, char *command);
struct t_gui_buffer *buffer, const char *command);
/* infos */
extern char *plugin_api_info_get (struct t_weechat_plugin *plugin, char *info);
extern char *plugin_api_info_get (struct t_weechat_plugin *plugin, const char *info);
/* infolists */
extern struct t_plugin_infolist *plugin_api_infolist_get (char *name,
extern struct t_plugin_infolist *plugin_api_infolist_get (const char *name,
void *pointer,
char *arguments);
const char *arguments);
extern int plugin_api_infolist_next (struct t_plugin_infolist *infolist);
extern int plugin_api_infolist_prev (struct t_plugin_infolist *infolist);
extern char *plugin_api_infolist_fields (struct t_plugin_infolist *infolist);
extern int plugin_api_infolist_integer (struct t_plugin_infolist *infolist,
char *var);
const char *var);
extern char *plugin_api_infolist_string (struct t_plugin_infolist *infolist,
char *var);
const char *var);
extern void *plugin_api_infolist_pointer (struct t_plugin_infolist *infolist,
char *var);
const char *var);
extern time_t plugin_api_infolist_time (struct t_plugin_infolist *infolist,
char *var);
const char *var);
extern void plugin_api_infolist_free (struct t_plugin_infolist *infolist);
#endif /* plugin-api.h */

View File

@ -48,7 +48,7 @@ struct t_config_section *plugin_config_section_var = NULL;
*/
struct t_config_option *
plugin_config_search (char *plugin_name, char *option_name)
plugin_config_search (const char *plugin_name, const char *option_name)
{
int length;
char *option_full_name;
@ -77,7 +77,7 @@ plugin_config_search (char *plugin_name, char *option_name)
*/
int
plugin_config_set_internal (char *option, char *value)
plugin_config_set_internal (const char *option, const char *value)
{
int rc;
struct t_config_option *ptr_option;
@ -108,7 +108,8 @@ plugin_config_set_internal (char *option, char *value)
*/
int
plugin_config_set (char *plugin_name, char *option_name, char *value)
plugin_config_set (const char *plugin_name, const char *option_name,
const char *value)
{
int length, rc;
char *option_full_name;
@ -153,7 +154,7 @@ plugin_config_reload (void *data, struct t_config_file *config_file)
int
plugin_config_create_option (void *data, struct t_config_file *config_file,
struct t_config_section *section,
char *option_name, char *value)
const char *option_name, const char *value)
{
struct t_config_option *ptr_option;

View File

@ -25,12 +25,12 @@
extern struct t_config_file *plugin_config;
extern struct t_config_option *plugin_options;
extern struct t_config_option *plugin_config_search_internal (char *option_name);
extern struct t_config_option *plugin_config_search (char *plugin_name,
char *option_name);
extern int plugin_config_set_internal (char *option, char *value);
extern int plugin_config_set (char *plugin_name, char *option_name,
char *value);
extern struct t_config_option *plugin_config_search_internal (const char *option_name);
extern struct t_config_option *plugin_config_search (const char *plugin_name,
const char *option_name);
extern int plugin_config_set_internal (const char *option, const char *value);
extern int plugin_config_set (const char *plugin_name, const char *option_name,
const char *value);
extern void plugin_config_init ();
extern int plugin_config_read ();
extern int plugin_config_reload ();

View File

@ -98,7 +98,7 @@ plugin_infolist_new_item (struct t_plugin_infolist *list)
struct t_plugin_infolist_var *
plugin_infolist_new_var_integer (struct t_plugin_infolist_item *item,
char *name, int value)
const char *name, int value)
{
struct t_plugin_infolist_var *new_var;
@ -132,7 +132,7 @@ plugin_infolist_new_var_integer (struct t_plugin_infolist_item *item,
struct t_plugin_infolist_var *
plugin_infolist_new_var_string (struct t_plugin_infolist_item *item,
char *name, char *value)
const char *name, const char *value)
{
struct t_plugin_infolist_var *new_var;
@ -164,7 +164,7 @@ plugin_infolist_new_var_string (struct t_plugin_infolist_item *item,
struct t_plugin_infolist_var *
plugin_infolist_new_var_pointer (struct t_plugin_infolist_item *item,
char *name, void *pointer)
const char *name, void *pointer)
{
struct t_plugin_infolist_var *new_var;
@ -196,7 +196,7 @@ plugin_infolist_new_var_pointer (struct t_plugin_infolist_item *item,
struct t_plugin_infolist_var *
plugin_infolist_new_var_time (struct t_plugin_infolist_item *item,
char *name, time_t time)
const char *name, time_t time)
{
struct t_plugin_infolist_var *new_var;
@ -340,7 +340,7 @@ plugin_infolist_get_fields (struct t_plugin_infolist *list)
*/
int
plugin_infolist_get_integer (struct t_plugin_infolist *list, char *var)
plugin_infolist_get_integer (struct t_plugin_infolist *list, const char *var)
{
struct t_plugin_infolist_var *ptr_var;
@ -367,7 +367,7 @@ plugin_infolist_get_integer (struct t_plugin_infolist *list, char *var)
*/
char *
plugin_infolist_get_string (struct t_plugin_infolist *list, char *var)
plugin_infolist_get_string (struct t_plugin_infolist *list, const char *var)
{
struct t_plugin_infolist_var *ptr_var;
@ -394,7 +394,7 @@ plugin_infolist_get_string (struct t_plugin_infolist *list, char *var)
*/
void *
plugin_infolist_get_pointer (struct t_plugin_infolist *list, char *var)
plugin_infolist_get_pointer (struct t_plugin_infolist *list, const char *var)
{
struct t_plugin_infolist_var *ptr_var;
@ -421,7 +421,7 @@ plugin_infolist_get_pointer (struct t_plugin_infolist *list, char *var)
*/
time_t
plugin_infolist_get_time (struct t_plugin_infolist *list, char *var)
plugin_infolist_get_time (struct t_plugin_infolist *list, const char *var)
{
struct t_plugin_infolist_var *ptr_var;

View File

@ -68,29 +68,29 @@ extern struct t_plugin_infolist *last_plugin_infolist;
extern struct t_plugin_infolist *plugin_infolist_new ();
extern struct t_plugin_infolist_item *plugin_infolist_new_item (struct t_plugin_infolist *list);
extern struct t_plugin_infolist_var *plugin_infolist_new_var_integer (struct t_plugin_infolist_item *item,
char *name,
const char *name,
int value);
extern struct t_plugin_infolist_var *plugin_infolist_new_var_string (struct t_plugin_infolist_item *item,
char *name,
char *value);
const char *name,
const char *value);
extern struct t_plugin_infolist_var *plugin_infolist_new_var_pointer (struct t_plugin_infolist_item *item,
char *name,
const char *name,
void *pointer);
extern struct t_plugin_infolist_var *plugin_infolist_new_var_time (struct t_plugin_infolist_item *item,
char *name,
const char *name,
time_t time);
extern int plugin_infolist_valid (struct t_plugin_infolist *list);
extern struct t_plugin_infolist_item *plugin_infolist_next_item (struct t_plugin_infolist *list);
extern struct t_plugin_infolist_item *plugin_infolist_prev_item (struct t_plugin_infolist *list);
extern char *plugin_infolist_get_fields (struct t_plugin_infolist *list);
extern int plugin_infolist_get_integer (struct t_plugin_infolist *list,
char *var);
const char *var);
extern char *plugin_infolist_get_string (struct t_plugin_infolist *list,
char *var);
const char *var);
extern void *plugin_infolist_get_pointer (struct t_plugin_infolist *list,
char *var);
const char *var);
extern time_t plugin_infolist_get_time (struct t_plugin_infolist *list,
char *var);
const char *var);
extern void plugin_infolist_free (struct t_plugin_infolist *list);
extern void plugin_infolist_print_log ();

View File

@ -65,7 +65,7 @@ char **plugin_argv; /* first time loading plugin) */
*/
struct t_weechat_plugin *
plugin_search (char *name)
plugin_search (const char *name)
{
struct t_weechat_plugin *ptr_plugin;
@ -86,7 +86,7 @@ plugin_search (char *name)
*/
struct t_weechat_plugin *
plugin_load (char *filename)
plugin_load (const char *filename)
{
char *ptr_home, *full_name, *full_name2;
void *handle;
@ -517,7 +517,7 @@ plugin_load (char *filename)
*/
int
plugin_auto_load_file (void *plugin, char *filename)
plugin_auto_load_file (void *plugin, const char *filename)
{
char *pos;
@ -716,7 +716,7 @@ plugin_unload (struct t_weechat_plugin *plugin)
*/
void
plugin_unload_name (char *name)
plugin_unload_name (const char *name)
{
struct t_weechat_plugin *ptr_plugin;
@ -750,7 +750,7 @@ plugin_unload_all ()
*/
void
plugin_reload_name (char *name)
plugin_reload_name (const char *name)
{
struct t_weechat_plugin *ptr_plugin;
char *filename;

View File

@ -31,14 +31,14 @@ extern struct t_weechat_plugin *last_weechat_plugin;
//extern t_plugin_irc_color plugins_irc_colors[GUI_NUM_IRC_COLORS];
extern struct t_weechat_plugin *plugin_search (char *name);
extern struct t_weechat_plugin *plugin_load (char *filename);
extern struct t_weechat_plugin *plugin_search (const char *name);
extern struct t_weechat_plugin *plugin_load (const char *filename);
extern void plugin_auto_load ();
extern void plugin_remove (struct t_weechat_plugin *plugin);
extern void plugin_unload (struct t_weechat_plugin *plugin);
extern void plugin_unload_name (char *name);
extern void plugin_unload_name (const char *name);
extern void plugin_unload_all ();
extern void plugin_reload_name (char *name);
extern void plugin_reload_name (const char *name);
extern void plugin_init (int auto_load, int argc, char *argv[]);
extern void plugin_end ();
extern void plugin_print_log ();

File diff suppressed because it is too large Load Diff

Some files were not shown because too many files have changed in this diff Show More