WeeChat 0.3.0 API
From FlashTux
WeeChat 0.3.0, new API
This page lists differences between API of WeeChat <= 0.2.6 and new API (WeeChat >= 0.3.x).
Only differences are here, there's no description about new functions in WeeChat 0.3.x.
Full API doc is available in WeeChat developer guide: http://weechat.flashtux.org/doc/devel/weechat_plugin_api.en.html
Script API
List of common actions done with old WeeChat, and new way to do with new API, useful if you want to convert old scripts to new API:
| Action | Old API <= 0.2.6.x | New API >= 0.3.0 | Info new API |
|---|---|---|---|
| Register script | weechat::register("name" ,"0.1", "end_func", "description"); | weechat::register("name", "author", "0.1", "GPL", "Description", "end_func", ""); | New arguments have been added: author, licence, charset (note: you can use empty string for UTF-8 charset because it is default in WeeChat) |
| Return values in some callbacks | PLUGIN_RC_OK / PLUGIN_RC_KO | WEECHAT_RC_OK / WEECHAT_RC_ERROR | Same value, it's just a rename of constants. |
| Print a message on a buffer | weechat::print("my message"); --- on IRC channel: weechat::print("my message", "freenode", "#weechat"); | weechat::print("", "my message"); --- on IRC channel: my $buffer = weechat::info_get("irc_buffer", "freenode,#weechat"); weechat::print($buffer, "my message"); | First argument of "print" is a string with pointer to a buffer, empty string means WeeChat core buffer. |
| Send a message to a channel or private | weechat::command("hello chan!", "#weechat", "freenode"); | my $buffer = weechat::info_get("irc_buffer", "freenode,#weechat"); weechat::command($buffer, "hello chan!"); | First argument of "command" is a string with pointer to a buffer, empty string means WeeChat core buffer. |
| Add a new command | weechat::add_command_handler("mycommand", "function", "description", "arguments", "arguments_desc", "template"); Arguments in function: arg0 = server, arg1 = user arguments for command | weechat::hook_command("mycommand", "description", "arguments", "arguments_desc", "template", "function", "data"); Arguments in function: arg0 = data, arg1 = string with pointer to buffer, arg2 = user arguments for command | |
| Catch an IRC message | weechat::add_message_handler("PRIVMSG", "function"); Arguments in function: arg0 = server, arg1 = full IRC message | Catch message before IRC action: weechat::hook_signal("*,irc_in_privmsg", "function", "data"); Catch message after IRC action: weechat::hook_signal("*,irc_in2_privmsg", "function", "data"); Arguments in function: arg0 = data, arg1 = "server,irc_in_privmsg", arg2 = full IRC message | The "*" in hook_signal may be replaced by an IRC internal server name. |
C plugin API
Plugin functions
| Old name | New name | New arguments? | In scripts? |
|---|---|---|---|
| - | plugin_get_name | - | yes |
String functions
| Old name | New name | New arguments? | In scripts? |
|---|---|---|---|
| set_charset | charset_set | - | yes |
| iconv_to_internal | iconv_to_internal | - | yes |
| iconv_from_internal | iconv_from_internal | - | yes |
| - | gettext | - | yes |
| - | ngettext | - | yes |
| - | strndup | - | no |
| - | string_tolower | - | no |
| - | string_toupper | - | no |
| ascii_strcasecmp | strcasecmp | - | no |
| ascii_strncasecmp | strncasecmp | - | no |
| - | strcmp_ignore_chars | - | no |
| - | strcasestr | - | no |
| - | string_match | - | no |
| - | string_replace | - | no |
| - | string_remove_quotes | - | no |
| - | string_strip | - | no |
| - | string_has_highlight | - | no |
| - | string_mask_to_regex | - | no |
| explode_string | string_explode | yes | no |
| free_exploded_string | string_free_exploded | - | no |
| - | string_build_with_exploded | - | no |
| - | string_split_command | - | no |
| - | string_free_split_command | - | no |
| - | string_format_size | - | no |
| - | string_remove_color | - | yes |
| - | utf8_has_8bits | - | no |
| - | utf8_is_valid | - | no |
| - | utf8_normalize | - | no |
| - | utf8_prev_char | - | no |
| - | utf8_next_char | - | no |
| - | utf8_char_int | - | no |
| - | utf8_char_size | - | no |
| - | utf8_strlen | - | no |
| - | utf8_strnlen | - | no |
| - | utf8_strlen_screen | - | no |
| - | utf8_charcasecmp | - | no |
| - | utf8_char_size_screen | - | no |
| - | utf8_add_offset | - | no |
| - | utf8_real_pos | - | no |
| - | utf8_pos | - | no |
| - | utf8_strndup | - | no |
Directory functions
| Old name | New name | New arguments? | In scripts? |
|---|---|---|---|
| mkdir_home | mkdir_home | - | yes |
| - | mkdir | - | yes |
| - | mkdir_parents | - | yes |
| exec_on_files | exec_on_files | yes | no |
| - | timeval_cmp | - | no |
| - | timeval_diff | - | no |
| - | timeval_add | - | no |
List functions
| Old name | New name | New arguments? | In scripts? |
|---|---|---|---|
| - | list_new | - | yes |
| - | list_add | - | yes |
| - | list_search | - | yes |
| - | list_casesearch | - | yes |
| - | list_get | - | yes |
| - | list_set | - | yes |
| - | list_next | - | yes |
| - | list_prev | - | yes |
| - | list_string | - | yes |
| - | list_size | - | yes |
| - | list_remove | - | yes |
| - | list_remove_all | - | yes |
| - | list_free | - | yes |
Config files functions
| Old name | New name | New arguments? | In scripts? |
|---|---|---|---|
| - | config_new | - | yes |
| - | config_new_section | - | yes |
| - | config_search_section | - | yes |
| - | config_new_option | - | yes |
| - | config_search_option | - | yes |
| - | config_search_section_option | - | no |
| - | config_search_with_string | - | no |
| - | config_string_to_boolean | - | yes |
| - | config_option_reset | - | yes |
| - | config_option_set | - | yes |
| - | config_option_set_null | - | yes |
| - | config_option_unset | - | yes |
| - | config_option_rename | - | yes |
| - | config_option_get_pointer | - | no |
| - | config_option_is_null | - | yes |
| - | config_option_default_is_null | - | yes |
| - | config_boolean | - | yes |
| - | config_boolean_default | - | yes |
| - | config_integer | - | yes |
| - | config_integer_default | - | yes |
| - | config_string | - | yes |
| - | config_string_default | - | yes |
| - | config_color | - | yes |
| - | config_color_default | - | yes |
| - | config_write_option | - | yes |
| - | config_write_line | - | yes |
| - | config_write | - | yes |
| - | config_read | - | yes |
| - | config_reload | - | yes |
| - | config_option_free | - | yes |
| - | config_section_free_options | - | yes |
| - | config_section_free | - | yes |
| - | config_free | - | yes |
| get_config | config_get | yes | yes |
| set_config | (removed) | - | - |
| get_plugin_config | config_get_plugin | - | yes |
| set_plugin_config | config_set_plugin | - | yes |
| - | config_unset_plugin | - | yes |
Display functions
| Old name | New name | New arguments? | In scripts? |
|---|---|---|---|
| - | prefix | - | yes |
| - | color | - | yes |
| printf_date_tags | - | yes (print_date_tags, prnt_date_tags for python) | |
| - | printf_y | - | yes (print_y, prnt_y for python) |
| print_server | (removed) | - | - |
| print_infobar | (removed) | - | - |
| infobar_remove | (removed) | - | - |
| log | (removed) | - | yes |
| - | log_printf | - | yes (log_print) |
Hooks
| Old name | New name | New arguments? | In scripts? |
|---|---|---|---|
| msg_handler_add | hook_signal (for IRC: hook signal "*,irc_in_*" where first "*" may be a server name and second an IRC command name) | yes | yes |
| cmd_handler_add | hook_command | yes | yes |
| - | hook_command_run | - | yes |
| timer_handler_add | hook_timer | yes | yes |
| keyboard_handler_add | (removed) | - | - |
| - | hook_fd | - | yes |
| - | hook_process | - | yes |
| - | hook_connect | - | yes |
| - | hook_print | - | yes |
| event_handler_add | hook_signal | yes | yes |
| - | hook_signal_send | - | yes |
| - | hook_config | - | yes |
| - | hook_completion | - | yes |
| - | hook_completion_list_add | - | yes |
| modifier_add | hook_modifier | yes | yes |
| - | hook_modifier_exec | - | yes |
| - | hook_info | - | yes |
| - | hook_infolist | - | yes |
| modifier_remove | (removed) | - | - |
| modifier_remove_all | (removed) | - | - |
| handler_remove | unhook | yes | yes |
| handler_remove_all | unhook_all | yes | yes |
Buffers
| Old name | New name | New arguments? | In scripts? |
|---|---|---|---|
| - | buffer_new | - | yes |
| - | current_buffer | - | yes |
| - | buffer_search | - | yes |
| - | buffer_clear | - | yes |
| - | buffer_close | - | yes |
| - | buffer_merge | - | yes |
| - | buffer_unmerge | - | yes |
| - | buffer_get_integer | - | yes |
| - | buffer_get_string | - | yes |
| - | buffer_get_pointer | - | yes |
| - | buffer_set | - | yes |
| - | buffer_set_pointer | - | no |
| - | buffer_string_replace_local_var | - | no |
Windows
| Old name | New name | New arguments? | In scripts? |
|---|---|---|---|
| - | current_window | - | yes |
| - | window_get_integer | - | yes |
| - | window_get_string | - | yes |
| - | window_get_pointer | - | yes |
| - | window_set_title | - | yes |
Nicklist
| Old name | New name | New arguments? | In scripts? |
|---|---|---|---|
| - | nicklist_add_group | - | yes |
| - | nicklist_search_group | - | yes |
| - | nicklist_add_nick | - | yes |
| - | nicklist_search_nick | - | yes |
| - | nicklist_remove_group | - | yes |
| - | nicklist_remove_nick | - | yes |
| - | nicklist_remove_all | - | yes |
Bars
| Old name | New name | New arguments? | In scripts? |
|---|---|---|---|
| - | bar_item_seach | - | yes |
| - | bar_item_new | - | yes |
| - | bar_item_update | - | yes |
| - | bar_item_remove | - | yes |
| - | bar_search | - | yes |
| - | bar_new | - | yes |
| - | bar_set | - | yes |
| - | bar_update | - | yes |
| - | bar_remove | - | yes |
Command
| Old name | New name | New arguments? | In scripts? |
|---|---|---|---|
| exec_command | command | yes | yes |
Network
| Old name | New name | New arguments? | In scripts? |
|---|---|---|---|
| - | network_pass_proxy | - | no |
| - | network_connect_to | - | no |
Info / infolist
| Old name | New name | New arguments? | In scripts? |
|---|---|---|---|
| get_info | info_get | yes | yes |
| - | infolist_new | - | yes |
| - | infolist_new_item | - | no |
| - | infolist_new_var_integer | - | yes |
| - | infolist_new_var_string | - | yes |
| - | infolist_new_var_pointer | - | yes |
| - | infolist_new_var_buffer | - | no |
| - | infolist_new_var_time | - | yes |
| - | infolist_get | - | yes |
| - | infolist_next | - | yes |
| - | infolist_prev | - | yes |
| - | infolist_reset_item_cursor | - | no |
| - | infolist_fields | - | yes |
| - | infolist_integer | - | yes |
| - | infolist_string | - | yes |
| - | infolist_pointer | - | yes |
| - | infolist_buffer | - | no |
| - | infolist_time | - | yes |
| - | infolist_free | - | yes |
| get_dcc_info | (removed) | - | - |
| free_dcc_info | (removed) | - | - |
| get_server_info | (removed) | - | - |
| free_server_info | (removed) | - | - |
| get_channel_info | (removed) | - | - |
| free_server_info | (removed) | - | - |
| get_nick_info | (removed) | - | - |
| free_nick_info | (removed) | - | - |
| get_window_info | (removed) | - | - |
| free_window_info | (removed) | - | - |
| get_buffer_info | (removed) | - | - |
| free_buffer_info | (removed) | - | - |
| get_buffer_data | (removed) | - | - |
| free_buffer_data | (removed) | - | - |
Upgrade
| Old name | New name | New arguments? | In scripts? |
|---|---|---|---|
| - | upgrade_new | - | yes |
| - | upgrade_write_object | - | yes |
| - | upgrade_read | - | yes |
| - | upgrade_close | - | yes |
Other functions
| Old name | New name | New arguments? | In scripts? |
|---|---|---|---|
| get_irc_color | (removed) | - | - |
| input_color | (removed) | - | - |

