diff --git a/doc/en/dev/plugin_c_api.en.xml b/doc/en/dev/plugin_c_api.en.xml
index f4eb5b150..6217814de 100644
--- a/doc/en/dev/plugin_c_api.en.xml
+++ b/doc/en/dev/plugin_c_api.en.xml
@@ -57,7 +57,7 @@ void weechat_plugin_get_name (struct t_weechat_plugin *plugin);
Example:
- char *name = weechat_plugin_get_name (plugin);
+ const char *name = weechat_plugin_get_name (plugin);
@@ -108,7 +108,7 @@ void weechat_charset_set (const char *charset);
Prototype:
-void weechat_iconv_to_internal (const char *charset, const char *string);
+char *weechat_iconv_to_internal (const char *charset, const char *string);
@@ -149,7 +149,7 @@ void weechat_iconv_to_internal (const char *charset, const char *string);
Prototype:
-void weechat_iconv_from_internal (const char *charset, const char *string);
+char *weechat_iconv_from_internal (const char *charset, const char *string);
@@ -190,7 +190,7 @@ void weechat_iconv_from_internal (const char *charset, const char *string);
Prototype:
-char *weechat_gettext (const char *string);
+const char *weechat_gettext (const char *string);
@@ -221,7 +221,7 @@ char *weechat_gettext (const char *string);
Prototype:
-char *weechat_ngettext (const char *string, const char *plural, int count);
+const char *weechat_ngettext (const char *string, const char *plural, int count);
@@ -305,7 +305,7 @@ char *weechat_strndup (const char *string, int length);
Prototype:
-char *weechat_string_tolower (const char *string);
+void weechat_string_tolower (const char *string);
@@ -336,7 +336,7 @@ char *weechat_string_tolower (const char *string);
Prototype:
-char *weechat_string_toupper (const char *string);
+void weechat_string_toupper (const char *string);
@@ -502,7 +502,7 @@ int weechat_strcmp_ignore_chars (
Prototype:
-int weechat_strcasestr (const char *string, const char *search);
+char *weechat_strcasestr (const char *string, const char *search);
@@ -732,7 +732,7 @@ char *weechat_string_strip (
Prototype:
-char *weechat_string_has_highlight (
+int weechat_string_has_highlight (
const char *string,
const char highlight_words);
@@ -925,7 +925,7 @@ weechat_string_free_exploded (, argv);
Prototype:
-char **weechat_string_build_with_exploded (
+char *weechat_string_build_with_exploded (
char **exploded_string,
const char *separator);
@@ -2196,7 +2196,7 @@ struct t_weelist_item *weechat_list_prev (struct t_weelist_item *item);
Prototype:
-char *weechat_list_string (struct t_weelist_item *item);
+const char *weechat_list_string (struct t_weelist_item *item);
@@ -3711,7 +3711,7 @@ int weechat_config_integer (struct t_config_option *option);
Prototype:
-char *weechat_config_string (struct t_config_option *option);
+const char *weechat_config_string (struct t_config_option *option);
@@ -3742,7 +3742,7 @@ char *weechat_config_string (struct t_config_option *option);
Prototype:
-char *weechat_config_color (struct t_config_option *option);
+const char *weechat_config_color (struct t_config_option *option);
@@ -4109,7 +4109,7 @@ struct t_config_option *option = weechat_config_get ("weechat.look.item_time_for
Prototype:
-char *weechat_config_get_plugin (const char *option_name);
+const char *weechat_config_get_plugin (const char *option_name);
@@ -4191,7 +4191,7 @@ weechat_config_set_plugin ("option", "test_value");
Prototype:
-char *weechat_prefix (const char *prefix);
+const char *weechat_prefix (const char *prefix);
@@ -4264,7 +4264,7 @@ weechat_printf (NULL, "%sThis is an error...",
Prototype:
-char *weechat_color (const char *color_name);
+const char *weechat_color (const char *color_name);
diff --git a/src/core/wee-command.c b/src/core/wee-command.c
index 7bc055616..e48a94324 100644
--- a/src/core/wee-command.c
+++ b/src/core/wee-command.c
@@ -2411,7 +2411,7 @@ void
command_set_display_option (struct t_config_option *option,
const char *message)
{
- char *color_name;
+ const char *color_name;
switch (option->type)
{
diff --git a/src/core/wee-config-file.c b/src/core/wee-config-file.c
index 79db1aa30..676429ce2 100644
--- a/src/core/wee-config-file.c
+++ b/src/core/wee-config-file.c
@@ -1412,7 +1412,7 @@ config_file_option_integer (struct t_config_option *option)
* config_file_option_string: return string value of an option
*/
-char *
+const char *
config_file_option_string (struct t_config_option *option)
{
if (!option)
@@ -1443,7 +1443,7 @@ config_file_option_string (struct t_config_option *option)
* config_file_option_color: return color value of an option
*/
-char *
+const char *
config_file_option_color (struct t_config_option *option)
{
if (!option)
@@ -2412,7 +2412,7 @@ config_file_print_stdout (struct t_config_file *config_file)
{
struct t_config_section *ptr_section;
struct t_config_option *ptr_option;
- char *color_name;
+ const char *color_name;
int i;
for (ptr_section = config_file->sections; ptr_section;
diff --git a/src/core/wee-config-file.h b/src/core/wee-config-file.h
index f8376a669..493b907d1 100644
--- a/src/core/wee-config-file.h
+++ b/src/core/wee-config-file.h
@@ -228,8 +228,8 @@ extern int config_file_option_set_with_string (const char *option_name, const ch
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 char *config_file_option_color (struct t_config_option *option);
+extern const char *config_file_option_string (struct t_config_option *option);
+extern const char *config_file_option_color (struct t_config_option *option);
extern void config_file_write_line (struct t_config_file *config_file,
const char *option_name, const char *value, ...);
diff --git a/src/core/wee-hook.c b/src/core/wee-hook.c
index bbb37c52c..6c1bfb8b1 100644
--- a/src/core/wee-hook.c
+++ b/src/core/wee-hook.c
@@ -1470,12 +1470,12 @@ hook_info (struct t_weechat_plugin *plugin, const char *info_name,
* hook_info_get: get info via info hook
*/
-char *
+const char *
hook_info_get (struct t_weechat_plugin *plugin, const char *info_name,
const char *arguments)
{
struct t_hook *ptr_hook, *next_hook;
- char *value;
+ const char *value;
/* make C compiler happy */
(void) plugin;
diff --git a/src/core/wee-hook.h b/src/core/wee-hook.h
index fb079a098..0b130e1b8 100644
--- a/src/core/wee-hook.h
+++ b/src/core/wee-hook.h
@@ -198,8 +198,8 @@ struct t_hook_modifier
char *modifier; /* name of modifier */
};
-typedef char *(t_hook_callback_info)(void *data, const char *info_name,
- const char *arguments);
+typedef const char *(t_hook_callback_info)(void *data, const char *info_name,
+ const char *arguments);
struct t_hook_info
{
@@ -305,9 +305,9 @@ extern struct t_hook *hook_info (struct t_weechat_plugin *plugin,
const char *description,
t_hook_callback_info *callback,
void *callback_data);
-extern char *hook_info_get (struct t_weechat_plugin *plugin,
- const char *info_name,
- const char *arguments);
+extern const char *hook_info_get (struct t_weechat_plugin *plugin,
+ const char *info_name,
+ const char *arguments);
extern struct t_hook *hook_infolist (struct t_weechat_plugin *plugin,
const char *infolist_name,
const char *description,
diff --git a/src/core/wee-infolist.c b/src/core/wee-infolist.c
index 07c59bcaf..e49a87d9a 100644
--- a/src/core/wee-infolist.c
+++ b/src/core/wee-infolist.c
@@ -331,7 +331,7 @@ infolist_reset_item_cursor (struct t_infolist *infolist)
* infolist_fields: get list of fields for current infolist item
*/
-char *
+const char *
infolist_fields (struct t_infolist *infolist)
{
struct t_infolist_var *ptr_var;
@@ -417,7 +417,7 @@ infolist_integer (struct t_infolist *infolist, const char *var)
* infolist_string: get a string variable value in current list item
*/
-char *
+const char *
infolist_string (struct t_infolist *infolist, const char *var)
{
struct t_infolist_var *ptr_var;
diff --git a/src/core/wee-infolist.h b/src/core/wee-infolist.h
index 681d5e4f8..60e8ebe03 100644
--- a/src/core/wee-infolist.h
+++ b/src/core/wee-infolist.h
@@ -88,10 +88,10 @@ extern int infolist_valid (struct t_infolist *infolist);
extern struct t_infolist_item *infolist_next (struct t_infolist *infolist);
extern struct t_infolist_item *infolist_prev (struct t_infolist *infolist);
extern void infolist_reset_item_cursor (struct t_infolist *infolist);
-extern char *infolist_fields (struct t_infolist *infolist);
+extern const char *infolist_fields (struct t_infolist *infolist);
extern int infolist_integer (struct t_infolist *infolist,
const char *var);
-extern char *infolist_string (struct t_infolist *infolist,
+extern const char *infolist_string (struct t_infolist *infolist,
const char *var);
extern void *infolist_pointer (struct t_infolist *infolist,
const char *var);
diff --git a/src/core/wee-list.c b/src/core/wee-list.c
index e6917b4a8..543983f66 100644
--- a/src/core/wee-list.c
+++ b/src/core/wee-list.c
@@ -293,7 +293,7 @@ weelist_prev (struct t_weelist_item *item)
* weelist_string: get string pointer to item data
*/
-char *
+const char *
weelist_string (struct t_weelist_item *item)
{
if (item)
diff --git a/src/core/wee-list.h b/src/core/wee-list.h
index 054988982..b38f1c0b0 100644
--- a/src/core/wee-list.h
+++ b/src/core/wee-list.h
@@ -47,7 +47,7 @@ extern struct t_weelist_item *weelist_get (struct t_weelist *weelist,
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);
+extern const char *weelist_string (struct t_weelist_item *item);
extern int weelist_size (struct t_weelist *weelist);
extern void weelist_remove (struct t_weelist *weelist,
struct t_weelist_item *item);
diff --git a/src/core/wee-upgrade-file.c b/src/core/wee-upgrade-file.c
index a8ee02d42..47748e8e2 100644
--- a/src/core/wee-upgrade-file.c
+++ b/src/core/wee-upgrade-file.c
@@ -116,7 +116,8 @@ upgrade_file_write_time (struct t_upgrade_file *upgrade_file, time_t date)
*/
int
-upgrade_file_write_string (struct t_upgrade_file *upgrade_file, char *string)
+upgrade_file_write_string (struct t_upgrade_file *upgrade_file,
+ const char *string)
{
int length;
@@ -239,7 +240,8 @@ upgrade_file_write_object (struct t_upgrade_file *upgrade_file, int object_id,
struct t_infolist *infolist)
{
int i, argc, length;
- char *fields, **argv;
+ char **argv;
+ const char *fields;
void *buf;
/* write all infolist variables */
diff --git a/src/core/wee-upgrade.c b/src/core/wee-upgrade.c
index 27b1c96b2..b8912525d 100644
--- a/src/core/wee-upgrade.c
+++ b/src/core/wee-upgrade.c
@@ -279,8 +279,8 @@ int
upgrade_weechat_read_cb (int object_id,
struct t_infolist *infolist)
{
- char *type, *name, *prefix, *group_name, option_name[64], *key;
- char *option_key, *var_name, *option_var;
+ const char *key, *var_name, *type, *name, *prefix, *group_name;
+ char option_name[64], *option_key, *option_var;
struct t_gui_nick_group *ptr_group;
struct t_gui_buffer *ptr_buffer;
struct t_gui_line *new_line;
diff --git a/src/gui/curses/gui-curses-color.c b/src/gui/curses/gui-curses-color.c
index a22553e93..4c7574733 100644
--- a/src/gui/curses/gui-curses-color.c
+++ b/src/gui/curses/gui-curses-color.c
@@ -262,7 +262,7 @@ gui_color_get_number ()
* gui_color_get_name: get color name
*/
-char *
+const char *
gui_color_get_name (int num_color)
{
return gui_weechat_colors[num_color].string;
diff --git a/src/gui/gtk/gui-gtk-color.c b/src/gui/gtk/gui-gtk-color.c
index ccfd5ebef..6b89d3d6d 100644
--- a/src/gui/gtk/gui-gtk-color.c
+++ b/src/gui/gtk/gui-gtk-color.c
@@ -114,7 +114,7 @@ gui_color_get_number ()
* gui_color_get_name: get color name
*/
-char *
+const char *
gui_color_get_name (int num_color)
{
return gui_weechat_colors[num_color].string;
diff --git a/src/gui/gui-bar-item.c b/src/gui/gui-bar-item.c
index 79ca1797c..904850b6d 100644
--- a/src/gui/gui-bar-item.c
+++ b/src/gui/gui-bar-item.c
@@ -819,7 +819,7 @@ gui_bar_item_default_buffer_plugin (void *data, struct t_gui_bar_item *item,
struct t_gui_window *window,
int max_width, int max_height)
{
- char *plugin_name;
+ const char *plugin_name;
/* make C compiler happy */
(void) data;
@@ -829,7 +829,7 @@ gui_bar_item_default_buffer_plugin (void *data, struct t_gui_bar_item *item,
if (!window)
window = gui_current_window;
-
+
plugin_name = plugin_get_name (window->buffer->plugin);
return (plugin_name) ? strdup (plugin_name) : strdup ("");
}
diff --git a/src/gui/gui-buffer.c b/src/gui/gui-buffer.c
index 6ebb44ea8..50435adcd 100644
--- a/src/gui/gui-buffer.c
+++ b/src/gui/gui-buffer.c
@@ -539,7 +539,7 @@ gui_buffer_get_integer (struct t_gui_buffer *buffer, const char *property)
* gui_buffer_get_string: get a buffer property as string
*/
-char *
+const char *
gui_buffer_get_string (struct t_gui_buffer *buffer, const char *property)
{
struct t_gui_buffer_local_var *ptr_local_var;
diff --git a/src/gui/gui-buffer.h b/src/gui/gui-buffer.h
index 756fd1181..0df4ab389 100644
--- a/src/gui/gui-buffer.h
+++ b/src/gui/gui-buffer.h
@@ -198,8 +198,8 @@ extern void gui_buffer_set_plugin_for_upgrade (char *name,
struct t_weechat_plugin *plugin);
extern int gui_buffer_get_integer (struct t_gui_buffer *buffer,
const char *property);
-extern char *gui_buffer_get_string (struct t_gui_buffer *buffer,
- const char *property);
+extern const char *gui_buffer_get_string (struct t_gui_buffer *buffer,
+ const char *property);
extern void *gui_buffer_get_pointer (struct t_gui_buffer *buffer,
const char *property);
extern void gui_buffer_ask_chat_refresh (struct t_gui_buffer *buffer,
diff --git a/src/gui/gui-color.c b/src/gui/gui-color.c
index dc77acaa9..c88fcdb29 100644
--- a/src/gui/gui-color.c
+++ b/src/gui/gui-color.c
@@ -77,7 +77,7 @@ gui_color_search_config_int (const char *color_name)
* return color configuration name, NULL if not found
*/
-char *
+const char *
gui_color_search_config_str (int color_number)
{
struct t_config_section *ptr_section;
@@ -103,7 +103,7 @@ gui_color_search_config_str (int color_number)
* gui_color_get_custom: get a custom color with a name (GUI dependent)
*/
-char *
+const char *
gui_color_get_custom (const char *color_name)
{
int fg, bg;
diff --git a/src/gui/gui-color.h b/src/gui/gui-color.h
index 9408f3dcf..45f571dd9 100644
--- a/src/gui/gui-color.h
+++ b/src/gui/gui-color.h
@@ -123,8 +123,8 @@ extern struct t_gui_color *gui_color[];
/* color functions */
extern int gui_color_search_config_int (const char *color_name);
-extern char *gui_color_search_config_str (int color_number);
-extern char *gui_color_get_custom (const char *color_name);
+extern const char *gui_color_search_config_str (int color_number);
+extern const char *gui_color_get_custom (const char *color_name);
extern unsigned char *gui_color_decode (const unsigned char *string);
extern void gui_color_free (struct t_gui_color *color);
@@ -133,7 +133,7 @@ extern void gui_color_free (struct t_gui_color *color);
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 const char *gui_color_get_name (int num_color);
extern void gui_color_init_pairs ();
extern void gui_color_init_weechat ();
diff --git a/src/gui/gui-completion.c b/src/gui/gui-completion.c
index c150b8b8c..e53fd81af 100644
--- a/src/gui/gui-completion.c
+++ b/src/gui/gui-completion.c
@@ -700,8 +700,9 @@ gui_completion_list_add_plugin_commands (struct t_gui_completion *completion)
void
gui_completion_list_add_option_value (struct t_gui_completion *completion)
{
- char *pos_space, *option_full_name, *color_name, *pos_section, *pos_option;
+ char *pos_space, *option_full_name, *pos_section, *pos_option;
char *file, *section, *value_string;
+ const char *color_name;
int length, i, num_colors;
struct t_config_file *ptr_config;
struct t_config_section *ptr_section, *section_found;
diff --git a/src/gui/gui-layout.c b/src/gui/gui-layout.c
index 658e89d71..7b844853c 100644
--- a/src/gui/gui-layout.c
+++ b/src/gui/gui-layout.c
@@ -184,7 +184,7 @@ void
gui_layout_buffer_apply ()
{
struct t_gui_buffer *ptr_buffer;
- char *plugin_name;
+ const char *plugin_name;
if (gui_layout_buffers)
{
@@ -408,7 +408,7 @@ void
gui_layout_window_check_buffer (struct t_gui_buffer *buffer)
{
struct t_gui_window *ptr_win;
- char *plugin_name;
+ const char *plugin_name;
plugin_name = plugin_get_name (buffer->plugin);
@@ -436,7 +436,7 @@ gui_layout_window_check_all_buffers ()
{
struct t_gui_window *ptr_win;
struct t_gui_buffer *ptr_buffer;
- char *plugin_name;
+ const char *plugin_name;
for (ptr_win = gui_windows; ptr_win; ptr_win = ptr_win->next_window)
{
diff --git a/src/gui/gui-window.c b/src/gui/gui-window.c
index 8c9071998..4e0ed9175 100644
--- a/src/gui/gui-window.c
+++ b/src/gui/gui-window.c
@@ -300,7 +300,7 @@ gui_window_get_integer (struct t_gui_window *window, const char *property)
* gui_window_get_string: get a window property as string
*/
-char *
+const char *
gui_window_get_string (struct t_gui_window *window, const char *property)
{
if (window && property)
diff --git a/src/gui/gui-window.h b/src/gui/gui-window.h
index 6441b1033..db17b29b0 100644
--- a/src/gui/gui-window.h
+++ b/src/gui/gui-window.h
@@ -103,8 +103,8 @@ extern struct t_gui_window *gui_window_new (struct t_gui_window *parent,
extern int gui_window_valid (struct t_gui_window *window);
extern int gui_window_get_integer (struct t_gui_window *window,
const char *property);
-extern char *gui_window_get_string (struct t_gui_window *window,
- const char *property);
+extern const char *gui_window_get_string (struct t_gui_window *window,
+ const char *property);
extern void *gui_window_get_pointer (struct t_gui_window *window,
const char *property);
extern void gui_window_set_layout_plugin_name (struct t_gui_window *window,
diff --git a/src/plugins/aspell/weechat-aspell-config.c b/src/plugins/aspell/weechat-aspell-config.c
index 46816d347..7de2ffabd 100644
--- a/src/plugins/aspell/weechat-aspell-config.c
+++ b/src/plugins/aspell/weechat-aspell-config.c
@@ -57,7 +57,7 @@ void
weechat_aspell_config_change_commands (void *data,
struct t_config_option *option)
{
- char *value;
+ const char *value;
int i;
/* make C compiler happy */
diff --git a/src/plugins/aspell/weechat-aspell.c b/src/plugins/aspell/weechat-aspell.c
index 6ad345ab1..9f26f7c41 100644
--- a/src/plugins/aspell/weechat-aspell.c
+++ b/src/plugins/aspell/weechat-aspell.c
@@ -158,7 +158,8 @@ struct t_aspell_code countries_avail[] =
char *
weechat_aspell_build_option_name (struct t_gui_buffer *buffer)
{
- char *plugin_name, *name, *option_name;
+ const char *plugin_name, *name;
+ char *option_name;
int length;
if (!buffer)
@@ -183,7 +184,7 @@ weechat_aspell_build_option_name (struct t_gui_buffer *buffer)
* one to find dict (from specific to general dict)
*/
-char *
+const char *
weechat_aspell_get_dict (struct t_gui_buffer *buffer)
{
char *name, *option_name, *ptr_end;
@@ -307,7 +308,8 @@ weechat_aspell_spellers_already_ok (const char *dict_list)
void
weechat_aspell_create_spellers (struct t_gui_buffer *buffer)
{
- char *dict_list, **argv;
+ const char *dict_list;
+ char **argv;
int argc, i;
if (buffer)
@@ -713,7 +715,8 @@ weechat_aspell_modifier_cb (void *data, const char *modifier,
const char *modifier_data, const char *string)
{
struct t_gui_buffer *buffer;
- char *result, *ptr_string, *pos_space, *color_normal, *color_error;
+ char *result, *ptr_string, *pos_space;
+ const char *color_normal, *color_error;
int length, index_result, length_word, word_ok;
int length_color_normal, length_color_error;
diff --git a/src/plugins/charset/charset.c b/src/plugins/charset/charset.c
index 3fa0c8b66..8e95925e5 100644
--- a/src/plugins/charset/charset.c
+++ b/src/plugins/charset/charset.c
@@ -50,8 +50,8 @@ struct t_config_option *charset_default_encode = NULL;
struct t_config_section *charset_config_section_decode = NULL;
struct t_config_section *charset_config_section_encode = NULL;
-char *charset_terminal = NULL;
-char *charset_internal = NULL;
+const char *charset_terminal = NULL;
+const char *charset_internal = NULL;
/*
@@ -250,7 +250,7 @@ charset_check (const char *charset)
* to find charset (from specific to general charset)
*/
-char *
+const char *
charset_get (struct t_config_section *section, const char *name,
struct t_config_option *default_charset)
{
@@ -306,7 +306,7 @@ char *
charset_decode_cb (void *data, const char *modifier, const char *modifier_data,
const char *string)
{
- char *charset;
+ const char *charset;
/* make C compiler happy */
(void) data;
@@ -335,7 +335,7 @@ char *
charset_encode_cb (void *data, const char *modifier, const char *modifier_data,
const char *string)
{
- char *charset;
+ const char *charset;
/* make C compiler happy */
(void) data;
@@ -389,7 +389,8 @@ charset_command_cb (void *data, struct t_gui_buffer *buffer, int argc,
{
struct t_config_section *ptr_section;
int length;
- char *ptr_charset, *option_name, *plugin_name, *name;
+ char *ptr_charset, *option_name;
+ const char *plugin_name, *name;
/* make C compiler happy */
(void) data;
diff --git a/src/plugins/demo/demo.c b/src/plugins/demo/demo.c
index 663fcd463..796b6df45 100644
--- a/src/plugins/demo/demo.c
+++ b/src/plugins/demo/demo.c
@@ -178,7 +178,8 @@ demo_buffer_set_command_cb (void *data, struct t_gui_buffer *buffer, int argc,
void
demo_infolist_print (struct t_infolist *infolist, const char *item_name)
{
- char *fields, **argv;
+ const char *fields;
+ char **argv;
void *pointer;
int i, j, argc, size;
time_t time;
diff --git a/src/plugins/fifo/fifo-info.c b/src/plugins/fifo/fifo-info.c
index 542098e80..3fc7aeca7 100644
--- a/src/plugins/fifo/fifo-info.c
+++ b/src/plugins/fifo/fifo-info.c
@@ -29,7 +29,7 @@
* fifo_info_get_info_cb: callback called when fifo info is asked
*/
-char *
+const char *
fifo_info_get_info_cb (void *data, const char *info_name,
const char *arguments)
{
diff --git a/src/plugins/fifo/fifo.c b/src/plugins/fifo/fifo.c
index ff9e9a3b3..321eadd38 100644
--- a/src/plugins/fifo/fifo.c
+++ b/src/plugins/fifo/fifo.c
@@ -58,7 +58,7 @@ int
fifo_create ()
{
int rc, filename_length;
- char *fifo_option, *weechat_home;
+ const char *fifo_option, *weechat_home;
rc = 0;
diff --git a/src/plugins/irc/irc-bar-item.c b/src/plugins/irc/irc-bar-item.c
index e2510c2cf..07ad3b140 100644
--- a/src/plugins/irc/irc-bar-item.c
+++ b/src/plugins/irc/irc-bar-item.c
@@ -42,7 +42,8 @@ irc_bar_item_buffer_title (void *data, struct t_gui_bar_item *item,
int max_width, int max_height)
{
struct t_gui_buffer *buffer;
- char *title, *title_color;
+ const char *title;
+ char *title_color;
/* make C compiler happy */
(void) data;
@@ -78,7 +79,8 @@ irc_bar_item_buffer_name (void *data, struct t_gui_bar_item *item,
struct t_gui_window *window,
int max_width, int max_height)
{
- char buf[512], buf_name[256], modes[128], away[128], *name;
+ char buf[512], buf_name[256], modes[128], away[128];
+ const char *name;
int number, part_from_channel;
struct t_gui_buffer *buffer;
struct t_irc_server *server;
diff --git a/src/plugins/irc/irc-buffer.c b/src/plugins/irc/irc-buffer.c
index fe0eb5e03..cee9ade8b 100644
--- a/src/plugins/irc/irc-buffer.c
+++ b/src/plugins/irc/irc-buffer.c
@@ -123,7 +123,7 @@ char *
irc_buffer_get_server_prefix (struct t_irc_server *server, char *prefix_code)
{
static char buf[256];
- char *prefix;
+ const char *prefix;
prefix = (prefix_code && prefix_code[0]) ?
weechat_prefix (prefix_code) : NULL;
diff --git a/src/plugins/irc/irc-channel.c b/src/plugins/irc/irc-channel.c
index 79b697c31..05ccb903a 100644
--- a/src/plugins/irc/irc-channel.c
+++ b/src/plugins/irc/irc-channel.c
@@ -178,7 +178,7 @@ irc_channel_new (struct t_irc_server *server, int channel_type,
*/
void
-irc_channel_set_topic (struct t_irc_channel *channel, char *topic)
+irc_channel_set_topic (struct t_irc_channel *channel, const char *topic)
{
if (channel->topic)
free (channel->topic);
diff --git a/src/plugins/irc/irc-channel.h b/src/plugins/irc/irc-channel.h
index 7a54244f7..49b109fde 100644
--- a/src/plugins/irc/irc-channel.h
+++ b/src/plugins/irc/irc-channel.h
@@ -72,7 +72,8 @@ extern struct t_irc_channel *irc_channel_new (struct t_irc_server *server,
int channel_type,
const char *channel_name,
int switch_to_channel);
-extern void irc_channel_set_topic (struct t_irc_channel *channel, char *topic);
+extern void irc_channel_set_topic (struct t_irc_channel *channel,
+ const char *topic);
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);
diff --git a/src/plugins/irc/irc-command.c b/src/plugins/irc/irc-command.c
index f378362f2..8cc26f261 100644
--- a/src/plugins/irc/irc-command.c
+++ b/src/plugins/irc/irc-command.c
@@ -790,7 +790,8 @@ int
irc_command_cycle (void *data, struct t_gui_buffer *buffer, int argc,
char **argv, char **argv_eol)
{
- char *channel_name, *pos_args, *ptr_arg, *buf, *version;
+ char *channel_name, *pos_args, *buf;
+ const char *version, *ptr_arg;
char **channels;
int i, num_channels;
@@ -1139,8 +1140,8 @@ irc_command_die (void *data, struct t_gui_buffer *buffer, int argc,
void
irc_command_quit_server (struct t_irc_server *server, const char *arguments)
{
- const char *ptr_arg;
- char *buf, *version;
+ const char *ptr_arg, *version;
+ char *buf;
if (!server)
return;
@@ -2379,7 +2380,8 @@ irc_command_part_channel (struct t_irc_server *server, const char *channel_name,
const char *part_message)
{
const char *ptr_arg;
- char *buf, *version;
+ char *buf;
+ const char *version;
ptr_arg = (part_message) ? part_message :
(weechat_config_string (irc_config_network_default_msg_part)
diff --git a/src/plugins/irc/irc-completion.c b/src/plugins/irc/irc-completion.c
index 686548c1d..45d3a0074 100644
--- a/src/plugins/irc/irc-completion.c
+++ b/src/plugins/irc/irc-completion.c
@@ -187,7 +187,7 @@ irc_completion_channel_nicks_cb (void *data, const char *completion_item,
struct t_gui_completion *completion)
{
struct t_irc_nick *ptr_nick;
- char *nick;
+ const char *nick;
int list_size, i;
IRC_GET_SERVER_CHANNEL(buffer);
diff --git a/src/plugins/irc/irc-config.c b/src/plugins/irc/irc-config.c
index a1dd9b88a..e3d910408 100644
--- a/src/plugins/irc/irc-config.c
+++ b/src/plugins/irc/irc-config.c
@@ -415,7 +415,8 @@ irc_config_reload_servers_from_config ()
struct t_infolist *infolist;
struct t_irc_server *ptr_server;
struct t_config_option *ptr_option;
- char *full_name, *option_name, *server_name, *pos_option;
+ const char *full_name, *option_name;
+ char *server_name, *pos_option;
int i, index_option;
infolist = weechat_infolist_get ("option", NULL, "irc.server.*");
diff --git a/src/plugins/irc/irc-info.c b/src/plugins/irc/irc-info.c
index 2148e7515..0afaed538 100644
--- a/src/plugins/irc/irc-info.c
+++ b/src/plugins/irc/irc-info.c
@@ -59,7 +59,7 @@ irc_info_create_string_with_pointer (char **string, void *pointer)
* irc_info_get_info_cb: callback called when IRC info is asked
*/
-char *
+const char *
irc_info_get_info_cb (void *data, const char *info_name,
const char *arguments)
{
diff --git a/src/plugins/irc/irc-nick.c b/src/plugins/irc/irc-nick.c
index 7968776be..58957c34a 100644
--- a/src/plugins/irc/irc-nick.c
+++ b/src/plugins/irc/irc-nick.c
@@ -60,7 +60,7 @@ irc_nick_valid (struct t_irc_channel *channel, struct t_irc_nick *nick)
* irc_nick_find_color: find a color for a nick (according to nick letters)
*/
-char *
+const char *
irc_nick_find_color (struct t_irc_nick *nick)
{
int i, color;
diff --git a/src/plugins/irc/irc-nick.h b/src/plugins/irc/irc-nick.h
index 501fdbc9e..34aebafa1 100644
--- a/src/plugins/irc/irc-nick.h
+++ b/src/plugins/irc/irc-nick.h
@@ -51,7 +51,7 @@ struct t_irc_nick
char *host; /* full hostname */
int flags; /* chanowner/chanadmin (unrealircd), */
/* op, halfop, voice, away */
- char *color; /* color for nickname in chat window */
+ const char *color; /* color for nickname in chat window */
struct t_irc_nick *prev_nick; /* link to previous nick on channel */
struct t_irc_nick *next_nick; /* link to next nick on channel */
};
diff --git a/src/plugins/irc/irc-protocol.c b/src/plugins/irc/irc-protocol.c
index 6c6c3ed17..ac152869d 100644
--- a/src/plugins/irc/irc-protocol.c
+++ b/src/plugins/irc/irc-protocol.c
@@ -1119,7 +1119,8 @@ irc_protocol_reply_version (struct t_irc_server *server,
struct t_irc_channel *channel, const char *nick,
const char *message, const char *str_version)
{
- char *pos, *version, *date;
+ char *pos;
+ const char *version, *date;
struct t_gui_buffer *ptr_buffer;
ptr_buffer = (channel) ? channel->buffer : server->buffer;
@@ -3654,7 +3655,8 @@ int
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;
+ char *pos_channel, *pos_nick;
+ const char *color;
int args, i, prefix_found;
int is_chanowner, is_chanadmin, is_chanadmin2, is_op, is_halfop;
int has_voice, is_chanuser;
@@ -3785,7 +3787,8 @@ irc_protocol_cmd_366 (struct t_irc_server *server, const char *command,
struct t_infolist *infolist;
struct t_config_option *ptr_option;
int num_nicks, num_op, num_halfop, num_voice, num_normal, length, i;
- char *string, *prefix;
+ char *string;
+ const char *prefix;
/* 366 message looks like:
:server 366 mynick #channel :End of /NAMES list.
diff --git a/src/plugins/irc/irc-server.c b/src/plugins/irc/irc-server.c
index 298448225..b11a9830a 100644
--- a/src/plugins/irc/irc-server.c
+++ b/src/plugins/irc/irc-server.c
@@ -884,7 +884,8 @@ irc_server_duplicate (struct t_irc_server *server, const char *new_server_name)
{
struct t_irc_server *new_server;
int length, index_option;
- char *mask, *option_name, *pos_option;
+ char *mask, *pos_option;
+ const char *option_name;
struct t_config_option *ptr_option;
struct t_infolist *infolist;
@@ -962,7 +963,8 @@ int
irc_server_rename (struct t_irc_server *server, const char *new_server_name)
{
int length;
- char *mask, *option_name, *pos_option, *new_option_name, *buffer_name;
+ char *mask, *pos_option, *new_option_name, *buffer_name;
+ const char *option_name;
struct t_infolist *infolist;
struct t_config_option *ptr_option;
struct t_irc_channel *ptr_channel;
@@ -2157,7 +2159,7 @@ int
irc_server_connect (struct t_irc_server *server, int disable_autojoin)
{
int set;
- char *config_proxy_type, *config_proxy_address;
+ const char *config_proxy_type, *config_proxy_address;
int config_proxy_use, config_proxy_ipv6, config_proxy_port;
if (!server->addresses || !server->addresses[0])
@@ -2678,7 +2680,7 @@ irc_server_xfer_send_ready_cb (void *data, const char *signal,
{
struct t_infolist *infolist;
struct t_irc_server *server, *ptr_server;
- char *plugin_name, *plugin_id, *type, *filename;
+ const char *plugin_name, *plugin_id, *type, *filename;
int spaces_in_name;
/* make C compiler happy */
@@ -2751,7 +2753,7 @@ irc_server_xfer_resume_ready_cb (void *data, const char *signal,
{
struct t_infolist *infolist;
struct t_irc_server *server, *ptr_server;
- char *plugin_name, *plugin_id, *filename;
+ const char *plugin_name, *plugin_id, *filename;
int spaces_in_name;
/* make C compiler happy */
@@ -2808,7 +2810,7 @@ irc_server_xfer_send_accept_resume_cb (void *data, const char *signal,
{
struct t_infolist *infolist;
struct t_irc_server *server, *ptr_server;
- char *plugin_name, *plugin_id, *filename;
+ const char *plugin_name, *plugin_id, *filename;
int spaces_in_name;
/* make C compiler happy */
diff --git a/src/plugins/irc/irc-upgrade.c b/src/plugins/irc/irc-upgrade.c
index 04c84b459..5d5641bfd 100644
--- a/src/plugins/irc/irc-upgrade.c
+++ b/src/plugins/irc/irc-upgrade.c
@@ -170,7 +170,8 @@ irc_upgrade_read_cb (int object_id,
struct t_infolist *infolist)
{
int flags, sock, size, index;
- char *str, *buf, *buffer_name, option_name[64], *nick;
+ char *buf, option_name[64];
+ const char *buffer_name, *str, *nick;
struct t_irc_nick *ptr_nick;
struct t_gui_buffer *ptr_buffer;
diff --git a/src/plugins/logger/logger.c b/src/plugins/logger/logger.c
index af534134b..8d8242645 100644
--- a/src/plugins/logger/logger.c
+++ b/src/plugins/logger/logger.c
@@ -65,7 +65,8 @@ int
logger_create_directory ()
{
int rc;
- char *dir1, *dir2, *weechat_dir;
+ char *dir1, *dir2;
+ const char *weechat_dir;
rc = 1;
@@ -104,7 +105,8 @@ logger_create_directory ()
char *
logger_build_option_name (struct t_gui_buffer *buffer)
{
- char *plugin_name, *name, *option_name;
+ const char *plugin_name, *name;
+ char *option_name;
int length;
if (!buffer)
@@ -130,7 +132,8 @@ logger_build_option_name (struct t_gui_buffer *buffer)
int
logger_get_level_for_buffer (struct t_gui_buffer *buffer)
{
- char *no_log, *name, *option_name, *ptr_end;
+ const char *no_log;
+ char *name, *option_name, *ptr_end;
struct t_config_option *ptr_option;
/* no log for buffer if local variable "no_log" is defined for buffer */
@@ -184,7 +187,7 @@ logger_get_level_for_buffer (struct t_gui_buffer *buffer)
* one to find mask (from specific to general mask)
*/
-char *
+const char *
logger_get_mask_for_buffer (struct t_gui_buffer *buffer)
{
char *name, *option_name, *ptr_end;
@@ -242,7 +245,9 @@ logger_get_mask_for_buffer (struct t_gui_buffer *buffer)
char *
logger_get_filename (struct t_gui_buffer *buffer)
{
- char *res, *mask, *mask_decoded, *dir_separator, *weechat_dir;
+ char *res, *mask_decoded;
+ const char *mask;
+ const char *dir_separator, *weechat_dir;
char *log_path, *log_path2, *pos_last_sep;
int length;
@@ -353,10 +358,10 @@ logger_write_line (struct t_logger_buffer *logger_buffer,
const char *format, ...)
{
va_list argptr;
- char *charset, *message;
+ char *message, buf_time[256];
+ const char *charset;
time_t seconds;
struct tm *date_tmp;
- char buf_time[256];
int log_level;
if (!logger_buf_write)
diff --git a/src/plugins/notify/notify.c b/src/plugins/notify/notify.c
index dfb6d05ae..603e2bd7f 100644
--- a/src/plugins/notify/notify.c
+++ b/src/plugins/notify/notify.c
@@ -76,7 +76,8 @@ notify_search (const char *notify_name)
char *
notify_build_option_name (struct t_gui_buffer *buffer)
{
- char *option_name, *plugin_name, *name;
+ const char *plugin_name, *name;
+ char *option_name;
int length;
plugin_name = weechat_buffer_get_string (buffer, "plugin");
diff --git a/src/plugins/plugin-api.c b/src/plugins/plugin-api.c
index 73148a638..3b9dd3fb5 100644
--- a/src/plugins/plugin-api.c
+++ b/src/plugins/plugin-api.c
@@ -70,7 +70,7 @@ plugin_api_charset_set (struct t_weechat_plugin *plugin, const char *charset)
* plugin_api_gettext: translate a string using gettext
*/
-char *
+const char *
plugin_api_gettext (const char *string)
{
return _(string);
@@ -80,7 +80,7 @@ plugin_api_gettext (const char *string)
* plugin_api_ngettext: translate a string using gettext
*/
-char *
+const char *
plugin_api_ngettext (const char *single, const char *plural, int count)
{
return NG_(single, plural, count);
@@ -104,7 +104,7 @@ plugin_api_config_get (const char *option_name)
* plugin_api_config_get_plugin: get value of a plugin config option
*/
-char *
+const char *
plugin_api_config_get_plugin (struct t_weechat_plugin *plugin,
const char *option_name)
{
@@ -142,7 +142,7 @@ plugin_api_config_set_plugin (struct t_weechat_plugin *plugin,
* plugin_api_prefix: return a prefix for display with printf
*/
-char *
+const char *
plugin_api_prefix (const char *prefix)
{
if (!prefix)
@@ -166,7 +166,7 @@ plugin_api_prefix (const char *prefix)
* plugin_api_color: return a WeeChat color for display with printf
*/
-char *
+const char *
plugin_api_color (const char *color_name)
{
int num_color;
@@ -207,7 +207,7 @@ plugin_api_command (struct t_weechat_plugin *plugin,
* plugin_api_info_get_inernal: get info about WeeChat
*/
-char *
+const char *
plugin_api_info_get_internal (void *data, const char *info_name,
const char *arguments)
{
@@ -580,7 +580,7 @@ plugin_api_infolist_reset_item_cursor (struct t_infolist *infolist)
* plugin_api_infolist_fields: get list of fields for current list item
*/
-char *
+const char *
plugin_api_infolist_fields (struct t_infolist *infolist)
{
if (!infolist || !infolist_valid (infolist))
@@ -606,7 +606,7 @@ plugin_api_infolist_integer (struct t_infolist *infolist, const char *var)
* plugin_api_infolist_string: get a string variable value in current list item
*/
-char *
+const char *
plugin_api_infolist_string (struct t_infolist *infolist, const char *var)
{
if (!infolist || !infolist_valid (infolist) || !infolist->ptr_item)
diff --git a/src/plugins/plugin-api.h b/src/plugins/plugin-api.h
index 3bd0bb23b..93b8a1f5b 100644
--- a/src/plugins/plugin-api.h
+++ b/src/plugins/plugin-api.h
@@ -23,27 +23,28 @@
/* strings */
extern void plugin_api_charset_set (struct t_weechat_plugin *plugin,
const char *charset);
-extern char *plugin_api_gettext (const char *string);
-extern char *plugin_api_ngettext (const char *single, const char *plural,
- int count);
+extern const char *plugin_api_gettext (const char *string);
+extern const char *plugin_api_ngettext (const char *single, const char *plural,
+ int count);
/* config */
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,
+extern const char *plugin_api_config_get_plugin (struct t_weechat_plugin *plugin,
const char *option_name);
extern int plugin_api_config_set_plugin (struct t_weechat_plugin *plugin,
const char *option_name, const char *value);
/* display */
-extern char *plugin_api_prefix (const char *prefix);
-extern char *plugin_api_color (const char *color_name);
+extern const char *plugin_api_prefix (const char *prefix);
+extern const char *plugin_api_color (const char *color_name);
/* command */
extern void plugin_api_command (struct t_weechat_plugin *plugin,
struct t_gui_buffer *buffer, const char *command);
/* infos */
-extern char *plugin_api_info_get (struct t_weechat_plugin *plugin, const char *info);
+extern const char *plugin_api_info_get (struct t_weechat_plugin *plugin,
+ const char *info);
/* infolists */
extern struct t_infolist *plugin_api_infolist_get (const char *name,
@@ -52,11 +53,11 @@ extern struct t_infolist *plugin_api_infolist_get (const char *name,
extern int plugin_api_infolist_next (struct t_infolist *infolist);
extern int plugin_api_infolist_prev (struct t_infolist *infolist);
extern void plugin_api_infolist_reset_item_cursor (struct t_infolist *infolist);
-extern char *plugin_api_infolist_fields (struct t_infolist *infolist);
+extern const char *plugin_api_infolist_fields (struct t_infolist *infolist);
extern int plugin_api_infolist_integer (struct t_infolist *infolist,
const char *var);
-extern char *plugin_api_infolist_string (struct t_infolist *infolist,
- const char *var);
+extern const char *plugin_api_infolist_string (struct t_infolist *infolist,
+ const char *var);
extern void *plugin_api_infolist_pointer (struct t_infolist *infolist,
const char *var);
extern void *plugin_api_infolist_buffer (struct t_infolist *infolist,
diff --git a/src/plugins/plugin.c b/src/plugins/plugin.c
index 8b0ff44fb..784d31604 100644
--- a/src/plugins/plugin.c
+++ b/src/plugins/plugin.c
@@ -114,7 +114,7 @@ plugin_search (const char *name)
* plugin_get_name: get name of plugin with a pointer
*/
-char *
+const char *
plugin_get_name (struct t_weechat_plugin *plugin)
{
static char *plugin_core = PLUGIN_CORE;
diff --git a/src/plugins/plugin.h b/src/plugins/plugin.h
index 875f4288a..54c302279 100644
--- a/src/plugins/plugin.h
+++ b/src/plugins/plugin.h
@@ -33,7 +33,7 @@ extern struct t_weechat_plugin *last_weechat_plugin;
extern int plugin_valid (struct t_weechat_plugin *plugin);
extern struct t_weechat_plugin *plugin_search (const char *name);
-extern char *plugin_get_name (struct t_weechat_plugin *plugin);
+extern const char *plugin_get_name (struct t_weechat_plugin *plugin);
extern struct t_weechat_plugin *plugin_load (const char *filename);
extern void plugin_auto_load ();
extern void plugin_remove (struct t_weechat_plugin *plugin);
diff --git a/src/plugins/scripts/lua/weechat-lua-api.c b/src/plugins/scripts/lua/weechat-lua-api.c
index 5f79c6e16..77d1432e6 100644
--- a/src/plugins/scripts/lua/weechat-lua-api.c
+++ b/src/plugins/scripts/lua/weechat-lua-api.c
@@ -140,8 +140,7 @@ weechat_lua_api_register (lua_State *L)
static int
weechat_lua_api_plugin_get_name (lua_State *L)
{
- const char *plugin;
- char *result;
+ const char *plugin, *result;
int n;
/* make C compiler happy */
@@ -293,8 +292,7 @@ weechat_lua_api_iconv_from_internal (lua_State *L)
static int
weechat_lua_api_gettext (lua_State *L)
{
- const char *string;
- char *result;
+ const char *string, *result;
int n;
/* make C compiler happy */
@@ -330,8 +328,7 @@ weechat_lua_api_gettext (lua_State *L)
static int
weechat_lua_api_ngettext (lua_State *L)
{
- const char *single, *plural;
- char *result;
+ const char *single, *plural, *result;
int n, count;
/* make C compiler happy */
@@ -788,8 +785,7 @@ weechat_lua_api_list_prev (lua_State *L)
static int
weechat_lua_api_list_string (lua_State *L)
{
- const char *item;
- char *result;
+ const char *item, *result;
int n;
/* make C compiler happy */
@@ -1848,8 +1844,7 @@ weechat_lua_api_config_integer (lua_State *L)
static int
weechat_lua_api_config_string (lua_State *L)
{
- const char *option;
- char *result;
+ const char *option, *result;
int n;
/* make C compiler happy */
@@ -1885,8 +1880,7 @@ weechat_lua_api_config_string (lua_State *L)
static int
weechat_lua_api_config_color (lua_State *L)
{
- const char *option;
- char *result;
+ const char *option, *result;
int n;
/* make C compiler happy */
@@ -2148,8 +2142,7 @@ weechat_lua_api_config_get (lua_State *L)
static int
weechat_lua_api_config_get_plugin (lua_State *L)
{
- const char *option;
- char *result;
+ const char *option, *result;
int n;
/* make C compiler happy */
@@ -2229,8 +2222,7 @@ weechat_lua_api_config_set_plugin (lua_State *L)
static int
weechat_lua_api_prefix (lua_State *L)
{
- const char *prefix;
- char *result;
+ const char *prefix, *result;
int n;
/* make C compiler happy */
@@ -2266,8 +2258,7 @@ weechat_lua_api_prefix (lua_State *L)
static int
weechat_lua_api_color (lua_State *L)
{
- const char *color;
- char *result;
+ const char *color, *result;
int n;
/* make C compiler happy */
@@ -3382,7 +3373,7 @@ weechat_lua_api_hook_modifier_exec (lua_State *L)
* weechat_lua_api_hook_info_cb: callback for info hooked
*/
-char *
+const char *
weechat_lua_api_hook_info_cb (void *data, const char *info_name,
const char *arguments)
{
@@ -3395,10 +3386,10 @@ weechat_lua_api_hook_info_cb (void *data, const char *info_name,
lua_argv[1] = (char *)arguments;
lua_argv[2] = NULL;
- return (char *)weechat_lua_exec (script_callback->script,
- WEECHAT_SCRIPT_EXEC_STRING,
- script_callback->function,
- lua_argv);
+ return (const char *)weechat_lua_exec (script_callback->script,
+ WEECHAT_SCRIPT_EXEC_STRING,
+ script_callback->function,
+ lua_argv);
}
/*
@@ -3882,8 +3873,7 @@ weechat_lua_api_buffer_get_integer (lua_State *L)
static int
weechat_lua_api_buffer_get_string (lua_State *L)
{
- const char *buffer, *property;
- char *result;
+ const char *buffer, *property, *result;
int n;
/* make C compiler happy */
@@ -3949,8 +3939,8 @@ weechat_lua_api_buffer_get_pointer (lua_State *L)
buffer = lua_tostring (lua_current_interpreter, -2);
property = lua_tostring (lua_current_interpreter, -1);
- result = script_ptr2str (weechat_buffer_get_string (script_str2ptr (buffer),
- property));
+ result = script_ptr2str (weechat_buffer_get_pointer (script_str2ptr (buffer),
+ property));
LUA_RETURN_STRING_FREE(result);
}
@@ -3994,6 +3984,124 @@ weechat_lua_api_buffer_set (lua_State *L)
LUA_RETURN_OK;
}
+/*
+ * weechat_lua_api_window_get_integer: get a window property as integer
+ */
+
+static int
+weechat_lua_api_window_get_integer (lua_State *L)
+{
+ const char *window, *property;
+ int n, value;
+
+ /* make C compiler happy */
+ (void) L;
+
+ if (!lua_current_script)
+ {
+ WEECHAT_SCRIPT_MSG_NOT_INITIALIZED("window_get_integer");
+ LUA_RETURN_INT(-1);
+ }
+
+ window = NULL;
+ property = NULL;
+
+ n = lua_gettop (lua_current_interpreter);
+
+ if (n < 2)
+ {
+ WEECHAT_SCRIPT_MSG_WRONG_ARGUMENTS("window_get_integer");
+ LUA_RETURN_INT(-1);
+ }
+
+ window = lua_tostring (lua_current_interpreter, -2);
+ property = lua_tostring (lua_current_interpreter, -1);
+
+ value = weechat_window_get_integer (script_str2ptr (window),
+ property);
+
+ LUA_RETURN_INT(value);
+}
+
+/*
+ * weechat_lua_api_window_get_string: get a window property as string
+ */
+
+static int
+weechat_lua_api_window_get_string (lua_State *L)
+{
+ const char *window, *property, *result;
+ int n;
+
+ /* make C compiler happy */
+ (void) L;
+
+ if (!lua_current_script)
+ {
+ WEECHAT_SCRIPT_MSG_NOT_INITIALIZED("window_get_string");
+ LUA_RETURN_EMPTY;
+ }
+
+ window = NULL;
+ property = NULL;
+
+ n = lua_gettop (lua_current_interpreter);
+
+ if (n < 2)
+ {
+ WEECHAT_SCRIPT_MSG_WRONG_ARGUMENTS("window_get_string");
+ LUA_RETURN_EMPTY;
+ }
+
+ window = lua_tostring (lua_current_interpreter, -2);
+ property = lua_tostring (lua_current_interpreter, -1);
+
+ result = weechat_window_get_string (script_str2ptr (window),
+ property);
+
+ LUA_RETURN_STRING(result);
+}
+
+/*
+ * weechat_lua_api_window_get_pointer: get a window property as pointer
+ */
+
+static int
+weechat_lua_api_window_get_pointer (lua_State *L)
+{
+ const char *window, *property;
+ char *result;
+ int n;
+
+ /* make C compiler happy */
+ (void) L;
+
+ if (!lua_current_script)
+ {
+ WEECHAT_SCRIPT_MSG_NOT_INITIALIZED("window_get_pointer");
+ LUA_RETURN_EMPTY;
+ }
+
+ window = NULL;
+ property = NULL;
+
+ n = lua_gettop (lua_current_interpreter);
+
+ if (n < 2)
+ {
+ WEECHAT_SCRIPT_MSG_WRONG_ARGUMENTS("window_get_pointer");
+ LUA_RETURN_EMPTY;
+ }
+
+ window = lua_tostring (lua_current_interpreter, -2);
+ property = lua_tostring (lua_current_interpreter, -1);
+
+ result = script_ptr2str (weechat_window_get_pointer (script_str2ptr (window),
+ property));
+
+ LUA_RETURN_STRING_FREE(result);
+}
+
/*
* weechat_lua_api_nicklist_add_group: add a group in nicklist
*/
@@ -4773,8 +4881,7 @@ weechat_lua_api_command (lua_State *L)
static int
weechat_lua_api_info_get (lua_State *L)
{
- const char *info_name, *arguments;
- char *result;
+ const char *info_name, *arguments, *result;
int n;
/* make C compiler happy */
@@ -5125,8 +5232,7 @@ weechat_lua_api_infolist_prev (lua_State *L)
static int
weechat_lua_api_infolist_fields (lua_State *L)
{
- const char *infolist;
- char *result;
+ const char *infolist, *result;
int n;
/* make C compiler happy */
@@ -5201,8 +5307,7 @@ weechat_lua_api_infolist_integer (lua_State *L)
static int
weechat_lua_api_infolist_string (lua_State *L)
{
- const char *infolist, *variable;
- char *result;
+ const char *infolist, *variable, *result;
int n;
/* make C compiler happy */
@@ -5788,6 +5893,9 @@ const struct luaL_reg weechat_lua_api_funcs[] = {
{ "buffer_get_string", &weechat_lua_api_buffer_get_string },
{ "buffer_get_pointer", &weechat_lua_api_buffer_get_pointer },
{ "buffer_set", &weechat_lua_api_buffer_set },
+ { "window_get_integer", &weechat_lua_api_window_get_integer },
+ { "window_get_string", &weechat_lua_api_window_get_string },
+ { "window_get_pointer", &weechat_lua_api_window_get_pointer },
{ "nicklist_add_group", &weechat_lua_api_nicklist_add_group },
{ "nicklist_search_group", &weechat_lua_api_nicklist_search_group },
{ "nicklist_add_nick", &weechat_lua_api_nicklist_add_nick },
diff --git a/src/plugins/scripts/perl/weechat-perl-api.c b/src/plugins/scripts/perl/weechat-perl-api.c
index 7f63d19f4..5e6dfd17e 100644
--- a/src/plugins/scripts/perl/weechat-perl-api.c
+++ b/src/plugins/scripts/perl/weechat-perl-api.c
@@ -130,7 +130,7 @@ static XS (XS_weechat_api_register)
static XS (XS_weechat_api_plugin_get_name)
{
- char *result;
+ const char *result;
dXSARGS;
/* make C compiler happy */
@@ -251,7 +251,7 @@ static XS (XS_weechat_api_iconv_from_internal)
static XS (XS_weechat_api_gettext)
{
- char *result;
+ const char *result;
dXSARGS;
/* make C compiler happy */
@@ -280,7 +280,8 @@ static XS (XS_weechat_api_gettext)
static XS (XS_weechat_api_ngettext)
{
- char *result, *single, *plural;
+ char *single, *plural;
+ const char *result;
dXSARGS;
/* make C compiler happy */
@@ -644,7 +645,7 @@ static XS (XS_weechat_api_list_prev)
static XS (XS_weechat_api_list_string)
{
- char *result;
+ const char *result;
dXSARGS;
/* make C compiler happy */
@@ -1554,7 +1555,7 @@ static XS (XS_weechat_api_config_integer)
static XS (XS_weechat_api_config_string)
{
- char *result;
+ const char *result;
dXSARGS;
/* make C compiler happy */
@@ -1583,7 +1584,7 @@ static XS (XS_weechat_api_config_string)
static XS (XS_weechat_api_config_color)
{
- char *result;
+ const char *result;
dXSARGS;
/* make C compiler happy */
@@ -1791,7 +1792,7 @@ static XS (XS_weechat_api_config_get)
static XS (XS_weechat_api_config_get_plugin)
{
- char *result;
+ const char *result;
dXSARGS;
/* make C compiler happy */
@@ -1857,7 +1858,7 @@ static XS (XS_weechat_api_config_set_plugin)
static XS (XS_weechat_api_prefix)
{
- char *result;
+ const char *result;
dXSARGS;
/* make C compiler happy */
@@ -1886,7 +1887,7 @@ static XS (XS_weechat_api_prefix)
static XS (XS_weechat_api_color)
{
- char *result;
+ const char *result;
dXSARGS;
/* make C compiler happy */
@@ -2838,7 +2839,7 @@ static XS (XS_weechat_api_hook_modifier_exec)
* weechat_perl_api_hook_info_cb: callback for info hooked
*/
-char *
+const char *
weechat_perl_api_hook_info_cb (void *data, const char *info_name,
const char *arguments)
{
@@ -2851,10 +2852,10 @@ weechat_perl_api_hook_info_cb (void *data, const char *info_name,
perl_argv[1] = (char *)arguments;
perl_argv[2] = NULL;
- return (char *)weechat_perl_exec (script_callback->script,
- WEECHAT_SCRIPT_EXEC_STRING,
- script_callback->function,
- perl_argv);
+ return (const char *)weechat_perl_exec (script_callback->script,
+ WEECHAT_SCRIPT_EXEC_STRING,
+ script_callback->function,
+ perl_argv);
}
/*
@@ -3272,7 +3273,8 @@ static XS (XS_weechat_api_buffer_get_integer)
static XS (XS_weechat_api_buffer_get_string)
{
- char *result, *buffer, *property;
+ char *buffer, *property;
+ const char *result;
dXSARGS;
/* make C compiler happy */
@@ -3361,6 +3363,102 @@ static XS (XS_weechat_api_buffer_set)
PERL_RETURN_OK;
}
+/*
+ * weechat::window_get_integer: get a window property as integer
+ */
+
+static XS (XS_weechat_api_window_get_integer)
+{
+ char *window, *property;
+ int value;
+ dXSARGS;
+
+ /* make C compiler happy */
+ (void) cv;
+
+ if (!perl_current_script)
+ {
+ WEECHAT_SCRIPT_MSG_NOT_INITIALIZED("window_get_integer");
+ PERL_RETURN_INT(-1);
+ }
+
+ if (items < 2)
+ {
+ WEECHAT_SCRIPT_MSG_WRONG_ARGUMENTS("window_get_integer");
+ PERL_RETURN_INT(-1);
+ }
+
+ window = SvPV (ST (0), PL_na);
+ property = SvPV (ST (1), PL_na);
+ value = weechat_window_get_integer (script_str2ptr (window), property);
+
+ PERL_RETURN_INT(value);
+}
+
+/*
+ * weechat::window_get_string: get a window property as string
+ */
+
+static XS (XS_weechat_api_window_get_string)
+{
+ char *window, *property;
+ const char *result;
+ dXSARGS;
+
+ /* make C compiler happy */
+ (void) cv;
+
+ if (!perl_current_script)
+ {
+ WEECHAT_SCRIPT_MSG_NOT_INITIALIZED("window_get_string");
+ PERL_RETURN_EMPTY;
+ }
+
+ if (items < 2)
+ {
+ WEECHAT_SCRIPT_MSG_WRONG_ARGUMENTS("window_get_string");
+ PERL_RETURN_EMPTY;
+ }
+
+ window = SvPV (ST (0), PL_na);
+ property = SvPV (ST (1), PL_na);
+ result = weechat_window_get_string (script_str2ptr (window), property);
+
+ PERL_RETURN_STRING(result);
+}
+
+/*
+ * weechat::window_get_pointer: get a window property as pointer
+ */
+
+static XS (XS_weechat_api_window_get_pointer)
+{
+ char *result, *window, *property;
+ dXSARGS;
+
+ /* make C compiler happy */
+ (void) cv;
+
+ if (!perl_current_script)
+ {
+ WEECHAT_SCRIPT_MSG_NOT_INITIALIZED("window_get_pointer");
+ PERL_RETURN_EMPTY;
+ }
+
+ if (items < 2)
+ {
+ WEECHAT_SCRIPT_MSG_WRONG_ARGUMENTS("window_get_pointer");
+ PERL_RETURN_EMPTY;
+ }
+
+ window = SvPV (ST (0), PL_na);
+ property = SvPV (ST (1), PL_na);
+ result = script_ptr2str (weechat_window_get_pointer (script_str2ptr (window),
+ property));
+
+ PERL_RETURN_STRING_FREE(result);
+}
+
/*
* weechat::nicklist_add_group: add a group in nicklist
*/
@@ -3981,7 +4079,7 @@ static XS (XS_weechat_api_command)
static XS (XS_weechat_api_info_get)
{
- char *result;
+ const char *result;
dXSARGS;
/* make C compiler happy */
@@ -4265,7 +4363,7 @@ static XS (XS_weechat_api_infolist_prev)
static XS (XS_weechat_api_infolist_fields)
{
- char *result;
+ const char *result;
dXSARGS;
/* make C compiler happy */
@@ -4327,7 +4425,7 @@ static XS (XS_weechat_api_infolist_integer)
static XS (XS_weechat_api_infolist_string)
{
char *infolist, *variable;
- char *result;
+ const char *result;
dXSARGS;
/* make C compiler happy */
@@ -4534,6 +4632,9 @@ weechat_perl_api_init (pTHX)
newXS ("weechat::buffer_get_string", XS_weechat_api_buffer_get_string, "weechat");
newXS ("weechat::buffer_get_pointer", XS_weechat_api_buffer_get_pointer, "weechat");
newXS ("weechat::buffer_set", XS_weechat_api_buffer_set, "weechat");
+ newXS ("weechat::window_get_integer", XS_weechat_api_window_get_integer, "weechat");
+ newXS ("weechat::window_get_string", XS_weechat_api_window_get_string, "weechat");
+ newXS ("weechat::window_get_pointer", XS_weechat_api_window_get_pointer, "weechat");
newXS ("weechat::nicklist_add_group", XS_weechat_api_nicklist_add_group, "weechat");
newXS ("weechat::nicklist_search_group", XS_weechat_api_nicklist_search_group, "weechat");
newXS ("weechat::nicklist_add_nick", XS_weechat_api_nicklist_add_nick, "weechat");
diff --git a/src/plugins/scripts/python/weechat-python-api.c b/src/plugins/scripts/python/weechat-python-api.c
index dd30e946a..872c3cbbd 100644
--- a/src/plugins/scripts/python/weechat-python-api.c
+++ b/src/plugins/scripts/python/weechat-python-api.c
@@ -123,7 +123,8 @@ weechat_python_api_register (PyObject *self, PyObject *args)
static PyObject *
weechat_python_api_plugin_get_name (PyObject *self, PyObject *args)
{
- char *plugin, *result;
+ char *plugin;
+ const char *result;
/* make C compiler happy */
(void) self;
@@ -253,7 +254,8 @@ weechat_python_api_iconv_from_internal (PyObject *self, PyObject *args)
static PyObject *
weechat_python_api_gettext (PyObject *self, PyObject *args)
{
- char *string, *result;
+ char *string;
+ const char *result;
/* make C compiler happy */
(void) self;
@@ -284,7 +286,8 @@ weechat_python_api_gettext (PyObject *self, PyObject *args)
static PyObject *
weechat_python_api_ngettext (PyObject *self, PyObject *args)
{
- char *single, *plural, *result;
+ char *single, *plural;
+ const char *result;
int count;
/* make C compiler happy */
@@ -681,7 +684,8 @@ weechat_python_api_list_prev (PyObject *self, PyObject *args)
static PyObject *
weechat_python_api_list_string (PyObject *self, PyObject *args)
{
- char *item, *result;
+ char *item;
+ const char *result;
/* make C compiler happy */
(void) self;
@@ -1641,7 +1645,8 @@ weechat_python_api_config_integer (PyObject *self, PyObject *args)
static PyObject *
weechat_python_api_config_string (PyObject *self, PyObject *args)
{
- char *option, *result;
+ char *option;
+ const char *result;
/* make C compiler happy */
(void) self;
@@ -1672,7 +1677,8 @@ weechat_python_api_config_string (PyObject *self, PyObject *args)
static PyObject *
weechat_python_api_config_color (PyObject *self, PyObject *args)
{
- char *option, *result;
+ char *option;
+ const char *result;
/* make C compiler happy */
(void) self;
@@ -1900,7 +1906,8 @@ weechat_python_api_config_get (PyObject *self, PyObject *args)
static PyObject *
weechat_python_api_config_get_plugin (PyObject *self, PyObject *args)
{
- char *option, *result;
+ char *option;
+ const char *result;
/* make C compiler happy */
(void) self;
@@ -1969,7 +1976,8 @@ weechat_python_api_config_set_plugin (PyObject *self, PyObject *args)
static PyObject *
weechat_python_api_prefix (PyObject *self, PyObject *args)
{
- char *prefix, *result;
+ char *prefix;
+ const char *result;
/* make C compiler happy */
(void) self;
@@ -2000,7 +2008,8 @@ weechat_python_api_prefix (PyObject *self, PyObject *args)
static PyObject *
weechat_python_api_color (PyObject *self, PyObject *args)
{
- char *color, *result;
+ char *color;
+ const char *result;
/* make C compiler happy */
(void) self;
@@ -3009,7 +3018,7 @@ weechat_python_api_hook_modifier_exec (PyObject *self, PyObject *args)
* weechat_python_api_hook_info_cb: callback for info hooked
*/
-char *
+const char *
weechat_python_api_hook_info_cb (void *data, const char *info_name,
const char *arguments)
{
@@ -3022,10 +3031,10 @@ weechat_python_api_hook_info_cb (void *data, const char *info_name,
python_argv[1] = (char *)arguments;
python_argv[2] = NULL;
- return (char *)weechat_python_exec (script_callback->script,
- WEECHAT_SCRIPT_EXEC_STRING,
- script_callback->function,
- python_argv);
+ return (const char *)weechat_python_exec (script_callback->script,
+ WEECHAT_SCRIPT_EXEC_STRING,
+ script_callback->function,
+ python_argv);
}
/*
@@ -3466,7 +3475,8 @@ weechat_python_api_buffer_get_integer (PyObject *self, PyObject *args)
static PyObject *
weechat_python_api_buffer_get_string (PyObject *self, PyObject *args)
{
- char *buffer, *property, *result;
+ char *buffer, *property;
+ const char *result;
/* make C compiler happy */
(void) self;
@@ -3560,6 +3570,106 @@ weechat_python_api_buffer_set (PyObject *self, PyObject *args)
PYTHON_RETURN_OK;
}
+/*
+ * weechat_python_api_window_get_integer get a window property as integer
+ */
+
+static PyObject *
+weechat_python_api_window_get_integer (PyObject *self, PyObject *args)
+{
+ char *window, *property;
+ int value;
+
+ /* make C compiler happy */
+ (void) self;
+
+ if (!python_current_script)
+ {
+ WEECHAT_SCRIPT_MSG_NOT_INITIALIZED("window_get_integer");
+ PYTHON_RETURN_INT(-1);
+ }
+
+ window = NULL;
+ property = NULL;
+
+ if (!PyArg_ParseTuple (args, "ss", &window, &property))
+ {
+ WEECHAT_SCRIPT_MSG_WRONG_ARGUMENTS("window_get_integer");
+ PYTHON_RETURN_INT(-1);
+ }
+
+ value = weechat_window_get_integer (script_str2ptr (window), property);
+
+ PYTHON_RETURN_INT(value);
+}
+
+/*
+ * weechat_python_api_window_get_string: get a window property as string
+ */
+
+static PyObject *
+weechat_python_api_window_get_string (PyObject *self, PyObject *args)
+{
+ char *window, *property;
+ const char *result;
+
+ /* make C compiler happy */
+ (void) self;
+
+ if (!python_current_script)
+ {
+ WEECHAT_SCRIPT_MSG_NOT_INITIALIZED("window_get_string");
+ PYTHON_RETURN_ERROR;
+ }
+
+ window = NULL;
+ property = NULL;
+
+ if (!PyArg_ParseTuple (args, "ss", &window, &property))
+ {
+ WEECHAT_SCRIPT_MSG_WRONG_ARGUMENTS("window_get_string");
+ PYTHON_RETURN_EMPTY;
+ }
+
+ result = weechat_window_get_string (script_str2ptr (window), property);
+
+ PYTHON_RETURN_STRING(result);
+}
+
+/*
+ * weechat_python_api_window_get_pointer: get a window property as pointer
+ */
+
+static PyObject *
+weechat_python_api_window_get_pointer (PyObject *self, PyObject *args)
+{
+ char *window, *property, *result;
+ PyObject *object;
+
+ /* make C compiler happy */
+ (void) self;
+
+ if (!python_current_script)
+ {
+ WEECHAT_SCRIPT_MSG_NOT_INITIALIZED("window_get_pointer");
+ PYTHON_RETURN_ERROR;
+ }
+
+ window = NULL;
+ property = NULL;
+
+ if (!PyArg_ParseTuple (args, "ss", &window, &property))
+ {
+ WEECHAT_SCRIPT_MSG_WRONG_ARGUMENTS("window_get_pointer");
+ PYTHON_RETURN_EMPTY;
+ }
+
+ result = script_ptr2str (weechat_window_get_pointer (script_str2ptr (window),
+ property));
+
+ PYTHON_RETURN_STRING_FREE(result);
+}
+
/*
* weechat_python_api_nicklist_add_group: add a group in nicklist
*/
@@ -4229,7 +4339,8 @@ weechat_python_api_command (PyObject *self, PyObject *args)
static PyObject *
weechat_python_api_info_get (PyObject *self, PyObject *args)
{
- char *info_name, *arguments, *result;
+ char *info_name, *arguments;
+ const char *result;
/* make C compiler happy */
(void) self;
@@ -4535,7 +4646,8 @@ weechat_python_api_infolist_prev (PyObject *self, PyObject *args)
static PyObject *
weechat_python_api_infolist_fields (PyObject *self, PyObject *args)
{
- char *infolist, *result;
+ char *infolist;
+ const char *result;
/* make C compiler happy */
(void) self;
@@ -4600,7 +4712,8 @@ weechat_python_api_infolist_integer (PyObject *self, PyObject *args)
static PyObject *
weechat_python_api_infolist_string (PyObject *self, PyObject *args)
{
- char *infolist, *variable, *result;
+ char *infolist, *variable;
+ const char *result;
/* make C compiler happy */
(void) self;
@@ -4654,8 +4767,8 @@ weechat_python_api_infolist_pointer (PyObject *self, PyObject *args)
PYTHON_RETURN_EMPTY;
}
- result = script_ptr2str (weechat_infolist_string (script_str2ptr (infolist),
- variable));
+ result = script_ptr2str (weechat_infolist_pointer (script_str2ptr (infolist),
+ variable));
PYTHON_RETURN_STRING_FREE(result);
}
@@ -4810,6 +4923,9 @@ PyMethodDef weechat_python_funcs[] =
{ "buffer_get_string", &weechat_python_api_buffer_get_string, METH_VARARGS, "" },
{ "buffer_get_pointer", &weechat_python_api_buffer_get_pointer, METH_VARARGS, "" },
{ "buffer_set", &weechat_python_api_buffer_set, METH_VARARGS, "" },
+ { "window_get_integer", &weechat_python_api_window_get_integer, METH_VARARGS, "" },
+ { "window_get_string", &weechat_python_api_window_get_string, METH_VARARGS, "" },
+ { "window_get_pointer", &weechat_python_api_window_get_pointer, METH_VARARGS, "" },
{ "nicklist_add_group", &weechat_python_api_nicklist_add_group, METH_VARARGS, "" },
{ "nicklist_search_group", &weechat_python_api_nicklist_search_group, METH_VARARGS, "" },
{ "nicklist_add_nick", &weechat_python_api_nicklist_add_nick, METH_VARARGS, "" },
diff --git a/src/plugins/scripts/python/weechat-python.c b/src/plugins/scripts/python/weechat-python.c
index ea0fe9bce..e43deffe4 100644
--- a/src/plugins/scripts/python/weechat-python.c
+++ b/src/plugins/scripts/python/weechat-python.c
@@ -263,7 +263,8 @@ weechat_python_load (const char *filename)
PyThreadState *python_current_interpreter;
PyObject *weechat_module, *weechat_outputs, *weechat_dict;
PyObject *python_path, *path;
- char *w_home, *p_home;
+ const char *weechat_home;
+ char *p_home;
int len;
if ((fp = fopen (filename, "r")) == NULL)
@@ -315,14 +316,14 @@ weechat_python_load (const char *filename)
/* adding $weechat_dir/python in $PYTHONPATH */
python_path = PySys_GetObject ("path");
- w_home = weechat_info_get ("weechat_dir", "");
- if (w_home)
+ weechat_home = weechat_info_get ("weechat_dir", "");
+ if (weechat_home)
{
- len = strlen (w_home) + 1 + strlen(PYTHON_PLUGIN_NAME) + 1;
+ len = strlen (weechat_home) + 1 + strlen(PYTHON_PLUGIN_NAME) + 1;
p_home = malloc (len);
if (p_home)
{
- snprintf (p_home, len, "%s/python", w_home);
+ snprintf (p_home, len, "%s/python", weechat_home);
path = PyString_FromString (p_home);
if (path != NULL)
{
diff --git a/src/plugins/scripts/ruby/weechat-ruby-api.c b/src/plugins/scripts/ruby/weechat-ruby-api.c
index 956cadbb9..f2433becb 100644
--- a/src/plugins/scripts/ruby/weechat-ruby-api.c
+++ b/src/plugins/scripts/ruby/weechat-ruby-api.c
@@ -141,7 +141,8 @@ weechat_ruby_api_register (VALUE class, VALUE name, VALUE author,
static VALUE
weechat_ruby_api_plugin_get_name (VALUE class, VALUE plugin)
{
- char *c_plugin, *result;
+ char *c_plugin;
+ const char *result;
/* make C compiler happy */
(void) class;
@@ -290,7 +291,8 @@ weechat_ruby_api_iconv_from_internal (VALUE class, VALUE charset, VALUE string)
static VALUE
weechat_ruby_api_gettext (VALUE class, VALUE string)
{
- char *c_string, *result;
+ char *c_string;
+ const char *result;
/* make C compiler happy */
(void) class;
@@ -326,7 +328,8 @@ static VALUE
weechat_ruby_api_ngettext (VALUE class, VALUE single, VALUE plural,
VALUE count)
{
- char *c_single, *c_plural, *result;
+ char *c_single, *c_plural;
+ const char *result;
int c_count;
/* make C compiler happy */
@@ -782,7 +785,8 @@ weechat_ruby_api_list_prev (VALUE class, VALUE item)
static VALUE
weechat_ruby_api_list_string (VALUE class, VALUE item)
{
- char *c_item, *result;
+ char *c_item;
+ const char *result;
/* make C compiler happy */
(void) class;
@@ -1889,7 +1893,8 @@ weechat_ruby_api_config_integer (VALUE class, VALUE option)
static VALUE
weechat_ruby_api_config_string (VALUE class, VALUE option)
{
- char *c_option, *result;
+ char *c_option;
+ const char *result;
/* make C compiler happy */
(void) class;
@@ -1924,7 +1929,8 @@ weechat_ruby_api_config_string (VALUE class, VALUE option)
static VALUE
weechat_ruby_api_config_color (VALUE class, VALUE option)
{
- char *c_option, *result;
+ char *c_option;
+ const char *result;
/* make C compiler happy */
(void) class;
@@ -2183,7 +2189,8 @@ weechat_ruby_api_config_get (VALUE class, VALUE option)
static VALUE
weechat_ruby_api_config_get_plugin (VALUE class, VALUE option)
{
- char *c_option, *result;
+ char *c_option;
+ const char *result;
/* make C compiler happy */
(void) class;
@@ -2257,7 +2264,8 @@ weechat_ruby_api_config_set_plugin (VALUE class, VALUE option, VALUE value)
static VALUE
weechat_ruby_api_prefix (VALUE class, VALUE prefix)
{
- char *c_prefix, *result;
+ char *c_prefix;
+ const char *result;
/* make C compiler happy */
(void) class;
@@ -2292,7 +2300,8 @@ weechat_ruby_api_prefix (VALUE class, VALUE prefix)
static VALUE
weechat_ruby_api_color (VALUE class, VALUE color)
{
- char *c_color, *result;
+ char *c_color;
+ const char *result;
/* make C compiler happy */
(void) class;
@@ -3457,7 +3466,7 @@ weechat_ruby_api_hook_modifier_exec (VALUE class, VALUE modifier,
* weechat_ruby_api_hook_info_cb: callback for info hooked
*/
-char *
+const char *
weechat_ruby_api_hook_info_cb (void *data, const char *info_name,
const char *arguments)
{
@@ -3470,10 +3479,10 @@ weechat_ruby_api_hook_info_cb (void *data, const char *info_name,
ruby_argv[1] = (char *)arguments;
ruby_argv[2] = NULL;
- return (char *)weechat_ruby_exec (script_callback->script,
- WEECHAT_SCRIPT_EXEC_STRING,
- script_callback->function,
- ruby_argv);
+ return (const char *)weechat_ruby_exec (script_callback->script,
+ WEECHAT_SCRIPT_EXEC_STRING,
+ script_callback->function,
+ ruby_argv);
}
/*
@@ -3964,7 +3973,8 @@ weechat_ruby_api_buffer_get_integer (VALUE class, VALUE buffer, VALUE property)
static VALUE
weechat_ruby_api_buffer_get_string (VALUE class, VALUE buffer, VALUE property)
{
- char *c_buffer, *c_property, *result;
+ char *c_buffer, *c_property;
+ const char *result;
/* make C compiler happy */
(void) class;
@@ -4024,8 +4034,8 @@ weechat_ruby_api_buffer_get_pointer (VALUE class, VALUE buffer, VALUE property)
c_buffer = STR2CSTR (buffer);
c_property = STR2CSTR (property);
- result = script_ptr2str (weechat_buffer_get_string (script_str2ptr (c_buffer),
- c_property));
+ result = script_ptr2str (weechat_buffer_get_pointer (script_str2ptr (c_buffer),
+ c_property));
RUBY_RETURN_STRING_FREE(result);
}
@@ -4070,6 +4080,117 @@ weechat_ruby_api_buffer_set (VALUE class, VALUE buffer, VALUE property,
RUBY_RETURN_OK;
}
+/*
+ * weechat_ruby_api_window_get_integer: get a window property as integer
+ */
+
+static VALUE
+weechat_ruby_api_window_get_integer (VALUE class, VALUE window, VALUE property)
+{
+ char *c_window, *c_property;
+ int value;
+
+ /* make C compiler happy */
+ (void) class;
+
+ if (!ruby_current_script)
+ {
+ WEECHAT_SCRIPT_MSG_NOT_INITIALIZED("window_get_integer");
+ RUBY_RETURN_INT(-1);
+ }
+
+ if (NIL_P (window) || NIL_P (property))
+ {
+ WEECHAT_SCRIPT_MSG_WRONG_ARGUMENTS("window_get_integer");
+ RUBY_RETURN_INT(-1);
+ }
+
+ Check_Type (window, T_STRING);
+ Check_Type (property, T_STRING);
+
+ c_window = STR2CSTR (window);
+ c_property = STR2CSTR (property);
+
+ value = weechat_window_get_integer (script_str2ptr (c_window),
+ c_property);
+
+ RUBY_RETURN_INT(value);
+}
+
+/*
+ * weechat_ruby_api_window_get_string: get a window property as string
+ */
+
+static VALUE
+weechat_ruby_api_window_get_string (VALUE class, VALUE window, VALUE property)
+{
+ char *c_window, *c_property;
+ const char *result;
+
+ /* make C compiler happy */
+ (void) class;
+
+ if (!ruby_current_script)
+ {
+ WEECHAT_SCRIPT_MSG_NOT_INITIALIZED("window_get_string");
+ RUBY_RETURN_EMPTY;
+ }
+
+ if (NIL_P (window) || NIL_P (property))
+ {
+ WEECHAT_SCRIPT_MSG_WRONG_ARGUMENTS("window_get_string");
+ RUBY_RETURN_EMPTY;
+ }
+
+ Check_Type (window, T_STRING);
+ Check_Type (property, T_STRING);
+
+ c_window = STR2CSTR (window);
+ c_property = STR2CSTR (property);
+
+ result = weechat_window_get_string (script_str2ptr (c_window),
+ c_property);
+
+ RUBY_RETURN_STRING(result);
+}
+
+/*
+ * weechat_ruby_api_window_get_pointer: get a window property as pointer
+ */
+
+static VALUE
+weechat_ruby_api_window_get_pointer (VALUE class, VALUE window, VALUE property)
+{
+ char *c_window, *c_property, *result;
+ VALUE return_value;
+
+ /* make C compiler happy */
+ (void) class;
+
+ if (!ruby_current_script)
+ {
+ WEECHAT_SCRIPT_MSG_NOT_INITIALIZED("window_get_pointer");
+ RUBY_RETURN_EMPTY;
+ }
+
+ if (NIL_P (window) || NIL_P (property))
+ {
+ WEECHAT_SCRIPT_MSG_WRONG_ARGUMENTS("window_get_pointer");
+ RUBY_RETURN_EMPTY;
+ }
+
+ Check_Type (window, T_STRING);
+ Check_Type (property, T_STRING);
+
+ c_window = STR2CSTR (window);
+ c_property = STR2CSTR (property);
+
+ result = script_ptr2str (weechat_window_get_pointer (script_str2ptr (c_window),
+ c_property));
+
+ RUBY_RETURN_STRING_FREE(result);
+}
+
/*
* weechat_ruby_api_nicklist_add_group: add a group in nicklist
*/
@@ -4865,7 +4986,8 @@ weechat_ruby_api_command (VALUE class, VALUE buffer, VALUE command)
static VALUE
weechat_ruby_api_info_get (VALUE class, VALUE info_name, VALUE arguments)
{
- char *c_info_name, *c_arguments, *result;
+ char *c_info_name, *c_arguments;
+ const char *result;
/* make C compiler happy */
(void) class;
@@ -5037,9 +5159,9 @@ weechat_ruby_api_infolist_new_var_pointer (VALUE class, VALUE infolist,
c_name = STR2CSTR (name);
c_value = STR2CSTR (value);
- result = script_ptr2str (weechat_infolist_new_var_string (script_str2ptr (c_infolist),
- c_name,
- script_str2ptr (c_value)));
+ result = script_ptr2str (weechat_infolist_new_var_pointer (script_str2ptr (c_infolist),
+ c_name,
+ script_str2ptr (c_value)));
RUBY_RETURN_STRING_FREE(result);
}
@@ -5202,7 +5324,8 @@ weechat_ruby_api_infolist_prev (VALUE class, VALUE infolist)
static VALUE
weechat_ruby_api_infolist_fields (VALUE class, VALUE infolist)
{
- char *c_infolist, *result;
+ char *c_infolist;
+ const char *result;
/* make C compiler happy */
(void) class;
@@ -5271,7 +5394,8 @@ weechat_ruby_api_infolist_integer (VALUE class, VALUE infolist, VALUE variable)
static VALUE
weechat_ruby_api_infolist_string (VALUE class, VALUE infolist, VALUE variable)
{
- char *c_infolist, *c_variable, *result;
+ char *c_infolist, *c_variable;
+ const char *result;
/* make C compiler happy */
(void) class;
@@ -5531,6 +5655,9 @@ weechat_ruby_api_init (VALUE ruby_mWeechat)
rb_define_module_function (ruby_mWeechat, "buffer_get_string", &weechat_ruby_api_buffer_get_string, 2);
rb_define_module_function (ruby_mWeechat, "buffer_get_pointer", &weechat_ruby_api_buffer_get_pointer, 2);
rb_define_module_function (ruby_mWeechat, "buffer_set", &weechat_ruby_api_buffer_set, 3);
+ rb_define_module_function (ruby_mWeechat, "window_get_integer", &weechat_ruby_api_window_get_integer, 2);
+ rb_define_module_function (ruby_mWeechat, "window_get_string", &weechat_ruby_api_window_get_string, 2);
+ rb_define_module_function (ruby_mWeechat, "window_get_pointer", &weechat_ruby_api_window_get_pointer, 2);
rb_define_module_function (ruby_mWeechat, "nicklist_add_group", &weechat_ruby_api_nicklist_add_group, 5);
rb_define_module_function (ruby_mWeechat, "nicklist_search_group", &weechat_ruby_api_nicklist_search_group, 3);
rb_define_module_function (ruby_mWeechat, "nicklist_add_nick", &weechat_ruby_api_nicklist_add_nick, 7);
diff --git a/src/plugins/scripts/script-api.c b/src/plugins/scripts/script-api.c
index 6a0e7d6b4..c1b17bb60 100644
--- a/src/plugins/scripts/script-api.c
+++ b/src/plugins/scripts/script-api.c
@@ -980,9 +980,9 @@ script_api_hook_info (struct t_weechat_plugin *weechat_plugin,
struct t_plugin_script *script,
const char *info_name,
const char *description,
- char *(*callback)(void *data,
- const char *info_name,
- const char *arguments),
+ const char *(*callback)(void *data,
+ const char *info_name,
+ const char *arguments),
const char *function)
{
struct t_script_callback *new_script_callback;
@@ -1316,12 +1316,13 @@ script_api_command (struct t_weechat_plugin *weechat_plugin,
* format in file is: plugin.script.option = value
*/
-char *
+const char *
script_api_config_get_plugin (struct t_weechat_plugin *weechat_plugin,
struct t_plugin_script *script,
const char *option)
{
- char *option_fullname, *return_value;
+ char *option_fullname;
+ const char *return_value;
option_fullname = malloc ((strlen (script->name) +
strlen (option) + 2));
diff --git a/src/plugins/scripts/script-api.h b/src/plugins/scripts/script-api.h
index 3633044ff..2b7da7c2a 100644
--- a/src/plugins/scripts/script-api.h
+++ b/src/plugins/scripts/script-api.h
@@ -180,9 +180,9 @@ extern struct t_hook *script_api_hook_info (struct t_weechat_plugin *weechat_plu
struct t_plugin_script *script,
const char *info_name,
const char *description,
- char *(*callback)(void *data,
- const char *info_name,
- const char *arguments),
+ const char *(*callback)(void *data,
+ const char *info_name,
+ const char *arguments),
const char *function);
extern struct t_hook *script_api_hook_infolist (struct t_weechat_plugin *weechat_plugin,
struct t_plugin_script *script,
@@ -227,9 +227,9 @@ extern void script_api_command (struct t_weechat_plugin *weechat_plugin,
struct t_plugin_script *script,
struct t_gui_buffer *buffer,
const char *command);
-extern char *script_api_config_get_plugin (struct t_weechat_plugin *weechat_plugin,
- struct t_plugin_script *script,
- const char *option);
+extern const char *script_api_config_get_plugin (struct t_weechat_plugin *weechat_plugin,
+ struct t_plugin_script *script,
+ const char *option);
extern int script_api_config_set_plugin (struct t_weechat_plugin *weechat_plugin,
struct t_plugin_script *script,
const char *option, const char *value);
diff --git a/src/plugins/scripts/script.c b/src/plugins/scripts/script.c
index 4497d9591..9407456bc 100644
--- a/src/plugins/scripts/script.c
+++ b/src/plugins/scripts/script.c
@@ -44,7 +44,7 @@ int script_option_check_license = 0;
void
script_config_read (struct t_weechat_plugin *weechat_plugin)
{
- char *string;
+ const char *string;
string = weechat_config_get_plugin (SCRIPT_OPTION_CHECK_LICENSE);
if (!string)
@@ -210,7 +210,8 @@ void
script_auto_load (struct t_weechat_plugin *weechat_plugin,
void (*callback)(void *data, const char *filename))
{
- char *dir_home, *dir_name;
+ const char *dir_home;
+ char *dir_name;
int dir_length;
/* build directory, adding WeeChat home */
@@ -258,7 +259,8 @@ char *
script_search_full_name (struct t_weechat_plugin *weechat_plugin,
const char *filename)
{
- char *final_name, *dir_home, *dir_system;
+ char *final_name;
+ const char *dir_home, *dir_system;
int length;
struct stat st;
diff --git a/src/plugins/scripts/tcl/weechat-tcl-api.c b/src/plugins/scripts/tcl/weechat-tcl-api.c
index e12dc4e44..5d5818b02 100644
--- a/src/plugins/scripts/tcl/weechat-tcl-api.c
+++ b/src/plugins/scripts/tcl/weechat-tcl-api.c
@@ -229,9 +229,10 @@ weechat_tcl_api_plugin_get_name (ClientData clientData, Tcl_Interp *interp,
int objc, Tcl_Obj *CONST objv[])
{
Tcl_Obj* objp;
- char *result, *plugin;
+ char *plugin;
+ const char *result;
int i;
-
+
/* make C compiler happy */
(void) clientData;
@@ -365,9 +366,9 @@ weechat_tcl_api_gettext (ClientData clientData, Tcl_Interp *interp,
int objc, Tcl_Obj *CONST objv[])
{
Tcl_Obj* objp;
- char *result;
+ const char *result;
int i;
-
+
/* make C compiler happy */
(void) clientData;
@@ -397,7 +398,8 @@ weechat_tcl_api_ngettext (ClientData clientData, Tcl_Interp *interp,
int objc, Tcl_Obj *CONST objv[])
{
Tcl_Obj* objp;
- char *result, *single, *plural;
+ char *single, *plural;
+ const char *result;
int i, count;
/* make C compiler happy */
@@ -828,9 +830,9 @@ weechat_tcl_api_list_string (ClientData clientData, Tcl_Interp *interp,
int objc, Tcl_Obj *CONST objv[])
{
Tcl_Obj* objp;
- char *result;
+ const char *result;
int i;
-
+
/* make C compiler happy */
(void) clientData;
@@ -1823,7 +1825,7 @@ weechat_tcl_api_config_string (ClientData clientData, Tcl_Interp *interp,
int objc, Tcl_Obj *CONST objv[])
{
Tcl_Obj *objp;
- char *result;
+ const char *result;
int i;
/* make C compiler happy */
@@ -1855,7 +1857,7 @@ weechat_tcl_api_config_color (ClientData clientData, Tcl_Interp *interp,
int objc, Tcl_Obj *CONST objv[])
{
Tcl_Obj *objp;
- char *result;
+ const char *result;
int i;
/* make C compiler happy */
@@ -2084,7 +2086,7 @@ weechat_tcl_api_config_get_plugin (ClientData clientData, Tcl_Interp *interp,
int objc, Tcl_Obj *CONST objv[])
{
Tcl_Obj *objp;
- char *result;
+ const char *result;
int i;
/* make C compiler happy */
@@ -2156,7 +2158,7 @@ weechat_tcl_api_prefix (ClientData clientData, Tcl_Interp *interp,
int objc, Tcl_Obj *CONST objv[])
{
Tcl_Obj *objp;
- char *result;
+ const char *result;
int i;
/* make C compiler happy */
@@ -2188,7 +2190,7 @@ weechat_tcl_api_color (ClientData clientData, Tcl_Interp *interp,
int objc, Tcl_Obj *CONST objv[])
{
Tcl_Obj *objp;
- char *result;
+ const char *result;
int i;
/* make C compiler happy */
@@ -3248,7 +3250,7 @@ weechat_tcl_api_hook_modifier_exec (ClientData clientData, Tcl_Interp *interp,
* weechat_tcl_api_hook_info_cb: callback for info hooked
*/
-char *
+const char *
weechat_tcl_api_hook_info_cb (void *data, const char *info_name,
const char *arguments)
{
@@ -3261,10 +3263,10 @@ weechat_tcl_api_hook_info_cb (void *data, const char *info_name,
tcl_argv[1] = (char *)arguments;
tcl_argv[2] = NULL;
- return (char *)weechat_tcl_exec (script_callback->script,
- WEECHAT_SCRIPT_EXEC_STRING,
- script_callback->function,
- tcl_argv);
+ return (const char *)weechat_tcl_exec (script_callback->script,
+ WEECHAT_SCRIPT_EXEC_STRING,
+ script_callback->function,
+ tcl_argv);
}
/*
@@ -3722,7 +3724,8 @@ weechat_tcl_api_buffer_get_string (ClientData clientData, Tcl_Interp *interp,
int objc, Tcl_Obj *CONST objv[])
{
Tcl_Obj *objp;
- char *result, *buffer, *property;
+ char *buffer, *property;
+ const char *result;
int i;
/* make C compiler happy */
@@ -3757,7 +3760,7 @@ weechat_tcl_api_buffer_get_pointer (ClientData clientData, Tcl_Interp *interp,
int objc, Tcl_Obj *CONST objv[])
{
Tcl_Obj *objp;
- char *result, *buffer, *property;
+ char *buffer, *property, *result;
int i;
/* make C compiler happy */
@@ -3820,6 +3823,114 @@ weechat_tcl_api_buffer_set (ClientData clientData, Tcl_Interp *interp,
TCL_RETURN_OK;
}
+/*
+ * weechat_tcl_api_window_get_integer: get a window property as integer
+ */
+
+static int
+weechat_tcl_api_window_get_integer (ClientData clientData, Tcl_Interp *interp,
+ int objc, Tcl_Obj *CONST objv[])
+{
+ Tcl_Obj *objp;
+ char *window, *property;
+ int result;
+ int i;
+
+ /* make C compiler happy */
+ (void) clientData;
+
+ if (!tcl_current_script)
+ {
+ WEECHAT_SCRIPT_MSG_NOT_INITIALIZED("window_get_integer");
+ TCL_RETURN_INT(-1);
+ }
+
+ if (objc < 3)
+ {
+ WEECHAT_SCRIPT_MSG_WRONG_ARGUMENTS("window_get_integer");
+ TCL_RETURN_INT(-1);
+ }
+
+ window = Tcl_GetStringFromObj (objv[1], &i);
+ property = Tcl_GetStringFromObj (objv[2], &i);
+
+ result = weechat_window_get_integer (script_str2ptr (window), property);
+
+ TCL_RETURN_INT(result);
+}
+
+/*
+ * weechat_tcl_api_window_get_string: get a window property as string
+ */
+
+static int
+weechat_tcl_api_window_get_string (ClientData clientData, Tcl_Interp *interp,
+ int objc, Tcl_Obj *CONST objv[])
+{
+ Tcl_Obj *objp;
+ char *window, *property;
+ const char *result;
+ int i;
+
+ /* make C compiler happy */
+ (void) clientData;
+
+ if (!tcl_current_script)
+ {
+ WEECHAT_SCRIPT_MSG_NOT_INITIALIZED("window_get_string");
+ TCL_RETURN_EMPTY;
+ }
+
+ if (objc < 3)
+ {
+ WEECHAT_SCRIPT_MSG_WRONG_ARGUMENTS("window_get_string");
+ TCL_RETURN_EMPTY;
+ }
+
+ window = Tcl_GetStringFromObj (objv[1], &i);
+ property = Tcl_GetStringFromObj (objv[2], &i);
+
+ result = weechat_window_get_string (script_str2ptr (window), property);
+
+ TCL_RETURN_STRING(result);
+}
+
+/*
+ * weechat_tcl_api_window_get_pointer: get a window property as pointer
+ */
+
+static int
+weechat_tcl_api_window_get_pointer (ClientData clientData, Tcl_Interp *interp,
+ int objc, Tcl_Obj *CONST objv[])
+{
+ Tcl_Obj *objp;
+ char *window, *property, *result;
+ int i;
+
+ /* make C compiler happy */
+ (void) clientData;
+
+ if (!tcl_current_script)
+ {
+ WEECHAT_SCRIPT_MSG_NOT_INITIALIZED("window_get_pointer");
+ TCL_RETURN_EMPTY;
+ }
+
+ if (objc < 2)
+ {
+ WEECHAT_SCRIPT_MSG_WRONG_ARGUMENTS("window_get_pointer");
+ TCL_RETURN_EMPTY;
+ }
+
+ window = Tcl_GetStringFromObj (objv[1], &i);
+ property = Tcl_GetStringFromObj (objv[2], &i);
+
+ result = script_ptr2str (weechat_window_get_pointer (script_str2ptr (window),
+ property));
+
+ TCL_RETURN_STRING_FREE(result);
+}
+
/*
* weechat_tcl_api_nicklist_add_group: add a group in nicklist
*/
@@ -4507,7 +4618,7 @@ weechat_tcl_api_info_get (ClientData clientData, Tcl_Interp *interp,
int objc, Tcl_Obj *CONST objv[])
{
Tcl_Obj *objp;
- char *result;
+ const char *result;
int i;
/* make C compiler happy */
@@ -4661,9 +4772,9 @@ weechat_tcl_api_infolist_new_var_pointer (ClientData clientData, Tcl_Interp *int
TCL_RETURN_INT(0);
}
- result = script_ptr2str (weechat_infolist_new_var_string (script_str2ptr (Tcl_GetStringFromObj (objv[1], &i)), /* infolist */
- Tcl_GetStringFromObj (objv[2], &i), /* name */
- script_str2ptr (Tcl_GetStringFromObj (objv[3], &i)))); /* value */
+ result = script_ptr2str (weechat_infolist_new_var_pointer (script_str2ptr (Tcl_GetStringFromObj (objv[1], &i)), /* infolist */
+ Tcl_GetStringFromObj (objv[2], &i), /* name */
+ script_str2ptr (Tcl_GetStringFromObj (objv[3], &i)))); /* value */
TCL_RETURN_STRING_FREE(result);
}
@@ -4818,7 +4929,7 @@ weechat_tcl_api_infolist_fields (ClientData clientData, Tcl_Interp *interp,
int objc, Tcl_Obj *CONST objv[])
{
Tcl_Obj *objp;
- char *result;
+ const char *result;
int i;
/* make C compiler happy */
@@ -4886,7 +4997,8 @@ weechat_tcl_api_infolist_string (ClientData clientData, Tcl_Interp *interp,
int objc, Tcl_Obj *CONST objv[])
{
Tcl_Obj *objp;
- char *infolist, *variable, *result;
+ char *infolist, *variable;
+ const char *result;
int i;
/* make C compiler happy */
@@ -5271,6 +5383,12 @@ void weechat_tcl_api_init (Tcl_Interp *interp) {
weechat_tcl_api_buffer_get_pointer, (ClientData)NULL, (Tcl_CmdDeleteProc*)NULL);
Tcl_CreateObjCommand (interp,"weechat::buffer_set",
weechat_tcl_api_buffer_set, (ClientData)NULL, (Tcl_CmdDeleteProc*)NULL);
+ Tcl_CreateObjCommand (interp,"weechat::window_get_integer",
+ weechat_tcl_api_window_get_integer, (ClientData)NULL, (Tcl_CmdDeleteProc*)NULL);
+ Tcl_CreateObjCommand (interp,"weechat::window_get_string",
+ weechat_tcl_api_window_get_string, (ClientData)NULL, (Tcl_CmdDeleteProc*)NULL);
+ Tcl_CreateObjCommand (interp,"weechat::window_get_pointer",
+ weechat_tcl_api_window_get_pointer, (ClientData)NULL, (Tcl_CmdDeleteProc*)NULL);
Tcl_CreateObjCommand (interp,"weechat::nicklist_add_group",
weechat_tcl_api_nicklist_add_group, (ClientData)NULL, (Tcl_CmdDeleteProc*)NULL);
Tcl_CreateObjCommand (interp,"weechat::nicklist_search_group",
diff --git a/src/plugins/weechat-plugin.h b/src/plugins/weechat-plugin.h
index e772308bf..657bd6c7d 100644
--- a/src/plugins/weechat-plugin.h
+++ b/src/plugins/weechat-plugin.h
@@ -122,14 +122,14 @@ struct t_weechat_plugin
existing plugins */
/* plugins */
- char *(*plugin_get_name) (struct t_weechat_plugin *plugin);
+ const char *(*plugin_get_name) (struct t_weechat_plugin *plugin);
/* strings */
void (*charset_set) (struct t_weechat_plugin *plugin, const char *charset);
char *(*iconv_to_internal) (const char *charset, const char *string);
char *(*iconv_from_internal) (const char *charset, const char *string);
- char *(*gettext) (const char *string);
- char *(*ngettext) (const char *single, const char *plural, int count);
+ const char *(*gettext) (const char *string);
+ const char *(*ngettext) (const char *single, const char *plural, int count);
char *(*strndup) (const char *string, int length);
void (*string_tolower) (char *string);
void (*string_toupper) (char *string);
@@ -199,7 +199,7 @@ struct t_weechat_plugin
void (*list_set) (struct t_weelist_item *item, const char *value);
struct t_weelist_item *(*list_next) (struct t_weelist_item *item);
struct t_weelist_item *(*list_prev) (struct t_weelist_item *item);
- char *(*list_string) (struct t_weelist_item *item);
+ const char *(*list_string) (struct t_weelist_item *item);
int (*list_size) (struct t_weelist *weelist);
void (*list_remove) (struct t_weelist *weelist,
struct t_weelist_item *item);
@@ -288,8 +288,8 @@ struct t_weechat_plugin
const char *property);
int (*config_boolean) (struct t_config_option *option);
int (*config_integer) (struct t_config_option *option);
- char *(*config_string) (struct t_config_option *option);
- char *(*config_color) (struct t_config_option *option);
+ const char *(*config_string) (struct t_config_option *option);
+ const char *(*config_color) (struct t_config_option *option);
void (*config_write_line) (struct t_config_file *config_file,
const char *option_name,
const char *value, ...);
@@ -302,14 +302,14 @@ struct t_weechat_plugin
struct t_config_section *section);
void (*config_free) (struct t_config_file *config_file);
struct t_config_option *(*config_get) (const char *option_name);
- char *(*config_get_plugin) (struct t_weechat_plugin *plugin,
- const char *option_name);
+ const char *(*config_get_plugin) (struct t_weechat_plugin *plugin,
+ const char *option_name);
int (*config_set_plugin) (struct t_weechat_plugin *plugin,
const char *option_name, const char *value);
/* display */
- char *(*prefix) (const char *prefix);
- char *(*color) (const char *color_name);
+ const char *(*prefix) (const char *prefix);
+ const char *(*color) (const char *color_name);
void (*printf_date_tags) (struct t_gui_buffer *buffer, time_t date,
const char *tags, const char *message, ...);
void (*printf_y) (struct t_gui_buffer *buffer, int y,
@@ -405,9 +405,9 @@ struct t_weechat_plugin
struct t_hook *(*hook_info) (struct t_weechat_plugin *plugin,
const char *info_name,
const char *description,
- char *(*callback)(void *data,
- const char *info_name,
- const char *arguments),
+ const char *(*callback)(void *data,
+ const char *info_name,
+ const char *arguments),
void *callback_data);
struct t_hook *(*hook_infolist) (struct t_weechat_plugin *plugin,
const char *infolist_name,
@@ -435,8 +435,8 @@ struct t_weechat_plugin
void (*buffer_close) (struct t_gui_buffer *buffer, int switch_to_another);
int (*buffer_get_integer) (struct t_gui_buffer *buffer,
const char *property);
- char *(*buffer_get_string) (struct t_gui_buffer *buffer,
- const char *property);
+ const char *(*buffer_get_string) (struct t_gui_buffer *buffer,
+ const char *property);
void *(*buffer_get_pointer) (struct t_gui_buffer *buffer,
const char *property);
void (*buffer_set) (struct t_gui_buffer *buffer, const char *property,
@@ -449,8 +449,8 @@ struct t_weechat_plugin
/* windows */
int (*window_get_integer) (struct t_gui_window *window,
const char *property);
- char *(*window_get_string) (struct t_gui_window *window,
- const char *property);
+ const char *(*window_get_string) (struct t_gui_window *window,
+ const char *property);
void *(*window_get_pointer) (struct t_gui_window *window,
const char *property);
@@ -522,8 +522,9 @@ struct t_weechat_plugin
int (*network_connect_to) (int sock, unsigned long address, int port);
/* infos */
- char *(*info_get) (struct t_weechat_plugin *plugin, const char *info_name,
- const char *arguments);
+ const char *(*info_get) (struct t_weechat_plugin *plugin,
+ const char *info_name,
+ const char *arguments);
/* infolists */
struct t_infolist *(*infolist_new) ();
@@ -551,9 +552,9 @@ struct t_weechat_plugin
int (*infolist_next) (struct t_infolist *infolist);
int (*infolist_prev) (struct t_infolist *infolist);
void (*infolist_reset_item_cursor) (struct t_infolist *infolist);
- char *(*infolist_fields) (struct t_infolist *infolist);
+ const char *(*infolist_fields) (struct t_infolist *infolist);
int (*infolist_integer) (struct t_infolist *infolist, const char *var);
- char *(*infolist_string) (struct t_infolist *infolist, const char *var);
+ const char *(*infolist_string) (struct t_infolist *infolist, const char *var);
void *(*infolist_pointer) (struct t_infolist *infolist, const char *var);
void *(*infolist_buffer) (struct t_infolist *infolist, const char *var,
int *size);
diff --git a/src/plugins/xfer/xfer-file.c b/src/plugins/xfer/xfer-file.c
index 20e2983d5..f2c86aad7 100644
--- a/src/plugins/xfer/xfer-file.c
+++ b/src/plugins/xfer/xfer-file.c
@@ -76,7 +76,8 @@ xfer_file_resume (struct t_xfer *xfer, const char *filename)
void
xfer_file_find_filename (struct t_xfer *xfer)
{
- char *weechat_home, *dir1, *dir2, *filename2, *dir_separator;
+ const char *weechat_home, *dir_separator;
+ char *dir1, *dir2, *filename2;
if (!XFER_IS_FILE(xfer->type))
return;
diff --git a/src/plugins/xfer/xfer.c b/src/plugins/xfer/xfer.c
index acc02ddc3..7fe2ad521 100644
--- a/src/plugins/xfer/xfer.c
+++ b/src/plugins/xfer/xfer.c
@@ -125,7 +125,8 @@ xfer_signal_upgrade_cb (void *data, const char *signal, const char *type_data,
void
xfer_create_directories ()
{
- char *weechat_dir, *dir1, *dir2;
+ const char *weechat_dir;
+ char *dir1, *dir2;
/* create download directory */
weechat_dir = weechat_info_get ("weechat_dir", "");
@@ -655,10 +656,11 @@ int
xfer_add_cb (void *data, const char *signal, const char *type_data, void *signal_data)
{
struct t_infolist *infolist;
- char *plugin_name, *plugin_id, *str_type, *str_protocol;
- char *remote_nick, *local_nick, *filename;
+ const char *plugin_name, *plugin_id, *str_type, *str_protocol;
+ const char *remote_nick, *local_nick, *filename;
int type, protocol;
- char *weechat_dir, *dir1, *dir2, *filename2, *short_filename, *pos;
+ const char *weechat_dir;
+ char *dir1, *dir2, *filename2, *short_filename, *pos;
int spaces, args, port_start, port_end;
struct stat st;
int sock, port;
@@ -1010,7 +1012,7 @@ xfer_start_resume_cb (void *data, const char *signal, const char *type_data,
{
struct t_infolist *infolist;
struct t_xfer *ptr_xfer;
- char *plugin_name, *plugin_id, *filename, *str_start_resume;
+ const char *plugin_name, *plugin_id, *filename, *str_start_resume;
int port;
unsigned long start_resume;
@@ -1090,7 +1092,7 @@ xfer_accept_resume_cb (void *data, const char *signal, const char *type_data,
{
struct t_infolist *infolist;
struct t_xfer *ptr_xfer;
- char *plugin_name, *plugin_id, *filename, *str_start_resume;
+ const char *plugin_name, *plugin_id, *filename, *str_start_resume;
int port;
unsigned long start_resume;