core: add "hdata" (direct access to WeeChat/plugin data)

v2.8-utf8proc
Sebastien Helleu 2011-06-13 12:32:27 +02:00
parent 756252b95c
commit c8b2a6a084
77 changed files with 12088 additions and 275 deletions

View File

@ -1,12 +1,13 @@
WeeChat ChangeLog
=================
Sébastien Helleu <flashcode@flashtux.org>
v0.3.6-dev, 2011-06-01
v0.3.6-dev, 2011-06-13
Version 0.3.6 (under dev!)
--------------------------
* core: add "hdata" (direct access to WeeChat/plugin data)
* core: fix bug with new line inserted at end of each line displayed (set
eat_newline_glitch to 0 if available)
* core: add option "infolists" for command /debug

View File

@ -0,0 +1,659 @@
[width="100%",cols="^1,^2,5,5,5",options="header"]
|========================================
| Erweiterung | Name | Beschreibung | Variables | Lists
| irc | irc_channel | irc channel |
'type' (integer) +
'name' (string) +
'topic' (string) +
'modes' (string) +
'limit' (integer) +
'key' (string) +
'checking_away' (integer) +
'away_message' (string) +
'has_quit_server' (integer) +
'cycle' (integer) +
'part' (integer) +
'display_creation_date' (integer) +
'nick_completion_reset' (integer) +
'pv_remote_nick_color' (string) +
'hook_autorejoin' (pointer) +
'nicks_count' (integer) +
'nicks' (pointer) +
'last_nick' (pointer) +
'nicks_speaking' (pointer) +
'nicks_speaking_time' (pointer) +
'last_nick_speaking_time' (pointer) +
'buffer' (pointer) +
'buffer_as_string' (string) +
'prev_channel' (pointer) +
'next_channel' (pointer) |
-
| irc | irc_channel_speaking | irc channel_speaking |
'nick' (string) +
'time_last_message' (time) +
'prev_nick' (pointer) +
'next_nick' (pointer) |
-
| irc | irc_ignore | irc ignore |
'number' (integer) +
'mask' (string) +
'regex_mask' (pointer) +
'server' (string) +
'channel' (string) +
'prev_ignore' (pointer) +
'next_ignore' (pointer) |
'irc_ignore_list' +
'last_irc_ignore'
| irc | irc_nick | irc nick |
'name' (string) +
'host' (string) +
'prefixes' (string) +
'prefix' (string) +
'away' (integer) +
'color' (string) +
'prev_nick' (pointer) +
'next_nick' (pointer) |
-
| irc | irc_notify | irc notify |
'server' (pointer) +
'nick' (string) +
'check_away' (integer) +
'is_on_server' (integer) +
'away_message' (string) +
'ison_received' (integer) +
'prev_notify' (pointer) +
'next_notify' (pointer) |
-
| irc | irc_redirect | irc redirect |
'server' (pointer) +
'pattern' (string) +
'signal' (string) +
'count' (integer) +
'current_count' (integer) +
'string' (string) +
'timeout' (integer) +
'command' (string) +
'start_time' (time) +
'cmd_start' (pointer) +
'cmd_stop' (pointer) +
'cmd_extra' (pointer) +
'cmd_start_received' (integer) +
'cmd_stop_received' (integer) +
'cmd_filter' (pointer) +
'output' (string) +
'output_size' (integer) +
'prev_redirect' (pointer) +
'next_redirect' (pointer) |
-
| irc | irc_redirect_pattern | pattern for irc redirect |
'name' (string) +
'temp_pattern' (integer) +
'timeout' (integer) +
'cmd_start' (string) +
'cmd_stop' (string) +
'cmd_extra' (string) +
'prev_redirect' (pointer) +
'next_redirect' (pointer) |
'irc_redirect_patterns' +
'last_irc_redirect_pattern'
| irc | irc_server | irc server |
'name' (string) +
'options' (pointer) +
'temp_server' (integer) +
'reloading_from_config' (integer) +
'reloaded_from_config' (integer) +
'addresses_count' (integer) +
'addresses_array' (pointer) +
'ports_array' (pointer) +
'index_current_address' (integer) +
'current_address' (string) +
'current_ip' (string) +
'current_port' (integer) +
'sock' (integer) +
'hook_connect' (pointer) +
'hook_fd' (pointer) +
'hook_timer_connection' (pointer) +
'hook_timer_sasl' (pointer) +
'is_connected' (integer) +
'ssl_connected' (integer) +
'gnutls_sess' (other) +
'tls_cert' (other) +
'tls_cert_key' (other) +
'unterminated_message' (string) +
'nicks_count' (integer) +
'nicks_array' (pointer) +
'nick_first_tried' (integer) +
'nick' (string) +
'nick_modes' (string) +
'isupport' (string) +
'prefix_modes' (string) +
'prefix_chars' (string) +
'reconnect_delay' (integer) +
'reconnect_start' (time) +
'command_time' (time) +
'reconnect_join' (integer) +
'disable_autojoin' (integer) +
'is_away' (integer) +
'away_message' (string) +
'away_time' (time) +
'lag' (integer) +
'lag_check_time' (other) +
'lag_next_check' (time) +
'lag_last_refresh' (time) +
'cmd_list_regexp' (pointer) +
'last_user_message' (time) +
'last_away_check' (time) +
'outqueue' (pointer) +
'last_outqueue' (pointer) +
'redirects' (pointer) +
'last_redirect' (pointer) +
'notify_list' (pointer) +
'last_notify' (pointer) +
'manual_joins' (pointer) +
'buffer' (pointer) +
'buffer_as_string' (string) +
'channels' (pointer) +
'last_channel' (pointer) +
'prev_server' (pointer) +
'next_server' (pointer) |
'irc_servers' +
'last_irc_server'
| weechat | bar | bar |
'name' (string) +
'options' (pointer) +
'conditions_count' (integer) +
'conditions_array' (pointer) +
'items_count' (integer) +
'items_subcount' (pointer) +
'items_array' (pointer) +
'bar_window' (pointer) +
'bar_refresh_needed' (integer) +
'prev_bar' (pointer) +
'next_bar' (pointer) |
'gui_bars' +
'last_gui_bar'
| weechat | bar_item | bar item |
'plugin' (pointer) +
'name' (string) +
'build_callback' (pointer) +
'build_callback_data' (pointer) +
'prev_item' (pointer) +
'next_item' (pointer) |
'gui_bar_items' +
'last_gui_bar_item'
| weechat | buffer | buffer |
'plugin' (pointer) +
'plugin_name_for_upgrade' (string) +
'merge_for_upgrade' (pointer) +
'number' (integer) +
'layout_number' (integer) +
'layout_applied' (integer) +
'name' (string) +
'short_name' (string) +
'type' (integer) +
'notify' (integer) +
'num_displayed' (integer) +
'active' (integer) +
'print_hooks_enabled' (integer) +
'close_callback' (pointer) +
'close_callback_data' (pointer) +
'title' (string) +
'own_lines' (pointer) +
'mixed_lines' (pointer) +
'lines' (pointer) +
'time_for_each_line' (integer) +
'chat_refresh_needed' (integer) +
'nicklist' (integer) +
'nicklist_case_sensitive' (integer) +
'nicklist_root' (pointer) +
'nicklist_max_length' (integer) +
'nicklist_display_groups' (integer) +
'nicklist_visible_count' (integer) +
'input' (integer) +
'input_callback' (pointer) +
'input_callback_data' (pointer) +
'input_get_unknown_commands' (integer) +
'input_buffer' (string) +
'input_buffer_alloc' (integer) +
'input_buffer_size' (integer) +
'input_buffer_length' (integer) +
'input_buffer_pos' (integer) +
'input_buffer_1st_display' (integer) +
'input_undo_snap' (pointer) +
'input_undo' (pointer) +
'last_input_undo' (pointer) +
'ptr_input_undo' (pointer) +
'input_undo_count' (integer) +
'completion' (pointer) +
'history' (pointer) +
'last_history' (pointer) +
'ptr_history' (pointer) +
'num_history' (integer) +
'text_search' (integer) +
'text_search_exact' (integer) +
'text_search_found' (integer) +
'text_search_input' (string) +
'highlight_words' (string) +
'highlight_tags' (string) +
'highlight_tags_count' (integer) +
'highlight_tags_array' (pointer) +
'hotlist_max_level_nicks' (pointer) +
'keys' (pointer) +
'last_key' (pointer) +
'keys_count' (integer) +
'local_variables' (pointer) +
'prev_buffer' (pointer) +
'next_buffer' (pointer) |
'gui_buffers' +
'last_gui_buffer'
| weechat | completion | completion |
'buffer' (pointer) +
'context' (integer) +
'base_command' (string) +
'base_command_arg_index' (integer) +
'base_word' (string) +
'base_word_pos' (integer) +
'position' (integer) +
'args' (string) +
'direction' (integer) +
'add_space' (integer) +
'force_partial_completion' (integer) +
'completion_list' (pointer) +
'word_found' (string) +
'word_found_is_nick' (integer) +
'position_replace' (integer) +
'diff_size' (integer) +
'diff_length' (integer) +
'partial_completion_list' (pointer) +
'last_partial_completion' (pointer) |
-
| weechat | completion_partial | partial completion |
'word' (string) +
'count' (integer) +
'prev_item' (pointer) +
'next_item' (pointer) |
-
| weechat | config_file | config file |
'plugin' (pointer) +
'name' (string) +
'filename' (string) +
'file' (pointer) +
'callback_reload' (pointer) +
'callback_reload_data' (pointer) +
'sections' (pointer) +
'last_section' (pointer) +
'prev_config' (pointer) +
'next_config' (pointer) |
'config_files' +
'last_config_file'
| weechat | config_option | config option |
'config_file' (pointer) +
'section' (pointer) +
'name' (string) +
'type' (integer) +
'description' (string) +
'string_values' (pointer) +
'min' (integer) +
'max' (integer) +
'default_value' (pointer) +
'value' (pointer) +
'null_value_allowed' (integer) +
'callback_check_value' (pointer) +
'callback_check_value_data' (pointer) +
'callback_change' (pointer) +
'callback_change_data' (pointer) +
'callback_delete' (pointer) +
'callback_delete_data' (pointer) +
'loaded' (integer) +
'prev_option' (pointer) +
'next_option' (pointer) |
-
| weechat | config_section | config section |
'config_file' (pointer) +
'name' (string) +
'user_can_add_options' (integer) +
'user_can_delete_options' (integer) +
'callback_read' (pointer) +
'callback_read_data' (pointer) +
'callback_write' (pointer) +
'callback_write_data' (pointer) +
'callback_write_default' (pointer) +
'callback_write_default_data' (pointer) +
'callback_create_option' (pointer) +
'callback_create_option_data' (pointer) +
'callback_delete_option' (pointer) +
'callback_delete_option_data' (pointer) +
'options' (pointer) +
'last_option' (pointer) +
'prev_section' (pointer) +
'next_section' (pointer) |
-
| weechat | filter | filter |
'enabled' (integer) +
'name' (string) +
'buffer_name' (string) +
'num_buffers' (integer) +
'buffers' (pointer) +
'tags' (string) +
'tags_count' (integer) +
'tags_array' (pointer) +
'regex' (string) +
'regex_prefix' (pointer) +
'regex_message' (pointer) +
'prev_filter' (pointer) +
'next_filter' (pointer) |
'gui_filters' +
'last_gui_filter'
| weechat | history | history of commands in buffer |
'text' (string) +
'next_history' (pointer) +
'prev_history' (pointer) |
-
| weechat | hook | hook (variables common to all hook types) |
'plugin' (pointer) +
'type' (integer) +
'deleted' (integer) +
'running' (integer) +
'priority' (integer) +
'callback_data' (pointer) +
'hook_data' (pointer) +
'prev_hook' (pointer) +
'next_hook' (pointer) |
-
| weechat | hook_command | hook of type "command" |
'callback' (pointer) +
'command' (string) +
'description' (string) +
'args' (string) +
'args_description' (string) +
'completion' (string) +
'cplt_num_templates' (integer) +
'cplt_templates' (pointer) +
'cplt_templates_static' (pointer) +
'cplt_template_num_args' (pointer) +
'cplt_template_args' (pointer) +
'cplt_template_num_args_concat' (integer) +
'cplt_template_args_concat' (pointer) |
'last_weechat_hook_command' +
'weechat_hooks_command'
| weechat | hook_command_run | hook of type "command_run" |
'callback' (pointer) +
'command' (string) |
'last_weechat_hook_command_run' +
'weechat_hooks_command_run'
| weechat | hook_completion | hook of type "completion" |
'callback' (pointer) +
'completion_item' (string) +
'description' (string) |
'last_weechat_hook_completion' +
'weechat_hooks_completion'
| weechat | hook_config | hook of type "config" |
'callback' (pointer) +
'option' (string) |
'last_weechat_hook_config' +
'weechat_hooks_config'
| weechat | hook_connect | hook of type "connect" |
'callback' (pointer) +
'proxy' (string) +
'address' (string) +
'port' (integer) +
'sock' (integer) +
'ipv6' (integer) +
'gnutls_sess' (pointer) +
'gnutls_cb' (pointer) +
'gnutls_dhkey_size' (integer) +
'gnutls_priorities' (string) +
'local_hostname' (string) +
'child_read' (integer) +
'child_write' (integer) +
'child_pid' (other) +
'hook_fd' (pointer) +
'handshake_hook_fd' (pointer) +
'handshake_hook_timer' (pointer) +
'handshake_fd_flags' (integer) +
'handshake_ip_address' (string) |
'last_weechat_hook_connect' +
'weechat_hooks_connect'
| weechat | hook_fd | hook of type "fd" |
'callback' (pointer) +
'fd' (integer) +
'flags' (integer) |
'last_weechat_hook_fd' +
'weechat_hooks_fd'
| weechat | hook_hdata | hook of type "hdata" |
'callback' (pointer) +
'hdata_name' (string) +
'description' (string) |
'last_weechat_hook_hdata' +
'weechat_hooks_hdata'
| weechat | hook_hsignal | hook of type "hsignal" |
'callback' (pointer) +
'signal' (string) |
'last_weechat_hook_hsignal' +
'weechat_hooks_hsignal'
| weechat | hook_info | hook of type "info" |
'callback' (pointer) +
'info_name' (string) +
'description' (string) +
'args_description' (string) |
'last_weechat_hook_info' +
'weechat_hooks_info'
| weechat | hook_info_hashtable | hook of type "info_hashtable" |
'callback' (pointer) +
'info_name' (string) +
'description' (string) +
'args_description' (string) +
'output_description' (string) |
'last_weechat_hook_info_hashtable' +
'weechat_hooks_info_hashtable'
| weechat | hook_infolist | hook of type "infolist" |
'callback' (pointer) +
'infolist_name' (string) +
'description' (string) +
'pointer_description' (string) +
'args_description' (string) |
'last_weechat_hook_infolist' +
'weechat_hooks_infolist'
| weechat | hook_modifier | hook of type "modifier" |
'callback' (pointer) +
'modifier' (string) |
'last_weechat_hook_modifier' +
'weechat_hooks_modifier'
| weechat | hook_print | hook of type "print" |
'callback' (pointer) +
'buffer' (pointer) +
'tags_count' (integer) +
'tags_array' (pointer) +
'message' (string) +
'strip_colors' (integer) |
'last_weechat_hook_print' +
'weechat_hooks_print'
| weechat | hook_process | hook of type "process" |
'callback' (pointer) +
'command' (string) +
'timeout' (long) +
'child_read' (pointer) +
'child_write' (pointer) +
'child_pid' (other) +
'hook_fd' (pointer) +
'hook_timer' (pointer) +
'buffer' (pointer) +
'buffer_size' (pointer) |
'last_weechat_hook_process' +
'weechat_hooks_process'
| weechat | hook_signal | hook of type "signal" |
'callback' (pointer) +
'signal' (string) |
'last_weechat_hook_signal' +
'weechat_hooks_signal'
| weechat | hook_timer | hook of type "timer" |
'callback' (pointer) +
'interval' (long) +
'align_second' (integer) +
'remaining_calls' (integer) +
'last_exec' (other) +
'next_exec' (other) |
'last_weechat_hook_timer' +
'weechat_hooks_timer'
| weechat | input_undo | undo for input line |
'data' (string) +
'pos' (integer) +
'prev_undo' (pointer) +
'next_undo' (pointer) |
-
| weechat | key | key |
'key' (string) +
'command' (string) +
'prev_key' (pointer) +
'next_key' (pointer) |
'gui_default_keys' +
'gui_keys' +
'last_gui_default_key' +
'last_gui_key'
| weechat | line | line |
'data' (pointer) +
'prev_line' (pointer) +
'next_line' (pointer) |
-
| weechat | line_data | line data |
'buffer' (pointer) +
'y' (integer) +
'date' (time) +
'date_printed' (time) +
'str_time' (string) +
'tags_count' (integer) +
'tags_array' (pointer) +
'displayed' (integer) +
'highlight' (integer) +
'refresh_needed' (integer) +
'prefix' (string) +
'prefix_length' (integer) +
'message' (string) |
-
| weechat | lines | lines |
'first_line' (pointer) +
'last_line' (pointer) +
'last_read_line' (pointer) +
'lines_count' (integer) +
'first_line_not_read' (integer) +
'lines_hidden' (integer) +
'buffer_max_length' (integer) +
'prefix_max_length' (integer) |
-
| weechat | nick | nick in nicklist |
'group' (pointer) +
'name' (string) +
'color' (string) +
'prefix' (string) +
'prefix_color' (string) +
'visible' (integer) +
'prev_nick' (pointer) +
'next_nick' (pointer) |
-
| weechat | nick_group | group in nicklist |
'name' (string) +
'color' (string) +
'visible' (integer) +
'level' (integer) +
'parent' (pointer) +
'childs' (pointer) +
'last_child' (pointer) +
'nicks' (pointer) +
'last_nick' (pointer) +
'prev_group' (pointer) +
'next_group' (pointer) |
-
| weechat | window | window |
'win_x' (integer) +
'win_y' (integer) +
'win_width' (integer) +
'win_height' (integer) +
'win_width_pct' (integer) +
'win_height_pct' (integer) +
'win_chat_x' (integer) +
'win_chat_y' (integer) +
'win_chat_width' (integer) +
'win_chat_height' (integer) +
'win_chat_cursor_x' (integer) +
'win_chat_cursor_y' (integer) +
'bar_windows' (pointer) +
'last_bar_window' (pointer) +
'refresh_needed' (integer) +
'gui_objects' (pointer) +
'buffer' (pointer) +
'layout_plugin_name' (string) +
'layout_buffer_name' (string) +
'scroll' (pointer) +
'ptr_tree' (pointer) +
'prev_window' (pointer) +
'next_window' (pointer) |
'gui_current_window' +
'gui_windows' +
'last_gui_window'
| weechat | window_scroll | scroll info in window |
'buffer' (pointer) +
'first_line_displayed' (integer) +
'start_line' (pointer) +
'start_line_pos' (integer) +
'scrolling' (integer) +
'start_col' (integer) +
'lines_after' (integer) +
'reset_allowed' (integer) +
'prev_scroll' (pointer) +
'next_scroll' (pointer) |
-
| weechat | window_tree | tree of windows |
'parent_node' (pointer) +
'split_pct' (integer) +
'split_horizontal' (integer) +
'child1' (pointer) +
'child2' (pointer) +
'window' (pointer) |
'gui_windows_tree'
|========================================

View File

@ -145,7 +145,7 @@ Erweiterung: Name der Erweiterung ('weechat' für interne WeeChat Befehle)
/debug list
set <plugin> <level>
dump [<plugin>]
buffer|color|infolists|memory|term|windows
buffer|color|hdata|infolists|memory|term|windows
list: list plugins with debug levels
set: set debug level for plugin
@ -154,6 +154,7 @@ Erweiterung: Name der Erweiterung ('weechat' für interne WeeChat Befehle)
dump: save memory dump in WeeChat log file (same dump is written when WeeChat crashes)
buffer: dump buffer content with hexadecimal values in log file
color: display infos about current color pairs
hdata: display infos about hdata
infolists: display infos about infolists
memory: display infos about memory usage
term: display infos about terminal

View File

@ -42,7 +42,7 @@ my $version = "0.1";
# -------------------------------[ config ]------------------------------------
# default path where doc XML files will be written (should be doc/ in sources
# default path where doc files will be written (should be doc/ in sources
# package tree)
# path must have subdirectories with languages and autogen directory:
# path
@ -53,7 +53,7 @@ my $version = "0.1";
# ...
my $default_path = "~/src/weechat/doc";
# list of locales for which we want to build XML doc files to include
# list of locales for which we want to build doc files to include
my @all_locale_list = qw(en_US fr_FR it_IT de_DE);
# all commands/options/.. of following plugins will produce a file
@ -101,6 +101,9 @@ my @ignore_infos_hashtable_plugins = ();
# infolists to ignore
my @ignore_infolists_plugins = ();
# hdata to ignore
my @ignore_hdata_plugins = ();
# completions to ignore
my @ignore_completions_plugins = ();
my @ignore_completions_items = ("docgen.*",
@ -291,6 +294,78 @@ sub get_infolists
return %infolists;
}
# get list of hdata hooked by plugins in a hash with 3 indexes: plugin, name, xxx
sub get_hdata
{
my %hdata;
# get hdata hooked
my $infolist = weechat::infolist_get("hook", "", "hdata");
while (weechat::infolist_next($infolist))
{
my $hdata_name = weechat::infolist_string($infolist, "hdata_name");
my $plugin = weechat::infolist_string($infolist, "plugin_name");
$plugin = "weechat" if ($plugin eq "");
# check if hdata is ignored or not
my $ignore = 0;
foreach my $mask (@ignore_hdata_plugins)
{
$ignore = 1 if ($plugin =~ /${mask}/);
}
if ($ignore ne 1)
{
$hdata{$plugin}{$hdata_name}{"description"} = weechat::infolist_string($infolist, "description");
my $vars = "";
my $lists = "";
my $ptr_hdata = weechat::hdata_get($hdata_name);
if ($ptr_hdata ne "")
{
my $str = weechat::hdata_get_string($ptr_hdata, "var_keys_values");
my @items = split(/,/, $str);
my %hdata2;
foreach my $item (@items)
{
my ($key, $value) = split(/:/, $item);
my $type = int($value) >> 16;
my $offset = int($value) & 0xFFFF;
my $stroffset = sprintf("%08d", $offset);
$hdata2{$stroffset} = "'".$key."' (".weechat::hdata_get_var_type_string($ptr_hdata, $key).")";
}
foreach my $offset (sort keys %hdata2)
{
$vars .= " +\n" if ($vars ne "");
$vars .= " ".$hdata2{$offset};
}
$hdata{$plugin}{$hdata_name}{"vars"} = "\n".$vars;
$str = weechat::hdata_get_string($ptr_hdata, "list_keys");
if ($str ne "")
{
my @items = split(/,/, $str);
@items = sort(@items);
foreach my $item (@items)
{
$lists .= " +\n" if ($lists ne "");
$lists .= " '".$item."'";
}
$lists = "\n".$lists;
}
else
{
$lists = "\n -";
}
$hdata{$plugin}{$hdata_name}{"lists"} = $lists;
}
}
}
weechat::infolist_free($infolist);
return %hdata;
}
# get list of completions hooked by plugins in a hash with 3 indexes: plugin, item, xxx
sub get_completions
{
@ -339,7 +414,7 @@ sub escape_table
return $str;
}
# build XML doc files (command /docgen)
# build doc files (command /docgen)
sub docgen
{
my ($data, $buffer, $args) = ($_[0], $_[1], $_[2]);
@ -352,6 +427,7 @@ sub docgen
my %plugin_infos = get_infos();
my %plugin_infos_hashtable = get_infos_hashtable();
my %plugin_infolists = get_infolists();
my %plugin_hdata = get_hdata();
my %plugin_completions = get_completions();
# get path and replace ~ by home if needed
@ -377,6 +453,8 @@ sub docgen
my $num_files_infos_hashtable_updated = 0;
my $num_files_infolists = 0;
my $num_files_infolists_updated = 0;
my $num_files_hdata = 0;
my $num_files_hdata_updated = 0;
my $num_files_completions = 0;
my $num_files_completions_updated = 0;
@ -678,6 +756,50 @@ sub docgen
weechat::print("", weechat::prefix("error")."docgen error: unable to write file '$filename'");
}
# write hdata hooked
$filename = $dir."plugin_api/hdata.txt";
if (open(FILE, ">".$filename.".tmp"))
{
print FILE "[width=\"100%\",cols=\"^1,^2,5,5,5\",options=\"header\"]\n";
print FILE "|========================================\n";
print FILE "| ".weechat_gettext("Plugin")." | ".weechat_gettext("Name")
." | ".weechat_gettext("Description")." | ".weechat_gettext("Variables")
." | ".weechat_gettext("Lists")."\n\n";
foreach my $plugin (sort keys %plugin_hdata)
{
foreach my $hdata (sort keys %{$plugin_hdata{$plugin}})
{
my $description = $plugin_hdata{$plugin}{$hdata}{"description"};
$description = $d->get($description) if ($description ne "");
my $vars = $plugin_hdata{$plugin}{$hdata}{"vars"};
my $lists = $plugin_hdata{$plugin}{$hdata}{"lists"};
print FILE "| ".escape_table($plugin)." | ".escape_table($hdata)
." | ".escape_table($description)." | ".escape_table($vars)
." | ".escape_table($lists)."\n\n";
}
}
print FILE "|========================================\n";
#weechat::print("", "docgen: file ok: '$filename'");
my $rc = system("diff ".$filename." ".$filename.".tmp >/dev/null 2>&1");
if ($rc != 0)
{
system("mv -f ".$filename.".tmp ".$filename);
$num_files_updated++;
$num_files_hdata_updated++;
}
else
{
system("rm ".$filename.".tmp");
}
$num_files++;
$num_files_hdata++;
close(FILE);
}
else
{
weechat::print("", weechat::prefix("error")."docgen error: unable to write file '$filename'");
}
# write completions hooked
$filename = $dir."plugin_api/completions.txt";
if (open(FILE, ">".$filename.".tmp"))
@ -725,27 +847,31 @@ sub docgen
}
my $total_files = $num_files_commands + $num_files_options
+ $num_files_infos + $num_files_infos_hashtable
+ $num_files_infolists + $num_files_completions;
+ $num_files_infolists + $num_files_hdata + $num_files_completions;
my $total_files_updated = $num_files_commands_updated
+ $num_files_options_updated + $num_files_infos_updated
+ $num_files_infos_hashtable_updated + $num_files_infolists_updated
+ $num_files_completions_updated;
weechat::print("", "docgen: ".$locale.": ".$total_files." files ("
.$num_files_commands." cmd, "
.$num_files_options." opt, "
.$num_files_infos." infos, "
.$num_files_infos." infos (hashtable), "
.$num_files_infolists." infolists, "
.$num_files_completions." complt) -- "
.$total_files_updated." updated ("
.$num_files_commands_updated." cmd, "
.$num_files_options_updated." opt, "
.$num_files_infos_updated." infos, "
.$num_files_infos_hashtable_updated." infos (hashtable), "
.$num_files_infolists_updated." infolists, "
.$num_files_completions_updated." complt)");
+ $num_files_hdata_updated + $num_files_completions_updated;
weechat::print("",
sprintf ("docgen: %s: %3d files (%2d cmd, %2d opt, %2d infos, "
."%2d infos_hash, %2d infolists, %2d hdata, "
."%2d complt)",
$locale, $total_files, $num_files_commands,
$num_files_options, $num_files_infos, $num_files_infos,
$num_files_infolists, $num_files_hdata,
$num_files_completions));
weechat::print("",
sprintf (" %3d updated (%2d cmd, %2d opt, %2d infos, "
."%2d infos_hash, %2d infolists, %2d hdata, "
."%2d complt)",
$total_files_updated, $num_files_commands_updated,
$num_files_options_updated, $num_files_infos_updated,
$num_files_infos_updated, $num_files_infolists_updated,
$num_files_hdata_updated, $num_files_completions_updated));
}
weechat::print("", "docgen: total: ".$num_files." files (".$num_files_updated." updated)");
weechat::print("",
sprintf ("docgen: total: %d files, %d updated",
$num_files, $num_files_updated));
setlocale(LC_MESSAGES, $old_locale);

View File

@ -0,0 +1,659 @@
[width="100%",cols="^1,^2,5,5,5",options="header"]
|========================================
| Plugin | Name | Description | Variables | Lists
| irc | irc_channel | irc channel |
'type' (integer) +
'name' (string) +
'topic' (string) +
'modes' (string) +
'limit' (integer) +
'key' (string) +
'checking_away' (integer) +
'away_message' (string) +
'has_quit_server' (integer) +
'cycle' (integer) +
'part' (integer) +
'display_creation_date' (integer) +
'nick_completion_reset' (integer) +
'pv_remote_nick_color' (string) +
'hook_autorejoin' (pointer) +
'nicks_count' (integer) +
'nicks' (pointer) +
'last_nick' (pointer) +
'nicks_speaking' (pointer) +
'nicks_speaking_time' (pointer) +
'last_nick_speaking_time' (pointer) +
'buffer' (pointer) +
'buffer_as_string' (string) +
'prev_channel' (pointer) +
'next_channel' (pointer) |
-
| irc | irc_channel_speaking | irc channel_speaking |
'nick' (string) +
'time_last_message' (time) +
'prev_nick' (pointer) +
'next_nick' (pointer) |
-
| irc | irc_ignore | irc ignore |
'number' (integer) +
'mask' (string) +
'regex_mask' (pointer) +
'server' (string) +
'channel' (string) +
'prev_ignore' (pointer) +
'next_ignore' (pointer) |
'irc_ignore_list' +
'last_irc_ignore'
| irc | irc_nick | irc nick |
'name' (string) +
'host' (string) +
'prefixes' (string) +
'prefix' (string) +
'away' (integer) +
'color' (string) +
'prev_nick' (pointer) +
'next_nick' (pointer) |
-
| irc | irc_notify | irc notify |
'server' (pointer) +
'nick' (string) +
'check_away' (integer) +
'is_on_server' (integer) +
'away_message' (string) +
'ison_received' (integer) +
'prev_notify' (pointer) +
'next_notify' (pointer) |
-
| irc | irc_redirect | irc redirect |
'server' (pointer) +
'pattern' (string) +
'signal' (string) +
'count' (integer) +
'current_count' (integer) +
'string' (string) +
'timeout' (integer) +
'command' (string) +
'start_time' (time) +
'cmd_start' (pointer) +
'cmd_stop' (pointer) +
'cmd_extra' (pointer) +
'cmd_start_received' (integer) +
'cmd_stop_received' (integer) +
'cmd_filter' (pointer) +
'output' (string) +
'output_size' (integer) +
'prev_redirect' (pointer) +
'next_redirect' (pointer) |
-
| irc | irc_redirect_pattern | pattern for irc redirect |
'name' (string) +
'temp_pattern' (integer) +
'timeout' (integer) +
'cmd_start' (string) +
'cmd_stop' (string) +
'cmd_extra' (string) +
'prev_redirect' (pointer) +
'next_redirect' (pointer) |
'irc_redirect_patterns' +
'last_irc_redirect_pattern'
| irc | irc_server | irc server |
'name' (string) +
'options' (pointer) +
'temp_server' (integer) +
'reloading_from_config' (integer) +
'reloaded_from_config' (integer) +
'addresses_count' (integer) +
'addresses_array' (pointer) +
'ports_array' (pointer) +
'index_current_address' (integer) +
'current_address' (string) +
'current_ip' (string) +
'current_port' (integer) +
'sock' (integer) +
'hook_connect' (pointer) +
'hook_fd' (pointer) +
'hook_timer_connection' (pointer) +
'hook_timer_sasl' (pointer) +
'is_connected' (integer) +
'ssl_connected' (integer) +
'gnutls_sess' (other) +
'tls_cert' (other) +
'tls_cert_key' (other) +
'unterminated_message' (string) +
'nicks_count' (integer) +
'nicks_array' (pointer) +
'nick_first_tried' (integer) +
'nick' (string) +
'nick_modes' (string) +
'isupport' (string) +
'prefix_modes' (string) +
'prefix_chars' (string) +
'reconnect_delay' (integer) +
'reconnect_start' (time) +
'command_time' (time) +
'reconnect_join' (integer) +
'disable_autojoin' (integer) +
'is_away' (integer) +
'away_message' (string) +
'away_time' (time) +
'lag' (integer) +
'lag_check_time' (other) +
'lag_next_check' (time) +
'lag_last_refresh' (time) +
'cmd_list_regexp' (pointer) +
'last_user_message' (time) +
'last_away_check' (time) +
'outqueue' (pointer) +
'last_outqueue' (pointer) +
'redirects' (pointer) +
'last_redirect' (pointer) +
'notify_list' (pointer) +
'last_notify' (pointer) +
'manual_joins' (pointer) +
'buffer' (pointer) +
'buffer_as_string' (string) +
'channels' (pointer) +
'last_channel' (pointer) +
'prev_server' (pointer) +
'next_server' (pointer) |
'irc_servers' +
'last_irc_server'
| weechat | bar | bar |
'name' (string) +
'options' (pointer) +
'conditions_count' (integer) +
'conditions_array' (pointer) +
'items_count' (integer) +
'items_subcount' (pointer) +
'items_array' (pointer) +
'bar_window' (pointer) +
'bar_refresh_needed' (integer) +
'prev_bar' (pointer) +
'next_bar' (pointer) |
'gui_bars' +
'last_gui_bar'
| weechat | bar_item | bar item |
'plugin' (pointer) +
'name' (string) +
'build_callback' (pointer) +
'build_callback_data' (pointer) +
'prev_item' (pointer) +
'next_item' (pointer) |
'gui_bar_items' +
'last_gui_bar_item'
| weechat | buffer | buffer |
'plugin' (pointer) +
'plugin_name_for_upgrade' (string) +
'merge_for_upgrade' (pointer) +
'number' (integer) +
'layout_number' (integer) +
'layout_applied' (integer) +
'name' (string) +
'short_name' (string) +
'type' (integer) +
'notify' (integer) +
'num_displayed' (integer) +
'active' (integer) +
'print_hooks_enabled' (integer) +
'close_callback' (pointer) +
'close_callback_data' (pointer) +
'title' (string) +
'own_lines' (pointer) +
'mixed_lines' (pointer) +
'lines' (pointer) +
'time_for_each_line' (integer) +
'chat_refresh_needed' (integer) +
'nicklist' (integer) +
'nicklist_case_sensitive' (integer) +
'nicklist_root' (pointer) +
'nicklist_max_length' (integer) +
'nicklist_display_groups' (integer) +
'nicklist_visible_count' (integer) +
'input' (integer) +
'input_callback' (pointer) +
'input_callback_data' (pointer) +
'input_get_unknown_commands' (integer) +
'input_buffer' (string) +
'input_buffer_alloc' (integer) +
'input_buffer_size' (integer) +
'input_buffer_length' (integer) +
'input_buffer_pos' (integer) +
'input_buffer_1st_display' (integer) +
'input_undo_snap' (pointer) +
'input_undo' (pointer) +
'last_input_undo' (pointer) +
'ptr_input_undo' (pointer) +
'input_undo_count' (integer) +
'completion' (pointer) +
'history' (pointer) +
'last_history' (pointer) +
'ptr_history' (pointer) +
'num_history' (integer) +
'text_search' (integer) +
'text_search_exact' (integer) +
'text_search_found' (integer) +
'text_search_input' (string) +
'highlight_words' (string) +
'highlight_tags' (string) +
'highlight_tags_count' (integer) +
'highlight_tags_array' (pointer) +
'hotlist_max_level_nicks' (pointer) +
'keys' (pointer) +
'last_key' (pointer) +
'keys_count' (integer) +
'local_variables' (pointer) +
'prev_buffer' (pointer) +
'next_buffer' (pointer) |
'gui_buffers' +
'last_gui_buffer'
| weechat | completion | completion |
'buffer' (pointer) +
'context' (integer) +
'base_command' (string) +
'base_command_arg_index' (integer) +
'base_word' (string) +
'base_word_pos' (integer) +
'position' (integer) +
'args' (string) +
'direction' (integer) +
'add_space' (integer) +
'force_partial_completion' (integer) +
'completion_list' (pointer) +
'word_found' (string) +
'word_found_is_nick' (integer) +
'position_replace' (integer) +
'diff_size' (integer) +
'diff_length' (integer) +
'partial_completion_list' (pointer) +
'last_partial_completion' (pointer) |
-
| weechat | completion_partial | partial completion |
'word' (string) +
'count' (integer) +
'prev_item' (pointer) +
'next_item' (pointer) |
-
| weechat | config_file | config file |
'plugin' (pointer) +
'name' (string) +
'filename' (string) +
'file' (pointer) +
'callback_reload' (pointer) +
'callback_reload_data' (pointer) +
'sections' (pointer) +
'last_section' (pointer) +
'prev_config' (pointer) +
'next_config' (pointer) |
'config_files' +
'last_config_file'
| weechat | config_option | config option |
'config_file' (pointer) +
'section' (pointer) +
'name' (string) +
'type' (integer) +
'description' (string) +
'string_values' (pointer) +
'min' (integer) +
'max' (integer) +
'default_value' (pointer) +
'value' (pointer) +
'null_value_allowed' (integer) +
'callback_check_value' (pointer) +
'callback_check_value_data' (pointer) +
'callback_change' (pointer) +
'callback_change_data' (pointer) +
'callback_delete' (pointer) +
'callback_delete_data' (pointer) +
'loaded' (integer) +
'prev_option' (pointer) +
'next_option' (pointer) |
-
| weechat | config_section | config section |
'config_file' (pointer) +
'name' (string) +
'user_can_add_options' (integer) +
'user_can_delete_options' (integer) +
'callback_read' (pointer) +
'callback_read_data' (pointer) +
'callback_write' (pointer) +
'callback_write_data' (pointer) +
'callback_write_default' (pointer) +
'callback_write_default_data' (pointer) +
'callback_create_option' (pointer) +
'callback_create_option_data' (pointer) +
'callback_delete_option' (pointer) +
'callback_delete_option_data' (pointer) +
'options' (pointer) +
'last_option' (pointer) +
'prev_section' (pointer) +
'next_section' (pointer) |
-
| weechat | filter | filter |
'enabled' (integer) +
'name' (string) +
'buffer_name' (string) +
'num_buffers' (integer) +
'buffers' (pointer) +
'tags' (string) +
'tags_count' (integer) +
'tags_array' (pointer) +
'regex' (string) +
'regex_prefix' (pointer) +
'regex_message' (pointer) +
'prev_filter' (pointer) +
'next_filter' (pointer) |
'gui_filters' +
'last_gui_filter'
| weechat | history | history of commands in buffer |
'text' (string) +
'next_history' (pointer) +
'prev_history' (pointer) |
-
| weechat | hook | hook (variables common to all hook types) |
'plugin' (pointer) +
'type' (integer) +
'deleted' (integer) +
'running' (integer) +
'priority' (integer) +
'callback_data' (pointer) +
'hook_data' (pointer) +
'prev_hook' (pointer) +
'next_hook' (pointer) |
-
| weechat | hook_command | hook of type "command" |
'callback' (pointer) +
'command' (string) +
'description' (string) +
'args' (string) +
'args_description' (string) +
'completion' (string) +
'cplt_num_templates' (integer) +
'cplt_templates' (pointer) +
'cplt_templates_static' (pointer) +
'cplt_template_num_args' (pointer) +
'cplt_template_args' (pointer) +
'cplt_template_num_args_concat' (integer) +
'cplt_template_args_concat' (pointer) |
'last_weechat_hook_command' +
'weechat_hooks_command'
| weechat | hook_command_run | hook of type "command_run" |
'callback' (pointer) +
'command' (string) |
'last_weechat_hook_command_run' +
'weechat_hooks_command_run'
| weechat | hook_completion | hook of type "completion" |
'callback' (pointer) +
'completion_item' (string) +
'description' (string) |
'last_weechat_hook_completion' +
'weechat_hooks_completion'
| weechat | hook_config | hook of type "config" |
'callback' (pointer) +
'option' (string) |
'last_weechat_hook_config' +
'weechat_hooks_config'
| weechat | hook_connect | hook of type "connect" |
'callback' (pointer) +
'proxy' (string) +
'address' (string) +
'port' (integer) +
'sock' (integer) +
'ipv6' (integer) +
'gnutls_sess' (pointer) +
'gnutls_cb' (pointer) +
'gnutls_dhkey_size' (integer) +
'gnutls_priorities' (string) +
'local_hostname' (string) +
'child_read' (integer) +
'child_write' (integer) +
'child_pid' (other) +
'hook_fd' (pointer) +
'handshake_hook_fd' (pointer) +
'handshake_hook_timer' (pointer) +
'handshake_fd_flags' (integer) +
'handshake_ip_address' (string) |
'last_weechat_hook_connect' +
'weechat_hooks_connect'
| weechat | hook_fd | hook of type "fd" |
'callback' (pointer) +
'fd' (integer) +
'flags' (integer) |
'last_weechat_hook_fd' +
'weechat_hooks_fd'
| weechat | hook_hdata | hook of type "hdata" |
'callback' (pointer) +
'hdata_name' (string) +
'description' (string) |
'last_weechat_hook_hdata' +
'weechat_hooks_hdata'
| weechat | hook_hsignal | hook of type "hsignal" |
'callback' (pointer) +
'signal' (string) |
'last_weechat_hook_hsignal' +
'weechat_hooks_hsignal'
| weechat | hook_info | hook of type "info" |
'callback' (pointer) +
'info_name' (string) +
'description' (string) +
'args_description' (string) |
'last_weechat_hook_info' +
'weechat_hooks_info'
| weechat | hook_info_hashtable | hook of type "info_hashtable" |
'callback' (pointer) +
'info_name' (string) +
'description' (string) +
'args_description' (string) +
'output_description' (string) |
'last_weechat_hook_info_hashtable' +
'weechat_hooks_info_hashtable'
| weechat | hook_infolist | hook of type "infolist" |
'callback' (pointer) +
'infolist_name' (string) +
'description' (string) +
'pointer_description' (string) +
'args_description' (string) |
'last_weechat_hook_infolist' +
'weechat_hooks_infolist'
| weechat | hook_modifier | hook of type "modifier" |
'callback' (pointer) +
'modifier' (string) |
'last_weechat_hook_modifier' +
'weechat_hooks_modifier'
| weechat | hook_print | hook of type "print" |
'callback' (pointer) +
'buffer' (pointer) +
'tags_count' (integer) +
'tags_array' (pointer) +
'message' (string) +
'strip_colors' (integer) |
'last_weechat_hook_print' +
'weechat_hooks_print'
| weechat | hook_process | hook of type "process" |
'callback' (pointer) +
'command' (string) +
'timeout' (long) +
'child_read' (pointer) +
'child_write' (pointer) +
'child_pid' (other) +
'hook_fd' (pointer) +
'hook_timer' (pointer) +
'buffer' (pointer) +
'buffer_size' (pointer) |
'last_weechat_hook_process' +
'weechat_hooks_process'
| weechat | hook_signal | hook of type "signal" |
'callback' (pointer) +
'signal' (string) |
'last_weechat_hook_signal' +
'weechat_hooks_signal'
| weechat | hook_timer | hook of type "timer" |
'callback' (pointer) +
'interval' (long) +
'align_second' (integer) +
'remaining_calls' (integer) +
'last_exec' (other) +
'next_exec' (other) |
'last_weechat_hook_timer' +
'weechat_hooks_timer'
| weechat | input_undo | undo for input line |
'data' (string) +
'pos' (integer) +
'prev_undo' (pointer) +
'next_undo' (pointer) |
-
| weechat | key | key |
'key' (string) +
'command' (string) +
'prev_key' (pointer) +
'next_key' (pointer) |
'gui_default_keys' +
'gui_keys' +
'last_gui_default_key' +
'last_gui_key'
| weechat | line | line |
'data' (pointer) +
'prev_line' (pointer) +
'next_line' (pointer) |
-
| weechat | line_data | line data |
'buffer' (pointer) +
'y' (integer) +
'date' (time) +
'date_printed' (time) +
'str_time' (string) +
'tags_count' (integer) +
'tags_array' (pointer) +
'displayed' (integer) +
'highlight' (integer) +
'refresh_needed' (integer) +
'prefix' (string) +
'prefix_length' (integer) +
'message' (string) |
-
| weechat | lines | lines |
'first_line' (pointer) +
'last_line' (pointer) +
'last_read_line' (pointer) +
'lines_count' (integer) +
'first_line_not_read' (integer) +
'lines_hidden' (integer) +
'buffer_max_length' (integer) +
'prefix_max_length' (integer) |
-
| weechat | nick | nick in nicklist |
'group' (pointer) +
'name' (string) +
'color' (string) +
'prefix' (string) +
'prefix_color' (string) +
'visible' (integer) +
'prev_nick' (pointer) +
'next_nick' (pointer) |
-
| weechat | nick_group | group in nicklist |
'name' (string) +
'color' (string) +
'visible' (integer) +
'level' (integer) +
'parent' (pointer) +
'childs' (pointer) +
'last_child' (pointer) +
'nicks' (pointer) +
'last_nick' (pointer) +
'prev_group' (pointer) +
'next_group' (pointer) |
-
| weechat | window | window |
'win_x' (integer) +
'win_y' (integer) +
'win_width' (integer) +
'win_height' (integer) +
'win_width_pct' (integer) +
'win_height_pct' (integer) +
'win_chat_x' (integer) +
'win_chat_y' (integer) +
'win_chat_width' (integer) +
'win_chat_height' (integer) +
'win_chat_cursor_x' (integer) +
'win_chat_cursor_y' (integer) +
'bar_windows' (pointer) +
'last_bar_window' (pointer) +
'refresh_needed' (integer) +
'gui_objects' (pointer) +
'buffer' (pointer) +
'layout_plugin_name' (string) +
'layout_buffer_name' (string) +
'scroll' (pointer) +
'ptr_tree' (pointer) +
'prev_window' (pointer) +
'next_window' (pointer) |
'gui_current_window' +
'gui_windows' +
'last_gui_window'
| weechat | window_scroll | scroll info in window |
'buffer' (pointer) +
'first_line_displayed' (integer) +
'start_line' (pointer) +
'start_line_pos' (integer) +
'scrolling' (integer) +
'start_col' (integer) +
'lines_after' (integer) +
'reset_allowed' (integer) +
'prev_scroll' (pointer) +
'next_scroll' (pointer) |
-
| weechat | window_tree | tree of windows |
'parent_node' (pointer) +
'split_pct' (integer) +
'split_horizontal' (integer) +
'child1' (pointer) +
'child2' (pointer) +
'window' (pointer) |
'gui_windows_tree'
|========================================

View File

@ -145,7 +145,7 @@ command: command to execute (a '/' is automatically added if not found at beginn
/debug list
set <plugin> <level>
dump [<plugin>]
buffer|color|infolists|memory|term|windows
buffer|color|hdata|infolists|memory|term|windows
list: list plugins with debug levels
set: set debug level for plugin
@ -154,6 +154,7 @@ command: command to execute (a '/' is automatically added if not found at beginn
dump: save memory dump in WeeChat log file (same dump is written when WeeChat crashes)
buffer: dump buffer content with hexadecimal values in log file
color: display infos about current color pairs
hdata: display infos about hdata
infolists: display infos about infolists
memory: display infos about memory usage
term: display infos about terminal

View File

@ -3247,7 +3247,7 @@ Prototype:
[source,C]
----------------------------------------
const char *weechat_hashtable_get_string (struct t_hashtable *hashtable,
void *property);
const char *property);
----------------------------------------
Arguments:
@ -6042,7 +6042,7 @@ weechat_hook_modifier ("2000|input_text_display", &modifier_cb, NULL);
----------------------------------------
Following hook types allow priority: command, command_run, signal, hsignal,
config, completion, modifier, info, infolist.
config, completion, modifier, info, info_hashtable, infolist, hdata.
weechat_hook_command
^^^^^^^^^^^^^^^^^^^^
@ -8173,6 +8173,62 @@ hook = weechat.hook_infolist("my_infolist", "Infolist with some data",
"my_infolist_cb", "")
----------------------------------------
weechat_hook_hdata
^^^^^^^^^^^^^^^^^^
Hook a hdata: callback will return pointer to hdata asked.
Prototype:
[source,C]
----------------------------------------
struct t_hook *weechat_hook_hdata (const char *hdata_name,
const char *description,
struct t_hdata *(*callback)(void *data,
const char *hdata_name),
void *callback_data);
----------------------------------------
Arguments:
* 'hdata_name': name of hdata
(priority allowed, see note about <<hook_priority,priority>>)
* 'description': description
* 'callback': function called when hdata is asked, arguments and return
value:
** 'void *data': pointer
** 'const char *hdata_name': name of hdata
** return value: hdata asked
* 'callback_data': pointer given to callback when it is called by WeeChat
Return value:
* pointer to new hook, NULL if error occured
C example:
[source,C]
----------------------------------------
struct t_hdata *
my_hdata_cb (void *data, const char *hdata_name)
{
struct t_hdata *my_hdata;
/* build hdata */
/* ... */
return my_hdata;
}
/* add hdata "my_hdata" */
struct t_hook *my_hdata = weechat_hook_hdata ("my_hdata",
"Hdata for my structure",
&my_hdata_cb, NULL);
----------------------------------------
[NOTE]
This function is not available in scripting API.
weechat_unhook
^^^^^^^^^^^^^^
@ -11101,6 +11157,13 @@ weechat_infolist_get
Return infolist from WeeChat or a plugin.
[IMPORTANT]
Content of infolist is a duplication of actual data. So if you are asking
infolist with lot of data (like "buffer_lines"), WeeChat will allocate memory
to duplicate all data, and this can take some time. +
Instead of using big infolist, it is preferable to use hdata (but infolist may
have more info than hdata, which is raw data), see <<hdata,hdata>>.
Prototype:
[source,C]
@ -11550,6 +11613,849 @@ weechat.infolist_free(infolist)
weechat.infolist_free(infolist)
----------------------------------------
[[hdata]]
Hdata
~~~~~
Functions for hdata (raw access to WeeChat or plugins data).
[IMPORTANT]
Hdata provides read-only access to data. It is *STRICTLY FORBIDDEN* to write
something in memory pointed by hdata variables.
weechat_hdata_new
^^^^^^^^^^^^^^^^^
_New in version 0.3.6._
Create a new hdata.
[NOTE]
.hdata vs infolist
========================================
Hdata is a fast way to read WeeChat or plugins data. It is similar to
infolist, but there are some differences:
* it is faster and uses less memory: direct read of data without duplication
* it may have different info than infolist: it only raw data in structures
(infolist may add some extra data for convenience)
========================================
Prototype:
[source,C]
----------------------------------------
struct t_hdata *weechat_hdata_new (const char *hdata_name, const char *var_prev, const char *var_next);
----------------------------------------
Arguments:
* 'hdata_name': name of hdata
* 'var_prev': name of variable in structure which is a pointer to previous
element in list (may be NULL if no such variable is available)
* 'var_next': name of variable in structure which is a pointer to next
element in list (may be NULL if no such variable is available)
Return value:
* pointer to new hdata
C example:
[source,C]
----------------------------------------
struct t_hdata *hdata = weechat_hdata_new ("myplugin_list", "prev", "next");
----------------------------------------
[NOTE]
This function is not available in scripting API.
weechat_hdata_new_var
^^^^^^^^^^^^^^^^^^^^^
_New in version 0.3.6._
Create a new variable in hdata.
Prototype:
[source,C]
----------------------------------------
void weechat_hdata_new_var (struct t_hdata *hdata, const char *name, int offset, int type);
----------------------------------------
Arguments:
* 'hdata': hdata pointer
* 'name': variable name
* 'offset': offset of variable in structure
* 'type': variable type, one of:
** WEECHAT_HDATA_INTEGER
** WEECHAT_HDATA_LONG
** WEECHAT_HDATA_STRING
** WEECHAT_HDATA_POINTER
** WEECHAT_HDATA_TIME
** WEECHAT_HDATA_OTHER
C example:
[source,C]
----------------------------------------
struct t_myplugin_list
{
char *name;
struct t_gui_buffer *buffer;
int count;
struct t_myplugin_list *prev;
struct t_myplugin_list *next;
};
/* ... */
struct t_hdata *hdata = weechat_hdata_new ("myplugin_list", "prev", "next");
weechat_hdata_new_var (hdata, "name", offsetof (struct t_myplugin_list, name), WEECHAT_HDATA_STRING);
weechat_hdata_new_var (hdata, "buffer", offsetof (struct t_myplugin_list, buffer), WEECHAT_HDATA_POINTER);
weechat_hdata_new_var (hdata, "count", offsetof (struct t_myplugin_list, count), WEECHAT_HDATA_INTEGER);
weechat_hdata_new_var (hdata, "prev", offsetof (struct t_myplugin_list, prev), WEECHAT_HDATA_POINTER);
weechat_hdata_new_var (hdata, "next", offsetof (struct t_myplugin_list, next), WEECHAT_HDATA_POINTER);
----------------------------------------
The macro "WEECHAT_HDATA_VAR" can be used to shorten code:
[source,C]
----------------------------------------
WEECHAT_HDATA_VAR(struct t_myplugin_list, name, STRING);
WEECHAT_HDATA_VAR(struct t_myplugin_list, buffer, POINTER);
WEECHAT_HDATA_VAR(struct t_myplugin_list, count, INTEGER);
WEECHAT_HDATA_VAR(struct t_myplugin_list, prev, POINTER);
WEECHAT_HDATA_VAR(struct t_myplugin_list, next, POINTER);
----------------------------------------
[NOTE]
This function is not available in scripting API.
weechat_hdata_new_list
^^^^^^^^^^^^^^^^^^^^^^
_New in version 0.3.6._
Create a new list pointer in hdata.
Prototype:
[source,C]
----------------------------------------
void weechat_hdata_new_list (struct t_hdata *hdata, const char *name, void *pointer);
----------------------------------------
Arguments:
* 'hdata': hdata pointer
* 'name': variable name
* 'pointer': list pointer
C example:
[source,C]
----------------------------------------
struct t_myplugin_list
{
char *name;
struct t_gui_buffer *buffer;
int count;
struct t_myplugin_list *prev;
struct t_myplugin_list *next;
};
struct t_myplugin_list *buffers = NULL;
struct t_myplugin_list *last_buffer = NULL;
/* ... */
struct t_hdata *hdata = weechat_hdata_new ("myplugin_list", "prev", "next");
weechat_hdata_new_var (hdata, "name", offsetof (struct t_myplugin_list, name), WEECHAT_HDATA_STRING);
weechat_hdata_new_var (hdata, "buffer", offsetof (struct t_myplugin_list, buffer), WEECHAT_HDATA_POINTER);
weechat_hdata_new_var (hdata, "count", offsetof (struct t_myplugin_list, count), WEECHAT_HDATA_INTEGER);
weechat_hdata_new_var (hdata, "prev", offsetof (struct t_myplugin_list, prev), WEECHAT_HDATA_POINTER);
weechat_hdata_new_var (hdata, "next", offsetof (struct t_myplugin_list, next), WEECHAT_HDATA_POINTER);
weechat_hdata_new_list (hdata, "buffers", &buffers);
weechat_hdata_new_list (hdata, "last_buffer", &last_buffer);
----------------------------------------
The macro "WEECHAT_HDATA_LIST" can be used to shorten code:
[source,C]
----------------------------------------
WEECHAT_HDATA_LIST(buffers);
WEECHAT_HDATA_LIST(last_buffer);
----------------------------------------
[NOTE]
This function is not available in scripting API.
weechat_hdata_get
^^^^^^^^^^^^^^^^^
_New in version 0.3.6._
Return hdata for a WeeChat or plugin structure.
[NOTE]
Hdata does not contain data, it's only a hashtable with position of variables
in structure. That means you will need this hdata and a pointer to a
WeeChat/plugin object to read some data.
Prototype:
[source,C]
----------------------------------------
struct t_hdata *weechat_hdata_get (const char *hdata_name);
----------------------------------------
Arguments:
* 'hdata_name': name of hdata:
include::autogen/plugin_api/hdata.txt[]
Return value:
* pointer to hdata, NULL if an error occured
C example:
[source,C]
----------------------------------------
struct t_hdata *hdata = weechat_hdata_get ("irc_server");
----------------------------------------
Script (Python):
[source,python]
----------------------------------------
# prototype
hdata = weechat.hdata_get(hdata_name)
# example
hdata = weechat.hdata_get("irc_server")
----------------------------------------
weechat_hdata_get_var_offset
^^^^^^^^^^^^^^^^^^^^^^^^^^^^
_New in version 0.3.6._
Return offset of variable in hdata.
Prototype:
[source,C]
----------------------------------------
int weechat_hdata_get_var_offset (struct t_hdata *hdata, const char *name);
----------------------------------------
Arguments:
* 'hdata': hdata pointer
* 'name': variable name
Return value:
* variable offset, 0 if an error occured
C example:
[source,C]
----------------------------------------
int offset = weechat_hdata_get_var_offset (hdata, "name");
----------------------------------------
[NOTE]
This function is not available in scripting API.
weechat_hdata_get_var_type
^^^^^^^^^^^^^^^^^^^^^^^^^^
_New in version 0.3.6._
Return type of variable in hdata (as integer).
Prototype:
[source,C]
----------------------------------------
int weechat_hdata_get_var_type (struct t_hdata *hdata, const char *name);
----------------------------------------
Arguments:
* 'hdata': hdata pointer
* 'name': variable name
Return value:
* variable type, -1 if an error occured
C example:
[source,C]
----------------------------------------
int type = weechat_hdata_get_var_type (hdata, "name");
switch (type)
{
case WEECHAT_HDATA_INTEGER:
/* ... */
break;
case WEECHAT_HDATA_LONG:
/* ... */
break;
case WEECHAT_HDATA_STRING:
/* ... */
break;
case WEECHAT_HDATA_POINTER:
/* ... */
break;
case WEECHAT_HDATA_TIME:
/* ... */
break;
case WEECHAT_HDATA_OTHER:
/* ... */
break;
default:
/* variable not found */
break;
}
----------------------------------------
[NOTE]
This function is not available in scripting API.
weechat_hdata_get_var_type_string
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
_New in version 0.3.6._
Return type of variable in hdata (as string).
Prototype:
[source,C]
----------------------------------------
const char *weechat_hdata_get_var_type_string (struct t_hdata *hdata, const char *name);
----------------------------------------
Arguments:
* 'hdata': hdata pointer
* 'name': variable name
Return value:
* variable type, NULL if an error occured
C example:
[source,C]
----------------------------------------
weechat_printf (NULL, "type = %s",
weechat_hdata_get_var_type_string (hdata, "name"));
----------------------------------------
Script (Python):
[source,python]
----------------------------------------
# prototype
type = weechat.hdata_get_var_type_string(hdata, name)
# example
weechat.prnt("", "type = %s" % weechat.hdata_get_var_type_string("name"))
----------------------------------------
weechat_hdata_get_var
^^^^^^^^^^^^^^^^^^^^^
_New in version 0.3.6._
Return pointer to content of variable in hdata.
Prototype:
[source,C]
----------------------------------------
void *weechat_hdata_get_var (struct t_hdata *hdata, void *pointer, const char *name);
----------------------------------------
Arguments:
* 'hdata': hdata pointer
* 'pointer': pointer to WeeChat/plugin object
* 'name': variable name
Return value:
* pointer to content of variable, NULL if an error occured
C example:
[source,C]
----------------------------------------
struct t_hdata *hdata = weechat_hdata_get ("buffer");
struct t_gui_buffer *buffer = weechat_buffer_search_main ();
void *pointer = weechat_hdata_get_var (hdata, buffer, "name");
----------------------------------------
[NOTE]
This function is not available in scripting API.
weechat_hdata_get_var_at_offset
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
_New in version 0.3.6._
Return pointer to content of variable in hdata, using offset.
Prototype:
[source,C]
----------------------------------------
void *weechat_hdata_get_var_at_offset (struct t_hdata *hdata, void *pointer, int offset);
----------------------------------------
Arguments:
* 'hdata': hdata pointer
* 'pointer': pointer to WeeChat/plugin object
* 'offset': offset of variable
Return value:
* pointer to content of variable, NULL if an error occured
C example:
[source,C]
----------------------------------------
struct t_hdata *hdata = weechat_hdata_get ("buffer");
struct t_gui_buffer *buffer = weechat_buffer_search_main ();
int offset = weechat_hdata_get_var_offset (hdata, "name");
void *pointer = weechat_hdata_get_var_at_offset (hdata, buffer, offset);
----------------------------------------
[NOTE]
This function is not available in scripting API.
weechat_hdata_get_list
^^^^^^^^^^^^^^^^^^^^^^
_New in version 0.3.6._
Return list pointer from hdata.
Prototype:
[source,C]
----------------------------------------
void *weechat_hdata_get_list (struct t_hdata *hdata, const char *name);
----------------------------------------
Arguments:
* 'hdata': hdata pointer
* 'name': list name
Return value:
* list pointer, NULL if an error occured
C example:
[source,C]
----------------------------------------
struct t_hdata *hdata = weechat_hdata_get ("buffer");
struct t_gui_buffer *buffers = weechat_hdata_get_list (hdata, "gui_buffers");
----------------------------------------
Script (Python):
[source,python]
----------------------------------------
# prototype
list = weechat.hdata_get_list(hdata, name)
# example
hdata = weechat.hdata_get("buffer")
buffers = weechat.hdata_get_list(hdata, "gui_buffers")
----------------------------------------
weechat_hdata_move
^^^^^^^^^^^^^^^^^^
_New in version 0.3.6._
Move pointer to another element in list.
Prototype:
[source,C]
----------------------------------------
void *weechat_hdata_move (struct t_hdata *hdata, void *pointer, int count);
----------------------------------------
Arguments:
* 'hdata': hdata pointer
* 'pointer': pointer to a WeeChat/plugin object
* 'count': number of jump(s) to execute (negative or positive integer, different
from 0)
Return value:
* pointer to element reached, NULL if an error occured
C example:
[source,C]
----------------------------------------
struct t_hdata *hdata = weechat_hdata_get ("buffer");
struct t_gui_buffer *buffer = weechat_buffer_search_main ();
/* move to next buffer, 2 times */
buffer = weechat_hdata_move (hdata, buffer, 2);
/* move to previous buffer */
if (buffer)
buffer = weechat_hdata_move (hdata, buffer, -1);
----------------------------------------
Script (Python):
[source,python]
----------------------------------------
# prototype
pointer = weechat.hdata_move(hdata, pointer, count)
# example
hdata = weechat_hdata_get("buffer")
buffer = weechat.buffer_search_main()
# move to next buffer, 2 times
buffer = weechat.hdata_move(hdata, buffer, 2)
# move to previous buffer
if buffer:
buffer = weechat.hdata_move(hdata, buffer, -1)
----------------------------------------
weechat_hdata_integer
^^^^^^^^^^^^^^^^^^^^^
_New in version 0.3.6._
Return value of integer variable in structure using hdata.
Prototype:
[source,C]
----------------------------------------
int weechat_hdata_integer (struct t_hdata *hdata, void *pointer, const char *name);
----------------------------------------
Arguments:
* 'hdata': hdata pointer
* 'pointer': pointer to WeeChat/plugin object
* 'name': variable name (must be type "integer")
Return value:
* integer value of variable
C example:
[source,C]
----------------------------------------
struct t_hdata *hdata = weechat_hdata_get ("buffer");
struct t_gui_buffer *buffer = weechat_buffer_search_main ();
weechat_printf (NULL, "number = %d", weechat_hdata_integer (hdata, buffer, "number"));
----------------------------------------
Script (Python):
[source,python]
----------------------------------------
# prototype
value = weechat.hdata_integer(hdata, pointer, name)
# example
hdata = weechat.hdata_get("buffer")
buffer = weechat.buffer_search_main()
weechat.prnt("", "number = %d" % weechat.hdata_integer(hdata, buffer, "number"))
----------------------------------------
weechat_hdata_long
^^^^^^^^^^^^^^^^^^
_New in version 0.3.6._
Return value of long variable in structure using hdata.
Prototype:
[source,C]
----------------------------------------
long weechat_hdata_long (struct t_hdata *hdata, void *pointer, const char *name);
----------------------------------------
Arguments:
* 'hdata': hdata pointer
* 'pointer': pointer to WeeChat/plugin object
* 'name': variable name (must be type "long")
Return value:
* long value of variable
C example:
[source,C]
----------------------------------------
weechat_printf (NULL, "longvar = %ld", weechat_hdata_long (hdata, pointer, "longvar"));
----------------------------------------
Script (Python):
[source,python]
----------------------------------------
# prototype
value = weechat.hdata_long(hdata, pointer, name)
# example
weechat.prnt("", "longvar = %ld" % weechat.hdata_long(hdata, pointer, "longvar"))
----------------------------------------
weechat_hdata_string
^^^^^^^^^^^^^^^^^^^^
_New in version 0.3.6._
Return value of string variable in structure using hdata.
Prototype:
[source,C]
----------------------------------------
const char *weechat_hdata_string (struct t_hdata *hdata, void *pointer, const char *name);
----------------------------------------
Arguments:
* 'hdata': hdata pointer
* 'pointer': pointer to WeeChat/plugin object
* 'name': variable name (must be type "string")
Return value:
* string value of variable
C example:
[source,C]
----------------------------------------
struct t_hdata *hdata = weechat_hdata_get ("buffer");
struct t_gui_buffer *buffer = weechat_buffer_search_main ();
weechat_printf (NULL, "name = %s", weechat_hdata_string (hdata, buffer, "name"));
----------------------------------------
Script (Python):
[source,python]
----------------------------------------
# prototype
value = weechat.hdata_string(hdata, pointer, name)
# example
hdata = weechat.hdata_get("buffer")
buffer = weechat.buffer_search_main()
weechat.prnt("", "name = %s" % weechat.hdata_string(hdata, buffer, "name"))
----------------------------------------
weechat_hdata_pointer
^^^^^^^^^^^^^^^^^^^^^
_New in version 0.3.6._
Return value of pointer variable in structure using hdata.
Prototype:
[source,C]
----------------------------------------
void *weechat_hdata_pointer (struct t_hdata *hdata, void *pointer, const char *name);
----------------------------------------
Arguments:
* 'hdata': hdata pointer
* 'pointer': pointer to WeeChat/plugin object
* 'name': variable name (must be type "pointer")
Return value:
* pointer value of variable
C example:
[source,C]
----------------------------------------
struct t_hdata *hdata = weechat_hdata_get ("buffer");
struct t_gui_buffer *buffer = weechat_buffer_search_main ();
weechat_printf (NULL, "lines = %lx", weechat_hdata_pointer (hdata, buffer, "lines"));
----------------------------------------
Script (Python):
[source,python]
----------------------------------------
# prototype
value = weechat.hdata_pointer(hdata, pointer, name)
# example
hdata = weechat.hdata_get("buffer")
buffer = weechat.buffer_search_main()
weechat.prnt("", "lines = %lx" % weechat.hdata_pointer(hdata, buffer, "lines"))
----------------------------------------
weechat_hdata_time
^^^^^^^^^^^^^^^^^^
_New in version 0.3.6._
Return value of time variable in structure using hdata.
Prototype:
[source,C]
----------------------------------------
time_t weechat_hdata_time (struct t_hdata *hdata, void *pointer, const char *name);
----------------------------------------
Arguments:
* 'hdata': hdata pointer
* 'pointer': pointer to WeeChat/plugin object
* 'name': variable name (must be type "time")
Return value:
* time value of variable
C example:
[source,C]
----------------------------------------
struct t_hdata *hdata = weechat_hdata_get ("buffer");
struct t_gui_buffer *ptr = weechat_buffer_search_main ();
ptr = weechat_hdata_pointer (hdata, ptr, "lines");
if (ptr)
{
hdata = weechat_hdata_get ("lines");
ptr = weechat_hdata_pointer (hdata, ptr, "first_line");
if (ptr)
{
hdata = weechat_hdata_get ("line");
ptr = weechat_hdata_pointer (hdata, ptr, "data");
if (ptr)
{
hdata = weechat_hdata_get ("line_data");
time_t date = weechat_hdata_time (hdata, hdata, "date");
weechat_printf (NULL, "time of last line displayed = %s", ctime (&date));
}
}
}
----------------------------------------
Script (Python):
[source,python]
----------------------------------------
# prototype
value = weechat.hdata_time(hdata, pointer, name)
# example
hdata = weechat.hdata_get("buffer")
ptr = weechat.buffer_search_main()
ptr = weechat.hdata_pointer(hdata, ptr, "lines")
if ptr:
hdata = weechat.hdata_get("lines")
ptr = weechat.hdata_pointer(hdata, ptr, "first_line")
if ptr:
hdata = weechat.hdata_get("line")
ptr = weechat.hdata_pointer(hdata, ptr, "data")
if ptr:
hdata = weechat.hdata_get("line_data")
weechat.prnt("", "time of last line displayed = %s" % weechat.hdata_time(hdata, ptr, "date"))
----------------------------------------
weechat_hdata_get_string
^^^^^^^^^^^^^^^^^^^^^^^^
_New in version 0.3.6._
Return string value of a hdata property.
Prototype:
[source,C]
----------------------------------------
const char *weechat_hdata_get_string (struct t_hdata *hdata, const char *property);
----------------------------------------
Arguments:
* 'hdata': hdata pointer
* 'property': property name:
** 'var_keys': string with list of keys for variables in hdata
(format: "key1,key2,key3")
** 'var_values': string with list of values for variables in hdata
(format: "value1,value2,value3")
** 'var_keys_values': string with list of keys and values for variables in hdata
(format: "key1:value1,key2:value2,key3:value3")
** 'var_prev': name of variable in structure which is a pointer to previous
element in list
** 'var_next': name of variable in structure which is a pointer to next
element in list
** 'list_keys': string with list of keys for lists in hdata
(format: "key1,key2,key3")
** 'list_values': string with list of values for lists in hdata
(format: "value1,value2,value3")
** 'list_keys_values': string with list of keys and values for lists in hdata
(format: "key1:value1,key2:value2,key3:value3")
Return value:
* string value of property
C example:
[source,C]
----------------------------------------
weechat_printf (NULL, "variables in hdata: %s" weechat_hdata_get_string (hdata, "var_keys"));
weechat_printf (NULL, "lists in hdata: %s" weechat_hdata_get_string (hdata, "list_keys"));
----------------------------------------
Script (Python):
[source,python]
----------------------------------------
# prototype
value = weechat.hdata_get_string(hdata, property)
# example
weechat.prnt("", "variables in hdata: %s" % weechat.hdata_get_string(hdata, "var_keys"))
weechat.prnt("", "lists in hdata: %s" % weechat.hdata_get_string(hdata, "list_keys"))
----------------------------------------
[[upgrade]]
Upgrade
~~~~~~~

View File

@ -0,0 +1,659 @@
[width="100%",cols="^1,^2,5,5,5",options="header"]
|========================================
| Extension | Nom | Description | Variables | Listes
| irc | irc_channel | canal irc |
'type' (integer) +
'name' (string) +
'topic' (string) +
'modes' (string) +
'limit' (integer) +
'key' (string) +
'checking_away' (integer) +
'away_message' (string) +
'has_quit_server' (integer) +
'cycle' (integer) +
'part' (integer) +
'display_creation_date' (integer) +
'nick_completion_reset' (integer) +
'pv_remote_nick_color' (string) +
'hook_autorejoin' (pointer) +
'nicks_count' (integer) +
'nicks' (pointer) +
'last_nick' (pointer) +
'nicks_speaking' (pointer) +
'nicks_speaking_time' (pointer) +
'last_nick_speaking_time' (pointer) +
'buffer' (pointer) +
'buffer_as_string' (string) +
'prev_channel' (pointer) +
'next_channel' (pointer) |
-
| irc | irc_channel_speaking | channel_speaking irc |
'nick' (string) +
'time_last_message' (time) +
'prev_nick' (pointer) +
'next_nick' (pointer) |
-
| irc | irc_ignore | ignore irc |
'number' (integer) +
'mask' (string) +
'regex_mask' (pointer) +
'server' (string) +
'channel' (string) +
'prev_ignore' (pointer) +
'next_ignore' (pointer) |
'irc_ignore_list' +
'last_irc_ignore'
| irc | irc_nick | pseudo irc |
'name' (string) +
'host' (string) +
'prefixes' (string) +
'prefix' (string) +
'away' (integer) +
'color' (string) +
'prev_nick' (pointer) +
'next_nick' (pointer) |
-
| irc | irc_notify | notify irc |
'server' (pointer) +
'nick' (string) +
'check_away' (integer) +
'is_on_server' (integer) +
'away_message' (string) +
'ison_received' (integer) +
'prev_notify' (pointer) +
'next_notify' (pointer) |
-
| irc | irc_redirect | redirection irc |
'server' (pointer) +
'pattern' (string) +
'signal' (string) +
'count' (integer) +
'current_count' (integer) +
'string' (string) +
'timeout' (integer) +
'command' (string) +
'start_time' (time) +
'cmd_start' (pointer) +
'cmd_stop' (pointer) +
'cmd_extra' (pointer) +
'cmd_start_received' (integer) +
'cmd_stop_received' (integer) +
'cmd_filter' (pointer) +
'output' (string) +
'output_size' (integer) +
'prev_redirect' (pointer) +
'next_redirect' (pointer) |
-
| irc | irc_redirect_pattern | modèle pour une redirection irc |
'name' (string) +
'temp_pattern' (integer) +
'timeout' (integer) +
'cmd_start' (string) +
'cmd_stop' (string) +
'cmd_extra' (string) +
'prev_redirect' (pointer) +
'next_redirect' (pointer) |
'irc_redirect_patterns' +
'last_irc_redirect_pattern'
| irc | irc_server | serveur irc |
'name' (string) +
'options' (pointer) +
'temp_server' (integer) +
'reloading_from_config' (integer) +
'reloaded_from_config' (integer) +
'addresses_count' (integer) +
'addresses_array' (pointer) +
'ports_array' (pointer) +
'index_current_address' (integer) +
'current_address' (string) +
'current_ip' (string) +
'current_port' (integer) +
'sock' (integer) +
'hook_connect' (pointer) +
'hook_fd' (pointer) +
'hook_timer_connection' (pointer) +
'hook_timer_sasl' (pointer) +
'is_connected' (integer) +
'ssl_connected' (integer) +
'gnutls_sess' (other) +
'tls_cert' (other) +
'tls_cert_key' (other) +
'unterminated_message' (string) +
'nicks_count' (integer) +
'nicks_array' (pointer) +
'nick_first_tried' (integer) +
'nick' (string) +
'nick_modes' (string) +
'isupport' (string) +
'prefix_modes' (string) +
'prefix_chars' (string) +
'reconnect_delay' (integer) +
'reconnect_start' (time) +
'command_time' (time) +
'reconnect_join' (integer) +
'disable_autojoin' (integer) +
'is_away' (integer) +
'away_message' (string) +
'away_time' (time) +
'lag' (integer) +
'lag_check_time' (other) +
'lag_next_check' (time) +
'lag_last_refresh' (time) +
'cmd_list_regexp' (pointer) +
'last_user_message' (time) +
'last_away_check' (time) +
'outqueue' (pointer) +
'last_outqueue' (pointer) +
'redirects' (pointer) +
'last_redirect' (pointer) +
'notify_list' (pointer) +
'last_notify' (pointer) +
'manual_joins' (pointer) +
'buffer' (pointer) +
'buffer_as_string' (string) +
'channels' (pointer) +
'last_channel' (pointer) +
'prev_server' (pointer) +
'next_server' (pointer) |
'irc_servers' +
'last_irc_server'
| weechat | bar | barre |
'name' (string) +
'options' (pointer) +
'conditions_count' (integer) +
'conditions_array' (pointer) +
'items_count' (integer) +
'items_subcount' (pointer) +
'items_array' (pointer) +
'bar_window' (pointer) +
'bar_refresh_needed' (integer) +
'prev_bar' (pointer) +
'next_bar' (pointer) |
'gui_bars' +
'last_gui_bar'
| weechat | bar_item | objet de barre |
'plugin' (pointer) +
'name' (string) +
'build_callback' (pointer) +
'build_callback_data' (pointer) +
'prev_item' (pointer) +
'next_item' (pointer) |
'gui_bar_items' +
'last_gui_bar_item'
| weechat | buffer | tampon |
'plugin' (pointer) +
'plugin_name_for_upgrade' (string) +
'merge_for_upgrade' (pointer) +
'number' (integer) +
'layout_number' (integer) +
'layout_applied' (integer) +
'name' (string) +
'short_name' (string) +
'type' (integer) +
'notify' (integer) +
'num_displayed' (integer) +
'active' (integer) +
'print_hooks_enabled' (integer) +
'close_callback' (pointer) +
'close_callback_data' (pointer) +
'title' (string) +
'own_lines' (pointer) +
'mixed_lines' (pointer) +
'lines' (pointer) +
'time_for_each_line' (integer) +
'chat_refresh_needed' (integer) +
'nicklist' (integer) +
'nicklist_case_sensitive' (integer) +
'nicklist_root' (pointer) +
'nicklist_max_length' (integer) +
'nicklist_display_groups' (integer) +
'nicklist_visible_count' (integer) +
'input' (integer) +
'input_callback' (pointer) +
'input_callback_data' (pointer) +
'input_get_unknown_commands' (integer) +
'input_buffer' (string) +
'input_buffer_alloc' (integer) +
'input_buffer_size' (integer) +
'input_buffer_length' (integer) +
'input_buffer_pos' (integer) +
'input_buffer_1st_display' (integer) +
'input_undo_snap' (pointer) +
'input_undo' (pointer) +
'last_input_undo' (pointer) +
'ptr_input_undo' (pointer) +
'input_undo_count' (integer) +
'completion' (pointer) +
'history' (pointer) +
'last_history' (pointer) +
'ptr_history' (pointer) +
'num_history' (integer) +
'text_search' (integer) +
'text_search_exact' (integer) +
'text_search_found' (integer) +
'text_search_input' (string) +
'highlight_words' (string) +
'highlight_tags' (string) +
'highlight_tags_count' (integer) +
'highlight_tags_array' (pointer) +
'hotlist_max_level_nicks' (pointer) +
'keys' (pointer) +
'last_key' (pointer) +
'keys_count' (integer) +
'local_variables' (pointer) +
'prev_buffer' (pointer) +
'next_buffer' (pointer) |
'gui_buffers' +
'last_gui_buffer'
| weechat | completion | complétion |
'buffer' (pointer) +
'context' (integer) +
'base_command' (string) +
'base_command_arg_index' (integer) +
'base_word' (string) +
'base_word_pos' (integer) +
'position' (integer) +
'args' (string) +
'direction' (integer) +
'add_space' (integer) +
'force_partial_completion' (integer) +
'completion_list' (pointer) +
'word_found' (string) +
'word_found_is_nick' (integer) +
'position_replace' (integer) +
'diff_size' (integer) +
'diff_length' (integer) +
'partial_completion_list' (pointer) +
'last_partial_completion' (pointer) |
-
| weechat | completion_partial | complétion partielle |
'word' (string) +
'count' (integer) +
'prev_item' (pointer) +
'next_item' (pointer) |
-
| weechat | config_file | fichier de configuration |
'plugin' (pointer) +
'name' (string) +
'filename' (string) +
'file' (pointer) +
'callback_reload' (pointer) +
'callback_reload_data' (pointer) +
'sections' (pointer) +
'last_section' (pointer) +
'prev_config' (pointer) +
'next_config' (pointer) |
'config_files' +
'last_config_file'
| weechat | config_option | option de configuration |
'config_file' (pointer) +
'section' (pointer) +
'name' (string) +
'type' (integer) +
'description' (string) +
'string_values' (pointer) +
'min' (integer) +
'max' (integer) +
'default_value' (pointer) +
'value' (pointer) +
'null_value_allowed' (integer) +
'callback_check_value' (pointer) +
'callback_check_value_data' (pointer) +
'callback_change' (pointer) +
'callback_change_data' (pointer) +
'callback_delete' (pointer) +
'callback_delete_data' (pointer) +
'loaded' (integer) +
'prev_option' (pointer) +
'next_option' (pointer) |
-
| weechat | config_section | section de configuration |
'config_file' (pointer) +
'name' (string) +
'user_can_add_options' (integer) +
'user_can_delete_options' (integer) +
'callback_read' (pointer) +
'callback_read_data' (pointer) +
'callback_write' (pointer) +
'callback_write_data' (pointer) +
'callback_write_default' (pointer) +
'callback_write_default_data' (pointer) +
'callback_create_option' (pointer) +
'callback_create_option_data' (pointer) +
'callback_delete_option' (pointer) +
'callback_delete_option_data' (pointer) +
'options' (pointer) +
'last_option' (pointer) +
'prev_section' (pointer) +
'next_section' (pointer) |
-
| weechat | filter | filtre |
'enabled' (integer) +
'name' (string) +
'buffer_name' (string) +
'num_buffers' (integer) +
'buffers' (pointer) +
'tags' (string) +
'tags_count' (integer) +
'tags_array' (pointer) +
'regex' (string) +
'regex_prefix' (pointer) +
'regex_message' (pointer) +
'prev_filter' (pointer) +
'next_filter' (pointer) |
'gui_filters' +
'last_gui_filter'
| weechat | history | historique des commandes dans le tampon |
'text' (string) +
'next_history' (pointer) +
'prev_history' (pointer) |
-
| weechat | hook | hook (variables communes à tous les types de hooks) |
'plugin' (pointer) +
'type' (integer) +
'deleted' (integer) +
'running' (integer) +
'priority' (integer) +
'callback_data' (pointer) +
'hook_data' (pointer) +
'prev_hook' (pointer) +
'next_hook' (pointer) |
-
| weechat | hook_command | hook de type "command" |
'callback' (pointer) +
'command' (string) +
'description' (string) +
'args' (string) +
'args_description' (string) +
'completion' (string) +
'cplt_num_templates' (integer) +
'cplt_templates' (pointer) +
'cplt_templates_static' (pointer) +
'cplt_template_num_args' (pointer) +
'cplt_template_args' (pointer) +
'cplt_template_num_args_concat' (integer) +
'cplt_template_args_concat' (pointer) |
'last_weechat_hook_command' +
'weechat_hooks_command'
| weechat | hook_command_run | hook de type "command_run" |
'callback' (pointer) +
'command' (string) |
'last_weechat_hook_command_run' +
'weechat_hooks_command_run'
| weechat | hook_completion | hook de type "completion" |
'callback' (pointer) +
'completion_item' (string) +
'description' (string) |
'last_weechat_hook_completion' +
'weechat_hooks_completion'
| weechat | hook_config | hook de type "config" |
'callback' (pointer) +
'option' (string) |
'last_weechat_hook_config' +
'weechat_hooks_config'
| weechat | hook_connect | hook de type "connect" |
'callback' (pointer) +
'proxy' (string) +
'address' (string) +
'port' (integer) +
'sock' (integer) +
'ipv6' (integer) +
'gnutls_sess' (pointer) +
'gnutls_cb' (pointer) +
'gnutls_dhkey_size' (integer) +
'gnutls_priorities' (string) +
'local_hostname' (string) +
'child_read' (integer) +
'child_write' (integer) +
'child_pid' (other) +
'hook_fd' (pointer) +
'handshake_hook_fd' (pointer) +
'handshake_hook_timer' (pointer) +
'handshake_fd_flags' (integer) +
'handshake_ip_address' (string) |
'last_weechat_hook_connect' +
'weechat_hooks_connect'
| weechat | hook_fd | hook de type "fd" |
'callback' (pointer) +
'fd' (integer) +
'flags' (integer) |
'last_weechat_hook_fd' +
'weechat_hooks_fd'
| weechat | hook_hdata | hook de type "hdata" |
'callback' (pointer) +
'hdata_name' (string) +
'description' (string) |
'last_weechat_hook_hdata' +
'weechat_hooks_hdata'
| weechat | hook_hsignal | hook de type "hsignal" |
'callback' (pointer) +
'signal' (string) |
'last_weechat_hook_hsignal' +
'weechat_hooks_hsignal'
| weechat | hook_info | hook de type "info" |
'callback' (pointer) +
'info_name' (string) +
'description' (string) +
'args_description' (string) |
'last_weechat_hook_info' +
'weechat_hooks_info'
| weechat | hook_info_hashtable | hook de type "info_hashtable" |
'callback' (pointer) +
'info_name' (string) +
'description' (string) +
'args_description' (string) +
'output_description' (string) |
'last_weechat_hook_info_hashtable' +
'weechat_hooks_info_hashtable'
| weechat | hook_infolist | hook de type "infolist" |
'callback' (pointer) +
'infolist_name' (string) +
'description' (string) +
'pointer_description' (string) +
'args_description' (string) |
'last_weechat_hook_infolist' +
'weechat_hooks_infolist'
| weechat | hook_modifier | hook de type "modifier" |
'callback' (pointer) +
'modifier' (string) |
'last_weechat_hook_modifier' +
'weechat_hooks_modifier'
| weechat | hook_print | hook de type "print" |
'callback' (pointer) +
'buffer' (pointer) +
'tags_count' (integer) +
'tags_array' (pointer) +
'message' (string) +
'strip_colors' (integer) |
'last_weechat_hook_print' +
'weechat_hooks_print'
| weechat | hook_process | hook de type "process" |
'callback' (pointer) +
'command' (string) +
'timeout' (long) +
'child_read' (pointer) +
'child_write' (pointer) +
'child_pid' (other) +
'hook_fd' (pointer) +
'hook_timer' (pointer) +
'buffer' (pointer) +
'buffer_size' (pointer) |
'last_weechat_hook_process' +
'weechat_hooks_process'
| weechat | hook_signal | hook de type "signal" |
'callback' (pointer) +
'signal' (string) |
'last_weechat_hook_signal' +
'weechat_hooks_signal'
| weechat | hook_timer | hook de type "timer" |
'callback' (pointer) +
'interval' (long) +
'align_second' (integer) +
'remaining_calls' (integer) +
'last_exec' (other) +
'next_exec' (other) |
'last_weechat_hook_timer' +
'weechat_hooks_timer'
| weechat | input_undo | undo pour la ligne de commande |
'data' (string) +
'pos' (integer) +
'prev_undo' (pointer) +
'next_undo' (pointer) |
-
| weechat | key | touche |
'key' (string) +
'command' (string) +
'prev_key' (pointer) +
'next_key' (pointer) |
'gui_default_keys' +
'gui_keys' +
'last_gui_default_key' +
'last_gui_key'
| weechat | line | ligne |
'data' (pointer) +
'prev_line' (pointer) +
'next_line' (pointer) |
-
| weechat | line_data | données de la ligne |
'buffer' (pointer) +
'y' (integer) +
'date' (time) +
'date_printed' (time) +
'str_time' (string) +
'tags_count' (integer) +
'tags_array' (pointer) +
'displayed' (integer) +
'highlight' (integer) +
'refresh_needed' (integer) +
'prefix' (string) +
'prefix_length' (integer) +
'message' (string) |
-
| weechat | lines | lignes |
'first_line' (pointer) +
'last_line' (pointer) +
'last_read_line' (pointer) +
'lines_count' (integer) +
'first_line_not_read' (integer) +
'lines_hidden' (integer) +
'buffer_max_length' (integer) +
'prefix_max_length' (integer) |
-
| weechat | nick | pseudo dans la liste de pseudos |
'group' (pointer) +
'name' (string) +
'color' (string) +
'prefix' (string) +
'prefix_color' (string) +
'visible' (integer) +
'prev_nick' (pointer) +
'next_nick' (pointer) |
-
| weechat | nick_group | groupe dans la liste de pseudos |
'name' (string) +
'color' (string) +
'visible' (integer) +
'level' (integer) +
'parent' (pointer) +
'childs' (pointer) +
'last_child' (pointer) +
'nicks' (pointer) +
'last_nick' (pointer) +
'prev_group' (pointer) +
'next_group' (pointer) |
-
| weechat | window | fenêtre |
'win_x' (integer) +
'win_y' (integer) +
'win_width' (integer) +
'win_height' (integer) +
'win_width_pct' (integer) +
'win_height_pct' (integer) +
'win_chat_x' (integer) +
'win_chat_y' (integer) +
'win_chat_width' (integer) +
'win_chat_height' (integer) +
'win_chat_cursor_x' (integer) +
'win_chat_cursor_y' (integer) +
'bar_windows' (pointer) +
'last_bar_window' (pointer) +
'refresh_needed' (integer) +
'gui_objects' (pointer) +
'buffer' (pointer) +
'layout_plugin_name' (string) +
'layout_buffer_name' (string) +
'scroll' (pointer) +
'ptr_tree' (pointer) +
'prev_window' (pointer) +
'next_window' (pointer) |
'gui_current_window' +
'gui_windows' +
'last_gui_window'
| weechat | window_scroll | info de défilement dans la fenêtre |
'buffer' (pointer) +
'first_line_displayed' (integer) +
'start_line' (pointer) +
'start_line_pos' (integer) +
'scrolling' (integer) +
'start_col' (integer) +
'lines_after' (integer) +
'reset_allowed' (integer) +
'prev_scroll' (pointer) +
'next_scroll' (pointer) |
-
| weechat | window_tree | arbre des fenêtres |
'parent_node' (pointer) +
'split_pct' (integer) +
'split_horizontal' (integer) +
'child1' (pointer) +
'child2' (pointer) +
'window' (pointer) |
'gui_windows_tree'
|========================================

View File

@ -145,7 +145,7 @@ extension: nom de l'extension ('weechat' pour une commande interne WeeChat)
/debug list
set <extension> <niveau>
dump [<extension>]
buffer|color|infolists|memory|term|windows
buffer|color|hdata|infolists|memory|term|windows
list: lister les extensions avec leur niveau de debug
set: définir le niveau de debug pour l'extension
@ -154,6 +154,7 @@ extension: nom de l'extension ("core" pour le coeur de WeeChat)
dump: afficher les variables mémoire WeeChat dans le fichier log (les mêmes messages sont affichés lorsque WeeChat plante)
buffer: afficher le contenu du tampon en valeurs hexadécimales dans le fichier log
color: afficher des infos sur les paires de couleur courantes
hdata: afficher des infos sur les hdata
infolists: afficher des infos sur les infolists
memory: afficher des infos sur l'utilisation de la mémoire
term: afficher des infos sur le terminal

View File

@ -3279,7 +3279,7 @@ Prototype :
[source,C]
----------------------------------------
const char *weechat_hashtable_get_string (struct t_hashtable *hashtable,
void *property);
const char *property);
----------------------------------------
Paramètres :
@ -6109,7 +6109,7 @@ weechat_hook_modifier ("2000|input_text_display", &modifier_cb, NULL);
----------------------------------------
Les types de "hooks" suivants autorisent une priorité : command, command_run,
signal, hsignal, config, completion, modifier, info, infolist.
signal, hsignal, config, completion, modifier, info, info_hashtable, infolist, hdata.
weechat_hook_command
^^^^^^^^^^^^^^^^^^^^
@ -8303,6 +8303,63 @@ hook = weechat.hook_infolist("mon_infolist", "Mon infolist",
"my_infolist_cb", "")
----------------------------------------
weechat_hook_hdata
^^^^^^^^^^^^^^^^^^
Accroche un hdata : le "callback" retournera un pointeur vers le hdata demandé.
Prototype:
[source,C]
----------------------------------------
struct t_hook *weechat_hook_hdata (const char *hdata_name,
const char *description,
struct t_hdata *(*callback)(void *data,
const char *hdata_name),
void *callback_data);
----------------------------------------
Paramètres :
* 'hdata_name' : nom du hdata
(priorité autorisée, voir la note sur la <<hook_priority,priorité>>)
* 'description' : description
* 'callback' : fonction appelée quand le hdata est demandé, paramètres et valeur
de retour :
** 'void *data' : pointeur
** 'const char *hdata_name' : nom du hdata
** valeur de retour : hdata demandé
* 'callback_data' : pointeur donné au "callback" lorsqu'il est appelé par
WeeChat
Valeur de retour :
* pointeur vers le nouveau "hook", NULL en cas d'erreur
Exemple en C :
[source,C]
----------------------------------------
struct t_hdata *
my_hdata_cb (void *data, const char *hdata_name)
{
struct t_hdata *mon_hdata;
/* construction du hdata */
/* ... */
return mon_hdata;
}
/* ajouts le hdata "mon_hdata" */
struct t_hook *my_hdata = weechat_hook_hdata ("mon_hdata",
"Hdata pour ma structure",
&my_hdata_cb, NULL);
----------------------------------------
[NOTE]
Cette fonction n'est pas disponible dans l'API script.
weechat_unhook
^^^^^^^^^^^^^^
@ -11274,6 +11331,15 @@ weechat_infolist_get
Retourne une "infolist" de WeeChat ou d'une extension.
[IMPORTANT]
Le contenu d'une infolist est une duplication des données réelles. Donc si vous
demandez une infolist avec beaucoup de données (comme "buffer_lines"), WeeChat
allouera de la mémoire pour dupliquer toutes les données, et cela peut prendre
du temps. +
Au lieu d'utiliser une grosse infolist, il est préférable d'utiliser un hdata
(mais l'infolist peut contenir plus de données que le hdata, qui contient des
données brutes), voir <<hdata,hdata>>.
Prototype :
[source,C]
@ -11733,6 +11799,861 @@ weechat.infolist_free(infolist)
weechat.infolist_free(infolist)
----------------------------------------
[[hdata]]
Hdata
~~~~~
Fonctions pour les hdata (accès brut aux données de WeeChat ou des extensions).
[IMPORTANT]
Le "hdata" fournit seulement un accès en lecture seule aux données. Il est
*STRICTEMENT INTERDIT* d'écrire quelque chose dans une zone mémoire pointée par
les variables du hdata.
weechat_hdata_new
^^^^^^^^^^^^^^^^^
_Nouveau dans la version 0.3.6._
Créé un "hdata".
[NOTE]
.hdata vs infolist
========================================
Le "hdata" est un moyen rapide de lire des données de WeeChat ou des extensions.
Il est similaire à l'infolist, mais il y a quelques différences :
* il est plus rapide et utilise moins de mémoire : accès direct aux données sans
duplication
* il peut contenir des informations différentes de l'infolist : il contient les
données brutes des structures (l'infolist peut ajouter des données
supplémentaires pour plus de commodité)
========================================
Prototype :
[source,C]
----------------------------------------
struct t_hdata *weechat_hdata_new (const char *hdata_name, const char *var_prev, const char *var_next);
----------------------------------------
Paramètres :
* 'hdata_name' : nom du hdata
* 'var_prev' : nom de la variable dans la structure qui est un pointeur vers
l'élément précédent dans la liste (peut être NULL si une telle variable
n'existe pas)
* 'var_next' : nom de la variable dans la structure qui est un pointeur vers
l'élément suivant dans la liste (peut être NULL si une telle variable
n'existe pas)
Valeur de retour :
* pointeur vers le nouveau "hdata"
Exemple en C :
[source,C]
----------------------------------------
struct t_hdata *hdata = weechat_hdata_new ("myplugin_list", "prev", "next");
----------------------------------------
[NOTE]
Cette fonction n'est pas disponible dans l'API script.
weechat_hdata_new_var
^^^^^^^^^^^^^^^^^^^^^
_Nouveau dans la version 0.3.6._
Créé une nouvelle variable dans le hdata.
Prototype :
[source,C]
----------------------------------------
void weechat_hdata_new_var (struct t_hdata *hdata, const char *name, int offset, int type);
----------------------------------------
Paramètres :
* 'hdata' : pointeur vers le hdata
* 'name' : nom de la variable
* 'offset' : position (offset) de la variable dans la structure
* 'type' : type de la variable, un parmi ceux-ci :
** WEECHAT_HDATA_INTEGER
** WEECHAT_HDATA_LONG
** WEECHAT_HDATA_STRING
** WEECHAT_HDATA_POINTER
** WEECHAT_HDATA_TIME
** WEECHAT_HDATA_OTHER
Exemple en C :
[source,C]
----------------------------------------
struct t_myplugin_list
{
char *name;
struct t_gui_buffer *buffer;
int count;
struct t_myplugin_list *prev;
struct t_myplugin_list *next;
};
/* ... */
struct t_hdata *hdata = weechat_hdata_new ("myplugin_list", "prev", "next");
weechat_hdata_new_var (hdata, "name", offsetof (struct t_myplugin_list, name), WEECHAT_HDATA_STRING);
weechat_hdata_new_var (hdata, "buffer", offsetof (struct t_myplugin_list, buffer), WEECHAT_HDATA_POINTER);
weechat_hdata_new_var (hdata, "count", offsetof (struct t_myplugin_list, count), WEECHAT_HDATA_INTEGER);
weechat_hdata_new_var (hdata, "prev", offsetof (struct t_myplugin_list, prev), WEECHAT_HDATA_POINTER);
weechat_hdata_new_var (hdata, "next", offsetof (struct t_myplugin_list, next), WEECHAT_HDATA_POINTER);
----------------------------------------
La macro "WEECHAT_HDATA_VAR" peut être utilisée pour raccourcir le code :
[source,C]
----------------------------------------
WEECHAT_HDATA_VAR(struct t_myplugin_list, name, STRING);
WEECHAT_HDATA_VAR(struct t_myplugin_list, buffer, POINTER);
WEECHAT_HDATA_VAR(struct t_myplugin_list, count, INTEGER);
WEECHAT_HDATA_VAR(struct t_myplugin_list, prev, POINTER);
WEECHAT_HDATA_VAR(struct t_myplugin_list, next, POINTER);
----------------------------------------
[NOTE]
Cette fonction n'est pas disponible dans l'API script.
weechat_hdata_new_list
^^^^^^^^^^^^^^^^^^^^^^
_Nouveau dans la version 0.3.6._
Créé un nouveau pointer vers une liste dans le hdata.
Prototype :
[source,C]
----------------------------------------
void weechat_hdata_new_list (struct t_hdata *hdata, const char *name, void *pointer);
----------------------------------------
Paramètres :
* 'hdata' : pointeur vers le hdata
* 'name' : nom de la variable
* 'pointer' : pointeur vers la liste
Exemple en C :
[source,C]
----------------------------------------
struct t_myplugin_list
{
char *name;
struct t_gui_buffer *buffer;
int count;
struct t_myplugin_list *prev;
struct t_myplugin_list *next;
};
struct t_myplugin_list *buffers = NULL;
struct t_myplugin_list *last_buffer = NULL;
/* ... */
struct t_hdata *hdata = weechat_hdata_new ("myplugin_list", "prev", "next");
weechat_hdata_new_var (hdata, "name", offsetof (struct t_myplugin_list, name), WEECHAT_HDATA_STRING);
weechat_hdata_new_var (hdata, "buffer", offsetof (struct t_myplugin_list, buffer), WEECHAT_HDATA_POINTER);
weechat_hdata_new_var (hdata, "count", offsetof (struct t_myplugin_list, count), WEECHAT_HDATA_INTEGER);
weechat_hdata_new_var (hdata, "prev", offsetof (struct t_myplugin_list, prev), WEECHAT_HDATA_POINTER);
weechat_hdata_new_var (hdata, "next", offsetof (struct t_myplugin_list, next), WEECHAT_HDATA_POINTER);
weechat_hdata_new_list (hdata, "buffers", &buffers);
weechat_hdata_new_list (hdata, "last_buffer", &last_buffer);
----------------------------------------
La macro "WEECHAT_HDATA_LIST" peut être utilisée pour raccourcir le code :
[source,C]
----------------------------------------
WEECHAT_HDATA_LIST(buffers);
WEECHAT_HDATA_LIST(last_buffer);
----------------------------------------
[NOTE]
Cette fonction n'est pas disponible dans l'API script.
weechat_hdata_get
^^^^^^^^^^^^^^^^^
_Nouveau dans la version 0.3.6._
Retourne un "hdata" pour une structure de WeeChat ou d'une extension.
[NOTE]
Le "hdata" ne contient aucune donnée, il s'agit seulement d'une hashtable avec
la position (offset) des variables dans la structure. Cela signifie que vous
aurez besoin de ce hdata et d'un pointeur vers un objet WeeChat ou d'une
extension pour lire des données.
Prototype :
[source,C]
----------------------------------------
struct t_hdata *weechat_hdata_get (const char *hdata_name);
----------------------------------------
Paramètres :
* 'hdata_name' : nom du hdata :
include::autogen/plugin_api/hdata.txt[]
Valeur de retour :
* pointeur vers le hdata, NULL en cas d'erreur
Exemple en C :
[source,C]
----------------------------------------
struct t_hdata *hdata = weechat_hdata_get ("irc_server");
----------------------------------------
Script (Python):
[source,python]
----------------------------------------
# prototype
hdata = weechat.hdata_get(hdata_name)
# exemple
hdata = weechat.hdata_get("irc_server")
----------------------------------------
weechat_hdata_get_var_offset
^^^^^^^^^^^^^^^^^^^^^^^^^^^^
_Nouveau dans la version 0.3.6._
Retourne la position (offset) de la variable dans le hdata.
Prototype :
[source,C]
----------------------------------------
int weechat_hdata_get_var_offset (struct t_hdata *hdata, const char *name);
----------------------------------------
Paramètres :
* 'hdata' : pointeur vers le hdata
* 'name' : nom de la variable
Valeur de retour :
* position (offset) de la variable, 0 en cas d'erreur
Exemple en C :
[source,C]
----------------------------------------
int offset = weechat_hdata_get_var_offset (hdata, "name");
----------------------------------------
[NOTE]
Cette fonction n'est pas disponible dans l'API script.
weechat_hdata_get_var_type
^^^^^^^^^^^^^^^^^^^^^^^^^^
_Nouveau dans la version 0.3.6._
Retourne le type de la variable dans le hdata (sous forme d'entier).
Prototype :
[source,C]
----------------------------------------
int weechat_hdata_get_var_type (struct t_hdata *hdata, const char *name);
----------------------------------------
Paramètres :
* 'hdata' : pointeur vers le hdata
* 'name' : nom de la variable
Valeur de retour :
* type de la variable, -1 en cas d'erreur
Exemple en C :
[source,C]
----------------------------------------
int type = weechat_hdata_get_var_type (hdata, "name");
switch (type)
{
case WEECHAT_HDATA_INTEGER:
/* ... */
break;
case WEECHAT_HDATA_LONG:
/* ... */
break;
case WEECHAT_HDATA_STRING:
/* ... */
break;
case WEECHAT_HDATA_POINTER:
/* ... */
break;
case WEECHAT_HDATA_TIME:
/* ... */
break;
case WEECHAT_HDATA_OTHER:
/* ... */
break;
default:
/* variable non trouvée */
break;
}
----------------------------------------
[NOTE]
Cette fonction n'est pas disponible dans l'API script.
weechat_hdata_get_var_type_string
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
_Nouveau dans la version 0.3.6._
Retourne le type de la variable dans le hdata (sous forme de chaîne).
Prototype :
[source,C]
----------------------------------------
const char *weechat_hdata_get_var_type_string (struct t_hdata *hdata, const char *name);
----------------------------------------
Paramètres :
* 'hdata' : pointeur vers le hdata
* 'name' : nom de la variable
Valeur de retour :
* type de la variable, NULL en cas d'erreur
Exemple en C :
[source,C]
----------------------------------------
weechat_printf (NULL, "type = %s",
weechat_hdata_get_var_type_string (hdata, "name"));
----------------------------------------
Script (Python):
[source,python]
----------------------------------------
# prototype
type = weechat.hdata_get_var_type_string(hdata, name)
# exemple
weechat.prnt("", "type = %s" % weechat.hdata_get_var_type_string("name"))
----------------------------------------
weechat_hdata_get_var
^^^^^^^^^^^^^^^^^^^^^
_Nouveau dans la version 0.3.6._
Retourne un pointeur vers le contenu de la variable dans le hdata.
Prototype :
[source,C]
----------------------------------------
void *weechat_hdata_get_var (struct t_hdata *hdata, void *pointer, const char *name);
----------------------------------------
Paramètres :
* 'hdata' : pointeur vers le hdata
* 'pointer' : pointeur vers un objet WeeChat ou d'une extension
* 'name' : nom de la variable
Valeur de retour :
* pointeur vers le contenu de la variable, NULL en cas d'erreur
Exemple en C :
[source,C]
----------------------------------------
struct t_hdata *hdata = weechat_hdata_get ("buffer");
struct t_gui_buffer *buffer = weechat_buffer_search_main ();
void *pointer = weechat_hdata_get_var (hdata, buffer, "name");
----------------------------------------
[NOTE]
Cette fonction n'est pas disponible dans l'API script.
weechat_hdata_get_var_at_offset
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
_Nouveau dans la version 0.3.6._
Retourne un pointeur vers le contenu de la variable dans le hdata, en utilisant
une position (offset).
Prototype :
[source,C]
----------------------------------------
void *weechat_hdata_get_var_at_offset (struct t_hdata *hdata, void *pointer, int offset);
----------------------------------------
Paramètres :
* 'hdata' : pointeur vers le hdata
* 'pointer' : pointeur vers un objet WeeChat ou d'une extension
* 'offset' : position (offset) de la variable
Valeur de retour :
* pointeur vers le contenu de la variable, NULL en cas d'erreur
Exemple en C :
[source,C]
----------------------------------------
struct t_hdata *hdata = weechat_hdata_get ("buffer");
struct t_gui_buffer *buffer = weechat_buffer_search_main ();
int offset = weechat_hdata_get_var_offset (hdata, "name");
void *pointer = weechat_hdata_get_var_at_offset (hdata, buffer, offset);
----------------------------------------
[NOTE]
Cette fonction n'est pas disponible dans l'API script.
weechat_hdata_get_list
^^^^^^^^^^^^^^^^^^^^^^
_Nouveau dans la version 0.3.6._
Retourne un pointeur de liste du hdata.
Prototype :
[source,C]
----------------------------------------
void *weechat_hdata_get_list (struct t_hdata *hdata, const char *name);
----------------------------------------
Paramètres :
* 'hdata' : pointeur vers le hdata
* 'name' : nom de la liste
Valeur de retour :
* pointeur vers la liste, NULL en cas d'erreur
Exemple en C :
[source,C]
----------------------------------------
struct t_hdata *hdata = weechat_hdata_get ("buffer");
struct t_gui_buffer *buffers = weechat_hdata_get_list (hdata, "gui_buffers");
----------------------------------------
Script (Python):
[source,python]
----------------------------------------
# prototype
list = weechat.hdata_get_list(hdata, name)
# exemple
hdata = weechat.hdata_get("buffer")
buffers = weechat.hdata_get_list(hdata, "gui_buffers")
----------------------------------------
weechat_hdata_move
^^^^^^^^^^^^^^^^^^
_Nouveau dans la version 0.3.6._
Déplace le pointeur vers un autre élément dans la liste.
Prototype :
[source,C]
----------------------------------------
void *weechat_hdata_move (struct t_hdata *hdata, void *pointer, int count);
----------------------------------------
Paramètres :
* 'hdata' : pointeur vers le hdata
* 'pointer' : pointeur vers un objet WeeChat ou d'une extension
* 'count' : nombre de saut(s) à exécuter (entier négatif ou positif, différent
de 0)
Valeur de retour :
* pointeur vers l'élément atteint, NULL en cas d'erreur
Exemple en C :
[source,C]
----------------------------------------
struct t_hdata *hdata = weechat_hdata_get ("buffer");
struct t_gui_buffer *buffer = weechat_buffer_search_main ();
/* se déplacer au tampon suivant, 2 fois */
buffer = weechat_hdata_move (hdata, buffer, 2);
/* se déplacer au tampon précédent */
if (buffer)
buffer = weechat_hdata_move (hdata, buffer, -1);
----------------------------------------
Script (Python):
[source,python]
----------------------------------------
# prototype
pointer = weechat.hdata_move(hdata, pointer, count)
# exemple
hdata = weechat.hdata_get("buffer")
buffer = weechat.buffer_search_main()
# se déplacer au tampon suivant, 2 fois
buffer = weechat.hdata_move(hdata, buffer, 2)
# se déplacer au tampon précédent
if buffer:
buffer = weechat.hdata_move(hdata, buffer, -1)
----------------------------------------
weechat_hdata_integer
^^^^^^^^^^^^^^^^^^^^^
_Nouveau dans la version 0.3.6._
Retourne la valeur de la variable dans la structure en utilisant le hdata, sous
forme d'entier.
Prototype :
[source,C]
----------------------------------------
int weechat_hdata_integer (struct t_hdata *hdata, void *pointer, const char *name);
----------------------------------------
Paramètres :
* 'hdata' : pointeur vers le hdata
* 'pointer' : pointeur vers un objet WeeChat ou d'une extension
* 'name' : nom de la variable (doit être de type "integer")
Valeur de retour :
* valeur de la variable, sous forme d'entier
Exemple en C :
[source,C]
----------------------------------------
struct t_hdata *hdata = weechat_hdata_get ("buffer");
struct t_gui_buffer *buffer = weechat_buffer_search_main ();
weechat_printf (NULL, "number = %d", weechat_hdata_integer (hdata, buffer, "number"));
----------------------------------------
Script (Python):
[source,python]
----------------------------------------
# prototype
value = weechat.hdata_integer(hdata, pointer, name)
# exemple
hdata = weechat.hdata_get("buffer")
buffer = weechat.buffer_search_main()
weechat.prnt("", "number = %d" % weechat.hdata_integer(hdata, buffer, "number"))
----------------------------------------
weechat_hdata_long
^^^^^^^^^^^^^^^^^^
_Nouveau dans la version 0.3.6._
Retourne la valeur de la variable dans la structure en utilisant le hdata, sous
forme d'entier long.
Prototype :
[source,C]
----------------------------------------
long weechat_hdata_long (struct t_hdata *hdata, void *pointer, const char *name);
----------------------------------------
Paramètres :
* 'hdata' : pointeur vers le hdata
* 'pointer' : pointeur vers un objet WeeChat ou d'une extension
* 'name' : nom de la variable (doit être de type "long")
Valeur de retour :
* valeur de la variable, sous forme d'entier long
Exemple en C :
[source,C]
----------------------------------------
weechat_printf (NULL, "longvar = %ld", weechat_hdata_long (hdata, pointer, "longvar"));
----------------------------------------
Script (Python):
[source,python]
----------------------------------------
# prototype
value = weechat.hdata_long(hdata, pointer, name)
# exemple
weechat.prnt("", "longvar = %ld" % weechat.hdata_long(hdata, pointer, "longvar"))
----------------------------------------
weechat_hdata_string
^^^^^^^^^^^^^^^^^^^^
_Nouveau dans la version 0.3.6._
Retourne la valeur de la variable dans la structure en utilisant le hdata, sous
forme de chaîne.
Prototype :
[source,C]
----------------------------------------
const char *weechat_hdata_string (struct t_hdata *hdata, void *pointer, const char *name);
----------------------------------------
Paramètres :
* 'hdata' : pointeur vers le hdata
* 'pointer' : pointeur vers un objet WeeChat ou d'une extension
* 'name' : nom de la variable (doit être de type "string")
Valeur de retour :
* valeur de la variable, sous forme de chaîne
Exemple en C :
[source,C]
----------------------------------------
struct t_hdata *hdata = weechat_hdata_get ("buffer");
struct t_gui_buffer *buffer = weechat_buffer_search_main ();
weechat_printf (NULL, "name = %s", weechat_hdata_string (hdata, buffer, "name"));
----------------------------------------
Script (Python):
[source,python]
----------------------------------------
# prototype
value = weechat.hdata_string(hdata, pointer, name)
# exemple
hdata = weechat.hdata_get("buffer")
buffer = weechat.buffer_search_main()
weechat.prnt("", "name = %s" % weechat.hdata_string(hdata, buffer, "name"))
----------------------------------------
weechat_hdata_pointer
^^^^^^^^^^^^^^^^^^^^^
_Nouveau dans la version 0.3.6._
Retourne la valeur de la variable dans la structure en utilisant le hdata, sous
forme de pointeur.
Prototype :
[source,C]
----------------------------------------
void *weechat_hdata_pointer (struct t_hdata *hdata, void *pointer, const char *name);
----------------------------------------
Paramètres :
* 'hdata' : pointeur vers le hdata
* 'pointer' : pointeur vers un objet WeeChat ou d'une extension
* 'name' : nom de la variable (doit être de type "pointeur")
Valeur de retour :
* valeur de la variable, sous forme de pointeur
Exemple en C :
[source,C]
----------------------------------------
struct t_hdata *hdata = weechat_hdata_get ("buffer");
struct t_gui_buffer *buffer = weechat_buffer_search_main ();
weechat_printf (NULL, "lines = %lx", weechat_hdata_pointer (hdata, buffer, "lines"));
----------------------------------------
Script (Python):
[source,python]
----------------------------------------
# prototype
value = weechat.hdata_pointer(hdata, pointer, name)
# exemple
hdata = weechat.hdata_get("buffer")
buffer = weechat.buffer_search_main()
weechat.prnt("", "lines = %lx" % weechat.hdata_pointer(hdata, buffer, "lines"))
----------------------------------------
weechat_hdata_time
^^^^^^^^^^^^^^^^^^
_Nouveau dans la version 0.3.6._
Retourne la valeur de la variable dans la structure en utilisant le hdata, sous
forme de date/heure.
Prototype :
[source,C]
----------------------------------------
time_t weechat_hdata_time (struct t_hdata *hdata, void *pointer, const char *name);
----------------------------------------
Paramètres :
* 'hdata' : pointeur vers le hdata
* 'pointer' : pointeur vers un objet WeeChat ou d'une extension
* 'name' : nom de la variable (doit être de type "time")
Valeur de retour :
* valeur de la variable, sous forme de date/heure
Exemple en C :
[source,C]
----------------------------------------
struct t_hdata *hdata = weechat_hdata_get ("buffer");
struct t_gui_buffer *ptr = weechat_buffer_search_main ();
ptr = weechat_hdata_pointer (hdata, ptr, "lines");
if (ptr)
{
hdata = weechat_hdata_get ("lines");
ptr = weechat_hdata_pointer (hdata, ptr, "first_line");
if (ptr)
{
hdata = weechat_hdata_get ("line");
ptr = weechat_hdata_pointer (hdata, ptr, "data");
if (ptr)
{
hdata = weechat_hdata_get ("line_data");
time_t date = weechat_hdata_time (hdata, hdata, "date");
weechat_printf (NULL, "heure de la première ligne affichée = %s", ctime (&date));
}
}
}
----------------------------------------
Script (Python):
[source,python]
----------------------------------------
# prototype
value = weechat.hdata_time(hdata, pointer, name)
# exemple
hdata = weechat.hdata_get("buffer")
ptr = weechat.buffer_search_main()
ptr = weechat.hdata_pointer(hdata, ptr, "lines")
if ptr:
hdata = weechat.hdata_get("lines")
ptr = weechat.hdata_pointer(hdata, ptr, "first_line")
if ptr:
hdata = weechat.hdata_get("line")
ptr = weechat.hdata_pointer(hdata, ptr, "data")
if ptr:
hdata = weechat.hdata_get("line_data")
weechat.prnt("", "heure de la première ligne affichée = %s" % weechat.hdata_time(hdata, ptr, "date"))
----------------------------------------
weechat_hdata_get_string
^^^^^^^^^^^^^^^^^^^^^^^^
_Nouveau dans la version 0.3.6._
Retourne une valeur pour une propriété d'un hdata sous forme de chaîne.
Prototype :
[source,C]
----------------------------------------
const char *weechat_hdata_get_string (struct t_hdata *hdata, const char *property);
----------------------------------------
Paramètres :
* 'hdata' : pointeur vers le hdata
* 'property' : nom de la propriété :
** 'var_keys' : chaîne avec la liste des clés pour les variables du hdata
(format : "key1,key2,key3")
** 'var_values' : chaîne avec la liste des valeurs pour les variables du hdata
(format : "value1,value2,value3")
** 'var_keys_values' : chaîne avec la liste des clés et valeurs pour les
variables du hdata (format : "key1:value1,key2:value2,key3:value3")
** 'var_prev' : nom de la variable dans la structure qui est un pointeur vers
l'élément précédent dans la liste
** 'var_next' : nom de la variable dans la structure qui est un pointeur vers
l'élément suivant dans la liste
** 'list_keys' : chaîne avec la liste des clés pour les listes du hdata
(format : "key1,key2,key3")
** 'list_values' : chaîne avec la liste des valeurs pour les listes du hdata
(format : "value1,value2,value3")
** 'list_keys_values' : chaîne avec la liste des clés et valeurs pour les listes
du hdata (format : "key1:value1,key2:value2,key3:value3")
Valeur de retour :
* valeur de la propriété sous forme de chaîne
Exemple en C :
[source,C]
----------------------------------------
weechat_printf (NULL, "variables dans le hdata: %s" weechat_hdata_get_string (hdata, "var_keys"));
weechat_printf (NULL, "listes dans le hdata: %s" weechat_hdata_get_string (hdata, "list_keys"));
----------------------------------------
Script (Python):
[source,python]
----------------------------------------
# prototype
value = weechat.hdata_get_string(hdata, property)
# exemple
weechat.prnt("", "variables dans le hdata: %s" % weechat.hdata_get_string(hdata, "var_keys"))
weechat.prnt("", "listes dans le hdata: %s" % weechat.hdata_get_string(hdata, "list_keys"))
----------------------------------------
[[upgrade]]
Mise à jour
~~~~~~~~~~~

View File

@ -0,0 +1,659 @@
[width="100%",cols="^1,^2,5,5,5",options="header"]
|========================================
| Plugin | Nome | Descrizione | Variables | Lists
| irc | irc_channel | irc channel |
'type' (integer) +
'name' (string) +
'topic' (string) +
'modes' (string) +
'limit' (integer) +
'key' (string) +
'checking_away' (integer) +
'away_message' (string) +
'has_quit_server' (integer) +
'cycle' (integer) +
'part' (integer) +
'display_creation_date' (integer) +
'nick_completion_reset' (integer) +
'pv_remote_nick_color' (string) +
'hook_autorejoin' (pointer) +
'nicks_count' (integer) +
'nicks' (pointer) +
'last_nick' (pointer) +
'nicks_speaking' (pointer) +
'nicks_speaking_time' (pointer) +
'last_nick_speaking_time' (pointer) +
'buffer' (pointer) +
'buffer_as_string' (string) +
'prev_channel' (pointer) +
'next_channel' (pointer) |
-
| irc | irc_channel_speaking | irc channel_speaking |
'nick' (string) +
'time_last_message' (time) +
'prev_nick' (pointer) +
'next_nick' (pointer) |
-
| irc | irc_ignore | irc ignore |
'number' (integer) +
'mask' (string) +
'regex_mask' (pointer) +
'server' (string) +
'channel' (string) +
'prev_ignore' (pointer) +
'next_ignore' (pointer) |
'irc_ignore_list' +
'last_irc_ignore'
| irc | irc_nick | irc nick |
'name' (string) +
'host' (string) +
'prefixes' (string) +
'prefix' (string) +
'away' (integer) +
'color' (string) +
'prev_nick' (pointer) +
'next_nick' (pointer) |
-
| irc | irc_notify | irc notify |
'server' (pointer) +
'nick' (string) +
'check_away' (integer) +
'is_on_server' (integer) +
'away_message' (string) +
'ison_received' (integer) +
'prev_notify' (pointer) +
'next_notify' (pointer) |
-
| irc | irc_redirect | irc redirect |
'server' (pointer) +
'pattern' (string) +
'signal' (string) +
'count' (integer) +
'current_count' (integer) +
'string' (string) +
'timeout' (integer) +
'command' (string) +
'start_time' (time) +
'cmd_start' (pointer) +
'cmd_stop' (pointer) +
'cmd_extra' (pointer) +
'cmd_start_received' (integer) +
'cmd_stop_received' (integer) +
'cmd_filter' (pointer) +
'output' (string) +
'output_size' (integer) +
'prev_redirect' (pointer) +
'next_redirect' (pointer) |
-
| irc | irc_redirect_pattern | pattern for irc redirect |
'name' (string) +
'temp_pattern' (integer) +
'timeout' (integer) +
'cmd_start' (string) +
'cmd_stop' (string) +
'cmd_extra' (string) +
'prev_redirect' (pointer) +
'next_redirect' (pointer) |
'irc_redirect_patterns' +
'last_irc_redirect_pattern'
| irc | irc_server | irc server |
'name' (string) +
'options' (pointer) +
'temp_server' (integer) +
'reloading_from_config' (integer) +
'reloaded_from_config' (integer) +
'addresses_count' (integer) +
'addresses_array' (pointer) +
'ports_array' (pointer) +
'index_current_address' (integer) +
'current_address' (string) +
'current_ip' (string) +
'current_port' (integer) +
'sock' (integer) +
'hook_connect' (pointer) +
'hook_fd' (pointer) +
'hook_timer_connection' (pointer) +
'hook_timer_sasl' (pointer) +
'is_connected' (integer) +
'ssl_connected' (integer) +
'gnutls_sess' (other) +
'tls_cert' (other) +
'tls_cert_key' (other) +
'unterminated_message' (string) +
'nicks_count' (integer) +
'nicks_array' (pointer) +
'nick_first_tried' (integer) +
'nick' (string) +
'nick_modes' (string) +
'isupport' (string) +
'prefix_modes' (string) +
'prefix_chars' (string) +
'reconnect_delay' (integer) +
'reconnect_start' (time) +
'command_time' (time) +
'reconnect_join' (integer) +
'disable_autojoin' (integer) +
'is_away' (integer) +
'away_message' (string) +
'away_time' (time) +
'lag' (integer) +
'lag_check_time' (other) +
'lag_next_check' (time) +
'lag_last_refresh' (time) +
'cmd_list_regexp' (pointer) +
'last_user_message' (time) +
'last_away_check' (time) +
'outqueue' (pointer) +
'last_outqueue' (pointer) +
'redirects' (pointer) +
'last_redirect' (pointer) +
'notify_list' (pointer) +
'last_notify' (pointer) +
'manual_joins' (pointer) +
'buffer' (pointer) +
'buffer_as_string' (string) +
'channels' (pointer) +
'last_channel' (pointer) +
'prev_server' (pointer) +
'next_server' (pointer) |
'irc_servers' +
'last_irc_server'
| weechat | bar | bar |
'name' (string) +
'options' (pointer) +
'conditions_count' (integer) +
'conditions_array' (pointer) +
'items_count' (integer) +
'items_subcount' (pointer) +
'items_array' (pointer) +
'bar_window' (pointer) +
'bar_refresh_needed' (integer) +
'prev_bar' (pointer) +
'next_bar' (pointer) |
'gui_bars' +
'last_gui_bar'
| weechat | bar_item | bar item |
'plugin' (pointer) +
'name' (string) +
'build_callback' (pointer) +
'build_callback_data' (pointer) +
'prev_item' (pointer) +
'next_item' (pointer) |
'gui_bar_items' +
'last_gui_bar_item'
| weechat | buffer | buffer |
'plugin' (pointer) +
'plugin_name_for_upgrade' (string) +
'merge_for_upgrade' (pointer) +
'number' (integer) +
'layout_number' (integer) +
'layout_applied' (integer) +
'name' (string) +
'short_name' (string) +
'type' (integer) +
'notify' (integer) +
'num_displayed' (integer) +
'active' (integer) +
'print_hooks_enabled' (integer) +
'close_callback' (pointer) +
'close_callback_data' (pointer) +
'title' (string) +
'own_lines' (pointer) +
'mixed_lines' (pointer) +
'lines' (pointer) +
'time_for_each_line' (integer) +
'chat_refresh_needed' (integer) +
'nicklist' (integer) +
'nicklist_case_sensitive' (integer) +
'nicklist_root' (pointer) +
'nicklist_max_length' (integer) +
'nicklist_display_groups' (integer) +
'nicklist_visible_count' (integer) +
'input' (integer) +
'input_callback' (pointer) +
'input_callback_data' (pointer) +
'input_get_unknown_commands' (integer) +
'input_buffer' (string) +
'input_buffer_alloc' (integer) +
'input_buffer_size' (integer) +
'input_buffer_length' (integer) +
'input_buffer_pos' (integer) +
'input_buffer_1st_display' (integer) +
'input_undo_snap' (pointer) +
'input_undo' (pointer) +
'last_input_undo' (pointer) +
'ptr_input_undo' (pointer) +
'input_undo_count' (integer) +
'completion' (pointer) +
'history' (pointer) +
'last_history' (pointer) +
'ptr_history' (pointer) +
'num_history' (integer) +
'text_search' (integer) +
'text_search_exact' (integer) +
'text_search_found' (integer) +
'text_search_input' (string) +
'highlight_words' (string) +
'highlight_tags' (string) +
'highlight_tags_count' (integer) +
'highlight_tags_array' (pointer) +
'hotlist_max_level_nicks' (pointer) +
'keys' (pointer) +
'last_key' (pointer) +
'keys_count' (integer) +
'local_variables' (pointer) +
'prev_buffer' (pointer) +
'next_buffer' (pointer) |
'gui_buffers' +
'last_gui_buffer'
| weechat | completion | completion |
'buffer' (pointer) +
'context' (integer) +
'base_command' (string) +
'base_command_arg_index' (integer) +
'base_word' (string) +
'base_word_pos' (integer) +
'position' (integer) +
'args' (string) +
'direction' (integer) +
'add_space' (integer) +
'force_partial_completion' (integer) +
'completion_list' (pointer) +
'word_found' (string) +
'word_found_is_nick' (integer) +
'position_replace' (integer) +
'diff_size' (integer) +
'diff_length' (integer) +
'partial_completion_list' (pointer) +
'last_partial_completion' (pointer) |
-
| weechat | completion_partial | partial completion |
'word' (string) +
'count' (integer) +
'prev_item' (pointer) +
'next_item' (pointer) |
-
| weechat | config_file | config file |
'plugin' (pointer) +
'name' (string) +
'filename' (string) +
'file' (pointer) +
'callback_reload' (pointer) +
'callback_reload_data' (pointer) +
'sections' (pointer) +
'last_section' (pointer) +
'prev_config' (pointer) +
'next_config' (pointer) |
'config_files' +
'last_config_file'
| weechat | config_option | config option |
'config_file' (pointer) +
'section' (pointer) +
'name' (string) +
'type' (integer) +
'description' (string) +
'string_values' (pointer) +
'min' (integer) +
'max' (integer) +
'default_value' (pointer) +
'value' (pointer) +
'null_value_allowed' (integer) +
'callback_check_value' (pointer) +
'callback_check_value_data' (pointer) +
'callback_change' (pointer) +
'callback_change_data' (pointer) +
'callback_delete' (pointer) +
'callback_delete_data' (pointer) +
'loaded' (integer) +
'prev_option' (pointer) +
'next_option' (pointer) |
-
| weechat | config_section | config section |
'config_file' (pointer) +
'name' (string) +
'user_can_add_options' (integer) +
'user_can_delete_options' (integer) +
'callback_read' (pointer) +
'callback_read_data' (pointer) +
'callback_write' (pointer) +
'callback_write_data' (pointer) +
'callback_write_default' (pointer) +
'callback_write_default_data' (pointer) +
'callback_create_option' (pointer) +
'callback_create_option_data' (pointer) +
'callback_delete_option' (pointer) +
'callback_delete_option_data' (pointer) +
'options' (pointer) +
'last_option' (pointer) +
'prev_section' (pointer) +
'next_section' (pointer) |
-
| weechat | filter | filter |
'enabled' (integer) +
'name' (string) +
'buffer_name' (string) +
'num_buffers' (integer) +
'buffers' (pointer) +
'tags' (string) +
'tags_count' (integer) +
'tags_array' (pointer) +
'regex' (string) +
'regex_prefix' (pointer) +
'regex_message' (pointer) +
'prev_filter' (pointer) +
'next_filter' (pointer) |
'gui_filters' +
'last_gui_filter'
| weechat | history | history of commands in buffer |
'text' (string) +
'next_history' (pointer) +
'prev_history' (pointer) |
-
| weechat | hook | hook (variables common to all hook types) |
'plugin' (pointer) +
'type' (integer) +
'deleted' (integer) +
'running' (integer) +
'priority' (integer) +
'callback_data' (pointer) +
'hook_data' (pointer) +
'prev_hook' (pointer) +
'next_hook' (pointer) |
-
| weechat | hook_command | hook of type "command" |
'callback' (pointer) +
'command' (string) +
'description' (string) +
'args' (string) +
'args_description' (string) +
'completion' (string) +
'cplt_num_templates' (integer) +
'cplt_templates' (pointer) +
'cplt_templates_static' (pointer) +
'cplt_template_num_args' (pointer) +
'cplt_template_args' (pointer) +
'cplt_template_num_args_concat' (integer) +
'cplt_template_args_concat' (pointer) |
'last_weechat_hook_command' +
'weechat_hooks_command'
| weechat | hook_command_run | hook of type "command_run" |
'callback' (pointer) +
'command' (string) |
'last_weechat_hook_command_run' +
'weechat_hooks_command_run'
| weechat | hook_completion | hook of type "completion" |
'callback' (pointer) +
'completion_item' (string) +
'description' (string) |
'last_weechat_hook_completion' +
'weechat_hooks_completion'
| weechat | hook_config | hook of type "config" |
'callback' (pointer) +
'option' (string) |
'last_weechat_hook_config' +
'weechat_hooks_config'
| weechat | hook_connect | hook of type "connect" |
'callback' (pointer) +
'proxy' (string) +
'address' (string) +
'port' (integer) +
'sock' (integer) +
'ipv6' (integer) +
'gnutls_sess' (pointer) +
'gnutls_cb' (pointer) +
'gnutls_dhkey_size' (integer) +
'gnutls_priorities' (string) +
'local_hostname' (string) +
'child_read' (integer) +
'child_write' (integer) +
'child_pid' (other) +
'hook_fd' (pointer) +
'handshake_hook_fd' (pointer) +
'handshake_hook_timer' (pointer) +
'handshake_fd_flags' (integer) +
'handshake_ip_address' (string) |
'last_weechat_hook_connect' +
'weechat_hooks_connect'
| weechat | hook_fd | hook of type "fd" |
'callback' (pointer) +
'fd' (integer) +
'flags' (integer) |
'last_weechat_hook_fd' +
'weechat_hooks_fd'
| weechat | hook_hdata | hook of type "hdata" |
'callback' (pointer) +
'hdata_name' (string) +
'description' (string) |
'last_weechat_hook_hdata' +
'weechat_hooks_hdata'
| weechat | hook_hsignal | hook of type "hsignal" |
'callback' (pointer) +
'signal' (string) |
'last_weechat_hook_hsignal' +
'weechat_hooks_hsignal'
| weechat | hook_info | hook of type "info" |
'callback' (pointer) +
'info_name' (string) +
'description' (string) +
'args_description' (string) |
'last_weechat_hook_info' +
'weechat_hooks_info'
| weechat | hook_info_hashtable | hook of type "info_hashtable" |
'callback' (pointer) +
'info_name' (string) +
'description' (string) +
'args_description' (string) +
'output_description' (string) |
'last_weechat_hook_info_hashtable' +
'weechat_hooks_info_hashtable'
| weechat | hook_infolist | hook of type "infolist" |
'callback' (pointer) +
'infolist_name' (string) +
'description' (string) +
'pointer_description' (string) +
'args_description' (string) |
'last_weechat_hook_infolist' +
'weechat_hooks_infolist'
| weechat | hook_modifier | hook of type "modifier" |
'callback' (pointer) +
'modifier' (string) |
'last_weechat_hook_modifier' +
'weechat_hooks_modifier'
| weechat | hook_print | hook of type "print" |
'callback' (pointer) +
'buffer' (pointer) +
'tags_count' (integer) +
'tags_array' (pointer) +
'message' (string) +
'strip_colors' (integer) |
'last_weechat_hook_print' +
'weechat_hooks_print'
| weechat | hook_process | hook of type "process" |
'callback' (pointer) +
'command' (string) +
'timeout' (long) +
'child_read' (pointer) +
'child_write' (pointer) +
'child_pid' (other) +
'hook_fd' (pointer) +
'hook_timer' (pointer) +
'buffer' (pointer) +
'buffer_size' (pointer) |
'last_weechat_hook_process' +
'weechat_hooks_process'
| weechat | hook_signal | hook of type "signal" |
'callback' (pointer) +
'signal' (string) |
'last_weechat_hook_signal' +
'weechat_hooks_signal'
| weechat | hook_timer | hook of type "timer" |
'callback' (pointer) +
'interval' (long) +
'align_second' (integer) +
'remaining_calls' (integer) +
'last_exec' (other) +
'next_exec' (other) |
'last_weechat_hook_timer' +
'weechat_hooks_timer'
| weechat | input_undo | undo for input line |
'data' (string) +
'pos' (integer) +
'prev_undo' (pointer) +
'next_undo' (pointer) |
-
| weechat | key | key |
'key' (string) +
'command' (string) +
'prev_key' (pointer) +
'next_key' (pointer) |
'gui_default_keys' +
'gui_keys' +
'last_gui_default_key' +
'last_gui_key'
| weechat | line | line |
'data' (pointer) +
'prev_line' (pointer) +
'next_line' (pointer) |
-
| weechat | line_data | line data |
'buffer' (pointer) +
'y' (integer) +
'date' (time) +
'date_printed' (time) +
'str_time' (string) +
'tags_count' (integer) +
'tags_array' (pointer) +
'displayed' (integer) +
'highlight' (integer) +
'refresh_needed' (integer) +
'prefix' (string) +
'prefix_length' (integer) +
'message' (string) |
-
| weechat | lines | lines |
'first_line' (pointer) +
'last_line' (pointer) +
'last_read_line' (pointer) +
'lines_count' (integer) +
'first_line_not_read' (integer) +
'lines_hidden' (integer) +
'buffer_max_length' (integer) +
'prefix_max_length' (integer) |
-
| weechat | nick | nick in nicklist |
'group' (pointer) +
'name' (string) +
'color' (string) +
'prefix' (string) +
'prefix_color' (string) +
'visible' (integer) +
'prev_nick' (pointer) +
'next_nick' (pointer) |
-
| weechat | nick_group | group in nicklist |
'name' (string) +
'color' (string) +
'visible' (integer) +
'level' (integer) +
'parent' (pointer) +
'childs' (pointer) +
'last_child' (pointer) +
'nicks' (pointer) +
'last_nick' (pointer) +
'prev_group' (pointer) +
'next_group' (pointer) |
-
| weechat | window | window |
'win_x' (integer) +
'win_y' (integer) +
'win_width' (integer) +
'win_height' (integer) +
'win_width_pct' (integer) +
'win_height_pct' (integer) +
'win_chat_x' (integer) +
'win_chat_y' (integer) +
'win_chat_width' (integer) +
'win_chat_height' (integer) +
'win_chat_cursor_x' (integer) +
'win_chat_cursor_y' (integer) +
'bar_windows' (pointer) +
'last_bar_window' (pointer) +
'refresh_needed' (integer) +
'gui_objects' (pointer) +
'buffer' (pointer) +
'layout_plugin_name' (string) +
'layout_buffer_name' (string) +
'scroll' (pointer) +
'ptr_tree' (pointer) +
'prev_window' (pointer) +
'next_window' (pointer) |
'gui_current_window' +
'gui_windows' +
'last_gui_window'
| weechat | window_scroll | scroll info in window |
'buffer' (pointer) +
'first_line_displayed' (integer) +
'start_line' (pointer) +
'start_line_pos' (integer) +
'scrolling' (integer) +
'start_col' (integer) +
'lines_after' (integer) +
'reset_allowed' (integer) +
'prev_scroll' (pointer) +
'next_scroll' (pointer) |
-
| weechat | window_tree | tree of windows |
'parent_node' (pointer) +
'split_pct' (integer) +
'split_horizontal' (integer) +
'child1' (pointer) +
'child2' (pointer) +
'window' (pointer) |
'gui_windows_tree'
|========================================

View File

@ -145,7 +145,7 @@ comando: comando da eseguire (una '/' viene aggiunta automaticamente se non trov
/debug list
set <plugin> <level>
dump [<plugin>]
buffer|color|infolists|memory|term|windows
buffer|color|hdata|infolists|memory|term|windows
list: list plugins with debug levels
set: set debug level for plugin
@ -154,6 +154,7 @@ comando: comando da eseguire (una '/' viene aggiunta automaticamente se non trov
dump: save memory dump in WeeChat log file (same dump is written when WeeChat crashes)
buffer: dump buffer content with hexadecimal values in log file
color: display infos about current color pairs
hdata: display infos about hdata
infolists: display infos about infolists
memory: display infos about memory usage
term: display infos about terminal

View File

@ -3237,7 +3237,7 @@ Prototipo:
[source,C]
----------------------------------------
const char *weechat_hashtable_get_string (struct t_hashtable *hashtable,
void *property);
const char *property);
----------------------------------------
Argomenti:
@ -6050,7 +6050,8 @@ weechat_hook_modifier ("2000|input_text_display", &modifier_cb, NULL);
----------------------------------------
I tipi di hook che seguono consentono la priorità: command, command_run,
signal, hsignal, config.
signal, hsignal, config, completion, modifier, info, info_hashtable, infolist,
hdata.
weechat_hook_command
^^^^^^^^^^^^^^^^^^^^
@ -8225,6 +8226,63 @@ hook = weechat.hook_infolist("my_infolist", "Infolist with some data",
"my_infolist_cb", "")
----------------------------------------
// TRANSLATION MISSING
weechat_hook_hdata
^^^^^^^^^^^^^^^^^^
Hook a hdata: callback will return pointer to hdata asked.
Prototipo:
[source,C]
----------------------------------------
struct t_hook *weechat_hook_hdata (const char *hdata_name,
const char *description,
struct t_hdata *(*callback)(void *data,
const char *hdata_name),
void *callback_data);
----------------------------------------
Argomenti:
* 'hdata_name': name of hdata
(priority allowed, see note about <<hook_priority,priority>>)
* 'description': description
* 'callback': function called when hdata is asked, arguments and return
value:
** 'void *data': pointer
** 'const char *hdata_name': name of hdata
** return value: hdata asked
* 'callback_data': pointer given to callback when it is called by WeeChat
Valore restituito:
* pointer to new hook, NULL if error occured
Esempio in C:
[source,C]
----------------------------------------
struct t_hdata *
my_hdata_cb (void *data, const char *hdata_name)
{
struct t_hdata *my_hdata;
/* build hdata */
/* ... */
return my_hdata;
}
/* add hdata "my_hdata" */
struct t_hook *my_hdata = weechat_hook_hdata ("my_hdata",
"Hdata for my structure",
&my_hdata_cb, NULL);
----------------------------------------
[NOTE]
Questa funzione non è disponibile nelle API per lo scripting.
weechat_unhook
^^^^^^^^^^^^^^
@ -11190,6 +11248,14 @@ weechat_infolist_get
Restituisce una lista info da WeeChat o da un plugin.
[IMPORTANT]
// TRANSLATION MISSING
Content of infolist is a duplication of actual data. So if you are asking
infolist with lot of data (like "buffer_lines"), WeeChat will allocate memory
to duplicate all data, and this can take some time. +
Instead of using big infolist, it is preferable to use hdata (but infolist may
have more info than hdata, which is raw data), see <<hdata,hdata>>.
Prototipo:
[source,C]
@ -11650,6 +11716,867 @@ weechat.infolist_free(infolist)
weechat.infolist_free(infolist)
----------------------------------------
[[hdata]]
Hdata
~~~~~
// TRANSLATION MISSING
Functions for hdata (raw access to WeeChat or plugins data).
[IMPORTANT]
Hdata provides read-only access to data. It is *STRICTLY FORBIDDEN* to write
something in memory pointed by hdata variables.
// TRANSLATION MISSING
weechat_hdata_new
^^^^^^^^^^^^^^^^^
_Novità nella versione 0.3.6._
Create a new hdata.
[NOTE]
.hdata vs infolist
========================================
Hdata is a fast way to read WeeChat or plugins data. It is similar to
infolist, but there are some differences:
* it is faster and uses less memory: direct read of data without duplication
* it may have different info than infolist: it only raw data in structures
(infolist may add some extra data for convenience)
========================================
Prototipo:
[source,C]
----------------------------------------
struct t_hdata *weechat_hdata_new (const char *hdata_name, const char *var_prev, const char *var_next);
----------------------------------------
Argomenti:
* 'hdata_name': name of hdata
* 'var_prev': name of variable in structure which is a pointer to previous
element in list (may be NULL if no such variable is available)
* 'var_next': name of variable in structure which is a pointer to next
element in list (may be NULL if no such variable is available)
Valore restituito:
* pointer to new hdata
Esempio in C:
[source,C]
----------------------------------------
struct t_hdata *hdata = weechat_hdata_new ("myplugin_list", "prev", "next");
----------------------------------------
[NOTE]
This function is not available in scripting API.
// TRANSLATION MISSING
weechat_hdata_new_var
^^^^^^^^^^^^^^^^^^^^^
_Novità nella versione 0.3.6._
Create a new variable in hdata.
Prototipo:
[source,C]
----------------------------------------
void weechat_hdata_new_var (struct t_hdata *hdata, const char *name, int offset, int type);
----------------------------------------
Argomenti:
* 'hdata': hdata pointer
* 'name': variable name
* 'offset': offset of variable in structure
* 'type': variable type, one of:
** WEECHAT_HDATA_INTEGER
** WEECHAT_HDATA_LONG
** WEECHAT_HDATA_STRING
** WEECHAT_HDATA_POINTER
** WEECHAT_HDATA_TIME
** WEECHAT_HDATA_OTHER
Esempio in C:
[source,C]
----------------------------------------
struct t_myplugin_list
{
char *name;
struct t_gui_buffer *buffer;
int count;
struct t_myplugin_list *prev;
struct t_myplugin_list *next;
};
/* ... */
struct t_hdata *hdata = weechat_hdata_new ("myplugin_list", "prev", "next");
weechat_hdata_new_var (hdata, "name", offsetof (struct t_myplugin_list, name), WEECHAT_HDATA_STRING);
weechat_hdata_new_var (hdata, "buffer", offsetof (struct t_myplugin_list, buffer), WEECHAT_HDATA_POINTER);
weechat_hdata_new_var (hdata, "count", offsetof (struct t_myplugin_list, count), WEECHAT_HDATA_INTEGER);
weechat_hdata_new_var (hdata, "prev", offsetof (struct t_myplugin_list, prev), WEECHAT_HDATA_POINTER);
weechat_hdata_new_var (hdata, "next", offsetof (struct t_myplugin_list, next), WEECHAT_HDATA_POINTER);
----------------------------------------
The macro "WEECHAT_HDATA_VAR" can be used to shorten code:
[source,C]
----------------------------------------
WEECHAT_HDATA_VAR(struct t_myplugin_list, name, STRING);
WEECHAT_HDATA_VAR(struct t_myplugin_list, buffer, POINTER);
WEECHAT_HDATA_VAR(struct t_myplugin_list, count, INTEGER);
WEECHAT_HDATA_VAR(struct t_myplugin_list, prev, POINTER);
WEECHAT_HDATA_VAR(struct t_myplugin_list, next, POINTER);
----------------------------------------
[NOTE]
This function is not available in scripting API.
// TRANSLATION MISSING
weechat_hdata_new_list
^^^^^^^^^^^^^^^^^^^^^^
_Novità nella versione 0.3.6._
Create a new list pointer in hdata.
Prototipo:
[source,C]
----------------------------------------
void weechat_hdata_new_list (struct t_hdata *hdata, const char *name, void *pointer);
----------------------------------------
Argomenti:
* 'hdata': hdata pointer
* 'name': variable name
* 'pointer': list pointer
Esempio in C:
[source,C]
----------------------------------------
struct t_myplugin_list
{
char *name;
struct t_gui_buffer *buffer;
int count;
struct t_myplugin_list *prev;
struct t_myplugin_list *next;
};
struct t_myplugin_list *buffers = NULL;
struct t_myplugin_list *last_buffer = NULL;
/* ... */
struct t_hdata *hdata = weechat_hdata_new ("myplugin_list", "prev", "next");
weechat_hdata_new_var (hdata, "name", offsetof (struct t_myplugin_list, name), WEECHAT_HDATA_STRING);
weechat_hdata_new_var (hdata, "buffer", offsetof (struct t_myplugin_list, buffer), WEECHAT_HDATA_POINTER);
weechat_hdata_new_var (hdata, "count", offsetof (struct t_myplugin_list, count), WEECHAT_HDATA_INTEGER);
weechat_hdata_new_var (hdata, "prev", offsetof (struct t_myplugin_list, prev), WEECHAT_HDATA_POINTER);
weechat_hdata_new_var (hdata, "next", offsetof (struct t_myplugin_list, next), WEECHAT_HDATA_POINTER);
weechat_hdata_new_list (hdata, "buffers", &buffers);
weechat_hdata_new_list (hdata, "last_buffer", &last_buffer);
----------------------------------------
The macro "WEECHAT_HDATA_LIST" can be used to shorten code:
[source,C]
----------------------------------------
WEECHAT_HDATA_LIST(buffers);
WEECHAT_HDATA_LIST(last_buffer);
----------------------------------------
[NOTE]
This function is not available in scripting API.
// TRANSLATION MISSING
weechat_hdata_get
^^^^^^^^^^^^^^^^^
_Novità nella versione 0.3.6._
Return hdata for a WeeChat or plugin structure.
[NOTE]
Hdata does not contain data, it's only a hashtable with position of variables
in structure. That means you will need this hdata and a pointer to a
WeeChat/plugin object to read some data.
Prototipo:
[source,C]
----------------------------------------
struct t_hdata *weechat_hdata_get (const char *hdata_name);
----------------------------------------
Argomenti:
* 'hdata_name': name of hdata:
include::autogen/plugin_api/hdata.txt[]
Valore restituito:
* pointer to hdata, NULL if an error occured
Esempio in C:
[source,C]
----------------------------------------
struct t_hdata *hdata = weechat_hdata_get ("irc_server");
----------------------------------------
Script (Python):
[source,python]
----------------------------------------
# prototipo
hdata = weechat.hdata_get(hdata_name)
# esempio
hdata = weechat.hdata_get("irc_server")
----------------------------------------
// TRANSLATION MISSING
weechat_hdata_get_var_offset
^^^^^^^^^^^^^^^^^^^^^^^^^^^^
_Novità nella versione 0.3.6._
Return offset of variable in hdata.
Prototipo:
[source,C]
----------------------------------------
int weechat_hdata_get_var_offset (struct t_hdata *hdata, const char *name);
----------------------------------------
Argomenti:
* 'hdata': hdata pointer
* 'name': variable name
Valore restituito:
* variable offset, 0 if an error occured
Esempio in C:
[source,C]
----------------------------------------
int offset = weechat_hdata_get_var_offset (hdata, "name");
----------------------------------------
[NOTE]
This function is not available in scripting API.
// TRANSLATION MISSING
weechat_hdata_get_var_type
^^^^^^^^^^^^^^^^^^^^^^^^^^
_Novità nella versione 0.3.6._
Return type of variable in hdata (as integer).
Prototipo:
[source,C]
----------------------------------------
int weechat_hdata_get_var_type (struct t_hdata *hdata, const char *name);
----------------------------------------
Argomenti:
* 'hdata': hdata pointer
* 'name': variable name
Valore restituito:
* variable type, -1 if an error occured
Esempio in C:
[source,C]
----------------------------------------
int type = weechat_hdata_get_var_type (hdata, "name");
switch (type)
{
case WEECHAT_HDATA_INTEGER:
/* ... */
break;
case WEECHAT_HDATA_LONG:
/* ... */
break;
case WEECHAT_HDATA_STRING:
/* ... */
break;
case WEECHAT_HDATA_POINTER:
/* ... */
break;
case WEECHAT_HDATA_TIME:
/* ... */
break;
case WEECHAT_HDATA_OTHER:
/* ... */
break;
default:
/* variable not found */
break;
}
----------------------------------------
[NOTE]
This function is not available in scripting API.
// TRANSLATION MISSING
weechat_hdata_get_var_type_string
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
_Novità nella versione 0.3.6._
Return type of variable in hdata (as string).
Prototipo:
[source,C]
----------------------------------------
const char *weechat_hdata_get_var_type_string (struct t_hdata *hdata, const char *name);
----------------------------------------
Argomenti:
* 'hdata': hdata pointer
* 'name': variable name
Valore restituito:
* variable type, NULL if an error occured
Esempio in C:
[source,C]
----------------------------------------
weechat_printf (NULL, "type = %s",
weechat_hdata_get_var_type_string (hdata, "name"));
----------------------------------------
Script (Python):
[source,python]
----------------------------------------
# prototipo
type = weechat.hdata_get_var_type_string(hdata, name)
# esempio
weechat.prnt("", "type = %s" % weechat.hdata_get_var_type_string("name"))
----------------------------------------
// TRANSLATION MISSING
weechat_hdata_get_var
^^^^^^^^^^^^^^^^^^^^^
_Novità nella versione 0.3.6._
Return pointer to content of variable in hdata.
Prototipo:
[source,C]
----------------------------------------
void *weechat_hdata_get_var (struct t_hdata *hdata, void *pointer, const char *name);
----------------------------------------
Argomenti:
* 'hdata': hdata pointer
* 'pointer': pointer to WeeChat/plugin object
* 'name': variable name
Valore restituito:
* pointer to content of variable, NULL if an error occured
Esempio in C:
[source,C]
----------------------------------------
struct t_hdata *hdata = weechat_hdata_get ("buffer");
struct t_gui_buffer *buffer = weechat_buffer_search_main ();
void *pointer = weechat_hdata_get_var (hdata, buffer, "name");
----------------------------------------
[NOTE]
This function is not available in scripting API.
// TRANSLATION MISSING
weechat_hdata_get_var_at_offset
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
_Novità nella versione 0.3.6._
Return pointer to content of variable in hdata, using offset.
Prototipo:
[source,C]
----------------------------------------
void *weechat_hdata_get_var_at_offset (struct t_hdata *hdata, void *pointer, int offset);
----------------------------------------
Argomenti:
* 'hdata': hdata pointer
* 'pointer': pointer to WeeChat/plugin object
* 'offset': offset of variable
Valore restituito:
* pointer to content of variable, NULL if an error occured
Esempio in C:
[source,C]
----------------------------------------
struct t_hdata *hdata = weechat_hdata_get ("buffer");
struct t_gui_buffer *buffer = weechat_buffer_search_main ();
int offset = weechat_hdata_get_var_offset (hdata, "name");
void *pointer = weechat_hdata_get_var_at_offset (hdata, buffer, offset);
----------------------------------------
[NOTE]
This function is not available in scripting API.
// TRANSLATION MISSING
weechat_hdata_get_list
^^^^^^^^^^^^^^^^^^^^^^
_Novità nella versione 0.3.6._
Return list pointer from hdata.
Prototipo:
[source,C]
----------------------------------------
void *weechat_hdata_get_list (struct t_hdata *hdata, const char *name);
----------------------------------------
Argomenti:
* 'hdata': hdata pointer
* 'name': list name
Valore restituito:
* list pointer, NULL if an error occured
Esempio in C:
[source,C]
----------------------------------------
struct t_hdata *hdata = weechat_hdata_get ("buffer");
struct t_gui_buffer *buffers = weechat_hdata_get_list (hdata, "gui_buffers");
----------------------------------------
Script (Python):
[source,python]
----------------------------------------
# prototipo
list = weechat.hdata_get_list(hdata, name)
# esempio
hdata = weechat.hdata_get("buffer")
buffers = weechat.hdata_get_list(hdata, "gui_buffers")
----------------------------------------
// TRANSLATION MISSING
weechat_hdata_move
^^^^^^^^^^^^^^^^^^
_Novità nella versione 0.3.6._
Move pointer to another element in list.
Prototipo:
[source,C]
----------------------------------------
void *weechat_hdata_move (struct t_hdata *hdata, void *pointer, int count);
----------------------------------------
Argomenti:
* 'hdata': hdata pointer
* 'pointer': pointer to a WeeChat/plugin object
* 'count': number of jump(s) to execute (negative or positive integer, different
from 0)
Valore restituito:
* pointer to element reached, NULL if an error occured
Esempio in C:
[source,C]
----------------------------------------
struct t_hdata *hdata = weechat_hdata_get ("buffer");
struct t_gui_buffer *buffer = weechat_buffer_search_main ();
/* move to next buffer, 2 times */
buffer = weechat_hdata_move (hdata, buffer, 2);
/* move to previous buffer */
if (buffer)
buffer = weechat_hdata_move (hdata, buffer, -1);
----------------------------------------
Script (Python):
[source,python]
----------------------------------------
# prototipo
pointer = weechat.hdata_move(hdata, pointer, count)
# esempio
hdata = weechat.hdata_get("buffer")
buffer = weechat.buffer_search_main()
# move to next buffer, 2 times
buffer = weechat.hdata_move(hdata, buffer, 2)
# move to previous buffer
if buffer:
buffer = weechat.hdata_move(hdata, buffer, -1)
----------------------------------------
// TRANSLATION MISSING
weechat_hdata_integer
^^^^^^^^^^^^^^^^^^^^^
_Novità nella versione 0.3.6._
Return value of integer variable in structure using hdata.
Prototipo:
[source,C]
----------------------------------------
int weechat_hdata_integer (struct t_hdata *hdata, void *pointer, const char *name);
----------------------------------------
Argomenti:
* 'hdata': hdata pointer
* 'pointer': pointer to WeeChat/plugin object
* 'name': variable name (must be type "integer")
Valore restituito:
* integer value of variable
Esempio in C:
[source,C]
----------------------------------------
struct t_hdata *hdata = weechat_hdata_get ("buffer");
struct t_gui_buffer *buffer = weechat_buffer_search_main ();
weechat_printf (NULL, "number = %d", weechat_hdata_integer (hdata, buffer, "number"));
----------------------------------------
Script (Python):
[source,python]
----------------------------------------
# prototipo
value = weechat.hdata_integer(hdata, pointer, name)
# esempio
hdata = weechat.hdata_get("buffer")
buffer = weechat.buffer_search_main()
weechat.prnt("", "number = %d" % weechat.hdata_integer(hdata, buffer, "number"))
----------------------------------------
// TRANSLATION MISSING
weechat_hdata_long
^^^^^^^^^^^^^^^^^^
_Novità nella versione 0.3.6._
Return value of long variable in structure using hdata.
Prototipo:
[source,C]
----------------------------------------
long weechat_hdata_long (struct t_hdata *hdata, void *pointer, const char *name);
----------------------------------------
Argomenti:
* 'hdata': hdata pointer
* 'pointer': pointer to WeeChat/plugin object
* 'name': variable name (must be type "long")
Valore restituito:
* long value of variable
Esempio in C:
[source,C]
----------------------------------------
weechat_printf (NULL, "longvar = %ld", weechat_hdata_long (hdata, pointer, "longvar"));
----------------------------------------
Script (Python):
[source,python]
----------------------------------------
# prototipo
value = weechat.hdata_long(hdata, pointer, name)
# esempio
weechat.prnt("", "longvar = %ld" % weechat.hdata_long(hdata, pointer, "longvar"))
----------------------------------------
// TRANSLATION MISSING
weechat_hdata_string
^^^^^^^^^^^^^^^^^^^^
_Novità nella versione 0.3.6._
Return value of string variable in structure using hdata.
Prototipo:
[source,C]
----------------------------------------
const char *weechat_hdata_string (struct t_hdata *hdata, void *pointer, const char *name);
----------------------------------------
Argomenti:
* 'hdata': hdata pointer
* 'pointer': pointer to WeeChat/plugin object
* 'name': variable name (must be type "string")
Valore restituito:
* string value of variable
Esempio in C:
[source,C]
----------------------------------------
struct t_hdata *hdata = weechat_hdata_get ("buffer");
struct t_gui_buffer *buffer = weechat_buffer_search_main ();
weechat_printf (NULL, "name = %s", weechat_hdata_string (hdata, buffer, "name"));
----------------------------------------
Script (Python):
[source,python]
----------------------------------------
# prototipo
value = weechat.hdata_string(hdata, pointer, name)
# esempio
hdata = weechat.hdata_get("buffer")
buffer = weechat.buffer_search_main()
weechat.prnt("", "name = %s" % weechat.hdata_string(hdata, buffer, "name"))
----------------------------------------
// TRANSLATION MISSING
weechat_hdata_pointer
^^^^^^^^^^^^^^^^^^^^^
_Novità nella versione 0.3.6._
Return value of pointer variable in structure using hdata.
Prototipo:
[source,C]
----------------------------------------
void *weechat_hdata_pointer (struct t_hdata *hdata, void *pointer, const char *name);
----------------------------------------
Argomenti:
* 'hdata': hdata pointer
* 'pointer': pointer to WeeChat/plugin object
* 'name': variable name (must be type "pointer")
Valore restituito:
* pointer value of variable
Esempio in C:
[source,C]
----------------------------------------
struct t_hdata *hdata = weechat_hdata_get ("buffer");
struct t_gui_buffer *buffer = weechat_buffer_search_main ();
weechat_printf (NULL, "lines = %lx", weechat_hdata_pointer (hdata, buffer, "lines"));
----------------------------------------
Script (Python):
[source,python]
----------------------------------------
# prototipo
value = weechat.hdata_pointer(hdata, pointer, name)
# esempio
hdata = weechat.hdata_get("buffer")
buffer = weechat.buffer_search_main()
weechat.prnt("", "lines = %lx" % weechat.hdata_pointer(hdata, buffer, "lines"))
----------------------------------------
// TRANSLATION MISSING
weechat_hdata_time
^^^^^^^^^^^^^^^^^^
_Novità nella versione 0.3.6._
Return value of time variable in structure using hdata.
Prototipo:
[source,C]
----------------------------------------
time_t weechat_hdata_time (struct t_hdata *hdata, void *pointer, const char *name);
----------------------------------------
Argomenti:
* 'hdata': hdata pointer
* 'pointer': pointer to WeeChat/plugin object
* 'name': variable name (must be type "time")
Valore restituito:
* time value of variable
Esempio in C:
[source,C]
----------------------------------------
struct t_hdata *hdata = weechat_hdata_get ("buffer");
struct t_gui_buffer *ptr = weechat_buffer_search_main ();
ptr = weechat_hdata_pointer (hdata, ptr, "lines");
if (ptr)
{
hdata = weechat_hdata_get ("lines");
ptr = weechat_hdata_pointer (hdata, ptr, "first_line");
if (ptr)
{
hdata = weechat_hdata_get ("line");
ptr = weechat_hdata_pointer (hdata, ptr, "data");
if (ptr)
{
hdata = weechat_hdata_get ("line_data");
time_t date = weechat_hdata_time (hdata, hdata, "date");
weechat_printf (NULL, "time of last line displayed = %s", ctime (&date));
}
}
}
----------------------------------------
Script (Python):
[source,python]
----------------------------------------
# prototipo
value = weechat.hdata_time(hdata, pointer, name)
# esempio
hdata = weechat.hdata_get("buffer")
ptr = weechat.buffer_search_main()
ptr = weechat.hdata_pointer(hdata, ptr, "lines")
if ptr:
hdata = weechat.hdata_get("lines")
ptr = weechat.hdata_pointer(hdata, ptr, "first_line")
if ptr:
hdata = weechat.hdata_get("line")
ptr = weechat.hdata_pointer(hdata, ptr, "data")
if ptr:
hdata = weechat.hdata_get("line_data")
weechat.prnt("", "time of last line displayed = %s" % weechat.hdata_time(hdata, ptr, "date"))
----------------------------------------
// TRANSLATION MISSING
weechat_hdata_get_string
^^^^^^^^^^^^^^^^^^^^^^^^
_Novità nella versione 0.3.6._
Return string value of a hdata property.
Prototipo:
[source,C]
----------------------------------------
const char *weechat_hdata_get_string (struct t_hdata *hdata, const char *property);
----------------------------------------
Argomenti:
* 'hdata': hdata pointer
* 'property': property name:
** 'var_keys': string with list of keys for variables in hdata
(format: "key1,key2,key3")
** 'var_values': string with list of values for variables in hdata
(format: "value1,value2,value3")
** 'var_keys_values': string with list of keys and values for variables in hdata
(format: "key1:value1,key2:value2,key3:value3")
** 'var_prev': name of variable in structure which is a pointer to previous
element in list
** 'var_next': name of variable in structure which is a pointer to next
element in list
** 'list_keys': string with list of keys for lists in hdata
(format: "key1,key2,key3")
** 'list_values': string with list of values for lists in hdata
(format: "value1,value2,value3")
** 'list_keys_values': string with list of keys and values for lists in hdata
(format: "key1:value1,key2:value2,key3:value3")
Valore restituito:
* string value of property
Esempio in C:
[source,C]
----------------------------------------
weechat_printf (NULL, "variables in hdata: %s" weechat_hdata_get_string (hdata, "var_keys"));
weechat_printf (NULL, "lists in hdata: %s" weechat_hdata_get_string (hdata, "list_keys"));
----------------------------------------
Script (Python):
[source,python]
----------------------------------------
# prototipo
value = weechat.hdata_get_string(hdata, property)
# esempio
weechat.prnt("", "variables in hdata: %s" % weechat.hdata_get_string(hdata, "var_keys"))
weechat.prnt("", "lists in hdata: %s" % weechat.hdata_get_string(hdata, "list_keys"))
----------------------------------------
[[upgrade]]
Aggiornamento
~~~~~~~~~~~~~

168
po/cs.po
View File

@ -20,7 +20,7 @@ msgid ""
msgstr ""
"Project-Id-Version: WeeChat 0.3.6-dev\n"
"Report-Msgid-Bugs-To: flashcode@flashtux.org\n"
"POT-Creation-Date: 2011-05-31 09:11+0200\n"
"POT-Creation-Date: 2011-06-13 11:52+0200\n"
"PO-Revision-Date: 2011-05-15 10:51+0200\n"
"Last-Translator: Jiri Golembiovsky <golemj@gmail.com>\n"
"Language-Team: weechat-dev <weechat-dev@nongnu.org>\n"
@ -1071,8 +1071,8 @@ msgstr "spřáva ladění pro jádro/pluginy"
#, fuzzy
msgid ""
"list || set <plugin> <level> || dump [<plugin>] || buffer|color|infolists|"
"memory|term|windows"
"list || set <plugin> <level> || dump [<plugin>] || buffer|color|hdata|"
"infolists|memory|term|windows"
msgstr ""
"list || set <plugin> <level> || dump [<plugin>] || buffer|color|memory|term|"
"windows"
@ -1087,6 +1087,7 @@ msgid ""
"WeeChat crashes)\n"
" buffer: dump buffer content with hexadecimal values in log file\n"
" color: display infos about current color pairs\n"
" hdata: display infos about hdata\n"
"infolists: display infos about infolists\n"
" memory: display infos about memory usage\n"
" term: display infos about terminal\n"
@ -5531,6 +5532,34 @@ msgstr "seznam notifikací"
msgid "notify pointer (optional)"
msgstr "ukazatel notifikace (volitelné)"
#, fuzzy
msgid "irc nick"
msgstr "přezdívka: přezdívka"
#, fuzzy
msgid "irc channel"
msgstr "kanál"
msgid "irc channel_speaking"
msgstr ""
msgid "irc ignore"
msgstr ""
#, fuzzy
msgid "irc notify"
msgstr "seznam notifikací"
msgid "pattern for irc redirect"
msgstr ""
msgid "irc redirect"
msgstr ""
#, fuzzy
msgid "irc server"
msgstr "server"
#, c-format
msgid "%s%s: you are not connected to server"
msgstr "%s%s: nejste připojen k serveru"
@ -6558,6 +6587,133 @@ msgid "window name (can start or end with \"*\" as wildcard) (optional)"
msgstr ""
"jméno okna (může začínat nebo končit \"*\" jako zástupným znakem) (volitelné)"
msgid "bar"
msgstr ""
#, fuzzy
msgid "bar item"
msgstr "seznam položek polí"
#, fuzzy
msgid "buffer"
msgstr "řídit buffery"
#, fuzzy
msgid "completion"
msgstr "kompilováno"
msgid "partial completion"
msgstr ""
#, fuzzy
msgid "config file"
msgstr "konfigurační soubory"
#, fuzzy
msgid "config section"
msgstr "nastaví konfigurační možnosti"
#, fuzzy
msgid "config option"
msgstr "nastaví konfigurační možnosti"
msgid "filter"
msgstr ""
#, fuzzy
msgid "history of commands in buffer"
msgstr "historie příkazů"
msgid "hook (variables common to all hook types)"
msgstr ""
#, fuzzy
msgid "hook of type \"command\""
msgstr "historie příkazů"
msgid "hook of type \"command_run\""
msgstr ""
msgid "hook of type \"timer\""
msgstr ""
msgid "hook of type \"fd\""
msgstr ""
msgid "hook of type \"process\""
msgstr ""
msgid "hook of type \"connect\""
msgstr ""
msgid "hook of type \"print\""
msgstr ""
msgid "hook of type \"signal\""
msgstr ""
msgid "hook of type \"hsignal\""
msgstr ""
msgid "hook of type \"config\""
msgstr ""
msgid "hook of type \"completion\""
msgstr ""
msgid "hook of type \"modifier\""
msgstr ""
msgid "hook of type \"info\""
msgstr ""
msgid "hook of type \"info_hashtable\""
msgstr ""
msgid "hook of type \"infolist\""
msgstr ""
msgid "hook of type \"hdata\""
msgstr ""
#, fuzzy
msgid "undo for input line"
msgstr "funkce pro příkazovou řádku"
msgid "key"
msgstr ""
#, fuzzy
msgid "lines"
msgstr "online"
#, fuzzy
msgid "line"
msgstr "online"
#, fuzzy
msgid "line data"
msgstr "online"
#, fuzzy
msgid "group in nicklist"
msgstr "barva textu pro skupiny v seznamu přezdívek"
#, fuzzy
msgid "nick in nicklist"
msgstr "přezdívky v seznamu notifikací"
#, fuzzy
msgid "window"
msgstr "spravuje okna"
msgid "scroll info in window"
msgstr ""
#, fuzzy
msgid "tree of windows"
msgstr "seznam oken"
#, c-format
msgid "%sError: unable to load plugin \"%s\": %s"
msgstr "%sChyba: nemůžu načist plugin \"%s\": %s"
@ -7627,3 +7783,9 @@ msgstr "Hash tabulka (výstup)"
msgid "Pointer"
msgstr "Ukazatel"
msgid "Variables"
msgstr ""
msgid "Lists"
msgstr ""

168
po/de.po
View File

@ -22,7 +22,7 @@ msgid ""
msgstr ""
"Project-Id-Version: WeeChat 0.3.6-dev\n"
"Report-Msgid-Bugs-To: flashcode@flashtux.org\n"
"POT-Creation-Date: 2011-05-31 09:11+0200\n"
"POT-Creation-Date: 2011-06-13 11:52+0200\n"
"PO-Revision-Date: 2011-05-15 10:51+0200\n"
"Last-Translator: Nils G.\n"
"Language-Team: weechat-dev <weechat-dev@nongnu.org>\n"
@ -1090,8 +1090,8 @@ msgstr "Debug-Kontrolle für Hauptprogramm und/oder Erweiterung"
#, fuzzy
msgid ""
"list || set <plugin> <level> || dump [<plugin>] || buffer|color|infolists|"
"memory|term|windows"
"list || set <plugin> <level> || dump [<plugin>] || buffer|color|hdata|"
"infolists|memory|term|windows"
msgstr ""
"list || set <plugin> <level> || dump [<plugin>] || buffer|color|memory|term|"
"windows"
@ -1106,6 +1106,7 @@ msgid ""
"WeeChat crashes)\n"
" buffer: dump buffer content with hexadecimal values in log file\n"
" color: display infos about current color pairs\n"
" hdata: display infos about hdata\n"
"infolists: display infos about infolists\n"
" memory: display infos about memory usage\n"
" term: display infos about terminal\n"
@ -5788,6 +5789,34 @@ msgstr "Liste mit Benachrichtigungen"
msgid "notify pointer (optional)"
msgstr "Benachrichtigungspointer (optional)"
#, fuzzy
msgid "irc nick"
msgstr "nick: nick"
#, fuzzy
msgid "irc channel"
msgstr "Channel"
msgid "irc channel_speaking"
msgstr ""
msgid "irc ignore"
msgstr ""
#, fuzzy
msgid "irc notify"
msgstr "Liste mit Benachrichtigungen"
msgid "pattern for irc redirect"
msgstr ""
msgid "irc redirect"
msgstr ""
#, fuzzy
msgid "irc server"
msgstr "Server"
#, c-format
msgid "%s%s: you are not connected to server"
msgstr "%s%s: Es besteht keine Verbindung zum Server"
@ -6838,6 +6867,133 @@ msgstr ""
"Fenstername (darf mit einem \"*\" als Platzhalter beginnen oder enden) "
"(optional)"
msgid "bar"
msgstr ""
#, fuzzy
msgid "bar item"
msgstr "Liste der Bar-Items"
#, fuzzy
msgid "buffer"
msgstr "Buffer verwalten"
#, fuzzy
msgid "completion"
msgstr "kompiliert am"
msgid "partial completion"
msgstr ""
#, fuzzy
msgid "config file"
msgstr "Konfigurationsdateien"
#, fuzzy
msgid "config section"
msgstr "Konfigurationsparameter setzen"
#, fuzzy
msgid "config option"
msgstr "Konfigurationsparameter setzen"
msgid "filter"
msgstr ""
#, fuzzy
msgid "history of commands in buffer"
msgstr "Verlaufspeicher der Befehle"
msgid "hook (variables common to all hook types)"
msgstr ""
#, fuzzy
msgid "hook of type \"command\""
msgstr "Verlaufspeicher der Befehle"
msgid "hook of type \"command_run\""
msgstr ""
msgid "hook of type \"timer\""
msgstr ""
msgid "hook of type \"fd\""
msgstr ""
msgid "hook of type \"process\""
msgstr ""
msgid "hook of type \"connect\""
msgstr ""
msgid "hook of type \"print\""
msgstr ""
msgid "hook of type \"signal\""
msgstr ""
msgid "hook of type \"hsignal\""
msgstr ""
msgid "hook of type \"config\""
msgstr ""
msgid "hook of type \"completion\""
msgstr ""
msgid "hook of type \"modifier\""
msgstr ""
msgid "hook of type \"info\""
msgstr ""
msgid "hook of type \"info_hashtable\""
msgstr ""
msgid "hook of type \"infolist\""
msgstr ""
msgid "hook of type \"hdata\""
msgstr ""
#, fuzzy
msgid "undo for input line"
msgstr "Funktionen für die Befehlszeile"
msgid "key"
msgstr ""
#, fuzzy
msgid "lines"
msgstr "Online"
#, fuzzy
msgid "line"
msgstr "Online"
#, fuzzy
msgid "line data"
msgstr "Online"
#, fuzzy
msgid "group in nicklist"
msgstr "Textfarbe für Gruppen in Nickliste"
#, fuzzy
msgid "nick in nicklist"
msgstr "Nicks für die eine Benachrichtigung existiert"
#, fuzzy
msgid "window"
msgstr "Fenster verwalten"
msgid "scroll info in window"
msgstr ""
#, fuzzy
msgid "tree of windows"
msgstr "Auflistung der Windows"
#, c-format
msgid "%sError: unable to load plugin \"%s\": %s"
msgstr "%sFehler: Kann Erweiterung \"%s\" nicht installieren: %s"
@ -7940,3 +8096,9 @@ msgstr "Hashtable (Ausgabe)"
msgid "Pointer"
msgstr "Pointer"
msgid "Variables"
msgstr ""
msgid "Lists"
msgstr ""

168
po/es.po
View File

@ -21,7 +21,7 @@ msgid ""
msgstr ""
"Project-Id-Version: WeeChat 0.3.6-dev\n"
"Report-Msgid-Bugs-To: flashcode@flashtux.org\n"
"POT-Creation-Date: 2011-05-31 09:11+0200\n"
"POT-Creation-Date: 2011-06-13 11:52+0200\n"
"PO-Revision-Date: 2011-05-15 10:51+0200\n"
"Last-Translator: Elián Hanisch <lambdae2@gmail.com>\n"
"Language-Team: weechat-dev <weechat-dev@nongnu.org>\n"
@ -1077,8 +1077,8 @@ msgstr "controla los mensajes de depuración para el núcleo/plugins"
#, fuzzy
msgid ""
"list || set <plugin> <level> || dump [<plugin>] || buffer|color|infolists|"
"memory|term|windows"
"list || set <plugin> <level> || dump [<plugin>] || buffer|color|hdata|"
"infolists|memory|term|windows"
msgstr ""
"list || set <plugin> <nivel> || dump [<plugin>] || buffer|color|memory|term|"
"windows"
@ -1093,6 +1093,7 @@ msgid ""
"WeeChat crashes)\n"
" buffer: dump buffer content with hexadecimal values in log file\n"
" color: display infos about current color pairs\n"
" hdata: display infos about hdata\n"
"infolists: display infos about infolists\n"
" memory: display infos about memory usage\n"
" term: display infos about terminal\n"
@ -5626,6 +5627,34 @@ msgstr "lista de notificaciones"
msgid "notify pointer (optional)"
msgstr "puntero de la notificación (opcional)"
#, fuzzy
msgid "irc nick"
msgstr "apodo: apodo"
#, fuzzy
msgid "irc channel"
msgstr "canal"
msgid "irc channel_speaking"
msgstr ""
msgid "irc ignore"
msgstr ""
#, fuzzy
msgid "irc notify"
msgstr "lista de notificaciones"
msgid "pattern for irc redirect"
msgstr ""
msgid "irc redirect"
msgstr ""
#, fuzzy
msgid "irc server"
msgstr "servidor"
#, c-format
msgid "%s%s: you are not connected to server"
msgstr "%s%s: no estas conectado a ningún servidor"
@ -6663,6 +6692,133 @@ msgstr ""
"nombre de la ventana (puede empezar o terminar con \"*\" como comodín) "
"(opcional)"
msgid "bar"
msgstr ""
#, fuzzy
msgid "bar item"
msgstr "lista de elementos de barra"
#, fuzzy
msgid "buffer"
msgstr "gestionar los buffers"
#, fuzzy
msgid "completion"
msgstr "compilado en"
msgid "partial completion"
msgstr ""
#, fuzzy
msgid "config file"
msgstr "archivos de configuración"
#, fuzzy
msgid "config section"
msgstr "establecer opciones de configuración"
#, fuzzy
msgid "config option"
msgstr "establecer opciones de configuración"
msgid "filter"
msgstr ""
#, fuzzy
msgid "history of commands in buffer"
msgstr "historial de comandos"
msgid "hook (variables common to all hook types)"
msgstr ""
#, fuzzy
msgid "hook of type \"command\""
msgstr "historial de comandos"
msgid "hook of type \"command_run\""
msgstr ""
msgid "hook of type \"timer\""
msgstr ""
msgid "hook of type \"fd\""
msgstr ""
msgid "hook of type \"process\""
msgstr ""
msgid "hook of type \"connect\""
msgstr ""
msgid "hook of type \"print\""
msgstr ""
msgid "hook of type \"signal\""
msgstr ""
msgid "hook of type \"hsignal\""
msgstr ""
msgid "hook of type \"config\""
msgstr ""
msgid "hook of type \"completion\""
msgstr ""
msgid "hook of type \"modifier\""
msgstr ""
msgid "hook of type \"info\""
msgstr ""
msgid "hook of type \"info_hashtable\""
msgstr ""
msgid "hook of type \"infolist\""
msgstr ""
msgid "hook of type \"hdata\""
msgstr ""
#, fuzzy
msgid "undo for input line"
msgstr "funciones para la línea de comandos"
msgid "key"
msgstr ""
#, fuzzy
msgid "lines"
msgstr "en línea"
#, fuzzy
msgid "line"
msgstr "en línea"
#, fuzzy
msgid "line data"
msgstr "en línea"
#, fuzzy
msgid "group in nicklist"
msgstr "color para grupos en la lista de apodos"
#, fuzzy
msgid "nick in nicklist"
msgstr "apodos en la lista de notificación"
#, fuzzy
msgid "window"
msgstr "gestión de ventanas"
msgid "scroll info in window"
msgstr ""
#, fuzzy
msgid "tree of windows"
msgstr "lista de ventanas"
#, c-format
msgid "%sError: unable to load plugin \"%s\": %s"
msgstr "%sError: no ha sido posible cargar el plugin \"%s\": %s"
@ -7755,3 +7911,9 @@ msgstr "Tabla hash (salida)"
msgid "Pointer"
msgstr "Puntero"
msgid "Variables"
msgstr ""
msgid "Lists"
msgstr ""

153
po/fr.po
View File

@ -21,8 +21,8 @@ msgid ""
msgstr ""
"Project-Id-Version: WeeChat 0.3.6-dev\n"
"Report-Msgid-Bugs-To: flashcode@flashtux.org\n"
"POT-Creation-Date: 2011-05-31 09:11+0200\n"
"PO-Revision-Date: 2011-05-31 09:12+0200\n"
"POT-Creation-Date: 2011-06-13 11:52+0200\n"
"PO-Revision-Date: 2011-06-12 11:27+0200\n"
"Last-Translator: Sebastien Helleu <flashcode@flashtux.org>\n"
"Language-Team: weechat-dev <weechat-dev@nongnu.org>\n"
"Language: French\n"
@ -1076,10 +1076,10 @@ msgid "control debug for core/plugins"
msgstr "contrôle du debug pour le coeur/les extensions"
msgid ""
"list || set <plugin> <level> || dump [<plugin>] || buffer|color|infolists|"
"memory|term|windows"
"list || set <plugin> <level> || dump [<plugin>] || buffer|color|hdata|"
"infolists|memory|term|windows"
msgstr ""
"list || set <extension> <niveau> || dump [<extension>] || buffer|color|"
"list || set <extension> <niveau> || dump [<extension>] || buffer|color|hdata|"
"infolists|memory|term|windows"
msgid ""
@ -1091,6 +1091,7 @@ msgid ""
"WeeChat crashes)\n"
" buffer: dump buffer content with hexadecimal values in log file\n"
" color: display infos about current color pairs\n"
" hdata: display infos about hdata\n"
"infolists: display infos about infolists\n"
" memory: display infos about memory usage\n"
" term: display infos about terminal\n"
@ -1105,6 +1106,7 @@ msgstr ""
" buffer: afficher le contenu du tampon en valeurs hexadécimales dans le "
"fichier log\n"
" color: afficher des infos sur les paires de couleur courantes\n"
" hdata: afficher des infos sur les hdata\n"
"infolists: afficher des infos sur les infolists\n"
" memory: afficher des infos sur l'utilisation de la mémoire\n"
" term: afficher des infos sur le terminal\n"
@ -5664,6 +5666,30 @@ msgstr "liste des notifications"
msgid "notify pointer (optional)"
msgstr "pointeur vers la notification (optionnel)"
msgid "irc nick"
msgstr "pseudo irc"
msgid "irc channel"
msgstr "canal irc"
msgid "irc channel_speaking"
msgstr "channel_speaking irc"
msgid "irc ignore"
msgstr "ignore irc"
msgid "irc notify"
msgstr "notify irc"
msgid "pattern for irc redirect"
msgstr "modèle pour une redirection irc"
msgid "irc redirect"
msgstr "redirection irc"
msgid "irc server"
msgstr "serveur irc"
#, c-format
msgid "%s%s: you are not connected to server"
msgstr "%s%s: vous n'êtes pas connecté au serveur"
@ -6699,6 +6725,117 @@ msgstr ""
"nom de fenêtre (peut démarrer ou se terminer par \"*\" comme joker) "
"(optionnel)"
msgid "bar"
msgstr "barre"
msgid "bar item"
msgstr "objet de barre"
msgid "buffer"
msgstr "tampon"
msgid "completion"
msgstr "complétion"
msgid "partial completion"
msgstr "complétion partielle"
msgid "config file"
msgstr "fichier de configuration"
msgid "config section"
msgstr "section de configuration"
msgid "config option"
msgstr "option de configuration"
msgid "filter"
msgstr "filtre"
msgid "history of commands in buffer"
msgstr "historique des commandes dans le tampon"
msgid "hook (variables common to all hook types)"
msgstr "hook (variables communes à tous les types de hooks)"
msgid "hook of type \"command\""
msgstr "hook de type \"command\""
msgid "hook of type \"command_run\""
msgstr "hook de type \"command_run\""
msgid "hook of type \"timer\""
msgstr "hook de type \"timer\""
msgid "hook of type \"fd\""
msgstr "hook de type \"fd\""
msgid "hook of type \"process\""
msgstr "hook de type \"process\""
msgid "hook of type \"connect\""
msgstr "hook de type \"connect\""
msgid "hook of type \"print\""
msgstr "hook de type \"print\""
msgid "hook of type \"signal\""
msgstr "hook de type \"signal\""
msgid "hook of type \"hsignal\""
msgstr "hook de type \"hsignal\""
msgid "hook of type \"config\""
msgstr "hook de type \"config\""
msgid "hook of type \"completion\""
msgstr "hook de type \"completion\""
msgid "hook of type \"modifier\""
msgstr "hook de type \"modifier\""
msgid "hook of type \"info\""
msgstr "hook de type \"info\""
msgid "hook of type \"info_hashtable\""
msgstr "hook de type \"info_hashtable\""
msgid "hook of type \"infolist\""
msgstr "hook de type \"infolist\""
msgid "hook of type \"hdata\""
msgstr "hook de type \"hdata\""
msgid "undo for input line"
msgstr "undo pour la ligne de commande"
msgid "key"
msgstr "touche"
msgid "lines"
msgstr "lignes"
msgid "line"
msgstr "ligne"
msgid "line data"
msgstr "données de la ligne"
msgid "group in nicklist"
msgstr "groupe dans la liste de pseudos"
msgid "nick in nicklist"
msgstr "pseudo dans la liste de pseudos"
msgid "window"
msgstr "fenêtre"
msgid "scroll info in window"
msgstr "info de défilement dans la fenêtre"
msgid "tree of windows"
msgstr "arbre des fenêtres"
#, c-format
msgid "%sError: unable to load plugin \"%s\": %s"
msgstr "%sErreur: impossible de charger l'extension \"%s\": %s"
@ -7795,3 +7932,9 @@ msgstr "Hashtable (sortie)"
msgid "Pointer"
msgstr "Pointeur"
msgid "Variables"
msgstr "Variables"
msgid "Lists"
msgstr "Listes"

165
po/hu.po
View File

@ -20,7 +20,7 @@ msgid ""
msgstr ""
"Project-Id-Version: WeeChat 0.3.6-dev\n"
"Report-Msgid-Bugs-To: flashcode@flashtux.org\n"
"POT-Creation-Date: 2011-05-31 09:11+0200\n"
"POT-Creation-Date: 2011-06-13 11:52+0200\n"
"PO-Revision-Date: 2011-05-15 10:51+0200\n"
"Last-Translator: Andras Voroskoi <voroskoi@frugalware.org>\n"
"Language-Team: weechat-dev <weechat-dev@nongnu.org>\n"
@ -1028,8 +1028,8 @@ msgstr ""
#, fuzzy
msgid ""
"list || set <plugin> <level> || dump [<plugin>] || buffer|color|infolists|"
"memory|term|windows"
"list || set <plugin> <level> || dump [<plugin>] || buffer|color|hdata|"
"infolists|memory|term|windows"
msgstr "dump | buffer | windows"
#, fuzzy
@ -1042,6 +1042,7 @@ msgid ""
"WeeChat crashes)\n"
" buffer: dump buffer content with hexadecimal values in log file\n"
" color: display infos about current color pairs\n"
" hdata: display infos about hdata\n"
"infolists: display infos about infolists\n"
" memory: display infos about memory usage\n"
" term: display infos about terminal\n"
@ -5167,6 +5168,34 @@ msgstr "konfigurációs paraméterek beállítása"
msgid "notify pointer (optional)"
msgstr "Beállítások mentése a lemezre\n"
#, fuzzy
msgid "irc nick"
msgstr "név: név"
#, fuzzy
msgid "irc channel"
msgstr "%d szoba"
msgid "irc channel_speaking"
msgstr ""
msgid "irc ignore"
msgstr ""
#, fuzzy
msgid "irc notify"
msgstr "konfigurációs paraméterek beállítása"
msgid "pattern for irc redirect"
msgstr ""
msgid "irc redirect"
msgstr ""
#, fuzzy
msgid "irc server"
msgstr "szerver"
#, fuzzy, c-format
msgid "%s%s: you are not connected to server"
msgstr "%s nincs csatlakozva szerverhez!\n"
@ -6142,6 +6171,130 @@ msgstr ""
msgid "window name (can start or end with \"*\" as wildcard) (optional)"
msgstr ""
msgid "bar"
msgstr ""
#, fuzzy
msgid "bar item"
msgstr "Aliaszok listája:\n"
#, fuzzy
msgid "buffer"
msgstr "pufferek kezelése"
#, fuzzy
msgid "completion"
msgstr "lefordítva:"
msgid "partial completion"
msgstr ""
#, fuzzy
msgid "config file"
msgstr "szerver konfigurációs fájljának újraolvastatása"
#, fuzzy
msgid "config section"
msgstr "konfigurációs paraméterek beállítása"
#, fuzzy
msgid "config option"
msgstr "konfigurációs paraméterek beállítása"
msgid "filter"
msgstr ""
#, fuzzy
msgid "history of commands in buffer"
msgstr "%s belső parancsok:\n"
msgid "hook (variables common to all hook types)"
msgstr ""
#, fuzzy
msgid "hook of type \"command\""
msgstr "%s belső parancsok:\n"
msgid "hook of type \"command_run\""
msgstr ""
msgid "hook of type \"timer\""
msgstr ""
msgid "hook of type \"fd\""
msgstr ""
msgid "hook of type \"process\""
msgstr ""
msgid "hook of type \"connect\""
msgstr ""
msgid "hook of type \"print\""
msgstr ""
msgid "hook of type \"signal\""
msgstr ""
msgid "hook of type \"hsignal\""
msgstr ""
msgid "hook of type \"config\""
msgstr ""
msgid "hook of type \"completion\""
msgstr ""
msgid "hook of type \"modifier\""
msgstr ""
msgid "hook of type \"info\""
msgstr ""
msgid "hook of type \"info_hashtable\""
msgstr ""
msgid "hook of type \"infolist\""
msgstr ""
msgid "hook of type \"hdata\""
msgstr ""
#, fuzzy
msgid "undo for input line"
msgstr "szöveg beillesztése a parancssorba"
msgid "key"
msgstr ""
msgid "lines"
msgstr ""
msgid "line"
msgstr ""
msgid "line data"
msgstr ""
#, fuzzy
msgid "group in nicklist"
msgstr "név színe"
#, fuzzy
msgid "nick in nicklist"
msgstr "%s nem található ilyen mellőzés\n"
#, fuzzy
msgid "window"
msgstr "ablakok kezelése"
msgid "scroll info in window"
msgstr ""
#, fuzzy
msgid "tree of windows"
msgstr "Mellőzések listája:\n"
#, fuzzy, c-format
msgid "%sError: unable to load plugin \"%s\": %s"
msgstr "%s nem sikerült a modult betölteni \"%s\": %s\n"
@ -7206,3 +7359,9 @@ msgstr ""
#, fuzzy
msgid "Pointer"
msgstr "perc"
msgid "Variables"
msgstr ""
msgid "Lists"
msgstr ""

168
po/it.po
View File

@ -20,7 +20,7 @@ msgid ""
msgstr ""
"Project-Id-Version: WeeChat 0.3.6-dev\n"
"Report-Msgid-Bugs-To: flashcode@flashtux.org\n"
"POT-Creation-Date: 2011-05-31 09:11+0200\n"
"POT-Creation-Date: 2011-06-13 11:52+0200\n"
"PO-Revision-Date: 2011-05-15 10:52+0200\n"
"Last-Translator: Marco Paolone <marcopaolone@gmail.com>\n"
"Language-Team: weechat-dev <weechat-dev@nongnu.org>\n"
@ -1069,8 +1069,8 @@ msgstr "attiva debug per core/plugin"
#, fuzzy
msgid ""
"list || set <plugin> <level> || dump [<plugin>] || buffer|color|infolists|"
"memory|term|windows"
"list || set <plugin> <level> || dump [<plugin>] || buffer|color|hdata|"
"infolists|memory|term|windows"
msgstr ""
"list || set <plugin> <livello> || dump [<plugin>] || buffer|color|memory|"
"term|windows"
@ -1085,6 +1085,7 @@ msgid ""
"WeeChat crashes)\n"
" buffer: dump buffer content with hexadecimal values in log file\n"
" color: display infos about current color pairs\n"
" hdata: display infos about hdata\n"
"infolists: display infos about infolists\n"
" memory: display infos about memory usage\n"
" term: display infos about terminal\n"
@ -5625,6 +5626,34 @@ msgstr "elenco delle notifiche"
msgid "notify pointer (optional)"
msgstr "puntatore alla notifica (opzionale)"
#, fuzzy
msgid "irc nick"
msgstr "nick: nick"
#, fuzzy
msgid "irc channel"
msgstr "canale"
msgid "irc channel_speaking"
msgstr ""
msgid "irc ignore"
msgstr ""
#, fuzzy
msgid "irc notify"
msgstr "elenco delle notifiche"
msgid "pattern for irc redirect"
msgstr ""
msgid "irc redirect"
msgstr ""
#, fuzzy
msgid "irc server"
msgstr "server"
#, c-format
msgid "%s%s: you are not connected to server"
msgstr "%s%s: non connesso al server"
@ -6656,6 +6685,133 @@ msgstr ""
"nome finestra (può iniziare o terminare con \"*\" come carattere jolly) "
"(opzionale)"
msgid "bar"
msgstr ""
#, fuzzy
msgid "bar item"
msgstr "elenco degli elementi barra"
#, fuzzy
msgid "buffer"
msgstr "gestione buffer"
#, fuzzy
msgid "completion"
msgstr "compilato il"
msgid "partial completion"
msgstr ""
#, fuzzy
msgid "config file"
msgstr "file di configurazione"
#, fuzzy
msgid "config section"
msgstr "imposta le opzioni di configurazione"
#, fuzzy
msgid "config option"
msgstr "imposta le opzioni di configurazione"
msgid "filter"
msgstr ""
#, fuzzy
msgid "history of commands in buffer"
msgstr "cronologia dei comandi"
msgid "hook (variables common to all hook types)"
msgstr ""
#, fuzzy
msgid "hook of type \"command\""
msgstr "cronologia dei comandi"
msgid "hook of type \"command_run\""
msgstr ""
msgid "hook of type \"timer\""
msgstr ""
msgid "hook of type \"fd\""
msgstr ""
msgid "hook of type \"process\""
msgstr ""
msgid "hook of type \"connect\""
msgstr ""
msgid "hook of type \"print\""
msgstr ""
msgid "hook of type \"signal\""
msgstr ""
msgid "hook of type \"hsignal\""
msgstr ""
msgid "hook of type \"config\""
msgstr ""
msgid "hook of type \"completion\""
msgstr ""
msgid "hook of type \"modifier\""
msgstr ""
msgid "hook of type \"info\""
msgstr ""
msgid "hook of type \"info_hashtable\""
msgstr ""
msgid "hook of type \"infolist\""
msgstr ""
msgid "hook of type \"hdata\""
msgstr ""
#, fuzzy
msgid "undo for input line"
msgstr "funzioni per la riga di comando"
msgid "key"
msgstr ""
#, fuzzy
msgid "lines"
msgstr "in linea"
#, fuzzy
msgid "line"
msgstr "in linea"
#, fuzzy
msgid "line data"
msgstr "in linea"
#, fuzzy
msgid "group in nicklist"
msgstr "colore del testo per i gruppi nella lista nick"
#, fuzzy
msgid "nick in nicklist"
msgstr "nick nella lista notifiche"
#, fuzzy
msgid "window"
msgstr "gestione finestre"
msgid "scroll info in window"
msgstr ""
#, fuzzy
msgid "tree of windows"
msgstr "elenco delle finestre"
#, c-format
msgid "%sError: unable to load plugin \"%s\": %s"
msgstr "%sErrore: impossibile attivare il plugin \"%s\": %s"
@ -7734,3 +7890,9 @@ msgstr "Tabella hash (output)"
msgid "Pointer"
msgstr "Puntatore"
msgid "Variables"
msgstr ""
msgid "Lists"
msgstr ""

168
po/pl.po
View File

@ -21,7 +21,7 @@ msgid ""
msgstr ""
"Project-Id-Version: WeeChat 0.3.6-dev\n"
"Report-Msgid-Bugs-To: flashcode@flashtux.org\n"
"POT-Creation-Date: 2011-05-31 09:11+0200\n"
"POT-Creation-Date: 2011-06-13 11:52+0200\n"
"PO-Revision-Date: 2011-05-15 10:52+0200\n"
"Last-Translator: Krzysztof Koroscik <soltys@szluug.org>\n"
"Language-Team: weechat-dev <weechat-dev@nongnu.org>\n"
@ -1079,8 +1079,8 @@ msgstr "kontrola debugu dla rdzenia/wtyczek"
#, fuzzy
msgid ""
"list || set <plugin> <level> || dump [<plugin>] || buffer|color|infolists|"
"memory|term|windows"
"list || set <plugin> <level> || dump [<plugin>] || buffer|color|hdata|"
"infolists|memory|term|windows"
msgstr ""
"list || set <plugin> <poziom> || dump [<plugin>] || buffer|color|memory|term|"
"windows"
@ -1095,6 +1095,7 @@ msgid ""
"WeeChat crashes)\n"
" buffer: dump buffer content with hexadecimal values in log file\n"
" color: display infos about current color pairs\n"
" hdata: display infos about hdata\n"
"infolists: display infos about infolists\n"
" memory: display infos about memory usage\n"
" term: display infos about terminal\n"
@ -5582,6 +5583,34 @@ msgstr "lista powiadomień"
msgid "notify pointer (optional)"
msgstr "wskaźnik powiadomienia (opcjonalne)"
#, fuzzy
msgid "irc nick"
msgstr "nick: nazwa użytkownika"
#, fuzzy
msgid "irc channel"
msgstr "kanał"
msgid "irc channel_speaking"
msgstr ""
msgid "irc ignore"
msgstr ""
#, fuzzy
msgid "irc notify"
msgstr "lista powiadomień"
msgid "pattern for irc redirect"
msgstr ""
msgid "irc redirect"
msgstr ""
#, fuzzy
msgid "irc server"
msgstr "serwer"
#, c-format
msgid "%s%s: you are not connected to server"
msgstr "%s%s: nie jesteś połączony z serwerem"
@ -6590,6 +6619,133 @@ msgstr "wskaźnik okna (opcjonalne)"
msgid "window name (can start or end with \"*\" as wildcard) (optional)"
msgstr "nazwa okna (może się zaczynać lub kończyć \"*\") (opcjonalne)"
msgid "bar"
msgstr ""
#, fuzzy
msgid "bar item"
msgstr "lista elementów pasków"
#, fuzzy
msgid "buffer"
msgstr "zarządzaj buforami"
#, fuzzy
msgid "completion"
msgstr "skompilowano"
msgid "partial completion"
msgstr ""
#, fuzzy
msgid "config file"
msgstr "pliki konfiguracyjne"
#, fuzzy
msgid "config section"
msgstr "ustawia opcje konfiguracyjne"
#, fuzzy
msgid "config option"
msgstr "ustawia opcje konfiguracyjne"
msgid "filter"
msgstr ""
#, fuzzy
msgid "history of commands in buffer"
msgstr "historia komend"
msgid "hook (variables common to all hook types)"
msgstr ""
#, fuzzy
msgid "hook of type \"command\""
msgstr "historia komend"
msgid "hook of type \"command_run\""
msgstr ""
msgid "hook of type \"timer\""
msgstr ""
msgid "hook of type \"fd\""
msgstr ""
msgid "hook of type \"process\""
msgstr ""
msgid "hook of type \"connect\""
msgstr ""
msgid "hook of type \"print\""
msgstr ""
msgid "hook of type \"signal\""
msgstr ""
msgid "hook of type \"hsignal\""
msgstr ""
msgid "hook of type \"config\""
msgstr ""
msgid "hook of type \"completion\""
msgstr ""
msgid "hook of type \"modifier\""
msgstr ""
msgid "hook of type \"info\""
msgstr ""
msgid "hook of type \"info_hashtable\""
msgstr ""
msgid "hook of type \"infolist\""
msgstr ""
msgid "hook of type \"hdata\""
msgstr ""
#, fuzzy
msgid "undo for input line"
msgstr "funkcje linii komend"
msgid "key"
msgstr ""
#, fuzzy
msgid "lines"
msgstr "online"
#, fuzzy
msgid "line"
msgstr "online"
#, fuzzy
msgid "line data"
msgstr "online"
#, fuzzy
msgid "group in nicklist"
msgstr "kolor grup na liście nicków"
#, fuzzy
msgid "nick in nicklist"
msgstr "nicki na liście powiadomień"
#, fuzzy
msgid "window"
msgstr "zarządza oknami"
msgid "scroll info in window"
msgstr ""
#, fuzzy
msgid "tree of windows"
msgstr "lista okien"
#, c-format
msgid "%sError: unable to load plugin \"%s\": %s"
msgstr "%sBłąd: nie można załadować wtyczki \"%s\": %s"
@ -7660,3 +7816,9 @@ msgstr "Hashtable (wyjście)"
msgid "Pointer"
msgstr "Wskaźnik"
msgid "Variables"
msgstr ""
msgid "Lists"
msgstr ""

View File

@ -20,7 +20,7 @@ msgid ""
msgstr ""
"Project-Id-Version: WeeChat 0.3.6-dev\n"
"Report-Msgid-Bugs-To: flashcode@flashtux.org\n"
"POT-Creation-Date: 2011-05-31 09:11+0200\n"
"POT-Creation-Date: 2011-06-13 11:52+0200\n"
"PO-Revision-Date: 2011-05-15 10:52+0200\n"
"Last-Translator: Ivan Sichmann Freitas <ivansichfreitas@gmail.com>\n"
"Language-Team: weechat-dev <weechat-dev@nongnu.org>\n"
@ -1091,8 +1091,8 @@ msgstr "cotrolar depuração para core/plugins"
#, fuzzy
msgid ""
"list || set <plugin> <level> || dump [<plugin>] || buffer|color|infolists|"
"memory|term|windows"
"list || set <plugin> <level> || dump [<plugin>] || buffer|color|hdata|"
"infolists|memory|term|windows"
msgstr "[list | set plugin level | dump [plugin] | buffer | windows | term]"
# find a better translation to dump?
@ -1107,6 +1107,7 @@ msgid ""
"WeeChat crashes)\n"
" buffer: dump buffer content with hexadecimal values in log file\n"
" color: display infos about current color pairs\n"
" hdata: display infos about hdata\n"
"infolists: display infos about infolists\n"
" memory: display infos about memory usage\n"
" term: display infos about terminal\n"
@ -5026,6 +5027,30 @@ msgstr ""
msgid "notify pointer (optional)"
msgstr ""
msgid "irc nick"
msgstr ""
msgid "irc channel"
msgstr ""
msgid "irc channel_speaking"
msgstr ""
msgid "irc ignore"
msgstr ""
msgid "irc notify"
msgstr ""
msgid "pattern for irc redirect"
msgstr ""
msgid "irc redirect"
msgstr ""
msgid "irc server"
msgstr ""
#, c-format
msgid "%s%s: you are not connected to server"
msgstr ""
@ -5946,6 +5971,127 @@ msgstr ""
msgid "window name (can start or end with \"*\" as wildcard) (optional)"
msgstr ""
msgid "bar"
msgstr ""
#, fuzzy
msgid "bar item"
msgstr "Lista de itens da barra:"
#, fuzzy
msgid "buffer"
msgstr "gerenciar buffers"
#, fuzzy
msgid "completion"
msgstr "compilado em"
msgid "partial completion"
msgstr ""
#, fuzzy
msgid "config file"
msgstr "arquivos de configuração"
#, fuzzy
msgid "config section"
msgstr "define opções de configuração"
#, fuzzy
msgid "config option"
msgstr "define opções de configuração"
msgid "filter"
msgstr ""
msgid "history of commands in buffer"
msgstr ""
msgid "hook (variables common to all hook types)"
msgstr ""
msgid "hook of type \"command\""
msgstr ""
msgid "hook of type \"command_run\""
msgstr ""
msgid "hook of type \"timer\""
msgstr ""
msgid "hook of type \"fd\""
msgstr ""
msgid "hook of type \"process\""
msgstr ""
msgid "hook of type \"connect\""
msgstr ""
msgid "hook of type \"print\""
msgstr ""
msgid "hook of type \"signal\""
msgstr ""
msgid "hook of type \"hsignal\""
msgstr ""
msgid "hook of type \"config\""
msgstr ""
msgid "hook of type \"completion\""
msgstr ""
msgid "hook of type \"modifier\""
msgstr ""
msgid "hook of type \"info\""
msgstr ""
msgid "hook of type \"info_hashtable\""
msgstr ""
msgid "hook of type \"infolist\""
msgstr ""
msgid "hook of type \"hdata\""
msgstr ""
#, fuzzy
msgid "undo for input line"
msgstr "funções para linha de comando"
msgid "key"
msgstr ""
msgid "lines"
msgstr ""
msgid "line"
msgstr ""
msgid "line data"
msgstr ""
msgid "group in nicklist"
msgstr ""
#, fuzzy
msgid "nick in nicklist"
msgstr "apelidos na lista de apelidos no buffer atual"
#, fuzzy
msgid "window"
msgstr "gerencia janelas"
msgid "scroll info in window"
msgstr ""
#, fuzzy
msgid "tree of windows"
msgstr "Restauração da disposição das janelas"
#, c-format
msgid "%sError: unable to load plugin \"%s\": %s"
msgstr ""
@ -6918,3 +7064,9 @@ msgstr ""
msgid "Pointer"
msgstr ""
msgid "Variables"
msgstr ""
msgid "Lists"
msgstr ""

165
po/ru.po
View File

@ -20,7 +20,7 @@ msgid ""
msgstr ""
"Project-Id-Version: WeeChat 0.3.6-dev\n"
"Report-Msgid-Bugs-To: flashcode@flashtux.org\n"
"POT-Creation-Date: 2011-05-31 09:11+0200\n"
"POT-Creation-Date: 2011-06-13 11:52+0200\n"
"PO-Revision-Date: 2011-05-15 10:52+0200\n"
"Last-Translator: Pavel Shevchuk <stlwrt@gmail.com>\n"
"Language-Team: weechat-dev <weechat-dev@nongnu.org>\n"
@ -1035,8 +1035,8 @@ msgstr ""
#, fuzzy
msgid ""
"list || set <plugin> <level> || dump [<plugin>] || buffer|color|infolists|"
"memory|term|windows"
"list || set <plugin> <level> || dump [<plugin>] || buffer|color|hdata|"
"infolists|memory|term|windows"
msgstr "dump | buffer | windows"
#, fuzzy
@ -1049,6 +1049,7 @@ msgid ""
"WeeChat crashes)\n"
" buffer: dump buffer content with hexadecimal values in log file\n"
" color: display infos about current color pairs\n"
" hdata: display infos about hdata\n"
"infolists: display infos about infolists\n"
" memory: display infos about memory usage\n"
" term: display infos about terminal\n"
@ -5181,6 +5182,34 @@ msgstr "настроить параметры конфигурации"
msgid "notify pointer (optional)"
msgstr "Сохраняю конфигурацию\n"
#, fuzzy
msgid "irc nick"
msgstr "ник: ник"
#, fuzzy
msgid "irc channel"
msgstr "%d канал"
msgid "irc channel_speaking"
msgstr ""
msgid "irc ignore"
msgstr ""
#, fuzzy
msgid "irc notify"
msgstr "настроить параметры конфигурации"
msgid "pattern for irc redirect"
msgstr ""
msgid "irc redirect"
msgstr ""
#, fuzzy
msgid "irc server"
msgstr "сервер"
#, fuzzy, c-format
msgid "%s%s: you are not connected to server"
msgstr "%s вы не подключены к серверу\n"
@ -6157,6 +6186,130 @@ msgstr ""
msgid "window name (can start or end with \"*\" as wildcard) (optional)"
msgstr ""
msgid "bar"
msgstr ""
#, fuzzy
msgid "bar item"
msgstr "Список сокращений:\n"
#, fuzzy
msgid "buffer"
msgstr "управление буферами"
#, fuzzy
msgid "completion"
msgstr "собран:"
msgid "partial completion"
msgstr ""
#, fuzzy
msgid "config file"
msgstr "перезагрузить конфигурационный файл сервера"
#, fuzzy
msgid "config section"
msgstr "настроить параметры конфигурации"
#, fuzzy
msgid "config option"
msgstr "настроить параметры конфигурации"
msgid "filter"
msgstr ""
#, fuzzy
msgid "history of commands in buffer"
msgstr "Внутренние команды %s:\n"
msgid "hook (variables common to all hook types)"
msgstr ""
#, fuzzy
msgid "hook of type \"command\""
msgstr "Внутренние команды %s:\n"
msgid "hook of type \"command_run\""
msgstr ""
msgid "hook of type \"timer\""
msgstr ""
msgid "hook of type \"fd\""
msgstr ""
msgid "hook of type \"process\""
msgstr ""
msgid "hook of type \"connect\""
msgstr ""
msgid "hook of type \"print\""
msgstr ""
msgid "hook of type \"signal\""
msgstr ""
msgid "hook of type \"hsignal\""
msgstr ""
msgid "hook of type \"config\""
msgstr ""
msgid "hook of type \"completion\""
msgstr ""
msgid "hook of type \"modifier\""
msgstr ""
msgid "hook of type \"info\""
msgstr ""
msgid "hook of type \"info_hashtable\""
msgstr ""
msgid "hook of type \"infolist\""
msgstr ""
msgid "hook of type \"hdata\""
msgstr ""
#, fuzzy
msgid "undo for input line"
msgstr "вставить строку в поле ввода"
msgid "key"
msgstr ""
msgid "lines"
msgstr ""
msgid "line"
msgstr ""
msgid "line data"
msgstr ""
#, fuzzy
msgid "group in nicklist"
msgstr "цвет ника"
#, fuzzy
msgid "nick in nicklist"
msgstr "%s игнорирования не найдены\n"
#, fuzzy
msgid "window"
msgstr "управление окнами"
msgid "scroll info in window"
msgstr ""
#, fuzzy
msgid "tree of windows"
msgstr "Список игнорирования:\n"
#, fuzzy, c-format
msgid "%sError: unable to load plugin \"%s\": %s"
msgstr "%s не могу загрузить plugin \"%s\": %s\n"
@ -7215,3 +7368,9 @@ msgstr ""
#, fuzzy
msgid "Pointer"
msgstr "минута"
msgid "Variables"
msgstr ""
msgid "Lists"
msgstr ""

View File

@ -7,7 +7,7 @@ msgid ""
msgstr ""
"Project-Id-Version: PACKAGE VERSION\n"
"Report-Msgid-Bugs-To: flashcode@flashtux.org\n"
"POT-Creation-Date: 2011-05-31 09:11+0200\n"
"POT-Creation-Date: 2011-06-13 11:52+0200\n"
"PO-Revision-Date: YEAR-MO-DA HO:MI+ZONE\n"
"Last-Translator: FULL NAME <EMAIL@ADDRESS>\n"
"Language-Team: LANGUAGE <LL@li.org>\n"
@ -891,8 +891,8 @@ msgid "control debug for core/plugins"
msgstr ""
msgid ""
"list || set <plugin> <level> || dump [<plugin>] || buffer|color|infolists|"
"memory|term|windows"
"list || set <plugin> <level> || dump [<plugin>] || buffer|color|hdata|"
"infolists|memory|term|windows"
msgstr ""
msgid ""
@ -904,6 +904,7 @@ msgid ""
"WeeChat crashes)\n"
" buffer: dump buffer content with hexadecimal values in log file\n"
" color: display infos about current color pairs\n"
" hdata: display infos about hdata\n"
"infolists: display infos about infolists\n"
" memory: display infos about memory usage\n"
" term: display infos about terminal\n"
@ -4416,6 +4417,30 @@ msgstr ""
msgid "notify pointer (optional)"
msgstr ""
msgid "irc nick"
msgstr ""
msgid "irc channel"
msgstr ""
msgid "irc channel_speaking"
msgstr ""
msgid "irc ignore"
msgstr ""
msgid "irc notify"
msgstr ""
msgid "pattern for irc redirect"
msgstr ""
msgid "irc redirect"
msgstr ""
msgid "irc server"
msgstr ""
#, c-format
msgid "%s%s: you are not connected to server"
msgstr ""
@ -5336,6 +5361,117 @@ msgstr ""
msgid "window name (can start or end with \"*\" as wildcard) (optional)"
msgstr ""
msgid "bar"
msgstr ""
msgid "bar item"
msgstr ""
msgid "buffer"
msgstr ""
msgid "completion"
msgstr ""
msgid "partial completion"
msgstr ""
msgid "config file"
msgstr ""
msgid "config section"
msgstr ""
msgid "config option"
msgstr ""
msgid "filter"
msgstr ""
msgid "history of commands in buffer"
msgstr ""
msgid "hook (variables common to all hook types)"
msgstr ""
msgid "hook of type \"command\""
msgstr ""
msgid "hook of type \"command_run\""
msgstr ""
msgid "hook of type \"timer\""
msgstr ""
msgid "hook of type \"fd\""
msgstr ""
msgid "hook of type \"process\""
msgstr ""
msgid "hook of type \"connect\""
msgstr ""
msgid "hook of type \"print\""
msgstr ""
msgid "hook of type \"signal\""
msgstr ""
msgid "hook of type \"hsignal\""
msgstr ""
msgid "hook of type \"config\""
msgstr ""
msgid "hook of type \"completion\""
msgstr ""
msgid "hook of type \"modifier\""
msgstr ""
msgid "hook of type \"info\""
msgstr ""
msgid "hook of type \"info_hashtable\""
msgstr ""
msgid "hook of type \"infolist\""
msgstr ""
msgid "hook of type \"hdata\""
msgstr ""
msgid "undo for input line"
msgstr ""
msgid "key"
msgstr ""
msgid "lines"
msgstr ""
msgid "line"
msgstr ""
msgid "line data"
msgstr ""
msgid "group in nicklist"
msgstr ""
msgid "nick in nicklist"
msgstr ""
msgid "window"
msgstr ""
msgid "scroll info in window"
msgstr ""
msgid "tree of windows"
msgstr ""
#, c-format
msgid "%sError: unable to load plugin \"%s\": %s"
msgstr ""
@ -6293,3 +6429,9 @@ msgstr ""
msgid "Pointer"
msgstr ""
msgid "Variables"
msgstr ""
msgid "Lists"
msgstr ""

View File

@ -28,6 +28,7 @@ wee-config.c wee-config.h
wee-config-file.c wee-config-file.h
wee-debug.c wee-debug.h
wee-hashtable.c wee-hashtable.h
wee-hdata.c wee-hdata.h
wee-hook.c wee-hook.h
wee-infolist.c wee-infolist.h
wee-input.c wee-input.h

View File

@ -37,6 +37,8 @@ lib_weechat_core_a_SOURCES = weechat.c \
wee-debug.h \
wee-hashtable.c \
wee-hashtable.h \
wee-hdata.c \
wee-hdata.h \
wee-hook.c \
wee-hook.h \
wee-infolist.c \

View File

@ -1152,6 +1152,10 @@ COMMAND_CALLBACK(debug)
{
gui_color_dump (buffer);
}
else if (string_strcasecmp (argv[1], "hdata") == 0)
{
debug_hdata ();
}
else if (string_strcasecmp (argv[1], "infolists") == 0)
{
debug_infolists ();
@ -4837,7 +4841,7 @@ command_init ()
N_("list"
" || set <plugin> <level>"
" || dump [<plugin>]"
" || buffer|color|infolists|memory|term|windows"),
" || buffer|color|hdata|infolists|memory|term|windows"),
N_(" list: list plugins with debug levels\n"
" set: set debug level for plugin\n"
" plugin: name of plugin (\"core\" for WeeChat core)\n"
@ -4847,6 +4851,7 @@ command_init ()
" buffer: dump buffer content with hexadecimal values "
"in log file\n"
" color: display infos about current color pairs\n"
" hdata: display infos about hdata\n"
"infolists: display infos about infolists\n"
" memory: display infos about memory usage\n"
" term: display infos about terminal\n"
@ -4856,6 +4861,7 @@ command_init ()
" || dump %(plugins_names)|core"
" || buffer"
" || color"
" || hdata"
" || infolists"
" || memory"
" || term"

View File

@ -27,6 +27,7 @@
#endif
#include <stdlib.h>
#include <stddef.h>
#include <unistd.h>
#include <stdarg.h>
#include <string.h>
@ -34,6 +35,7 @@
#include "weechat.h"
#include "wee-config-file.h"
#include "wee-hdata.h"
#include "wee-hook.h"
#include "wee-infolist.h"
#include "wee-log.h"
@ -51,6 +53,10 @@ char *config_option_type_string[CONFIG_NUM_OPTION_TYPES] =
char *config_boolean_true[] = { "on", "yes", "y", "true", "t", "1", NULL };
char *config_boolean_false[] = { "off", "no", "n", "false", "f", "0", NULL };
struct t_hdata *config_file_hdata_config_file = NULL;
struct t_hdata *config_file_hdata_config_section = NULL;
struct t_hdata *config_file_hdata_config_option = NULL;
void config_file_option_free_data (struct t_config_option *option);
@ -2543,6 +2549,125 @@ config_file_free_all_plugin (struct t_weechat_plugin *plugin)
}
}
/*
* config_file_hdata_config_file_cb: return hdata for config_file
*/
struct t_hdata *
config_file_hdata_config_file_cb (void *data, const char *hdata_name)
{
struct t_hdata *hdata;
/* make C compiler happy */
(void) data;
if (config_file_hdata_config_file)
return config_file_hdata_config_file;
hdata = hdata_new (hdata_name, "prev_config", "next_config");
if (hdata)
{
config_file_hdata_config_file = hdata;
HDATA_VAR(struct t_config_file, plugin, POINTER);
HDATA_VAR(struct t_config_file, name, STRING);
HDATA_VAR(struct t_config_file, filename, STRING);
HDATA_VAR(struct t_config_file, file, POINTER);
HDATA_VAR(struct t_config_file, callback_reload, POINTER);
HDATA_VAR(struct t_config_file, callback_reload_data, POINTER);
HDATA_VAR(struct t_config_file, sections, POINTER);
HDATA_VAR(struct t_config_file, last_section, POINTER);
HDATA_VAR(struct t_config_file, prev_config, POINTER);
HDATA_VAR(struct t_config_file, next_config, POINTER);
HDATA_LIST(config_files);
HDATA_LIST(last_config_file);
}
return config_file_hdata_config_file;
}
/*
* config_file_hdata_config_section_cb: return hdata for config_section
*/
struct t_hdata *
config_file_hdata_config_section_cb (void *data, const char *hdata_name)
{
struct t_hdata *hdata;
/* make C compiler happy */
(void) data;
if (config_file_hdata_config_section)
return config_file_hdata_config_section;
hdata = hdata_new (hdata_name, "prev_section", "next_section");
if (hdata)
{
config_file_hdata_config_section = hdata;
HDATA_VAR(struct t_config_section, config_file, POINTER);
HDATA_VAR(struct t_config_section, name, STRING);
HDATA_VAR(struct t_config_section, user_can_add_options, INTEGER);
HDATA_VAR(struct t_config_section, user_can_delete_options, INTEGER);
HDATA_VAR(struct t_config_section, callback_read, POINTER);
HDATA_VAR(struct t_config_section, callback_read_data, POINTER);
HDATA_VAR(struct t_config_section, callback_write, POINTER);
HDATA_VAR(struct t_config_section, callback_write_data, POINTER);
HDATA_VAR(struct t_config_section, callback_write_default, POINTER);
HDATA_VAR(struct t_config_section, callback_write_default_data, POINTER);
HDATA_VAR(struct t_config_section, callback_create_option, POINTER);
HDATA_VAR(struct t_config_section, callback_create_option_data, POINTER);
HDATA_VAR(struct t_config_section, callback_delete_option, POINTER);
HDATA_VAR(struct t_config_section, callback_delete_option_data, POINTER);
HDATA_VAR(struct t_config_section, options, POINTER);
HDATA_VAR(struct t_config_section, last_option, POINTER);
HDATA_VAR(struct t_config_section, prev_section, POINTER);
HDATA_VAR(struct t_config_section, next_section, POINTER);
}
return config_file_hdata_config_section;
}
/*
* config_file_hdata_config_option_cb: return hdata for config_option
*/
struct t_hdata *
config_file_hdata_config_option_cb (void *data, const char *hdata_name)
{
struct t_hdata *hdata;
/* make C compiler happy */
(void) data;
if (config_file_hdata_config_option)
return config_file_hdata_config_option;
hdata = hdata_new (hdata_name, "prev_option", "next_option");
if (hdata)
{
config_file_hdata_config_option = hdata;
HDATA_VAR(struct t_config_option, config_file, POINTER);
HDATA_VAR(struct t_config_option, section, POINTER);
HDATA_VAR(struct t_config_option, name, STRING);
HDATA_VAR(struct t_config_option, type, INTEGER);
HDATA_VAR(struct t_config_option, description, STRING);
HDATA_VAR(struct t_config_option, string_values, POINTER);
HDATA_VAR(struct t_config_option, min, INTEGER);
HDATA_VAR(struct t_config_option, max, INTEGER);
HDATA_VAR(struct t_config_option, default_value, POINTER);
HDATA_VAR(struct t_config_option, value, POINTER);
HDATA_VAR(struct t_config_option, null_value_allowed, INTEGER);
HDATA_VAR(struct t_config_option, callback_check_value, POINTER);
HDATA_VAR(struct t_config_option, callback_check_value_data, POINTER);
HDATA_VAR(struct t_config_option, callback_change, POINTER);
HDATA_VAR(struct t_config_option, callback_change_data, POINTER);
HDATA_VAR(struct t_config_option, callback_delete, POINTER);
HDATA_VAR(struct t_config_option, callback_delete_data, POINTER);
HDATA_VAR(struct t_config_option, loaded, INTEGER);
HDATA_VAR(struct t_config_option, prev_option, POINTER);
HDATA_VAR(struct t_config_option, next_option, POINTER);
}
return config_file_hdata_config_option;
}
/*
* config_file_add_to_infolist: add configuration options in an infolist
* return 1 if ok, 0 if error

View File

@ -248,6 +248,12 @@ extern void config_file_section_free (struct t_config_section *section);
extern void config_file_free (struct t_config_file *config_file);
extern void config_file_free_all ();
extern void config_file_free_all_plugin (struct t_weechat_plugin *plugin);
extern struct t_hdata *config_file_hdata_config_file_cb (void *data,
const char *hdata_name);
extern struct t_hdata *config_file_hdata_config_section_cb (void *data,
const char *hdata_name);
extern struct t_hdata *config_file_hdata_config_option_cb (void *data,
const char *hdata_name);
extern int config_file_add_to_infolist (struct t_infolist *infolist,
const char *option_name);
extern void config_file_print_log ();

View File

@ -35,7 +35,10 @@
#include "weechat.h"
#include "wee-backtrace.h"
#include "wee-config-file.h"
#include "wee-hashtable.h"
#include "wee-hdata.h"
#include "wee-infolist.h"
#include "wee-list.h"
#include "wee-log.h"
#include "wee-hook.h"
#include "wee-proxy.h"
@ -95,6 +98,8 @@ debug_dump (int crash)
gui_bar_item_print_log ();
gui_hotlist_print_log ();
hdata_print_log ();
infolist_print_log ();
hook_print_log ();
@ -294,6 +299,108 @@ debug_memory ()
#endif
}
/*
* debug_hdata_hash_var_map_cb: function called for each variable in hdata
*/
void
debug_hdata_hash_var_map_cb (void *data,
struct t_hashtable *hashtable,
const void *key, const void *value)
{
struct t_weelist *list;
char str_offset[16];
/* make C compiler happy */
(void) hashtable;
list = (struct t_weelist *)data;
snprintf (str_offset, sizeof (str_offset),
"%12d", (*((int *)value)) & 0xFFFF);
weelist_add (list, str_offset, WEECHAT_LIST_POS_SORT, (void *)key);
}
/*
* debug_hdata_hash_list_map_cb: function called for each list in hdata
*/
void
debug_hdata_hash_list_map_cb (void *data,
struct t_hashtable *hashtable,
const void *key, const void *value)
{
/* make C compiler happy */
(void) data;
(void) hashtable;
gui_chat_printf (NULL,
" list: %s -> 0x%lx",
(char *)key,
*((void **)value));
}
/*
* debug_hdata: display list of hdata in memory
*/
void
debug_hdata ()
{
struct t_hdata *ptr_hdata;
int i, count;
struct t_weelist *list;
struct t_weelist_item *ptr_item;
void *value;
count = 0;
for (ptr_hdata = weechat_hdata; ptr_hdata;
ptr_hdata = ptr_hdata->next_hdata)
{
count++;
}
gui_chat_printf (NULL, "");
gui_chat_printf (NULL, "%d hdata in memory", count);
if (count > 0)
{
i = 0;
for (ptr_hdata = weechat_hdata; ptr_hdata;
ptr_hdata = ptr_hdata->next_hdata)
{
gui_chat_printf (NULL,
"%4d: hdata 0x%lx: \"%s\", %d vars, %d lists:",
i + 1, ptr_hdata,
ptr_hdata->name,
hashtable_get_integer (ptr_hdata->hash_var,
"items_count"),
hashtable_get_integer (ptr_hdata->hash_list,
"items_count"));
list = weelist_new ();
hashtable_map (ptr_hdata->hash_var,
&debug_hdata_hash_var_map_cb, list);
for (ptr_item = list->items; ptr_item;
ptr_item = ptr_item->next_item)
{
value = hashtable_get (ptr_hdata->hash_var, ptr_item->user_data);
if (value)
{
gui_chat_printf (NULL,
" %04d -> %s (%s)",
(*((int *)value)) & 0xFFFF,
(char *)ptr_item->user_data,
hdata_type_string[(*((int *)value)) >> 16]);
}
}
weelist_free (list);
hashtable_map (ptr_hdata->hash_list,
&debug_hdata_hash_list_map_cb, NULL);
i++;
}
}
}
/*
* debug_infolists: display list of infolists in memory
*/
@ -370,7 +477,7 @@ debug_infolists ()
}
}
gui_chat_printf (NULL,
" %d: infolist 0x%lx: %d items, %d vars - "
"%4d: infolist 0x%lx: %d items, %d vars - "
"structs: %d, data: %d (total: %d bytes)",
i + 1, ptr_infolist, count_items, count_vars,
size_structs, size_data, size_structs + size_data);
@ -378,7 +485,7 @@ debug_infolists ()
i++;
}
gui_chat_printf (NULL,
" Total: %d items, %d vars - %d bytes",
"Total: %d items, %d vars - %d bytes",
total_items, total_vars, total_size);
}
}

View File

@ -25,6 +25,7 @@ struct t_gui_window_tree;
extern void debug_sigsegv ();
extern void debug_windows_tree ();
extern void debug_memory ();
extern void debug_hdata ();
extern void debug_infolists ();
extern void debug_init ();

400
src/core/wee-hdata.c Normal file
View File

@ -0,0 +1,400 @@
/*
* Copyright (C) 2011 Sebastien Helleu <flashcode@flashtux.org>
*
* This file is part of WeeChat, the extensible chat client.
*
* WeeChat is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation; either version 3 of the License, or
* (at your option) any later version.
*
* WeeChat is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with WeeChat. If not, see <http://www.gnu.org/licenses/>.
*/
/*
* wee-hdata.c: direct access to WeeChat data using hashtables (for C plugins)
*/
#ifdef HAVE_CONFIG_H
#include "config.h"
#endif
#include <stdlib.h>
#include <string.h>
#include "weechat.h"
#include "wee-hdata.h"
#include "wee-hashtable.h"
#include "wee-log.h"
#include "wee-string.h"
#include "../plugins/plugin.h"
struct t_hdata *weechat_hdata = NULL;
struct t_hdata *last_weechat_hdata = NULL;
char *hdata_type_string[6] =
{ "other", "integer", "long", "string", "pointer", "time" };
/*
* hdata_new: create a new hdata
*/
struct t_hdata *
hdata_new (const char *hdata_name, const char *var_prev, const char *var_next)
{
struct t_hdata *new_hdata;
if (!hdata_name || !hdata_name[0])
return NULL;
new_hdata = malloc (sizeof (*new_hdata));
if (new_hdata)
{
new_hdata->name = strdup (hdata_name);
new_hdata->hash_var = hashtable_new (8,
WEECHAT_HASHTABLE_STRING,
WEECHAT_HASHTABLE_INTEGER,
NULL,
NULL);
new_hdata->var_prev = (var_prev) ? strdup (var_prev) : NULL;
new_hdata->var_next = (var_next) ? strdup (var_next) : NULL;
new_hdata->hash_list = hashtable_new (8,
WEECHAT_HASHTABLE_STRING,
WEECHAT_HASHTABLE_POINTER,
NULL,
NULL);
new_hdata->prev_hdata = last_weechat_hdata;
new_hdata->next_hdata = NULL;
if (weechat_hdata)
last_weechat_hdata->next_hdata = new_hdata;
else
weechat_hdata = new_hdata;
last_weechat_hdata = new_hdata;
}
return new_hdata;
}
/*
* hdata_new_var: add a new variable (offset/type) in a hdata
*/
void
hdata_new_var (struct t_hdata *hdata, const char *name, int offset, int type)
{
int value;
if (hdata && name)
{
value = (type << 16) | (offset & 0xFFFF);
hashtable_set (hdata->hash_var, name, &value);
}
}
/*
* hdata_new_list: add a new list pointer in a hdata
*/
void
hdata_new_list (struct t_hdata *hdata, const char *name, void *pointer)
{
if (hdata && name)
hashtable_set (hdata->hash_list, name, pointer);
}
/*
* hdata_get_var_offset: get offset of variable
*/
int
hdata_get_var_offset (struct t_hdata *hdata, const char *name)
{
int *ptr_value;
if (hdata && name)
{
ptr_value = hashtable_get (hdata->hash_var, name);
if (ptr_value)
return (*ptr_value) & 0xFFFF;
}
return -1;
}
/*
* hdata_get_var_type: get type of variable (as integer)
*/
int
hdata_get_var_type (struct t_hdata *hdata, const char *name)
{
int *ptr_value;
if (hdata && name)
{
ptr_value = hashtable_get (hdata->hash_var, name);
if (ptr_value)
return (*ptr_value) >> 16;
}
return -1;
}
/*
* hdata_get_var_type_string: get type of variable (as string)
*/
const char *
hdata_get_var_type_string (struct t_hdata *hdata, const char *name)
{
int *ptr_value;
if (hdata && name)
{
ptr_value = hashtable_get (hdata->hash_var, name);
if (ptr_value)
return hdata_type_string[(*ptr_value) >> 16];
}
return NULL;
}
/*
* hdata_get_var: get pointer to content of variable using hdata var name
*/
void *
hdata_get_var (struct t_hdata *hdata, void *pointer, const char *name)
{
int offset;
if (hdata && pointer)
{
offset = hdata_get_var_offset (hdata, name);
if (offset >= 0)
return pointer + offset;
}
return NULL;
}
/*
* hdata_get_var_at_offset: get pointer to content of variable using hdata var
* offset
*/
void *
hdata_get_var_at_offset (struct t_hdata *hdata, void *pointer, int offset)
{
if (hdata && pointer)
return pointer + offset;
return NULL;
}
/*
* hdata_get_list: get a list pointer
*/
void *
hdata_get_list (struct t_hdata *hdata, const char *name)
{
void *ptr_value;
if (hdata && name)
{
ptr_value = hashtable_get (hdata->hash_list, name);
if (ptr_value)
return *((void **)ptr_value);
}
return NULL;
}
/*
* hdata_move: move pointer to another element in list
*/
void *
hdata_move (struct t_hdata *hdata, void *pointer, int count)
{
char *ptr_var;
int i, abs_count;
if (hdata && pointer && (count != 0))
{
ptr_var = (count < 0) ? hdata->var_prev : hdata->var_next;
abs_count = abs(count);
for (i = 0; i < abs_count; i++)
{
pointer = hdata_pointer (hdata, pointer, ptr_var);
if (pointer)
return pointer;
}
}
return NULL;
}
/*
* hdata_integer: get integer value of a variable in structure using hdata
*/
int
hdata_integer (struct t_hdata *hdata, void *pointer, const char *name)
{
int offset;
if (hdata && pointer)
{
offset = hdata_get_var_offset (hdata, name);
if (offset >= 0)
return *((int *)(pointer + offset));
}
return 0;
}
/*
* hdata_long: get long value of a variable in structure using hdata
*/
long
hdata_long (struct t_hdata *hdata, void *pointer, const char *name)
{
int offset;
if (hdata && pointer)
{
offset = hdata_get_var_offset (hdata, name);
if (offset >= 0)
return *((long *)(pointer + offset));
}
return 0;
}
/*
* hdata_string: get string value of a variable in structure using hdata
*/
const char *
hdata_string (struct t_hdata *hdata, void *pointer, const char *name)
{
int offset;
if (hdata && pointer)
{
offset = hdata_get_var_offset (hdata, name);
if (offset >= 0)
return *((char **)(pointer + offset));
}
return NULL;
}
/*
* hdata_pointer: get pointer value of a variable in structure using hdata
*/
void *
hdata_pointer (struct t_hdata *hdata, void *pointer, const char *name)
{
int offset;
if (hdata && pointer)
{
offset = hdata_get_var_offset (hdata, name);
if (offset >= 0)
return *((void **)(pointer + offset));
}
return NULL;
}
/*
* hdata_time: get time value of a variable in structure using hdata
*/
time_t
hdata_time (struct t_hdata *hdata, void *pointer, const char *name)
{
int offset;
if (hdata && pointer)
{
offset = hdata_get_var_offset (hdata, name);
if (offset >= 0)
return *((time_t *)(pointer + offset));
}
return 0;
}
/*
* hdata_get_string: get a hdata property as string
*/
const char *
hdata_get_string (struct t_hdata *hdata, const char *property)
{
if (hdata && property)
{
if (string_strcasecmp (property, "var_keys") == 0)
return hashtable_get_string (hdata->hash_var, "keys");
else if (string_strcasecmp (property, "var_values") == 0)
return hashtable_get_string (hdata->hash_var, "values");
else if (string_strcasecmp (property, "var_keys_values") == 0)
return hashtable_get_string (hdata->hash_var, "keys_values");
else if (string_strcasecmp (property, "var_prev") == 0)
return hdata->var_prev;
else if (string_strcasecmp (property, "var_next") == 0)
return hdata->var_next;
else if (string_strcasecmp (property, "list_keys") == 0)
return hashtable_get_string (hdata->hash_list, "keys");
else if (string_strcasecmp (property, "list_values") == 0)
return hashtable_get_string (hdata->hash_list, "values");
else if (string_strcasecmp (property, "list_keys_values") == 0)
return hashtable_get_string (hdata->hash_list, "keys_values");
}
return NULL;
}
/*
* hdata_print_log: print hdata in log (usually for crash dump)
*/
void
hdata_print_log ()
{
struct t_hdata *ptr_hdata;
for (ptr_hdata = weechat_hdata; ptr_hdata;
ptr_hdata = ptr_hdata->next_hdata)
{
log_printf ("");
log_printf ("[hdata (addr:0x%lx)]", ptr_hdata);
log_printf (" name . . . . . . . . . : '%s'", ptr_hdata->name);
log_printf (" hash_var . . . . . . . : 0x%lx (hashtable: '%s')",
ptr_hdata->hash_var,
hashtable_get_string (ptr_hdata->hash_var, "keys_values"));
log_printf (" var_prev . . . . . . . : '%s'", ptr_hdata->var_prev);
log_printf (" var_next . . . . . . . : '%s'", ptr_hdata->var_next);
log_printf (" hash_list. . . . . . . : 0x%lx (hashtable: '%s')",
ptr_hdata->hash_list,
hashtable_get_string (ptr_hdata->hash_list, "keys_values"));
log_printf (" prev_hdata . . . . . . : 0x%lx", ptr_hdata->prev_hdata);
log_printf (" next_hdata . . . . . . : 0x%lx", ptr_hdata->next_hdata);
}
}

77
src/core/wee-hdata.h Normal file
View File

@ -0,0 +1,77 @@
/*
* Copyright (C) 2011 Sebastien Helleu <flashcode@flashtux.org>
*
* This file is part of WeeChat, the extensible chat client.
*
* WeeChat is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation; either version 3 of the License, or
* (at your option) any later version.
*
* WeeChat is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with WeeChat. If not, see <http://www.gnu.org/licenses/>.
*/
#ifndef __WEECHAT_HDATA_H
#define __WEECHAT_HDATA_H 1
#define HDATA_VAR(__struct, __name, __type) \
hdata_new_var (hdata, #__name, offsetof (__struct, __name), \
WEECHAT_HDATA_##__type);
#define HDATA_LIST(__name) hdata_new_list (hdata, #__name, &(__name));
struct t_hdata
{
char *name; /* name of hdata */
struct t_hashtable *hash_var; /* hashtable with offset of vars */
char *var_prev; /* name of var with pointer to */
/* previous element in list */
char *var_next; /* name of var with pointer to */
/* next element in list */
struct t_hashtable *hash_list; /* hashtable with pointers on lists */
/* (used to search objects) */
struct t_hdata *prev_hdata; /* link to previous hdata */
struct t_hdata *next_hdata; /* link to next hdata */
};
extern struct t_hdata *weechat_hdata;
extern struct t_hdata *last_weechat_hdata;
extern char *hdata_type_string[];
extern struct t_hdata *hdata_new (const char *hdata_name, const char *var_prev,
const char *var_next);
extern void hdata_new_var (struct t_hdata *hdata, const char *name, int offset,
int type);
extern void hdata_new_list (struct t_hdata *hdata, const char *name,
void *pointer);
extern int hdata_get_var_offset (struct t_hdata *hdata, const char *name);
extern int hdata_get_var_type (struct t_hdata *hdata, const char *name);
extern const char *hdata_get_var_type_string (struct t_hdata *hdata,
const char *name);
extern void *hdata_get_var (struct t_hdata *hdata, void *pointer,
const char *name);
extern void *hdata_get_var_at_offset (struct t_hdata *hdata, void *pointer,
int offset);
extern void *hdata_get_list (struct t_hdata *hdata, const char *name);
extern void *hdata_move (struct t_hdata *hdata, void *pointer, int count);
extern int hdata_integer (struct t_hdata *hdata, void *pointer,
const char *name);
extern long hdata_long (struct t_hdata *hdata, void *pointer,
const char *name);
extern const char *hdata_string (struct t_hdata *hdata, void *pointer,
const char *name);
extern void *hdata_pointer (struct t_hdata *hdata, void *pointer,
const char *name);
extern time_t hdata_time (struct t_hdata *hdata, void *pointer,
const char *name);
extern const char *hdata_get_string (struct t_hdata *hdata,
const char *property);
extern void hdata_print_log ();
#endif /* __WEECHAT_HDATA_H */

View File

@ -25,8 +25,9 @@
#include "config.h"
#endif
#include <unistd.h>
#include <stdlib.h>
#include <stddef.h>
#include <unistd.h>
#include <string.h>
#include <sys/time.h>
#include <time.h>
@ -37,6 +38,7 @@
#include "weechat.h"
#include "wee-hook.h"
#include "wee-hashtable.h"
#include "wee-hdata.h"
#include "wee-infolist.h"
#include "wee-list.h"
#include "wee-log.h"
@ -54,13 +56,31 @@
char *hook_type_string[HOOK_NUM_TYPES] =
{ "command", "command_run", "timer", "fd", "process", "connect", "print",
"signal", "hsignal", "config", "completion", "modifier",
"info", "info_hashtable", "infolist" };
"info", "info_hashtable", "infolist", "hdata" };
struct t_hook *weechat_hooks[HOOK_NUM_TYPES]; /* list of hooks */
struct t_hook *last_weechat_hook[HOOK_NUM_TYPES]; /* last hook */
int hook_exec_recursion = 0; /* 1 when a hook is executed */
time_t hook_last_system_time = 0; /* used to detect system clock skew */
int real_delete_pending = 0; /* 1 if some hooks must be deleted */
struct t_hdata *hook_hdata_hook = NULL;
struct t_hdata *hook_hdata_hook_command = NULL;
struct t_hdata *hook_hdata_hook_command_run = NULL;
struct t_hdata *hook_hdata_hook_timer = NULL;
struct t_hdata *hook_hdata_hook_fd = NULL;
struct t_hdata *hook_hdata_hook_process = NULL;
struct t_hdata *hook_hdata_hook_connect = NULL;
struct t_hdata *hook_hdata_hook_print = NULL;
struct t_hdata *hook_hdata_hook_signal = NULL;
struct t_hdata *hook_hdata_hook_hsignal = NULL;
struct t_hdata *hook_hdata_hook_config = NULL;
struct t_hdata *hook_hdata_hook_completion = NULL;
struct t_hdata *hook_hdata_hook_modifier = NULL;
struct t_hdata *hook_hdata_hook_info = NULL;
struct t_hdata *hook_hdata_hook_info_hashtable = NULL;
struct t_hdata *hook_hdata_hook_infolist = NULL;
struct t_hdata *hook_hdata_hook_hdata = NULL;
void hook_process_run (struct t_hook *hook_process);
@ -2580,7 +2600,7 @@ hook_infolist (struct t_weechat_plugin *plugin, const char *infolist_name,
}
/*
* hook_infolist_get: get info via info hook
* hook_infolist_get: get infolist via infolist hook
*/
struct t_infolist *
@ -2626,6 +2646,95 @@ hook_infolist_get (struct t_weechat_plugin *plugin, const char *infolist_name,
return NULL;
}
/*
* hook_hdata: hook a hdata
*/
struct t_hook *
hook_hdata (struct t_weechat_plugin *plugin, const char *hdata_name,
const char *description,
t_hook_callback_hdata *callback, void *callback_data)
{
struct t_hook *new_hook;
struct t_hook_hdata *new_hook_hdata;
int priority;
const char *ptr_hdata_name;
if (!hdata_name || !hdata_name[0] || !callback)
return NULL;
new_hook = malloc (sizeof (*new_hook));
if (!new_hook)
return NULL;
new_hook_hdata = malloc (sizeof (*new_hook_hdata));
if (!new_hook_hdata)
{
free (new_hook);
return NULL;
}
hook_get_priority_and_name (hdata_name, &priority, &ptr_hdata_name);
hook_init_data (new_hook, plugin, HOOK_TYPE_HDATA, priority,
callback_data);
new_hook->hook_data = new_hook_hdata;
new_hook_hdata->callback = callback;
new_hook_hdata->hdata_name = strdup ((ptr_hdata_name) ?
ptr_hdata_name : hdata_name);
new_hook_hdata->description = strdup ((description) ? description : "");
hook_add_to_list (new_hook);
return new_hook;
}
/*
* hook_hdata_get: get hdata via info hook
*/
struct t_hdata *
hook_hdata_get (struct t_weechat_plugin *plugin, const char *hdata_name)
{
struct t_hook *ptr_hook, *next_hook;
struct t_hdata *value;
/* make C compiler happy */
(void) plugin;
if (!hdata_name || !hdata_name[0])
return NULL;
hook_exec_start ();
ptr_hook = weechat_hooks[HOOK_TYPE_HDATA];
while (ptr_hook)
{
next_hook = ptr_hook->next_hook;
if (!ptr_hook->deleted
&& !ptr_hook->running
&& (string_strcasecmp (HOOK_HDATA(ptr_hook, hdata_name),
hdata_name) == 0))
{
ptr_hook->running = 1;
value = (HOOK_HDATA(ptr_hook, callback))
(ptr_hook->callback_data,
HOOK_HDATA(ptr_hook, hdata_name));
ptr_hook->running = 0;
hook_exec_end ();
return value;
}
ptr_hook = next_hook;
}
hook_exec_end ();
/* hdata not found */
return NULL;
}
/*
* unhook: unhook something
*/
@ -2810,6 +2919,12 @@ unhook (struct t_hook *hook)
if (HOOK_INFOLIST(hook, args_description))
free (HOOK_INFOLIST(hook, args_description));
break;
case HOOK_TYPE_HDATA:
if (HOOK_HDATA(hook, hdata_name))
free (HOOK_HDATA(hook, hdata_name));
if (HOOK_HDATA(hook, description))
free (HOOK_HDATA(hook, description));
break;
case HOOK_NUM_TYPES:
/*
* this constant is used to count types only,
@ -2879,6 +2994,529 @@ unhook_all ()
}
}
/*
* hook_hdata_hook_cb: return hdata for hook (variables common to all hook
* types)
*/
struct t_hdata *
hook_hdata_hook_cb (void *data, const char *hdata_name)
{
struct t_hdata *hdata;
/* make C compiler happy */
(void) data;
if (hook_hdata_hook)
return hook_hdata_hook;
hdata = hdata_new (hdata_name, "prev_hook", "next_hook");
if (hdata)
{
hook_hdata_hook = hdata;
HDATA_VAR(struct t_hook, plugin, POINTER);
HDATA_VAR(struct t_hook, type, INTEGER);
HDATA_VAR(struct t_hook, deleted, INTEGER);
HDATA_VAR(struct t_hook, running, INTEGER);
HDATA_VAR(struct t_hook, priority, INTEGER);
HDATA_VAR(struct t_hook, callback_data, POINTER);
HDATA_VAR(struct t_hook, hook_data, POINTER);
HDATA_VAR(struct t_hook, prev_hook, POINTER);
HDATA_VAR(struct t_hook, next_hook, POINTER);
}
return hook_hdata_hook;
}
/*
* hook_hdata_hook_command_cb: return hdata for hook of type "command"
*/
struct t_hdata *
hook_hdata_hook_command_cb (void *data, const char *hdata_name)
{
struct t_hdata *hdata;
/* make C compiler happy */
(void) data;
if (hook_hdata_hook_command)
return hook_hdata_hook_command;
hdata = hdata_new (hdata_name, NULL, NULL);
if (hdata)
{
hook_hdata_hook_command = hdata;
HDATA_VAR(struct t_hook_command, callback, POINTER);
HDATA_VAR(struct t_hook_command, command, STRING);
HDATA_VAR(struct t_hook_command, description, STRING);
HDATA_VAR(struct t_hook_command, args, STRING);
HDATA_VAR(struct t_hook_command, args_description, STRING);
HDATA_VAR(struct t_hook_command, completion, STRING);
HDATA_VAR(struct t_hook_command, cplt_num_templates, INTEGER);
HDATA_VAR(struct t_hook_command, cplt_templates, POINTER);
HDATA_VAR(struct t_hook_command, cplt_templates_static, POINTER);
HDATA_VAR(struct t_hook_command, cplt_template_num_args, POINTER);
HDATA_VAR(struct t_hook_command, cplt_template_args, POINTER);
HDATA_VAR(struct t_hook_command, cplt_template_num_args_concat, INTEGER);
HDATA_VAR(struct t_hook_command, cplt_template_args_concat, POINTER);
hdata_new_list(hdata, "weechat_hooks_command", &weechat_hooks[HOOK_TYPE_COMMAND]);
hdata_new_list(hdata, "last_weechat_hook_command", &last_weechat_hook[HOOK_TYPE_COMMAND]);
}
return hook_hdata_hook_command;
}
/*
* hook_hdata_hook_command_run_cb: return hdata for hook of type "command_run"
*/
struct t_hdata *
hook_hdata_hook_command_run_cb (void *data, const char *hdata_name)
{
struct t_hdata *hdata;
/* make C compiler happy */
(void) data;
if (hook_hdata_hook_command_run)
return hook_hdata_hook_command_run;
hdata = hdata_new (hdata_name, NULL, NULL);
if (hdata)
{
hook_hdata_hook_command_run = hdata;
HDATA_VAR(struct t_hook_command_run, callback, POINTER);
HDATA_VAR(struct t_hook_command_run, command, STRING);
hdata_new_list(hdata, "weechat_hooks_command_run", &weechat_hooks[HOOK_TYPE_COMMAND_RUN]);
hdata_new_list(hdata, "last_weechat_hook_command_run", &last_weechat_hook[HOOK_TYPE_COMMAND_RUN]);
}
return hook_hdata_hook_command_run;
}
/*
* hook_hdata_hook_timer_cb: return hdata for hook of type "timer"
*/
struct t_hdata *
hook_hdata_hook_timer_cb (void *data, const char *hdata_name)
{
struct t_hdata *hdata;
/* make C compiler happy */
(void) data;
if (hook_hdata_hook_timer)
return hook_hdata_hook_timer;
hdata = hdata_new (hdata_name, NULL, NULL);
if (hdata)
{
hook_hdata_hook_timer = hdata;
HDATA_VAR(struct t_hook_timer, callback, POINTER);
HDATA_VAR(struct t_hook_timer, interval, LONG);
HDATA_VAR(struct t_hook_timer, align_second, INTEGER);
HDATA_VAR(struct t_hook_timer, remaining_calls, INTEGER);
HDATA_VAR(struct t_hook_timer, last_exec, OTHER);
HDATA_VAR(struct t_hook_timer, next_exec, OTHER);
hdata_new_list(hdata, "weechat_hooks_timer", &weechat_hooks[HOOK_TYPE_TIMER]);
hdata_new_list(hdata, "last_weechat_hook_timer", &last_weechat_hook[HOOK_TYPE_TIMER]);
}
return hook_hdata_hook_timer;
}
/*
* hook_hdata_hook_fd_cb: return hdata for hook of type "fd"
*/
struct t_hdata *
hook_hdata_hook_fd_cb (void *data, const char *hdata_name)
{
struct t_hdata *hdata;
/* make C compiler happy */
(void) data;
if (hook_hdata_hook_fd)
return hook_hdata_hook_fd;
hdata = hdata_new (hdata_name, NULL, NULL);
if (hdata)
{
hook_hdata_hook_fd = hdata;
HDATA_VAR(struct t_hook_fd, callback, POINTER);
HDATA_VAR(struct t_hook_fd, fd, INTEGER);
HDATA_VAR(struct t_hook_fd, flags, INTEGER);
hdata_new_list(hdata, "weechat_hooks_fd", &weechat_hooks[HOOK_TYPE_FD]);
hdata_new_list(hdata, "last_weechat_hook_fd", &last_weechat_hook[HOOK_TYPE_FD]);
}
return hook_hdata_hook_fd;
}
/*
* hook_hdata_hook_process_cb: return hdata for hook of type "process"
*/
struct t_hdata *
hook_hdata_hook_process_cb (void *data, const char *hdata_name)
{
struct t_hdata *hdata;
/* make C compiler happy */
(void) data;
if (hook_hdata_hook_process)
return hook_hdata_hook_process;
hdata = hdata_new (hdata_name, NULL, NULL);
if (hdata)
{
hook_hdata_hook_process = hdata;
HDATA_VAR(struct t_hook_process, callback, POINTER);
HDATA_VAR(struct t_hook_process, command, STRING);
HDATA_VAR(struct t_hook_process, timeout, LONG);
HDATA_VAR(struct t_hook_process, child_read, POINTER);
HDATA_VAR(struct t_hook_process, child_write, POINTER);
HDATA_VAR(struct t_hook_process, child_pid, OTHER);
HDATA_VAR(struct t_hook_process, hook_fd, POINTER);
HDATA_VAR(struct t_hook_process, hook_timer, POINTER);
HDATA_VAR(struct t_hook_process, buffer, POINTER);
HDATA_VAR(struct t_hook_process, buffer_size, POINTER);
hdata_new_list(hdata, "weechat_hooks_process", &weechat_hooks[HOOK_TYPE_PROCESS]);
hdata_new_list(hdata, "last_weechat_hook_process", &last_weechat_hook[HOOK_TYPE_PROCESS]);
}
return hook_hdata_hook_process;
}
/*
* hook_hdata_hook_connect_cb: return hdata for hook of type "connect"
*/
struct t_hdata *
hook_hdata_hook_connect_cb (void *data, const char *hdata_name)
{
struct t_hdata *hdata;
/* make C compiler happy */
(void) data;
if (hook_hdata_hook_connect)
return hook_hdata_hook_connect;
hdata = hdata_new (hdata_name, NULL, NULL);
if (hdata)
{
hook_hdata_hook_connect = hdata;
HDATA_VAR(struct t_hook_connect, callback, POINTER);
HDATA_VAR(struct t_hook_connect, proxy, STRING);
HDATA_VAR(struct t_hook_connect, address, STRING);
HDATA_VAR(struct t_hook_connect, port, INTEGER);
HDATA_VAR(struct t_hook_connect, sock, INTEGER);
HDATA_VAR(struct t_hook_connect, ipv6, INTEGER);
#ifdef HAVE_GNUTLS
HDATA_VAR(struct t_hook_connect, gnutls_sess, POINTER);
HDATA_VAR(struct t_hook_connect, gnutls_cb, POINTER);
HDATA_VAR(struct t_hook_connect, gnutls_dhkey_size, INTEGER);
HDATA_VAR(struct t_hook_connect, gnutls_priorities, STRING);
#endif
HDATA_VAR(struct t_hook_connect, local_hostname, STRING);
HDATA_VAR(struct t_hook_connect, child_read, INTEGER);
HDATA_VAR(struct t_hook_connect, child_write, INTEGER);
HDATA_VAR(struct t_hook_connect, child_pid, OTHER);
HDATA_VAR(struct t_hook_connect, hook_fd, POINTER);
HDATA_VAR(struct t_hook_connect, handshake_hook_fd, POINTER);
HDATA_VAR(struct t_hook_connect, handshake_hook_timer, POINTER);
HDATA_VAR(struct t_hook_connect, handshake_fd_flags, INTEGER);
HDATA_VAR(struct t_hook_connect, handshake_ip_address, STRING);
hdata_new_list(hdata, "weechat_hooks_connect", &weechat_hooks[HOOK_TYPE_CONNECT]);
hdata_new_list(hdata, "last_weechat_hook_connect", &last_weechat_hook[HOOK_TYPE_CONNECT]);
}
return hook_hdata_hook_connect;
}
/*
* hook_hdata_hook_print_cb: return hdata for hook of type "print"
*/
struct t_hdata *
hook_hdata_hook_print_cb (void *data, const char *hdata_name)
{
struct t_hdata *hdata;
/* make C compiler happy */
(void) data;
if (hook_hdata_hook_print)
return hook_hdata_hook_print;
hdata = hdata_new (hdata_name, NULL, NULL);
if (hdata)
{
hook_hdata_hook_print = hdata;
HDATA_VAR(struct t_hook_print, callback, POINTER);
HDATA_VAR(struct t_hook_print, buffer, POINTER);
HDATA_VAR(struct t_hook_print, tags_count, INTEGER);
HDATA_VAR(struct t_hook_print, tags_array, POINTER);
HDATA_VAR(struct t_hook_print, message, STRING);
HDATA_VAR(struct t_hook_print, strip_colors, INTEGER);
hdata_new_list(hdata, "weechat_hooks_print", &weechat_hooks[HOOK_TYPE_PRINT]);
hdata_new_list(hdata, "last_weechat_hook_print", &last_weechat_hook[HOOK_TYPE_PRINT]);
}
return hook_hdata_hook_print;
}
/*
* hook_hdata_hook_signal_cb: return hdata for hook of type "signal"
*/
struct t_hdata *
hook_hdata_hook_signal_cb (void *data, const char *hdata_name)
{
struct t_hdata *hdata;
/* make C compiler happy */
(void) data;
if (hook_hdata_hook_signal)
return hook_hdata_hook_signal;
hdata = hdata_new (hdata_name, NULL, NULL);
if (hdata)
{
hook_hdata_hook_signal = hdata;
HDATA_VAR(struct t_hook_signal, callback, POINTER);
HDATA_VAR(struct t_hook_signal, signal, STRING);
hdata_new_list(hdata, "weechat_hooks_signal", &weechat_hooks[HOOK_TYPE_SIGNAL]);
hdata_new_list(hdata, "last_weechat_hook_signal", &last_weechat_hook[HOOK_TYPE_SIGNAL]);
}
return hook_hdata_hook_signal;
}
/*
* hook_hdata_hook_hsignal_cb: return hdata for hook of type "hsignal"
*/
struct t_hdata *
hook_hdata_hook_hsignal_cb (void *data, const char *hdata_name)
{
struct t_hdata *hdata;
/* make C compiler happy */
(void) data;
if (hook_hdata_hook_hsignal)
return hook_hdata_hook_hsignal;
hdata = hdata_new (hdata_name, NULL, NULL);
if (hdata)
{
hook_hdata_hook_hsignal = hdata;
HDATA_VAR(struct t_hook_hsignal, callback, POINTER);
HDATA_VAR(struct t_hook_hsignal, signal, STRING);
hdata_new_list(hdata, "weechat_hooks_hsignal", &weechat_hooks[HOOK_TYPE_HSIGNAL]);
hdata_new_list(hdata, "last_weechat_hook_hsignal", &last_weechat_hook[HOOK_TYPE_HSIGNAL]);
}
return hook_hdata_hook_hsignal;
}
/*
* hook_hdata_hook_config_cb: return hdata for hook of type "config"
*/
struct t_hdata *
hook_hdata_hook_config_cb (void *data, const char *hdata_name)
{
struct t_hdata *hdata;
/* make C compiler happy */
(void) data;
if (hook_hdata_hook_config)
return hook_hdata_hook_config;
hdata = hdata_new (hdata_name, NULL, NULL);
if (hdata)
{
hook_hdata_hook_config = hdata;
HDATA_VAR(struct t_hook_config, callback, POINTER);
HDATA_VAR(struct t_hook_config, option, STRING);
hdata_new_list(hdata, "weechat_hooks_config", &weechat_hooks[HOOK_TYPE_CONFIG]);
hdata_new_list(hdata, "last_weechat_hook_config", &last_weechat_hook[HOOK_TYPE_CONFIG]);
}
return hook_hdata_hook_config;
}
/*
* hook_hdata_hook_completion_cb: return hdata for hook of type "completion"
*/
struct t_hdata *
hook_hdata_hook_completion_cb (void *data, const char *hdata_name)
{
struct t_hdata *hdata;
/* make C compiler happy */
(void) data;
if (hook_hdata_hook_completion)
return hook_hdata_hook_completion;
hdata = hdata_new (hdata_name, NULL, NULL);
if (hdata)
{
hook_hdata_hook_completion = hdata;
HDATA_VAR(struct t_hook_completion, callback, POINTER);
HDATA_VAR(struct t_hook_completion, completion_item, STRING);
HDATA_VAR(struct t_hook_completion, description, STRING);
hdata_new_list(hdata, "weechat_hooks_completion", &weechat_hooks[HOOK_TYPE_COMPLETION]);
hdata_new_list(hdata, "last_weechat_hook_completion", &last_weechat_hook[HOOK_TYPE_COMPLETION]);
}
return hook_hdata_hook_completion;
}
/*
* hook_hdata_hook_modifier_cb: return hdata for hook of type "modifier"
*/
struct t_hdata *
hook_hdata_hook_modifier_cb (void *data, const char *hdata_name)
{
struct t_hdata *hdata;
/* make C compiler happy */
(void) data;
if (hook_hdata_hook_modifier)
return hook_hdata_hook_modifier;
hdata = hdata_new (hdata_name, NULL, NULL);
if (hdata)
{
hook_hdata_hook_modifier = hdata;
HDATA_VAR(struct t_hook_modifier, callback, POINTER);
HDATA_VAR(struct t_hook_modifier, modifier, STRING);
hdata_new_list(hdata, "weechat_hooks_modifier", &weechat_hooks[HOOK_TYPE_MODIFIER]);
hdata_new_list(hdata, "last_weechat_hook_modifier", &last_weechat_hook[HOOK_TYPE_MODIFIER]);
}
return hook_hdata_hook_modifier;
}
/*
* hook_hdata_hook_info_cb: return hdata for hook of type "info"
*/
struct t_hdata *
hook_hdata_hook_info_cb (void *data, const char *hdata_name)
{
struct t_hdata *hdata;
/* make C compiler happy */
(void) data;
if (hook_hdata_hook_info)
return hook_hdata_hook_info;
hdata = hdata_new (hdata_name, NULL, NULL);
if (hdata)
{
hook_hdata_hook_info = hdata;
HDATA_VAR(struct t_hook_info, callback, POINTER);
HDATA_VAR(struct t_hook_info, info_name, STRING);
HDATA_VAR(struct t_hook_info, description, STRING);
HDATA_VAR(struct t_hook_info, args_description, STRING);
hdata_new_list(hdata, "weechat_hooks_info", &weechat_hooks[HOOK_TYPE_INFO]);
hdata_new_list(hdata, "last_weechat_hook_info", &last_weechat_hook[HOOK_TYPE_INFO]);
}
return hook_hdata_hook_info;
}
/*
* hook_hdata_hook_info_hashtable_cb: return hdata for hook of type
* "info_hashtable"
*/
struct t_hdata *
hook_hdata_hook_info_hashtable_cb (void *data, const char *hdata_name)
{
struct t_hdata *hdata;
/* make C compiler happy */
(void) data;
if (hook_hdata_hook_info_hashtable)
return hook_hdata_hook_info_hashtable;
hdata = hdata_new (hdata_name, NULL, NULL);
if (hdata)
{
hook_hdata_hook_info_hashtable = hdata;
HDATA_VAR(struct t_hook_info_hashtable, callback, POINTER);
HDATA_VAR(struct t_hook_info_hashtable, info_name, STRING);
HDATA_VAR(struct t_hook_info_hashtable, description, STRING);
HDATA_VAR(struct t_hook_info_hashtable, args_description, STRING);
HDATA_VAR(struct t_hook_info_hashtable, output_description, STRING);
hdata_new_list(hdata, "weechat_hooks_info_hashtable", &weechat_hooks[HOOK_TYPE_INFO_HASHTABLE]);
hdata_new_list(hdata, "last_weechat_hook_info_hashtable", &last_weechat_hook[HOOK_TYPE_INFO_HASHTABLE]);
}
return hook_hdata_hook_info_hashtable;
}
/*
* hook_hdata_hook_infolist_cb: return hdata for hook of type "infolist"
*/
struct t_hdata *
hook_hdata_hook_infolist_cb (void *data, const char *hdata_name)
{
struct t_hdata *hdata;
/* make C compiler happy */
(void) data;
if (hook_hdata_hook_infolist)
return hook_hdata_hook_infolist;
hdata = hdata_new (hdata_name, NULL, NULL);
if (hdata)
{
hook_hdata_hook_infolist = hdata;
HDATA_VAR(struct t_hook_infolist, callback, POINTER);
HDATA_VAR(struct t_hook_infolist, infolist_name, STRING);
HDATA_VAR(struct t_hook_infolist, description, STRING);
HDATA_VAR(struct t_hook_infolist, pointer_description, STRING);
HDATA_VAR(struct t_hook_infolist, args_description, STRING);
hdata_new_list(hdata, "weechat_hooks_infolist", &weechat_hooks[HOOK_TYPE_INFOLIST]);
hdata_new_list(hdata, "last_weechat_hook_infolist", &last_weechat_hook[HOOK_TYPE_INFOLIST]);
}
return hook_hdata_hook_infolist;
}
/*
* hook_hdata_hook_hdata_cb: return hdata for hook of type "hdata"
*/
struct t_hdata *
hook_hdata_hook_hdata_cb (void *data, const char *hdata_name)
{
struct t_hdata *hdata;
/* make C compiler happy */
(void) data;
if (hook_hdata_hook_hdata)
return hook_hdata_hook_hdata;
hdata = hdata_new (hdata_name, NULL, NULL);
if (hdata)
{
hook_hdata_hook_hdata = hdata;
HDATA_VAR(struct t_hook_hdata, callback, POINTER);
HDATA_VAR(struct t_hook_hdata, hdata_name, STRING);
HDATA_VAR(struct t_hook_hdata, description, STRING);
hdata_new_list(hdata, "weechat_hooks_hdata", &weechat_hooks[HOOK_TYPE_HDATA]);
hdata_new_list(hdata, "last_weechat_hook_hdata", &last_weechat_hook[HOOK_TYPE_HDATA]);
}
return hook_hdata_hook_hdata;
}
/*
* hook_add_to_infolist_type: add hooks of a type in an infolist
* return 1 if ok, 0 if error
@ -3231,6 +3869,22 @@ hook_add_to_infolist_type (struct t_infolist *infolist, int type,
return 0;
}
break;
case HOOK_TYPE_HDATA:
if (!ptr_hook->deleted)
{
if (!infolist_new_var_pointer (ptr_item, "callback", HOOK_HDATA(ptr_hook, callback)))
return 0;
if (!infolist_new_var_string (ptr_item, "hdata_name", HOOK_HDATA(ptr_hook, hdata_name)))
return 0;
if (!infolist_new_var_string (ptr_item, "description", HOOK_HDATA(ptr_hook, description)))
return 0;
if (!infolist_new_var_string (ptr_item, "description_nls",
(HOOK_HDATA(ptr_hook, description)
&& HOOK_HDATA(ptr_hook, description)[0]) ?
_(HOOK_HDATA(ptr_hook, description)) : ""))
return 0;
}
break;
case HOOK_NUM_TYPES:
/*
* this constant is used to count types only,
@ -3520,6 +4174,15 @@ hook_print_log ()
log_printf (" args_description. . . : '%s'", HOOK_INFOLIST(ptr_hook, args_description));
}
break;
case HOOK_TYPE_HDATA:
if (!ptr_hook->deleted)
{
log_printf (" hdata data:");
log_printf (" callback. . . . . . . : 0x%lx", HOOK_HDATA(ptr_hook, callback));
log_printf (" hdata_name. . . . . . : '%s'", HOOK_HDATA(ptr_hook, hdata_name));
log_printf (" description . . . . . : '%s'", HOOK_HDATA(ptr_hook, description));
}
break;
case HOOK_NUM_TYPES:
/*
* this constant is used to count types only,

View File

@ -50,6 +50,7 @@ enum t_hook_type
HOOK_TYPE_INFO, /* get some info as string */
HOOK_TYPE_INFO_HASHTABLE, /* get some info as hashtable */
HOOK_TYPE_INFOLIST, /* get some info as infolist */
HOOK_TYPE_HDATA, /* get hdata pointer */
/* number of hook types */
HOOK_NUM_TYPES,
};
@ -89,6 +90,7 @@ enum t_hook_type
#define HOOK_INFO(hook, var) (((struct t_hook_info *)hook->hook_data)->var)
#define HOOK_INFO_HASHTABLE(hook, var) (((struct t_hook_info_hashtable *)hook->hook_data)->var)
#define HOOK_INFOLIST(hook, var) (((struct t_hook_infolist *)hook->hook_data)->var)
#define HOOK_HDATA(hook, var) (((struct t_hook_hdata *)hook->hook_data)->var)
struct t_hook
{
@ -358,6 +360,18 @@ struct t_hook_infolist
char *args_description; /* description of arguments */
};
/* hook hdata */
typedef struct t_hdata *(t_hook_callback_hdata)(void *data,
const char *hdata_name);
struct t_hook_hdata
{
t_hook_callback_hdata *callback; /* hdata callback */
char *hdata_name; /* hdata name */
char *description; /* description */
};
/* hook variables */
extern struct t_hook *weechat_hooks[];
@ -498,9 +512,50 @@ extern struct t_infolist *hook_infolist_get (struct t_weechat_plugin *plugin,
const char *infolist_name,
void *pointer,
const char *arguments);
extern struct t_hook *hook_hdata (struct t_weechat_plugin *plugin,
const char *hdata_name,
const char *description,
t_hook_callback_hdata *callback,
void *callback_data);
extern struct t_hdata *hook_hdata_get (struct t_weechat_plugin *plugin,
const char *hdata_name);
extern void unhook (struct t_hook *hook);
extern void unhook_all_plugin (struct t_weechat_plugin *plugin);
extern void unhook_all ();
extern struct t_hdata *hook_hdata_hook_cb (void *data,
const char *hdata_name);
extern struct t_hdata *hook_hdata_hook_command_cb (void *data,
const char *hdata_name);
extern struct t_hdata *hook_hdata_hook_command_run_cb (void *data,
const char *hdata_name);
extern struct t_hdata *hook_hdata_hook_timer_cb (void *data,
const char *hdata_name);
extern struct t_hdata *hook_hdata_hook_fd_cb (void *data,
const char *hdata_name);
extern struct t_hdata *hook_hdata_hook_process_cb (void *data,
const char *hdata_name);
extern struct t_hdata *hook_hdata_hook_connect_cb (void *data,
const char *hdata_name);
extern struct t_hdata *hook_hdata_hook_print_cb (void *data,
const char *hdata_name);
extern struct t_hdata *hook_hdata_hook_signal_cb (void *data,
const char *hdata_name);
extern struct t_hdata *hook_hdata_hook_hsignal_cb (void *data,
const char *hdata_name);
extern struct t_hdata *hook_hdata_hook_config_cb (void *data,
const char *hdata_name);
extern struct t_hdata *hook_hdata_hook_completion_cb (void *data,
const char *hdata_name);
extern struct t_hdata *hook_hdata_hook_modifier_cb (void *data,
const char *hdata_name);
extern struct t_hdata *hook_hdata_hook_info_cb (void *data,
const char *hdata_name);
extern struct t_hdata *hook_hdata_hook_info_hashtable_cb (void *data,
const char *hdata_name);
extern struct t_hdata *hook_hdata_hook_infolist_cb (void *data,
const char *hdata_name);
extern struct t_hdata *hook_hdata_hook_hdata_cb (void *data,
const char *hdata_name);
extern int hook_add_to_infolist (struct t_infolist *infolist,
const char *arguments);
extern void hook_print_log ();

View File

@ -26,12 +26,14 @@
#endif
#include <stdlib.h>
#include <stddef.h>
#include <string.h>
#include <time.h>
#include "../core/weechat.h"
#include "../core/wee-config.h"
#include "../core/wee-hashtable.h"
#include "../core/wee-hdata.h"
#include "../core/wee-hook.h"
#include "../core/wee-infolist.h"
#include "../core/wee-log.h"
@ -78,6 +80,8 @@ char *gui_bar_items_default_for_bars[][2] =
struct t_gui_bar_item_hook *gui_bar_item_hooks = NULL;
struct t_hook *gui_bar_item_timer = NULL;
struct t_hdata *gui_bar_item_hdata_bar_item = NULL;
/*
* gui_bar_item_valid: check if a bar item pointer exists
@ -1685,6 +1689,37 @@ gui_bar_item_end ()
gui_bar_item_free_all ();
}
/*
* gui_bar_item_hdata_bar_item_cb: return hdata for bar item
*/
struct t_hdata *
gui_bar_item_hdata_bar_item_cb (void *data, const char *hdata_name)
{
struct t_hdata *hdata;
/* make C compiler happy */
(void) data;
if (gui_bar_item_hdata_bar_item)
return gui_bar_item_hdata_bar_item;
hdata = hdata_new (hdata_name, "prev_item", "next_item");
if (hdata)
{
gui_bar_item_hdata_bar_item = hdata;
HDATA_VAR(struct t_gui_bar_item, plugin, POINTER);
HDATA_VAR(struct t_gui_bar_item, name, STRING);
HDATA_VAR(struct t_gui_bar_item, build_callback, POINTER);
HDATA_VAR(struct t_gui_bar_item, build_callback_data, POINTER);
HDATA_VAR(struct t_gui_bar_item, prev_item, POINTER);
HDATA_VAR(struct t_gui_bar_item, next_item, POINTER);
HDATA_LIST(gui_bar_items);
HDATA_LIST(last_gui_bar_item);
}
return gui_bar_item_hdata_bar_item;
}
/*
* gui_bar_item_add_to_infolist: add a bar item in an infolist
* return 1 if ok, 0 if error

View File

@ -93,6 +93,8 @@ extern void gui_bar_item_free_all ();
extern void gui_bar_item_free_all_plugin (struct t_weechat_plugin *plugin);
extern void gui_bar_item_init ();
extern void gui_bar_item_end ();
extern struct t_hdata *gui_bar_item_hdata_bar_item_cb (void *data,
const char *hdata_name);
extern int gui_bar_item_add_to_infolist (struct t_infolist *infolist,
struct t_gui_bar_item *bar_item);
extern void gui_bar_item_print_log ();

View File

@ -26,11 +26,13 @@
#endif
#include <stdlib.h>
#include <stddef.h>
#include <string.h>
#include <limits.h>
#include "../core/weechat.h"
#include "../core/wee-config.h"
#include "../core/wee-hdata.h"
#include "../core/wee-hook.h"
#include "../core/wee-infolist.h"
#include "../core/wee-log.h"
@ -66,6 +68,8 @@ struct t_gui_bar *last_gui_bar = NULL; /* last bar */
struct t_gui_bar *gui_temp_bars = NULL; /* bars used when reading config */
struct t_gui_bar *last_gui_temp_bar = NULL;
struct t_hdata *gui_bar_hdata_bar = NULL;
void gui_bar_free_bar_windows (struct t_gui_bar *bar);
@ -2142,6 +2146,42 @@ gui_bar_free_bar_windows (struct t_gui_bar *bar)
}
}
/*
* gui_bar_hdata_bar_cb: return hdata for bar
*/
struct t_hdata *
gui_bar_hdata_bar_cb (void *data, const char *hdata_name)
{
struct t_hdata *hdata;
/* make C compiler happy */
(void) data;
if (gui_bar_hdata_bar)
return gui_bar_hdata_bar;
hdata = hdata_new (hdata_name, "prev_bar", "next_bar");
if (hdata)
{
gui_bar_hdata_bar = hdata;
HDATA_VAR(struct t_gui_bar, name, STRING);
HDATA_VAR(struct t_gui_bar, options, POINTER);
HDATA_VAR(struct t_gui_bar, conditions_count, INTEGER);
HDATA_VAR(struct t_gui_bar, conditions_array, POINTER);
HDATA_VAR(struct t_gui_bar, items_count, INTEGER);
HDATA_VAR(struct t_gui_bar, items_subcount, POINTER);
HDATA_VAR(struct t_gui_bar, items_array, POINTER);
HDATA_VAR(struct t_gui_bar, bar_window, POINTER);
HDATA_VAR(struct t_gui_bar, bar_refresh_needed, INTEGER);
HDATA_VAR(struct t_gui_bar, prev_bar, POINTER);
HDATA_VAR(struct t_gui_bar, next_bar, POINTER);
HDATA_LIST(gui_bars);
HDATA_LIST(last_gui_bar);
}
return gui_bar_hdata_bar;
}
/*
* gui_bar_add_to_infolist: add a bar in an infolist
* return 1 if ok, 0 if error

View File

@ -151,6 +151,8 @@ extern int gui_bar_scroll (struct t_gui_bar *bar, struct t_gui_buffer *buffer,
const char *scroll);
extern void gui_bar_free (struct t_gui_bar *bar);
extern void gui_bar_free_all ();
extern struct t_hdata *gui_bar_hdata_bar_cb (void *data,
const char *hdata_name);
extern int gui_bar_add_to_infolist (struct t_infolist *infolist,
struct t_gui_bar *bar);
extern void gui_bar_print_log ();

View File

@ -26,6 +26,7 @@
#endif
#include <stdlib.h>
#include <stddef.h>
#include <stdio.h>
#include <stdarg.h>
#include <unistd.h>
@ -37,6 +38,7 @@
#include "../core/weechat.h"
#include "../core/wee-config.h"
#include "../core/wee-hashtable.h"
#include "../core/wee-hdata.h"
#include "../core/wee-hook.h"
#include "../core/wee-infolist.h"
#include "../core/wee-list.h"
@ -69,6 +71,10 @@ int gui_buffers_visited_index = -1; /* index of pointer in list */
int gui_buffers_visited_count = 0; /* number of visited buffers*/
int gui_buffers_visited_frozen = 0; /* 1 to forbid list updates */
struct t_hdata *gui_buffer_hdata_buffer = NULL;
struct t_hdata *gui_buffer_hdata_input_undo = NULL;
struct t_hdata *gui_buffer_hdata_buffer_visited = NULL;
char *gui_buffer_notify_string[GUI_BUFFER_NUM_NOTIFY] =
{ "none", "highlight", "message", "all" };
@ -426,10 +432,11 @@ gui_buffer_new (struct t_weechat_plugin *plugin,
gui_buffer_input_buffer_init (new_buffer);
/* undo for input */
(new_buffer->input_undo_snap).data = NULL;
(new_buffer->input_undo_snap).pos = 0;
(new_buffer->input_undo_snap).prev_undo = NULL; /* not used */
(new_buffer->input_undo_snap).next_undo = NULL; /* not used */
new_buffer->input_undo_snap = malloc (sizeof (*(new_buffer->input_undo_snap)));
(new_buffer->input_undo_snap)->data = NULL;
(new_buffer->input_undo_snap)->pos = 0;
(new_buffer->input_undo_snap)->prev_undo = NULL; /* not used */
(new_buffer->input_undo_snap)->next_undo = NULL; /* not used */
new_buffer->input_undo = NULL;
new_buffer->last_input_undo = NULL;
new_buffer->ptr_input_undo = NULL;
@ -2058,6 +2065,8 @@ gui_buffer_close (struct t_gui_buffer *buffer)
if (buffer->input_buffer)
free (buffer->input_buffer);
gui_buffer_undo_free_all (buffer);
if (buffer->input_undo_snap)
free (buffer->input_undo_snap);
if (buffer->completion)
gui_completion_free (buffer->completion);
gui_history_buffer_free (buffer);
@ -2523,18 +2532,18 @@ gui_buffer_unmerge (struct t_gui_buffer *buffer, int number)
void
gui_buffer_undo_snap (struct t_gui_buffer *buffer)
{
if ((buffer->input_undo_snap).data)
if ((buffer->input_undo_snap)->data)
{
free ((buffer->input_undo_snap).data);
(buffer->input_undo_snap).data = NULL;
free ((buffer->input_undo_snap)->data);
(buffer->input_undo_snap)->data = NULL;
}
(buffer->input_undo_snap).pos = 0;
(buffer->input_undo_snap)->pos = 0;
if (CONFIG_INTEGER(config_look_input_undo_max) > 0)
{
(buffer->input_undo_snap).data = (buffer->input_buffer) ?
(buffer->input_undo_snap)->data = (buffer->input_buffer) ?
strdup (buffer->input_buffer) : NULL;
(buffer->input_undo_snap).pos = buffer->input_buffer_pos;
(buffer->input_undo_snap)->pos = buffer->input_buffer_pos;
}
}
@ -2545,12 +2554,12 @@ gui_buffer_undo_snap (struct t_gui_buffer *buffer)
void
gui_buffer_undo_snap_free (struct t_gui_buffer *buffer)
{
if ((buffer->input_undo_snap).data)
if ((buffer->input_undo_snap)->data)
{
free ((buffer->input_undo_snap).data);
(buffer->input_undo_snap).data = NULL;
free ((buffer->input_undo_snap)->data);
(buffer->input_undo_snap)->data = NULL;
}
(buffer->input_undo_snap).pos = 0;
(buffer->input_undo_snap)->pos = 0;
}
/*
@ -2572,8 +2581,8 @@ gui_buffer_undo_add (struct t_gui_buffer *buffer)
* if nothing has changed since snapshot of input buffer, then do nothing
* (just discard snapshot)
*/
if ((buffer->input_undo_snap).data
&& (strcmp (buffer->input_buffer, (buffer->input_undo_snap).data) == 0))
if ((buffer->input_undo_snap)->data
&& (strcmp (buffer->input_buffer, (buffer->input_undo_snap)->data) == 0))
{
goto end;
}
@ -2598,8 +2607,8 @@ gui_buffer_undo_add (struct t_gui_buffer *buffer)
/* if input is the same as current undo, then do not add it */
if (buffer->ptr_input_undo
&& (buffer->ptr_input_undo)->data
&& (buffer->input_undo_snap).data
&& (strcmp ((buffer->input_undo_snap).data, (buffer->ptr_input_undo)->data) == 0))
&& (buffer->input_undo_snap)->data
&& (strcmp ((buffer->input_undo_snap)->data, (buffer->ptr_input_undo)->data) == 0))
{
goto end;
}
@ -2608,10 +2617,10 @@ gui_buffer_undo_add (struct t_gui_buffer *buffer)
if (!new_undo)
goto end;
if ((buffer->input_undo_snap).data)
if ((buffer->input_undo_snap)->data)
{
new_undo->data = strdup ((buffer->input_undo_snap).data);
new_undo->pos = (buffer->input_undo_snap).pos;
new_undo->data = strdup ((buffer->input_undo_snap)->data);
new_undo->pos = (buffer->input_undo_snap)->pos;
}
else
{
@ -2873,6 +2882,148 @@ gui_buffer_visited_get_index_next ()
return gui_buffers_visited_index + 1;
}
/*
* gui_buffer_hdata_buffer_cb: return hdata for buffer
*/
struct t_hdata *
gui_buffer_hdata_buffer_cb (void *data, const char *hdata_name)
{
struct t_hdata *hdata;
/* make C compiler happy */
(void) data;
if (gui_buffer_hdata_buffer)
return gui_buffer_hdata_buffer;
hdata = hdata_new (hdata_name, "prev_buffer", "next_buffer");
if (hdata)
{
gui_buffer_hdata_buffer = hdata;
HDATA_VAR(struct t_gui_buffer, plugin, POINTER);
HDATA_VAR(struct t_gui_buffer, plugin_name_for_upgrade, STRING);
HDATA_VAR(struct t_gui_buffer, merge_for_upgrade, POINTER);
HDATA_VAR(struct t_gui_buffer, number, INTEGER);
HDATA_VAR(struct t_gui_buffer, layout_number, INTEGER);
HDATA_VAR(struct t_gui_buffer, layout_applied, INTEGER);
HDATA_VAR(struct t_gui_buffer, name, STRING);
HDATA_VAR(struct t_gui_buffer, short_name, STRING);
HDATA_VAR(struct t_gui_buffer, type, INTEGER);
HDATA_VAR(struct t_gui_buffer, notify, INTEGER);
HDATA_VAR(struct t_gui_buffer, num_displayed, INTEGER);
HDATA_VAR(struct t_gui_buffer, active, INTEGER);
HDATA_VAR(struct t_gui_buffer, print_hooks_enabled, INTEGER);
HDATA_VAR(struct t_gui_buffer, close_callback, POINTER);
HDATA_VAR(struct t_gui_buffer, close_callback_data, POINTER);
HDATA_VAR(struct t_gui_buffer, title, STRING);
HDATA_VAR(struct t_gui_buffer, own_lines, POINTER);
HDATA_VAR(struct t_gui_buffer, mixed_lines, POINTER);
HDATA_VAR(struct t_gui_buffer, lines, POINTER);
HDATA_VAR(struct t_gui_buffer, time_for_each_line, INTEGER);
HDATA_VAR(struct t_gui_buffer, chat_refresh_needed, INTEGER);
HDATA_VAR(struct t_gui_buffer, nicklist, INTEGER);
HDATA_VAR(struct t_gui_buffer, nicklist_case_sensitive, INTEGER);
HDATA_VAR(struct t_gui_buffer, nicklist_root, POINTER);
HDATA_VAR(struct t_gui_buffer, nicklist_max_length, INTEGER);
HDATA_VAR(struct t_gui_buffer, nicklist_display_groups, INTEGER);
HDATA_VAR(struct t_gui_buffer, nicklist_visible_count, INTEGER);
HDATA_VAR(struct t_gui_buffer, input, INTEGER);
HDATA_VAR(struct t_gui_buffer, input_callback, POINTER);
HDATA_VAR(struct t_gui_buffer, input_callback_data, POINTER);
HDATA_VAR(struct t_gui_buffer, input_get_unknown_commands, INTEGER);
HDATA_VAR(struct t_gui_buffer, input_buffer, STRING);
HDATA_VAR(struct t_gui_buffer, input_buffer_alloc, INTEGER);
HDATA_VAR(struct t_gui_buffer, input_buffer_size, INTEGER);
HDATA_VAR(struct t_gui_buffer, input_buffer_length, INTEGER);
HDATA_VAR(struct t_gui_buffer, input_buffer_pos, INTEGER);
HDATA_VAR(struct t_gui_buffer, input_buffer_1st_display, INTEGER);
HDATA_VAR(struct t_gui_buffer, input_undo_snap, POINTER);
HDATA_VAR(struct t_gui_buffer, input_undo, POINTER);
HDATA_VAR(struct t_gui_buffer, last_input_undo, POINTER);
HDATA_VAR(struct t_gui_buffer, ptr_input_undo, POINTER);
HDATA_VAR(struct t_gui_buffer, input_undo_count, INTEGER);
HDATA_VAR(struct t_gui_buffer, completion, POINTER);
HDATA_VAR(struct t_gui_buffer, history, POINTER);
HDATA_VAR(struct t_gui_buffer, last_history, POINTER);
HDATA_VAR(struct t_gui_buffer, ptr_history, POINTER);
HDATA_VAR(struct t_gui_buffer, num_history, INTEGER);
HDATA_VAR(struct t_gui_buffer, text_search, INTEGER);
HDATA_VAR(struct t_gui_buffer, text_search_exact, INTEGER);
HDATA_VAR(struct t_gui_buffer, text_search_found, INTEGER);
HDATA_VAR(struct t_gui_buffer, text_search_input, STRING);
HDATA_VAR(struct t_gui_buffer, highlight_words, STRING);
HDATA_VAR(struct t_gui_buffer, highlight_tags, STRING);
HDATA_VAR(struct t_gui_buffer, highlight_tags_count, INTEGER);
HDATA_VAR(struct t_gui_buffer, highlight_tags_array, POINTER);
HDATA_VAR(struct t_gui_buffer, hotlist_max_level_nicks, POINTER);
HDATA_VAR(struct t_gui_buffer, keys, POINTER);
HDATA_VAR(struct t_gui_buffer, last_key, POINTER);
HDATA_VAR(struct t_gui_buffer, keys_count, INTEGER);
HDATA_VAR(struct t_gui_buffer, local_variables, POINTER);
HDATA_VAR(struct t_gui_buffer, prev_buffer, POINTER);
HDATA_VAR(struct t_gui_buffer, next_buffer, POINTER);
HDATA_LIST(gui_buffers);
HDATA_LIST(last_gui_buffer);
}
return gui_buffer_hdata_buffer;
}
/*
* gui_buffer_hdata_input_undo_cb: return hdata for input undo
*/
struct t_hdata *
gui_buffer_hdata_input_undo_cb (void *data, const char *hdata_name)
{
struct t_hdata *hdata;
/* make C compiler happy */
(void) data;
if (gui_buffer_hdata_input_undo)
return gui_buffer_hdata_input_undo;
hdata = hdata_new (hdata_name, "prev_undo", "next_undo");
if (hdata)
{
gui_buffer_hdata_input_undo = hdata;
HDATA_VAR(struct t_gui_input_undo, data, STRING);
HDATA_VAR(struct t_gui_input_undo, pos, INTEGER);
HDATA_VAR(struct t_gui_input_undo, prev_undo, POINTER);
HDATA_VAR(struct t_gui_input_undo, next_undo, POINTER);
}
return gui_buffer_hdata_input_undo;
}
/*
* gui_buffer_hdata_buffer_visited_cb: return hdata for buffer visited
*/
struct t_hdata *
gui_buffer_hdata_buffer_visited_cb (void *data, const char *hdata_name)
{
struct t_hdata *hdata;
/* make C compiler happy */
(void) data;
if (gui_buffer_hdata_buffer_visited)
return gui_buffer_hdata_buffer_visited;
hdata = hdata_new (hdata_name, "prev_buffer", "next_buffer");
if (hdata)
{
gui_buffer_hdata_buffer_visited = hdata;
HDATA_VAR(struct t_gui_buffer_visited, buffer, POINTER);
HDATA_VAR(struct t_gui_buffer_visited, prev_buffer, POINTER);
HDATA_VAR(struct t_gui_buffer_visited, next_buffer, POINTER);
HDATA_LIST(gui_buffers_visited);
HDATA_LIST(last_gui_buffer_visited);
}
return gui_buffer_hdata_buffer_visited;
}
/*
* gui_buffer_add_to_infolist: add a buffer in an infolist
* return 1 if ok, 0 if error
@ -3118,8 +3269,8 @@ gui_buffer_print_log ()
log_printf (" input_buffer_length. . : %d", ptr_buffer->input_buffer_length);
log_printf (" input_buffer_pos . . . : %d", ptr_buffer->input_buffer_pos);
log_printf (" input_buffer_1st_disp. : %d", ptr_buffer->input_buffer_1st_display);
log_printf (" input_undo_snap.data . : '%s'", (ptr_buffer->input_undo_snap).data);
log_printf (" input_undo_snap.pos. . : %d", (ptr_buffer->input_undo_snap).pos);
log_printf (" input_undo_snap->data. : '%s'", (ptr_buffer->input_undo_snap)->data);
log_printf (" input_undo_snap->pos . : %d", (ptr_buffer->input_undo_snap)->pos);
log_printf (" input_undo . . . . . . : 0x%lx", ptr_buffer->input_undo);
log_printf (" last_input_undo. . . . : 0x%lx", ptr_buffer->last_input_undo);
log_printf (" ptr_input_undo . . . . : 0x%lx", ptr_buffer->ptr_input_undo);

View File

@ -137,7 +137,7 @@ struct t_gui_buffer
int input_buffer_1st_display; /* first char displayed on screen */
/* undo/redo for input */
struct t_gui_input_undo input_undo_snap; /* snapshot of input buffer */
struct t_gui_input_undo *input_undo_snap; /* snapshot of input buffer */
struct t_gui_input_undo *input_undo; /* undo for input */
struct t_gui_input_undo *last_input_undo; /* last undo for input */
struct t_gui_input_undo *ptr_input_undo; /* pointer to current undo */
@ -284,6 +284,10 @@ extern void gui_buffer_visited_remove_by_buffer (struct t_gui_buffer *buffer);
extern struct t_gui_buffer_visited *gui_buffer_visited_add (struct t_gui_buffer *buffer);
extern int gui_buffer_visited_get_index_previous ();
extern int gui_buffer_visited_get_index_next ();
extern struct t_hdata *gui_buffer_hdata_buffer_cb (void *data,
const char *hdata_name);
extern struct t_hdata *gui_buffer_hdata_input_undo_cb (void *data,
const char *hdata_name);
extern int gui_buffer_add_to_infolist (struct t_infolist *infolist,
struct t_gui_buffer *buffer);
extern void gui_buffer_dump_hexa (struct t_gui_buffer *buffer);

View File

@ -26,6 +26,7 @@
#endif
#include <stdlib.h>
#include <stddef.h>
#include <string.h>
#include <strings.h>
#include <sys/stat.h>
@ -37,6 +38,7 @@
#include "../core/weechat.h"
#include "../core/wee-completion.h"
#include "../core/wee-config.h"
#include "../core/wee-hdata.h"
#include "../core/wee-hook.h"
#include "../core/wee-list.h"
#include "../core/wee-log.h"
@ -46,6 +48,10 @@
#include "gui-completion.h"
struct t_hdata *gui_completion_hdata_completion = NULL;
struct t_hdata *gui_completion_hdata_completion_partial = NULL;
/*
* gui_completion_buffer_init: init completion for a buffer
*/
@ -1181,6 +1187,76 @@ gui_completion_get_string (struct t_gui_completion *completion,
return NULL;
}
/*
* gui_completion_hdata_completion_cb: return hdata for completion
*/
struct t_hdata *
gui_completion_hdata_completion_cb (void *data, const char *hdata_name)
{
struct t_hdata *hdata;
/* make C compiler happy */
(void) data;
if (gui_completion_hdata_completion)
return gui_completion_hdata_completion;
hdata = hdata_new (hdata_name, NULL, NULL);
if (hdata)
{
gui_completion_hdata_completion = hdata;
HDATA_VAR(struct t_gui_completion, buffer, POINTER);
HDATA_VAR(struct t_gui_completion, context, INTEGER);
HDATA_VAR(struct t_gui_completion, base_command, STRING);
HDATA_VAR(struct t_gui_completion, base_command_arg_index, INTEGER);
HDATA_VAR(struct t_gui_completion, base_word, STRING);
HDATA_VAR(struct t_gui_completion, base_word_pos, INTEGER);
HDATA_VAR(struct t_gui_completion, position, INTEGER);
HDATA_VAR(struct t_gui_completion, args, STRING);
HDATA_VAR(struct t_gui_completion, direction, INTEGER);
HDATA_VAR(struct t_gui_completion, add_space, INTEGER);
HDATA_VAR(struct t_gui_completion, force_partial_completion, INTEGER);
HDATA_VAR(struct t_gui_completion, completion_list, POINTER);
HDATA_VAR(struct t_gui_completion, word_found, STRING);
HDATA_VAR(struct t_gui_completion, word_found_is_nick, INTEGER);
HDATA_VAR(struct t_gui_completion, position_replace, INTEGER);
HDATA_VAR(struct t_gui_completion, diff_size, INTEGER);
HDATA_VAR(struct t_gui_completion, diff_length, INTEGER);
HDATA_VAR(struct t_gui_completion, partial_completion_list, POINTER);
HDATA_VAR(struct t_gui_completion, last_partial_completion, POINTER);
}
return gui_completion_hdata_completion;
}
/*
* gui_completion_hdata_completion_partial_cb: return hdata for partial
* completion
*/
struct t_hdata *
gui_completion_hdata_completion_partial_cb (void *data, const char *hdata_name)
{
struct t_hdata *hdata;
/* make C compiler happy */
(void) data;
if (gui_completion_hdata_completion_partial)
return gui_completion_hdata_completion_partial;
hdata = hdata_new (hdata_name, "prev_item", "next_item");
if (hdata)
{
gui_completion_hdata_completion_partial = hdata;
HDATA_VAR(struct t_gui_completion_partial, word, STRING);
HDATA_VAR(struct t_gui_completion_partial, count, INTEGER);
HDATA_VAR(struct t_gui_completion_partial, prev_item, POINTER);
HDATA_VAR(struct t_gui_completion_partial, next_item, POINTER);
}
return gui_completion_hdata_completion_partial;
}
/*
* gui_completion_print_log: print completion list in log (usually for crash dump)
*/

View File

@ -78,6 +78,10 @@ extern void gui_completion_search (struct t_gui_completion *completion,
int pos);
extern const char *gui_completion_get_string (struct t_gui_completion *completion,
const char *property);
extern struct t_hdata *gui_completion_hdata_completion_cb (void *data,
const char *hdata_name);
extern struct t_hdata *gui_completion_hdata_completion_partial_cb (void *data,
const char *hdata_name);
extern void gui_completion_print_log (struct t_gui_completion *completion);
#endif /* __WEECHAT_GUI_COMPLETION_H */

View File

@ -26,11 +26,13 @@
#endif
#include <stdlib.h>
#include <stddef.h>
#include <string.h>
#include <regex.h>
#include "../core/weechat.h"
#include "../core/wee-config.h"
#include "../core/wee-hdata.h"
#include "../core/wee-hook.h"
#include "../core/wee-infolist.h"
#include "../core/wee-log.h"
@ -45,6 +47,8 @@ struct t_gui_filter *gui_filters = NULL; /* first filter */
struct t_gui_filter *last_gui_filter = NULL; /* last filter */
int gui_filters_enabled = 1; /* filters enabled? */
struct t_hdata *gui_filter_hdata_filter = NULL;
/*
* gui_filter_line_has_tag_no_filter: return 1 if line has tag "no_filter",
@ -473,6 +477,44 @@ gui_filter_free_all ()
}
}
/*
* gui_filter_hdata_filter_cb: return hdata for filter
*/
struct t_hdata *
gui_filter_hdata_filter_cb (void *data, const char *hdata_name)
{
struct t_hdata *hdata;
/* make C compiler happy */
(void) data;
if (gui_filter_hdata_filter)
return gui_filter_hdata_filter;
hdata = hdata_new (hdata_name, "prev_filter", "next_filter");
if (hdata)
{
gui_filter_hdata_filter = hdata;
HDATA_VAR(struct t_gui_filter, enabled, INTEGER);
HDATA_VAR(struct t_gui_filter, name, STRING);
HDATA_VAR(struct t_gui_filter, buffer_name, STRING);
HDATA_VAR(struct t_gui_filter, num_buffers, INTEGER);
HDATA_VAR(struct t_gui_filter, buffers, POINTER);
HDATA_VAR(struct t_gui_filter, tags, STRING);
HDATA_VAR(struct t_gui_filter, tags_count, INTEGER);
HDATA_VAR(struct t_gui_filter, tags_array, POINTER);
HDATA_VAR(struct t_gui_filter, regex, STRING);
HDATA_VAR(struct t_gui_filter, regex_prefix, POINTER);
HDATA_VAR(struct t_gui_filter, regex_message, POINTER);
HDATA_VAR(struct t_gui_filter, prev_filter, POINTER);
HDATA_VAR(struct t_gui_filter, next_filter, POINTER);
HDATA_LIST(gui_filters);
HDATA_LIST(last_gui_filter);
}
return gui_filter_hdata_filter;
}
/*
* gui_filter_add_to_infolist: add a filter in an infolist
* return 1 if ok, 0 if error

View File

@ -69,6 +69,8 @@ extern int gui_filter_rename (struct t_gui_filter *filter,
const char *new_name);
extern void gui_filter_free (struct t_gui_filter *filter);
extern void gui_filter_free_all ();
extern struct t_hdata *gui_filter_hdata_filter_cb (void *data,
const char *hdata_name);
extern int gui_filter_add_to_infolist (struct t_infolist *infolist,
struct t_gui_filter *filter);
extern void gui_filter_print_log ();

View File

@ -27,13 +27,16 @@
#endif
#include <stdlib.h>
#include <stddef.h>
#include <string.h>
#include "../core/weechat.h"
#include "../core/wee-config.h"
#include "../core/wee-hdata.h"
#include "../core/wee-hook.h"
#include "../core/wee-infolist.h"
#include "../core/wee-string.h"
#include "../plugins/plugin.h"
#include "gui-history.h"
#include "gui-buffer.h"
@ -43,6 +46,8 @@ struct t_gui_history *last_history_global = NULL;
struct t_gui_history *history_global_ptr = NULL;
int num_history_global = 0;
struct t_hdata *gui_history_hdata_history = NULL;
/*
* gui_history_buffer_add: add a text/command to buffer's history
@ -212,6 +217,32 @@ gui_history_buffer_free (struct t_gui_buffer *buffer)
buffer->num_history = 0;
}
/*
* gui_history_hdata_history_cb: return hdata for history
*/
struct t_hdata *
gui_history_hdata_history_cb (void *data, const char *hdata_name)
{
struct t_hdata *hdata;
/* make C compiler happy */
(void) data;
if (gui_history_hdata_history)
return gui_history_hdata_history;
hdata = hdata_new (hdata_name, "prev_history", "next_history");
if (hdata)
{
gui_history_hdata_history = hdata;
HDATA_VAR(struct t_gui_history, text, STRING);
HDATA_VAR(struct t_gui_history, prev_history, POINTER);
HDATA_VAR(struct t_gui_history, next_history, POINTER);
}
return gui_history_hdata_history;
}
/*
* gui_history_add_to_infolist: add history of commands in an infolist
* if buffer is NULL, global history is returned

View File

@ -39,6 +39,8 @@ extern void gui_history_global_add (const char *string);
extern void gui_history_add (struct t_gui_buffer *buffer, const char *string);
extern void gui_history_global_free ();
extern void gui_history_buffer_free (struct t_gui_buffer *buffer);
extern struct t_hdata *gui_history_hdata_history_cb (void *data,
const char *hdata_name);
extern int gui_history_add_to_infolist (struct t_infolist *infolist,
struct t_gui_history *history);

View File

@ -275,14 +275,14 @@ gui_input_move_to_buffer (struct t_gui_buffer *from_buffer,
/* move undo data */
gui_buffer_undo_free_all (to_buffer);
(to_buffer->input_undo_snap).data = (from_buffer->input_undo_snap).data;
(to_buffer->input_undo_snap).pos = (from_buffer->input_undo_snap).pos;
(to_buffer->input_undo_snap)->data = (from_buffer->input_undo_snap)->data;
(to_buffer->input_undo_snap)->pos = (from_buffer->input_undo_snap)->pos;
to_buffer->input_undo = from_buffer->input_undo;
to_buffer->last_input_undo = from_buffer->last_input_undo;
to_buffer->ptr_input_undo = from_buffer->ptr_input_undo;
to_buffer->input_undo_count = from_buffer->input_undo_count;
(from_buffer->input_undo_snap).data = NULL;
(from_buffer->input_undo_snap).pos = 0;
(from_buffer->input_undo_snap)->data = NULL;
(from_buffer->input_undo_snap)->pos = 0;
from_buffer->input_undo = NULL;
from_buffer->last_input_undo = NULL;
from_buffer->ptr_input_undo = NULL;

View File

@ -26,11 +26,13 @@
#endif
#include <stdlib.h>
#include <stddef.h>
#include <string.h>
#include <ctype.h>
#include <time.h>
#include "../core/weechat.h"
#include "../core/wee-hdata.h"
#include "../core/wee-hook.h"
#include "../core/wee-infolist.h"
#include "../core/wee-input.h"
@ -72,6 +74,8 @@ int gui_keyboard_paste_lines = 0; /* number of lines for pending paste */
time_t gui_keyboard_last_activity_time = 0; /* last activity time (key) */
struct t_hdata *gui_keyboard_hdata_key = NULL;
/*
* gui_keyboard_init: init keyboard
@ -745,6 +749,37 @@ gui_keyboard_end ()
&gui_default_keys_count);
}
/*
* gui_keyboard_hdata_key_cb: return hdata for key
*/
struct t_hdata *
gui_keyboard_hdata_key_cb (void *data, const char *hdata_name)
{
struct t_hdata *hdata;
/* make C compiler happy */
(void) data;
if (gui_keyboard_hdata_key)
return gui_keyboard_hdata_key;
hdata = hdata_new (hdata_name, "prev_key", "next_key");
if (hdata)
{
gui_keyboard_hdata_key = hdata;
HDATA_VAR(struct t_gui_key, key, STRING);
HDATA_VAR(struct t_gui_key, command, STRING);
HDATA_VAR(struct t_gui_key, prev_key, POINTER);
HDATA_VAR(struct t_gui_key, next_key, POINTER);
HDATA_LIST(gui_keys);
HDATA_LIST(last_gui_key);
HDATA_LIST(gui_default_keys);
HDATA_LIST(last_gui_default_key);
}
return gui_keyboard_hdata_key;
}
/*
* gui_keyboard_add_to_infolist: add a key in an infolist
* return 1 if ok, 0 if error

View File

@ -80,6 +80,8 @@ extern int gui_keyboard_get_paste_lines ();
extern void gui_keyboard_paste_accept ();
extern void gui_keyboard_paste_cancel ();
extern void gui_keyboard_end ();
extern struct t_hdata *gui_keyboard_hdata_key_cb (void *data,
const char *hdata_name);
extern int gui_keyboard_add_to_infolist (struct t_infolist *infolist,
struct t_gui_key *key);
extern void gui_keyboard_print_log (struct t_gui_buffer *buffer);

View File

@ -26,11 +26,13 @@
#endif
#include <stdlib.h>
#include <stddef.h>
#include <string.h>
#include "../core/weechat.h"
#include "../core/wee-config.h"
#include "../core/wee-hashtable.h"
#include "../core/wee-hdata.h"
#include "../core/wee-hook.h"
#include "../core/wee-infolist.h"
#include "../core/wee-log.h"
@ -45,6 +47,11 @@
#include "gui-window.h"
struct t_hdata *gui_line_hdata_lines = NULL;
struct t_hdata *gui_line_hdata_line = NULL;
struct t_hdata *gui_line_hdata_line_data = NULL;
/*
* gui_lines_alloc: alloc structure "t_gui_lines" and initialize it
*/
@ -1132,6 +1139,99 @@ gui_line_mix_buffers (struct t_gui_buffer *buffer)
}
}
/*
* gui_line_hdata_lines_cb: return hdata for lines
*/
struct t_hdata *
gui_line_hdata_lines_cb (void *data, const char *hdata_name)
{
struct t_hdata *hdata;
/* make C compiler happy */
(void) data;
if (gui_line_hdata_lines)
return gui_line_hdata_lines;
hdata = hdata_new (hdata_name, NULL, NULL);
if (hdata)
{
gui_line_hdata_lines = hdata;
HDATA_VAR(struct t_gui_lines, first_line, POINTER);
HDATA_VAR(struct t_gui_lines, last_line, POINTER);
HDATA_VAR(struct t_gui_lines, last_read_line, POINTER);
HDATA_VAR(struct t_gui_lines, lines_count, INTEGER);
HDATA_VAR(struct t_gui_lines, first_line_not_read, INTEGER);
HDATA_VAR(struct t_gui_lines, lines_hidden, INTEGER);
HDATA_VAR(struct t_gui_lines, buffer_max_length, INTEGER);
HDATA_VAR(struct t_gui_lines, prefix_max_length, INTEGER);
}
return gui_line_hdata_lines;
}
/*
* gui_line_hdata_line_cb: return hdata for line
*/
struct t_hdata *
gui_line_hdata_line_cb (void *data, const char *hdata_name)
{
struct t_hdata *hdata;
/* make C compiler happy */
(void) data;
if (gui_line_hdata_line)
return gui_line_hdata_line;
hdata = hdata_new (hdata_name, "prev_line", "next_line");
if (hdata)
{
gui_line_hdata_line = hdata;
HDATA_VAR(struct t_gui_line, data, POINTER);
HDATA_VAR(struct t_gui_line, prev_line, POINTER);
HDATA_VAR(struct t_gui_line, next_line, POINTER);
}
return gui_line_hdata_line;
}
/*
* gui_line_hdata_line_data_cb: return hdata for line data
*/
struct t_hdata *
gui_line_hdata_line_data_cb (void *data, const char *hdata_name)
{
struct t_hdata *hdata;
/* make C compiler happy */
(void) data;
if (gui_line_hdata_line_data)
return gui_line_hdata_line_data;
hdata = hdata_new (hdata_name, NULL, NULL);
if (hdata)
{
gui_line_hdata_line_data = hdata;
HDATA_VAR(struct t_gui_line_data, buffer, POINTER);
HDATA_VAR(struct t_gui_line_data, y, INTEGER);
HDATA_VAR(struct t_gui_line_data, date, TIME);
HDATA_VAR(struct t_gui_line_data, date_printed, TIME);
HDATA_VAR(struct t_gui_line_data, str_time, STRING);
HDATA_VAR(struct t_gui_line_data, tags_count, INTEGER);
HDATA_VAR(struct t_gui_line_data, tags_array, POINTER);
HDATA_VAR(struct t_gui_line_data, displayed, INTEGER);
HDATA_VAR(struct t_gui_line_data, highlight, INTEGER);
HDATA_VAR(struct t_gui_line_data, refresh_needed, INTEGER);
HDATA_VAR(struct t_gui_line_data, prefix, STRING);
HDATA_VAR(struct t_gui_line_data, prefix_length, INTEGER);
HDATA_VAR(struct t_gui_line_data, message, STRING);
}
return gui_line_hdata_line_data;
}
/*
* gui_buffer_line_add_to_infolist: add a buffer line in an infolist
* return 1 if ok, 0 if error

View File

@ -102,6 +102,12 @@ extern void gui_line_add_y (struct t_gui_buffer *buffer, int y,
const char *message);
extern void gui_line_clear (struct t_gui_line *line);
extern void gui_line_mix_buffers (struct t_gui_buffer *buffer);
extern struct t_hdata *gui_line_hdata_lines_cb (void *data,
const char *hdata_name);
extern struct t_hdata *gui_line_hdata_line_cb (void *data,
const char *hdata_name);
extern struct t_hdata *gui_line_hdata_line_data_cb (void *data,
const char *hdata_name);
extern int gui_line_add_to_infolist (struct t_infolist *infolist,
struct t_gui_lines *lines,
struct t_gui_line *line);

View File

@ -26,6 +26,7 @@
#endif
#include <stdlib.h>
#include <stddef.h>
#include <stdio.h>
#include <stdarg.h>
#include <unistd.h>
@ -35,6 +36,7 @@
#include <ctype.h>
#include "../core/weechat.h"
#include "../core/wee-hdata.h"
#include "../core/wee-hook.h"
#include "../core/wee-infolist.h"
#include "../core/wee-log.h"
@ -46,6 +48,10 @@
#include "gui-color.h"
struct t_hdata *gui_nicklist_hdata_nick_group = NULL;
struct t_hdata *gui_nicklist_hdata_nick = NULL;
/*
* gui_nicklist_send_signal: send a signal when something has changed in
* nicklist
@ -939,6 +945,71 @@ gui_nicklist_nick_set (struct t_gui_buffer *buffer,
}
}
/*
* gui_nicklist_hdata_nick_group_cb: return hdata for nick_group
*/
struct t_hdata *
gui_nicklist_hdata_nick_group_cb (void *data, const char *hdata_name)
{
struct t_hdata *hdata;
/* make C compiler happy */
(void) data;
if (gui_nicklist_hdata_nick_group)
return gui_nicklist_hdata_nick_group;
hdata = hdata_new (hdata_name, "prev_group", "next_group");
if (hdata)
{
gui_nicklist_hdata_nick_group = hdata;
HDATA_VAR(struct t_gui_nick_group, name, STRING);
HDATA_VAR(struct t_gui_nick_group, color, STRING);
HDATA_VAR(struct t_gui_nick_group, visible, INTEGER);
HDATA_VAR(struct t_gui_nick_group, level, INTEGER);
HDATA_VAR(struct t_gui_nick_group, parent, POINTER);
HDATA_VAR(struct t_gui_nick_group, childs, POINTER);
HDATA_VAR(struct t_gui_nick_group, last_child, POINTER);
HDATA_VAR(struct t_gui_nick_group, nicks, POINTER);
HDATA_VAR(struct t_gui_nick_group, last_nick, POINTER);
HDATA_VAR(struct t_gui_nick_group, prev_group, POINTER);
HDATA_VAR(struct t_gui_nick_group, next_group, POINTER);
}
return gui_nicklist_hdata_nick_group;
}
/*
* gui_nicklist_hdata_nick_cb: return hdata for nick
*/
struct t_hdata *
gui_nicklist_hdata_nick_cb (void *data, const char *hdata_name)
{
struct t_hdata *hdata;
/* make C compiler happy */
(void) data;
if (gui_nicklist_hdata_nick)
return gui_nicklist_hdata_nick;
hdata = hdata_new (hdata_name, "prev_nick", "next_nick");
if (hdata)
{
gui_nicklist_hdata_nick = hdata;
HDATA_VAR(struct t_gui_nick, group, POINTER);
HDATA_VAR(struct t_gui_nick, name, STRING);
HDATA_VAR(struct t_gui_nick, color, STRING);
HDATA_VAR(struct t_gui_nick, prefix, STRING);
HDATA_VAR(struct t_gui_nick, prefix_color, STRING);
HDATA_VAR(struct t_gui_nick, visible, INTEGER);
HDATA_VAR(struct t_gui_nick, prev_nick, POINTER);
HDATA_VAR(struct t_gui_nick, next_nick, POINTER);
}
return gui_nicklist_hdata_nick;
}
/*
* gui_nicklist_add_group_to_infolist: add a group in an infolist
* return 1 if ok, 0 if error

View File

@ -108,6 +108,10 @@ extern void *gui_nicklist_nick_get_pointer (struct t_gui_buffer *buffer,
extern void gui_nicklist_nick_set (struct t_gui_buffer *buffer,
struct t_gui_nick *nick,
const char *property, const char *value);
extern struct t_hdata *gui_nicklist_hdata_nick_group_cb (void *data,
const char *hdata_name);
extern struct t_hdata *gui_nicklist_hdata_nick_cb (void *data,
const char *hdata_name);
extern int gui_nicklist_add_to_infolist (struct t_infolist *infolist,
struct t_gui_buffer *buffer,
const char *name);

View File

@ -26,6 +26,7 @@
#endif
#include <stdlib.h>
#include <stddef.h>
#include <stdio.h>
#include <stdarg.h>
#include <unistd.h>
@ -36,6 +37,7 @@
#include "../core/weechat.h"
#include "../core/wee-config.h"
#include "../core/wee-hdata.h"
#include "../core/wee-hook.h"
#include "../core/wee-infolist.h"
#include "../core/wee-log.h"
@ -69,6 +71,10 @@ struct t_gui_layout_window *gui_window_layout_before_zoom = NULL;
int gui_window_layout_id_current_window = -1;
/* current window id before zoom */
struct t_hdata *gui_window_hdata_window = NULL;
struct t_hdata *gui_window_hdata_window_scroll = NULL;
struct t_hdata *gui_window_hdata_window_tree = NULL;
/*
* gui_window_ask_refresh: set "gui_window_refresh_needed" flag
@ -1263,6 +1269,118 @@ gui_window_zoom (struct t_gui_window *window)
}
}
/*
* gui_window_hdata_window_cb: return hdata for window
*/
struct t_hdata *
gui_window_hdata_window_cb (void *data, const char *hdata_name)
{
struct t_hdata *hdata;
/* make C compiler happy */
(void) data;
if (gui_window_hdata_window)
return gui_window_hdata_window;
hdata = hdata_new (hdata_name, "prev_window", "next_window");
if (hdata)
{
gui_window_hdata_window = hdata;
HDATA_VAR(struct t_gui_window, win_x, INTEGER);
HDATA_VAR(struct t_gui_window, win_y, INTEGER);
HDATA_VAR(struct t_gui_window, win_width, INTEGER);
HDATA_VAR(struct t_gui_window, win_height, INTEGER);
HDATA_VAR(struct t_gui_window, win_width_pct, INTEGER);
HDATA_VAR(struct t_gui_window, win_height_pct, INTEGER);
HDATA_VAR(struct t_gui_window, win_chat_x, INTEGER);
HDATA_VAR(struct t_gui_window, win_chat_y, INTEGER);
HDATA_VAR(struct t_gui_window, win_chat_width, INTEGER);
HDATA_VAR(struct t_gui_window, win_chat_height, INTEGER);
HDATA_VAR(struct t_gui_window, win_chat_cursor_x, INTEGER);
HDATA_VAR(struct t_gui_window, win_chat_cursor_y, INTEGER);
HDATA_VAR(struct t_gui_window, bar_windows, POINTER);
HDATA_VAR(struct t_gui_window, last_bar_window, POINTER);
HDATA_VAR(struct t_gui_window, refresh_needed, INTEGER);
HDATA_VAR(struct t_gui_window, gui_objects, POINTER);
HDATA_VAR(struct t_gui_window, buffer, POINTER);
HDATA_VAR(struct t_gui_window, layout_plugin_name, STRING);
HDATA_VAR(struct t_gui_window, layout_buffer_name, STRING);
HDATA_VAR(struct t_gui_window, scroll, POINTER);
HDATA_VAR(struct t_gui_window, ptr_tree, POINTER);
HDATA_VAR(struct t_gui_window, prev_window, POINTER);
HDATA_VAR(struct t_gui_window, next_window, POINTER);
HDATA_LIST(gui_windows);
HDATA_LIST(last_gui_window);
HDATA_LIST(gui_current_window);
}
return gui_window_hdata_window;
}
/*
* gui_window_hdata_window_scroll_cb: return hdata for window scroll
*/
struct t_hdata *
gui_window_hdata_window_scroll_cb (void *data, const char *hdata_name)
{
struct t_hdata *hdata;
/* make C compiler happy */
(void) data;
if (gui_window_hdata_window_scroll)
return gui_window_hdata_window_scroll;
hdata = hdata_new (hdata_name, "prev_scroll", "next_scroll");
if (hdata)
{
gui_window_hdata_window_scroll = hdata;
HDATA_VAR(struct t_gui_window_scroll, buffer, POINTER);
HDATA_VAR(struct t_gui_window_scroll, first_line_displayed, INTEGER);
HDATA_VAR(struct t_gui_window_scroll, start_line, POINTER);
HDATA_VAR(struct t_gui_window_scroll, start_line_pos, INTEGER);
HDATA_VAR(struct t_gui_window_scroll, scrolling, INTEGER);
HDATA_VAR(struct t_gui_window_scroll, start_col, INTEGER);
HDATA_VAR(struct t_gui_window_scroll, lines_after, INTEGER);
HDATA_VAR(struct t_gui_window_scroll, reset_allowed, INTEGER);
HDATA_VAR(struct t_gui_window_scroll, prev_scroll, POINTER);
HDATA_VAR(struct t_gui_window_scroll, next_scroll, POINTER);
}
return gui_window_hdata_window_scroll;
}
/*
* gui_window_hdata_window_tree_cb: return hdata for window tree
*/
struct t_hdata *
gui_window_hdata_window_tree_cb (void *data, const char *hdata_name)
{
struct t_hdata *hdata;
/* make C compiler happy */
(void) data;
if (gui_window_hdata_window_tree)
return gui_window_hdata_window_tree;
hdata = hdata_new (hdata_name, NULL, NULL);
if (hdata)
{
gui_window_hdata_window_tree = hdata;
HDATA_VAR(struct t_gui_window_tree, parent_node, POINTER);
HDATA_VAR(struct t_gui_window_tree, split_pct, INTEGER);
HDATA_VAR(struct t_gui_window_tree, split_horizontal, INTEGER);
HDATA_VAR(struct t_gui_window_tree, child1, POINTER);
HDATA_VAR(struct t_gui_window_tree, child2, POINTER);
HDATA_VAR(struct t_gui_window_tree, window, POINTER);
HDATA_LIST(gui_windows_tree);
}
return gui_window_hdata_window_tree;
}
/*
* gui_window_add_to_infolist: add a window in an infolist
* return 1 if ok, 0 if error

View File

@ -155,6 +155,12 @@ extern void gui_window_search_restart (struct t_gui_window *window);
extern void gui_window_search_stop (struct t_gui_window *window);
extern int gui_window_search_text (struct t_gui_window *window);
extern void gui_window_zoom (struct t_gui_window *window);
extern struct t_hdata *gui_window_hdata_window_cb (void *data,
const char *hdata_name);
extern struct t_hdata *gui_window_hdata_window_scroll_cb (void *data,
const char *hdata_name);
extern struct t_hdata *gui_window_hdata_window_tree_cb (void *data,
const char *hdata_name);
extern int gui_window_add_to_infolist (struct t_infolist *infolist,
struct t_gui_window *window);
extern void gui_window_print_log ();

View File

@ -22,6 +22,7 @@
*/
#include <stdlib.h>
#include <stddef.h>
#include <unistd.h>
#include <stdio.h>
#include <string.h>
@ -39,6 +40,10 @@
#include "irc-input.h"
struct t_hdata *irc_channel_hdata_channel = NULL;
struct t_hdata *irc_channel_hdata_channel_speaking = NULL;
/*
* irc_channel_valid: check if a channel pointer exists for a server
* return 1 if channel exists
@ -832,6 +837,81 @@ irc_channel_free_all (struct t_irc_server *server)
}
}
/*
* irc_channel_hdata_channel_cb: return hdata for channel
*/
struct t_hdata *
irc_channel_hdata_channel_cb (void *data, const char *hdata_name)
{
struct t_hdata *hdata;
/* make C compiler happy */
(void) data;
if (irc_channel_hdata_channel)
return irc_channel_hdata_channel;
hdata = weechat_hdata_new (hdata_name, "prev_channel", "next_channel");
if (hdata)
{
irc_channel_hdata_channel = hdata;
WEECHAT_HDATA_VAR(struct t_irc_channel, type, INTEGER);
WEECHAT_HDATA_VAR(struct t_irc_channel, name, STRING);
WEECHAT_HDATA_VAR(struct t_irc_channel, topic, STRING);
WEECHAT_HDATA_VAR(struct t_irc_channel, modes, STRING);
WEECHAT_HDATA_VAR(struct t_irc_channel, limit, INTEGER);
WEECHAT_HDATA_VAR(struct t_irc_channel, key, STRING);
WEECHAT_HDATA_VAR(struct t_irc_channel, checking_away, INTEGER);
WEECHAT_HDATA_VAR(struct t_irc_channel, away_message, STRING);
WEECHAT_HDATA_VAR(struct t_irc_channel, has_quit_server, INTEGER);
WEECHAT_HDATA_VAR(struct t_irc_channel, cycle, INTEGER);
WEECHAT_HDATA_VAR(struct t_irc_channel, part, INTEGER);
WEECHAT_HDATA_VAR(struct t_irc_channel, display_creation_date, INTEGER);
WEECHAT_HDATA_VAR(struct t_irc_channel, nick_completion_reset, INTEGER);
WEECHAT_HDATA_VAR(struct t_irc_channel, pv_remote_nick_color, STRING);
WEECHAT_HDATA_VAR(struct t_irc_channel, hook_autorejoin, POINTER);
WEECHAT_HDATA_VAR(struct t_irc_channel, nicks_count, INTEGER);
WEECHAT_HDATA_VAR(struct t_irc_channel, nicks, POINTER);
WEECHAT_HDATA_VAR(struct t_irc_channel, last_nick, POINTER);
WEECHAT_HDATA_VAR(struct t_irc_channel, nicks_speaking, POINTER);
WEECHAT_HDATA_VAR(struct t_irc_channel, nicks_speaking_time, POINTER);
WEECHAT_HDATA_VAR(struct t_irc_channel, last_nick_speaking_time, POINTER);
WEECHAT_HDATA_VAR(struct t_irc_channel, buffer, POINTER);
WEECHAT_HDATA_VAR(struct t_irc_channel, buffer_as_string, STRING);
WEECHAT_HDATA_VAR(struct t_irc_channel, prev_channel, POINTER);
WEECHAT_HDATA_VAR(struct t_irc_channel, next_channel, POINTER);
}
return irc_channel_hdata_channel;
}
/*
* irc_channel_hdata_channel_speaking_cb: return hdata for channel_speaking
*/
struct t_hdata *
irc_channel_hdata_channel_speaking_cb (void *data, const char *hdata_name)
{
struct t_hdata *hdata;
/* make C compiler happy */
(void) data;
if (irc_channel_hdata_channel_speaking)
return irc_channel_hdata_channel_speaking;
hdata = weechat_hdata_new (hdata_name, "prev_nick", "next_nick");
if (hdata)
{
irc_channel_hdata_channel_speaking = hdata;
WEECHAT_HDATA_VAR(struct t_irc_channel_speaking, nick, STRING);
WEECHAT_HDATA_VAR(struct t_irc_channel_speaking, time_last_message, TIME);
WEECHAT_HDATA_VAR(struct t_irc_channel_speaking, prev_nick, POINTER);
WEECHAT_HDATA_VAR(struct t_irc_channel_speaking, next_nick, POINTER);
}
return irc_channel_hdata_channel_speaking;
}
/*
* irc_channel_add_to_infolist: add a channel in an infolist
* return 1 if ok, 0 if error

View File

@ -118,6 +118,10 @@ extern int irc_channel_autorejoin_cb (void *data, int remaining_calls);
extern void irc_channel_display_nick_back_in_pv (struct t_irc_server *server,
struct t_irc_nick *nick,
const char *nickname);
extern struct t_hdata *irc_channel_hdata_channel_cb (void *data,
const char *hdata_name);
extern struct t_hdata *irc_channel_hdata_channel_speaking_cb (void *data,
const char *hdata_name);
extern int irc_channel_add_to_infolist (struct t_infolist *infolist,
struct t_irc_channel *channel);
extern void irc_channel_print_log (struct t_irc_channel *channel);

View File

@ -22,6 +22,7 @@
*/
#include <stdlib.h>
#include <stddef.h>
#include <string.h>
#include "../weechat-plugin.h"
@ -34,6 +35,8 @@
struct t_irc_ignore *irc_ignore_list = NULL; /* list of ignore */
struct t_irc_ignore *last_irc_ignore = NULL; /* last ignore in list */
struct t_hdata *irc_ignore_hdata_ignore = NULL;
/*
* irc_ignore_valid: check if an ignore pointer exists
@ -301,6 +304,38 @@ irc_ignore_free_all ()
}
}
/*
* irc_ignore_hdata_ignore_cb: return hdata for ignore
*/
struct t_hdata *
irc_ignore_hdata_ignore_cb (void *data, const char *hdata_name)
{
struct t_hdata *hdata;
/* make C compiler happy */
(void) data;
if (irc_ignore_hdata_ignore)
return irc_ignore_hdata_ignore;
hdata = weechat_hdata_new (hdata_name, "prev_ignore", "next_ignore");
if (hdata)
{
irc_ignore_hdata_ignore = hdata;
WEECHAT_HDATA_VAR(struct t_irc_ignore, number, INTEGER);
WEECHAT_HDATA_VAR(struct t_irc_ignore, mask, STRING);
WEECHAT_HDATA_VAR(struct t_irc_ignore, regex_mask, POINTER);
WEECHAT_HDATA_VAR(struct t_irc_ignore, server, STRING);
WEECHAT_HDATA_VAR(struct t_irc_ignore, channel, STRING);
WEECHAT_HDATA_VAR(struct t_irc_ignore, prev_ignore, POINTER);
WEECHAT_HDATA_VAR(struct t_irc_ignore, next_ignore, POINTER);
WEECHAT_HDATA_LIST(irc_ignore_list);
WEECHAT_HDATA_LIST(last_irc_ignore);
}
return irc_ignore_hdata_ignore;
}
/*
* irc_ignore_add_to_infolist: add an ignore in an infolist
* return 1 if ok, 0 if error

View File

@ -51,6 +51,8 @@ extern int irc_ignore_check (struct t_irc_server *server,
const char *host);
extern void irc_ignore_free (struct t_irc_ignore *ignore);
extern void irc_ignore_free_all ();
extern struct t_hdata *irc_ignore_hdata_ignore_cb (void *data,
const char *hdata_name);
extern int irc_ignore_add_to_infolist (struct t_infolist *infolist,
struct t_irc_ignore *ignore);
extern void irc_ignore_print_log ();

View File

@ -18,7 +18,7 @@
*/
/*
* irc-info.c: info and infolist hooks for IRC plugin
* irc-info.c: info, infolist and hdata hooks for IRC plugin
*/
#include <stdlib.h>
@ -34,6 +34,7 @@
#include "irc-nick.h"
#include "irc-notify.h"
#include "irc-protocol.h"
#include "irc-redirect.h"
#include "irc-server.h"
@ -626,4 +627,22 @@ irc_info_init ()
N_("notify pointer (optional)"),
N_("server name (can start or end with \"*\" as wildcard) (optional)"),
&irc_info_get_infolist_cb, NULL);
/* hdata hooks */
weechat_hook_hdata ("irc_nick", N_("irc nick"),
&irc_nick_hdata_nick_cb, NULL);
weechat_hook_hdata ("irc_channel", N_("irc channel"),
&irc_channel_hdata_channel_cb, NULL);
weechat_hook_hdata ("irc_channel_speaking", N_("irc channel_speaking"),
&irc_channel_hdata_channel_speaking_cb, NULL);
weechat_hook_hdata ("irc_ignore", N_("irc ignore"),
&irc_ignore_hdata_ignore_cb, NULL);
weechat_hook_hdata ("irc_notify", N_("irc notify"),
&irc_notify_hdata_notify_cb, NULL);
weechat_hook_hdata ("irc_redirect_pattern", N_("pattern for irc redirect"),
&irc_redirect_hdata_redirect_pattern_cb, NULL);
weechat_hook_hdata ("irc_redirect", N_("irc redirect"),
&irc_redirect_hdata_redirect_cb, NULL);
weechat_hook_hdata ("irc_server", N_("irc server"),
&irc_server_hdata_server_cb, NULL);
}

View File

@ -22,6 +22,7 @@
*/
#include <stdlib.h>
#include <stddef.h>
#include <stdio.h>
#include <string.h>
#include <limits.h>
@ -36,6 +37,9 @@
#include "irc-channel.h"
struct t_hdata *irc_nick_hdata_nick = NULL;
/*
* irc_nick_valid: check if a nick pointer exists for a channel
* return 1 if nick exists
@ -927,6 +931,37 @@ irc_nick_color_for_pv (struct t_irc_channel *channel, const char *nickname)
return IRC_COLOR_CHAT_NICK_OTHER;
}
/*
* irc_nick_hdata_nick_cb: return hdata for nick
*/
struct t_hdata *
irc_nick_hdata_nick_cb (void *data, const char *hdata_name)
{
struct t_hdata *hdata;
/* make C compiler happy */
(void) data;
if (irc_nick_hdata_nick)
return irc_nick_hdata_nick;
hdata = weechat_hdata_new (hdata_name, "prev_nick", "next_nick");
if (hdata)
{
irc_nick_hdata_nick = hdata;
WEECHAT_HDATA_VAR(struct t_irc_nick, name, STRING);
WEECHAT_HDATA_VAR(struct t_irc_nick, host, STRING);
WEECHAT_HDATA_VAR(struct t_irc_nick, prefixes, STRING);
WEECHAT_HDATA_VAR(struct t_irc_nick, prefix, STRING);
WEECHAT_HDATA_VAR(struct t_irc_nick, away, INTEGER);
WEECHAT_HDATA_VAR(struct t_irc_nick, color, STRING);
WEECHAT_HDATA_VAR(struct t_irc_nick, prev_nick, POINTER);
WEECHAT_HDATA_VAR(struct t_irc_nick, next_nick, POINTER);
}
return irc_nick_hdata_nick;
}
/*
* irc_nick_add_to_infolist: add a nick in an infolist
* return 1 if ok, 0 if error

View File

@ -90,6 +90,8 @@ extern char *irc_nick_as_prefix (struct t_irc_server *server,
const char *force_color);
extern const char * irc_nick_color_for_pv (struct t_irc_channel *channel,
const char *nickname);
extern struct t_hdata *irc_nick_hdata_nick_cb (void *data,
const char *hdata_name);
extern int irc_nick_add_to_infolist (struct t_infolist *infolist,
struct t_irc_nick *nick);
extern void irc_nick_print_log (struct t_irc_nick *nick);

View File

@ -22,6 +22,7 @@
*/
#include <stdlib.h>
#include <stddef.h>
#include <stdio.h>
#include <string.h>
@ -42,6 +43,8 @@ struct t_hook *irc_notify_timer_whois = NULL; /* timer for "whois" */
/* hsignal for redirected commands */
struct t_hook *irc_notify_hsignal = NULL;
struct t_hdata *irc_notify_hdata_notify = NULL;
/*
* irc_notify_valid: check if a notify pointer exists for a server
@ -808,6 +811,37 @@ irc_notify_timer_whois_cb (void *data, int remaining_calls)
return WEECHAT_RC_OK;
}
/*
* irc_notify_hdata_notify_cb: return hdata for notify
*/
struct t_hdata *
irc_notify_hdata_notify_cb (void *data, const char *hdata_name)
{
struct t_hdata *hdata;
/* make C compiler happy */
(void) data;
if (irc_notify_hdata_notify)
return irc_notify_hdata_notify;
hdata = weechat_hdata_new (hdata_name, "prev_notify", "next_notify");
if (hdata)
{
irc_notify_hdata_notify = hdata;
WEECHAT_HDATA_VAR(struct t_irc_notify, server, POINTER);
WEECHAT_HDATA_VAR(struct t_irc_notify, nick, STRING);
WEECHAT_HDATA_VAR(struct t_irc_notify, check_away, INTEGER);
WEECHAT_HDATA_VAR(struct t_irc_notify, is_on_server, INTEGER);
WEECHAT_HDATA_VAR(struct t_irc_notify, away_message, STRING);
WEECHAT_HDATA_VAR(struct t_irc_notify, ison_received, INTEGER);
WEECHAT_HDATA_VAR(struct t_irc_notify, prev_notify, POINTER);
WEECHAT_HDATA_VAR(struct t_irc_notify, next_notify, POINTER);
}
return irc_notify_hdata_notify;
}
/*
* irc_notify_add_to_infolist: add a notify in an infolist
* return 1 if ok, 0 if error

View File

@ -55,6 +55,8 @@ extern void irc_notify_free_all (struct t_irc_server *server);
extern void irc_notify_display_list (struct t_irc_server *server);
extern int irc_notify_timer_ison_cb (void *data, int remaining_calls);
extern int irc_notify_timer_whois_cb (void *data, int remaining_calls);
extern struct t_hdata *irc_notify_hdata_notify_cb (void *data,
const char *hdata_name);
extern int irc_notify_add_to_infolist (struct t_infolist *infolist,
struct t_irc_notify *notify);
extern void irc_notify_print_log (struct t_irc_server *server);

View File

@ -22,6 +22,7 @@
*/
#include <stdlib.h>
#include <stddef.h>
#include <stdio.h>
#include <string.h>
#include <ctype.h>
@ -36,6 +37,9 @@
struct t_irc_redirect_pattern *irc_redirect_patterns = NULL;
struct t_irc_redirect_pattern *last_irc_redirect_pattern = NULL;
struct t_hdata *irc_redirect_hdata_redirect_pattern = NULL;
struct t_hdata *irc_redirect_hdata_redirect = NULL;
/* default redirect patterns */
struct t_irc_redirect_pattern irc_redirect_patterns_default[] =
{
@ -951,6 +955,81 @@ irc_redirect_free_all (struct t_irc_server *server)
}
}
/*
* irc_redirect_hdata_redirect_pattern_cb: return hdata for redirect pattern
*/
struct t_hdata *
irc_redirect_hdata_redirect_pattern_cb (void *data, const char *hdata_name)
{
struct t_hdata *hdata;
/* make C compiler happy */
(void) data;
if (irc_redirect_hdata_redirect_pattern)
return irc_redirect_hdata_redirect_pattern;
hdata = weechat_hdata_new (hdata_name, "prev_redirect", "next_redirect");
if (hdata)
{
irc_redirect_hdata_redirect_pattern = hdata;
WEECHAT_HDATA_VAR(struct t_irc_redirect_pattern, name, STRING);
WEECHAT_HDATA_VAR(struct t_irc_redirect_pattern, temp_pattern, INTEGER);
WEECHAT_HDATA_VAR(struct t_irc_redirect_pattern, timeout, INTEGER);
WEECHAT_HDATA_VAR(struct t_irc_redirect_pattern, cmd_start, STRING);
WEECHAT_HDATA_VAR(struct t_irc_redirect_pattern, cmd_stop, STRING);
WEECHAT_HDATA_VAR(struct t_irc_redirect_pattern, cmd_extra, STRING);
WEECHAT_HDATA_VAR(struct t_irc_redirect_pattern, prev_redirect, POINTER);
WEECHAT_HDATA_VAR(struct t_irc_redirect_pattern, next_redirect, POINTER);
WEECHAT_HDATA_LIST(irc_redirect_patterns);
WEECHAT_HDATA_LIST(last_irc_redirect_pattern);
}
return irc_redirect_hdata_redirect_pattern;
}
/*
* irc_redirect_hdata_redirect_cb: return hdata for redirect
*/
struct t_hdata *
irc_redirect_hdata_redirect_cb (void *data, const char *hdata_name)
{
struct t_hdata *hdata;
/* make C compiler happy */
(void) data;
if (irc_redirect_hdata_redirect)
return irc_redirect_hdata_redirect;
hdata = weechat_hdata_new (hdata_name, "prev_redirect", "next_redirect");
if (hdata)
{
irc_redirect_hdata_redirect = hdata;
WEECHAT_HDATA_VAR(struct t_irc_redirect, server, POINTER);
WEECHAT_HDATA_VAR(struct t_irc_redirect, pattern, STRING);
WEECHAT_HDATA_VAR(struct t_irc_redirect, signal, STRING);
WEECHAT_HDATA_VAR(struct t_irc_redirect, count, INTEGER);
WEECHAT_HDATA_VAR(struct t_irc_redirect, current_count, INTEGER);
WEECHAT_HDATA_VAR(struct t_irc_redirect, string, STRING);
WEECHAT_HDATA_VAR(struct t_irc_redirect, timeout, INTEGER);
WEECHAT_HDATA_VAR(struct t_irc_redirect, command, STRING);
WEECHAT_HDATA_VAR(struct t_irc_redirect, start_time, TIME);
WEECHAT_HDATA_VAR(struct t_irc_redirect, cmd_start, POINTER);
WEECHAT_HDATA_VAR(struct t_irc_redirect, cmd_stop, POINTER);
WEECHAT_HDATA_VAR(struct t_irc_redirect, cmd_extra, POINTER);
WEECHAT_HDATA_VAR(struct t_irc_redirect, cmd_start_received, INTEGER);
WEECHAT_HDATA_VAR(struct t_irc_redirect, cmd_stop_received, INTEGER);
WEECHAT_HDATA_VAR(struct t_irc_redirect, cmd_filter, POINTER);
WEECHAT_HDATA_VAR(struct t_irc_redirect, output, STRING);
WEECHAT_HDATA_VAR(struct t_irc_redirect, output_size, INTEGER);
WEECHAT_HDATA_VAR(struct t_irc_redirect, prev_redirect, POINTER);
WEECHAT_HDATA_VAR(struct t_irc_redirect, next_redirect, POINTER);
}
return irc_redirect_hdata_redirect;
}
/*
* irc_redirect_pattern_add_to_infolist: add a redirect pattern in an infolist
* return 1 if ok, 0 if error

View File

@ -108,6 +108,10 @@ extern int irc_redirect_message (struct t_irc_server *server,
const char *arguments);
extern void irc_redirect_free (struct t_irc_redirect *redirect);
extern void irc_redirect_free_all (struct t_irc_server *server);
extern struct t_hdata *irc_redirect_hdata_redirect_pattern_cb (void *data,
const char *hdata_name);
extern struct t_hdata *irc_redirect_hdata_redirect_cb (void *data,
const char *hdata_name);
extern int irc_redirect_pattern_add_to_infolist (struct t_infolist *infolist,
struct t_irc_redirect_pattern *redirect_pattern);
extern int irc_redirect_add_to_infolist (struct t_infolist *infolist,

View File

@ -23,6 +23,7 @@
*/
#include <stdlib.h>
#include <stddef.h>
#include <unistd.h>
#include <errno.h>
#include <stdio.h>
@ -64,6 +65,8 @@ struct t_irc_server *last_irc_server = NULL;
struct t_irc_message *irc_recv_msgq = NULL;
struct t_irc_message *irc_msgq_last_msg = NULL;
struct t_hdata *irc_server_hdata_server = NULL;
char *irc_server_option_string[IRC_SERVER_NUM_OPTIONS] =
{ "addresses", "proxy", "ipv6",
"ssl", "ssl_cert", "ssl_priorities", "ssl_dhkey_size", "ssl_verify",
@ -3934,6 +3937,92 @@ irc_server_xfer_send_accept_resume_cb (void *data, const char *signal,
return WEECHAT_RC_OK;
}
/*
* irc_server_hdata_server_cb: return hdata for server
*/
struct t_hdata *
irc_server_hdata_server_cb (void *data, const char *hdata_name)
{
struct t_hdata *hdata;
/* make C compiler happy */
(void) data;
if (irc_server_hdata_server)
return irc_server_hdata_server;
hdata = weechat_hdata_new (hdata_name, "prev_server", "next_server");
if (hdata)
{
irc_server_hdata_server = hdata;
WEECHAT_HDATA_VAR(struct t_irc_server, name, STRING);
WEECHAT_HDATA_VAR(struct t_irc_server, options, POINTER);
WEECHAT_HDATA_VAR(struct t_irc_server, temp_server, INTEGER);
WEECHAT_HDATA_VAR(struct t_irc_server, reloading_from_config, INTEGER);
WEECHAT_HDATA_VAR(struct t_irc_server, reloaded_from_config, INTEGER);
WEECHAT_HDATA_VAR(struct t_irc_server, addresses_count, INTEGER);
WEECHAT_HDATA_VAR(struct t_irc_server, addresses_array, POINTER);
WEECHAT_HDATA_VAR(struct t_irc_server, ports_array, POINTER);
WEECHAT_HDATA_VAR(struct t_irc_server, index_current_address, INTEGER);
WEECHAT_HDATA_VAR(struct t_irc_server, current_address, STRING);
WEECHAT_HDATA_VAR(struct t_irc_server, current_ip, STRING);
WEECHAT_HDATA_VAR(struct t_irc_server, current_port, INTEGER);
WEECHAT_HDATA_VAR(struct t_irc_server, sock, INTEGER);
WEECHAT_HDATA_VAR(struct t_irc_server, hook_connect, POINTER);
WEECHAT_HDATA_VAR(struct t_irc_server, hook_fd, POINTER);
WEECHAT_HDATA_VAR(struct t_irc_server, hook_timer_connection, POINTER);
WEECHAT_HDATA_VAR(struct t_irc_server, hook_timer_sasl, POINTER);
WEECHAT_HDATA_VAR(struct t_irc_server, is_connected, INTEGER);
WEECHAT_HDATA_VAR(struct t_irc_server, ssl_connected, INTEGER);
#ifdef HAVE_GNUTLS
WEECHAT_HDATA_VAR(struct t_irc_server, gnutls_sess, OTHER);
WEECHAT_HDATA_VAR(struct t_irc_server, tls_cert, OTHER);
WEECHAT_HDATA_VAR(struct t_irc_server, tls_cert_key, OTHER);
#endif
WEECHAT_HDATA_VAR(struct t_irc_server, unterminated_message, STRING);
WEECHAT_HDATA_VAR(struct t_irc_server, nicks_count, INTEGER);
WEECHAT_HDATA_VAR(struct t_irc_server, nicks_array, POINTER);
WEECHAT_HDATA_VAR(struct t_irc_server, nick_first_tried, INTEGER);
WEECHAT_HDATA_VAR(struct t_irc_server, nick, STRING);
WEECHAT_HDATA_VAR(struct t_irc_server, nick_modes, STRING);
WEECHAT_HDATA_VAR(struct t_irc_server, isupport, STRING);
WEECHAT_HDATA_VAR(struct t_irc_server, prefix_modes, STRING);
WEECHAT_HDATA_VAR(struct t_irc_server, prefix_chars, STRING);
WEECHAT_HDATA_VAR(struct t_irc_server, reconnect_delay, INTEGER);
WEECHAT_HDATA_VAR(struct t_irc_server, reconnect_start, TIME);
WEECHAT_HDATA_VAR(struct t_irc_server, command_time, TIME);
WEECHAT_HDATA_VAR(struct t_irc_server, reconnect_join, INTEGER);
WEECHAT_HDATA_VAR(struct t_irc_server, disable_autojoin, INTEGER);
WEECHAT_HDATA_VAR(struct t_irc_server, is_away, INTEGER);
WEECHAT_HDATA_VAR(struct t_irc_server, away_message, STRING);
WEECHAT_HDATA_VAR(struct t_irc_server, away_time, TIME);
WEECHAT_HDATA_VAR(struct t_irc_server, lag, INTEGER);
WEECHAT_HDATA_VAR(struct t_irc_server, lag_check_time, OTHER);
WEECHAT_HDATA_VAR(struct t_irc_server, lag_next_check, TIME);
WEECHAT_HDATA_VAR(struct t_irc_server, lag_last_refresh, TIME);
WEECHAT_HDATA_VAR(struct t_irc_server, cmd_list_regexp, POINTER);
WEECHAT_HDATA_VAR(struct t_irc_server, last_user_message, TIME);
WEECHAT_HDATA_VAR(struct t_irc_server, last_away_check, TIME);
WEECHAT_HDATA_VAR(struct t_irc_server, outqueue, POINTER);
WEECHAT_HDATA_VAR(struct t_irc_server, last_outqueue, POINTER);
WEECHAT_HDATA_VAR(struct t_irc_server, redirects, POINTER);
WEECHAT_HDATA_VAR(struct t_irc_server, last_redirect, POINTER);
WEECHAT_HDATA_VAR(struct t_irc_server, notify_list, POINTER);
WEECHAT_HDATA_VAR(struct t_irc_server, last_notify, POINTER);
WEECHAT_HDATA_VAR(struct t_irc_server, manual_joins, POINTER);
WEECHAT_HDATA_VAR(struct t_irc_server, buffer, POINTER);
WEECHAT_HDATA_VAR(struct t_irc_server, buffer_as_string, STRING);
WEECHAT_HDATA_VAR(struct t_irc_server, channels, POINTER);
WEECHAT_HDATA_VAR(struct t_irc_server, last_channel, POINTER);
WEECHAT_HDATA_VAR(struct t_irc_server, prev_server, POINTER);
WEECHAT_HDATA_VAR(struct t_irc_server, next_server, POINTER);
WEECHAT_HDATA_LIST(irc_servers);
WEECHAT_HDATA_LIST(last_irc_server);
}
return irc_server_hdata_server;
}
/*
* irc_server_add_to_infolist: add a server in an infolist
* return 1 if ok, 0 if error

View File

@ -272,6 +272,8 @@ extern int irc_server_xfer_resume_ready_cb (void *data, const char *signal,
extern int irc_server_xfer_send_accept_resume_cb (void *data, const char *signal,
const char *type_data,
void *signal_data);
extern struct t_hdata *irc_server_hdata_server_cb (void *data,
const char *hdata_name);
extern int irc_server_add_to_infolist (struct t_infolist *infolist,
struct t_irc_server *server);
extern void irc_server_print_log ();

View File

@ -37,6 +37,7 @@
#include "../core/weechat.h"
#include "../core/wee-config.h"
#include "../core/wee-hashtable.h"
#include "../core/wee-hook.h"
#include "../core/wee-infolist.h"
#include "../core/wee-input.h"
@ -47,6 +48,7 @@
#include "../gui/gui-bar-window.h"
#include "../gui/gui-buffer.h"
#include "../gui/gui-chat.h"
#include "../gui/gui-completion.h"
#include "../gui/gui-color.h"
#include "../gui/gui-filter.h"
#include "../gui/gui-history.h"
@ -56,6 +58,7 @@
#include "../gui/gui-nicklist.h"
#include "../gui/gui-window.h"
#include "plugin.h"
#include "plugin-api.h"
#include "plugin-config.h"
@ -1046,4 +1049,80 @@ plugin_api_init ()
N_("window pointer (optional)"),
N_("window name (can start or end with \"*\" as wildcard) (optional)"),
&plugin_api_infolist_get_internal, NULL);
/* WeeChat core hdata */
hook_hdata (NULL, "bar", N_("bar"),
&gui_bar_hdata_bar_cb, NULL);
hook_hdata (NULL, "bar_item", N_("bar item"),
&gui_bar_item_hdata_bar_item_cb, NULL);
hook_hdata (NULL, "buffer", N_("buffer"),
&gui_buffer_hdata_buffer_cb, NULL);
hook_hdata (NULL, "completion", N_("completion"),
&gui_completion_hdata_completion_cb, NULL);
hook_hdata (NULL, "completion_partial", N_("partial completion"),
&gui_completion_hdata_completion_partial_cb, NULL);
hook_hdata (NULL, "config_file", N_("config file"),
&config_file_hdata_config_file_cb, NULL);
hook_hdata (NULL, "config_section", N_("config section"),
&config_file_hdata_config_section_cb, NULL);
hook_hdata (NULL, "config_option", N_("config option"),
&config_file_hdata_config_option_cb, NULL);
hook_hdata (NULL, "filter", N_("filter"),
&gui_filter_hdata_filter_cb, NULL);
hook_hdata (NULL, "history", N_("history of commands in buffer"),
&gui_history_hdata_history_cb, NULL);
hook_hdata (NULL, "hook", N_("hook (variables common to all hook types)"),
&hook_hdata_hook_cb, NULL);
hook_hdata (NULL, "hook_command", N_("hook of type \"command\""),
&hook_hdata_hook_command_cb, NULL);
hook_hdata (NULL, "hook_command_run", N_("hook of type \"command_run\""),
&hook_hdata_hook_command_run_cb, NULL);
hook_hdata (NULL, "hook_timer", N_("hook of type \"timer\""),
&hook_hdata_hook_timer_cb, NULL);
hook_hdata (NULL, "hook_fd", N_("hook of type \"fd\""),
&hook_hdata_hook_fd_cb, NULL);
hook_hdata (NULL, "hook_process", N_("hook of type \"process\""),
&hook_hdata_hook_process_cb, NULL);
hook_hdata (NULL, "hook_connect", N_("hook of type \"connect\""),
&hook_hdata_hook_connect_cb, NULL);
hook_hdata (NULL, "hook_print", N_("hook of type \"print\""),
&hook_hdata_hook_print_cb, NULL);
hook_hdata (NULL, "hook_signal", N_("hook of type \"signal\""),
&hook_hdata_hook_signal_cb, NULL);
hook_hdata (NULL, "hook_hsignal", N_("hook of type \"hsignal\""),
&hook_hdata_hook_hsignal_cb, NULL);
hook_hdata (NULL, "hook_config", N_("hook of type \"config\""),
&hook_hdata_hook_config_cb, NULL);
hook_hdata (NULL, "hook_completion", N_("hook of type \"completion\""),
&hook_hdata_hook_completion_cb, NULL);
hook_hdata (NULL, "hook_modifier", N_("hook of type \"modifier\""),
&hook_hdata_hook_modifier_cb, NULL);
hook_hdata (NULL, "hook_info", N_("hook of type \"info\""),
&hook_hdata_hook_info_cb, NULL);
hook_hdata (NULL, "hook_info_hashtable", N_("hook of type \"info_hashtable\""),
&hook_hdata_hook_info_hashtable_cb, NULL);
hook_hdata (NULL, "hook_infolist", N_("hook of type \"infolist\""),
&hook_hdata_hook_infolist_cb, NULL);
hook_hdata (NULL, "hook_hdata", N_("hook of type \"hdata\""),
&hook_hdata_hook_hdata_cb, NULL);
hook_hdata (NULL, "input_undo", N_("undo for input line"),
&gui_buffer_hdata_input_undo_cb, NULL);
hook_hdata (NULL, "key", N_("key"),
&gui_keyboard_hdata_key_cb, NULL);
hook_hdata (NULL, "lines", N_("lines"),
&gui_line_hdata_lines_cb, NULL);
hook_hdata (NULL, "line", N_("line"),
&gui_line_hdata_line_cb, NULL);
hook_hdata (NULL, "line_data", N_("line data"),
&gui_line_hdata_line_data_cb, NULL);
hook_hdata (NULL, "nick_group", N_("group in nicklist"),
&gui_nicklist_hdata_nick_group_cb, NULL);
hook_hdata (NULL, "nick", N_("nick in nicklist"),
&gui_nicklist_hdata_nick_cb, NULL);
hook_hdata (NULL, "window", N_("window"),
&gui_window_hdata_window_cb, NULL);
hook_hdata (NULL, "window_scroll", N_("scroll info in window"),
&gui_window_hdata_window_scroll_cb, NULL);
hook_hdata (NULL, "window_tree", N_("tree of windows"),
&gui_window_hdata_window_tree_cb, NULL);
}

View File

@ -20,6 +20,12 @@
#ifndef __WEECHAT_PLUGIN_API_H
#define __WEECHAT_PLUGIN_API_H 1
struct t_plugin_api_hdata
{
char *name; /* hdata name */
struct t_hdata *(*callback_get_hdata)(); /* callback to get hdata */
};
/* strings */
extern void plugin_api_charset_set (struct t_weechat_plugin *plugin,
const char *charset);

View File

@ -39,6 +39,7 @@
#include "../core/weechat.h"
#include "../core/wee-config.h"
#include "../core/wee-hashtable.h"
#include "../core/wee-hdata.h"
#include "../core/wee-hook.h"
#include "../core/wee-infolist.h"
#include "../core/wee-list.h"
@ -604,6 +605,7 @@ plugin_load (const char *filename)
new_plugin->hook_info = &hook_info;
new_plugin->hook_info_hashtable = &hook_info_hashtable;
new_plugin->hook_infolist = &hook_infolist;
new_plugin->hook_hdata = &hook_hdata;
new_plugin->unhook = &unhook;
new_plugin->unhook_all = &unhook_all_plugin;
@ -680,6 +682,24 @@ plugin_load (const char *filename)
new_plugin->infolist_buffer = &plugin_api_infolist_buffer;
new_plugin->infolist_time = &plugin_api_infolist_time;
new_plugin->infolist_free = &plugin_api_infolist_free;
new_plugin->hdata_new = &hdata_new;
new_plugin->hdata_new_var = &hdata_new_var;
new_plugin->hdata_new_list = &hdata_new_list;
new_plugin->hdata_get = &hook_hdata_get;
new_plugin->hdata_get_var_offset = &hdata_get_var_offset;
new_plugin->hdata_get_var_type = &hdata_get_var_type;
new_plugin->hdata_get_var_type_string = &hdata_get_var_type_string;
new_plugin->hdata_get_var = &hdata_get_var;
new_plugin->hdata_get_var_at_offset = &hdata_get_var_at_offset;
new_plugin->hdata_get_list = &hdata_get_list;
new_plugin->hdata_move = &hdata_move;
new_plugin->hdata_integer = &hdata_integer;
new_plugin->hdata_long = &hdata_long;
new_plugin->hdata_string = &hdata_string;
new_plugin->hdata_pointer = &hdata_pointer;
new_plugin->hdata_time = &hdata_time;
new_plugin->hdata_get_string = &hdata_get_string;
new_plugin->upgrade_new = &upgrade_file_new;
new_plugin->upgrade_write_object = &upgrade_file_write_object;

View File

@ -40,21 +40,24 @@
#define LUA_RETURN_OK return 1
#define LUA_RETURN_ERROR return 0
#define LUA_RETURN_EMPTY \
lua_pushstring (lua_current_interpreter, ""); \
#define LUA_RETURN_EMPTY \
lua_pushstring (lua_current_interpreter, ""); \
return 0
#define LUA_RETURN_STRING(__string) \
lua_pushstring (lua_current_interpreter, \
(__string) ? __string : ""); \
#define LUA_RETURN_STRING(__string) \
lua_pushstring (lua_current_interpreter, \
(__string) ? __string : ""); \
return 1;
#define LUA_RETURN_STRING_FREE(__string) \
lua_pushstring (lua_current_interpreter, \
(__string) ? __string : ""); \
if (__string) \
free (__string); \
#define LUA_RETURN_STRING_FREE(__string) \
lua_pushstring (lua_current_interpreter, \
(__string) ? __string : ""); \
if (__string) \
free (__string); \
return 1;
#define LUA_RETURN_INT(__int) \
lua_pushnumber (lua_current_interpreter, __int); \
#define LUA_RETURN_INT(__int) \
lua_pushnumber (lua_current_interpreter, __int); \
return 1;
#define LUA_RETURN_LONG(__long) \
lua_pushnumber (lua_current_interpreter, __long); \
return 1;
@ -7187,7 +7190,390 @@ weechat_lua_api_infolist_free (lua_State *L)
}
/*
* weechat_lua_api_config_new: create a new configuration file
* weechat_lua_api_hdata_get: get hdata
*/
static int
weechat_lua_api_hdata_get (lua_State *L)
{
const char *name;
char *result;
int n;
/* make C compiler happy */
(void) L;
if (!lua_current_script || !lua_current_script->name)
{
WEECHAT_SCRIPT_MSG_NOT_INIT(LUA_CURRENT_SCRIPT_NAME, "hdata_get");
LUA_RETURN_EMPTY;
}
n = lua_gettop (lua_current_interpreter);
if (n < 1)
{
WEECHAT_SCRIPT_MSG_WRONG_ARGS(LUA_CURRENT_SCRIPT_NAME, "hdata_get");
LUA_RETURN_EMPTY;
}
name = lua_tostring (lua_current_interpreter, -1);
result = script_ptr2str (weechat_hdata_get (name));
LUA_RETURN_STRING_FREE(result);
}
/*
* weechat_lua_api_hdata_get_var_type_string: get type of variable as string in
* hdata
*/
static int
weechat_lua_api_hdata_get_var_type_string (lua_State *L)
{
const char *hdata, *name, *result;
int n;
/* make C compiler happy */
(void) L;
if (!lua_current_script || !lua_current_script->name)
{
WEECHAT_SCRIPT_MSG_NOT_INIT(LUA_CURRENT_SCRIPT_NAME, "hdata_get_var_type_string");
LUA_RETURN_EMPTY;
}
n = lua_gettop (lua_current_interpreter);
if (n < 2)
{
WEECHAT_SCRIPT_MSG_WRONG_ARGS(LUA_CURRENT_SCRIPT_NAME, "hdata_get_var_type_string");
LUA_RETURN_EMPTY;
}
hdata = lua_tostring (lua_current_interpreter, -2);
name = lua_tostring (lua_current_interpreter, -1);
result = weechat_hdata_get_var_type_string (script_str2ptr (hdata), name);
LUA_RETURN_STRING(result);
}
/*
* weechat_lua_api_hdata_get_list: get list pointer in hdata
*/
static int
weechat_lua_api_hdata_get_list (lua_State *L)
{
const char *hdata, *name;
char *result;
int n;
/* make C compiler happy */
(void) L;
if (!lua_current_script || !lua_current_script->name)
{
WEECHAT_SCRIPT_MSG_NOT_INIT(LUA_CURRENT_SCRIPT_NAME, "hdata_get_list");
LUA_RETURN_EMPTY;
}
n = lua_gettop (lua_current_interpreter);
if (n < 2)
{
WEECHAT_SCRIPT_MSG_WRONG_ARGS(LUA_CURRENT_SCRIPT_NAME, "hdata_get_list");
LUA_RETURN_EMPTY;
}
hdata = lua_tostring (lua_current_interpreter, -2);
name = lua_tostring (lua_current_interpreter, -1);
result = script_ptr2str (weechat_hdata_get_list (script_str2ptr (hdata),
name));
LUA_RETURN_STRING_FREE(result);
}
/*
* weechat_lua_api_hdata_move: move pointer to another element in list
*/
static int
weechat_lua_api_hdata_move (lua_State *L)
{
const char *hdata, *pointer;
char *result;
int count, n;
/* make C compiler happy */
(void) L;
if (!lua_current_script || !lua_current_script->name)
{
WEECHAT_SCRIPT_MSG_NOT_INIT(LUA_CURRENT_SCRIPT_NAME, "hdata_move");
LUA_RETURN_EMPTY;
}
n = lua_gettop (lua_current_interpreter);
if (n < 3)
{
WEECHAT_SCRIPT_MSG_WRONG_ARGS(LUA_CURRENT_SCRIPT_NAME, "hdata_move");
LUA_RETURN_EMPTY;
}
hdata = lua_tostring (lua_current_interpreter, -3);
pointer = lua_tostring (lua_current_interpreter, -2);
count = lua_tonumber (lua_current_interpreter, -1);
result = script_ptr2str (weechat_hdata_move (script_str2ptr (hdata),
script_str2ptr (pointer),
count));
LUA_RETURN_STRING_FREE(result);
}
/*
* weechat_lua_api_hdata_integer: get integer value of a variable in structure
* using hdata
*/
static int
weechat_lua_api_hdata_integer (lua_State *L)
{
const char *hdata, *pointer, *name;
int n, value;
/* make C compiler happy */
(void) L;
if (!lua_current_script || !lua_current_script->name)
{
WEECHAT_SCRIPT_MSG_NOT_INIT(LUA_CURRENT_SCRIPT_NAME, "hdata_integer");
LUA_RETURN_INT(0);
}
n = lua_gettop (lua_current_interpreter);
if (n < 3)
{
WEECHAT_SCRIPT_MSG_WRONG_ARGS(LUA_CURRENT_SCRIPT_NAME, "hdata_integer");
LUA_RETURN_INT(0);
}
hdata = lua_tostring (lua_current_interpreter, -3);
pointer = lua_tostring (lua_current_interpreter, -2);
name = lua_tostring (lua_current_interpreter, -1);
value = weechat_hdata_integer (script_str2ptr (hdata),
script_str2ptr (pointer),
name);
LUA_RETURN_INT(value);
}
/*
* weechat_lua_api_hdata_long: get long value of a variable in structure using
* hdata
*/
static int
weechat_lua_api_hdata_long (lua_State *L)
{
const char *hdata, *pointer, *name;
long value;
int n;
/* make C compiler happy */
(void) L;
if (!lua_current_script || !lua_current_script->name)
{
WEECHAT_SCRIPT_MSG_NOT_INIT(LUA_CURRENT_SCRIPT_NAME, "hdata_long");
LUA_RETURN_LONG(0);
}
n = lua_gettop (lua_current_interpreter);
if (n < 3)
{
WEECHAT_SCRIPT_MSG_WRONG_ARGS(LUA_CURRENT_SCRIPT_NAME, "hdata_long");
LUA_RETURN_LONG(0);
}
hdata = lua_tostring (lua_current_interpreter, -3);
pointer = lua_tostring (lua_current_interpreter, -2);
name = lua_tostring (lua_current_interpreter, -1);
value = weechat_hdata_long (script_str2ptr (hdata),
script_str2ptr (pointer),
name);
LUA_RETURN_LONG(value);
}
/*
* weechat_lua_api_hdata_string: get string value of a variable in structure
* using hdata
*/
static int
weechat_lua_api_hdata_string (lua_State *L)
{
const char *hdata, *pointer, *name, *result;
int n;
/* make C compiler happy */
(void) L;
if (!lua_current_script || !lua_current_script->name)
{
WEECHAT_SCRIPT_MSG_NOT_INIT(LUA_CURRENT_SCRIPT_NAME, "hdata_string");
LUA_RETURN_EMPTY;
}
n = lua_gettop (lua_current_interpreter);
if (n < 3)
{
WEECHAT_SCRIPT_MSG_WRONG_ARGS(LUA_CURRENT_SCRIPT_NAME, "hdata_string");
LUA_RETURN_EMPTY;
}
hdata = lua_tostring (lua_current_interpreter, -3);
pointer = lua_tostring (lua_current_interpreter, -2);
name = lua_tostring (lua_current_interpreter, -1);
result = weechat_hdata_string (script_str2ptr (hdata),
script_str2ptr (pointer),
name);
LUA_RETURN_STRING(result);
}
/*
* weechat_lua_api_hdata_pointer: get pointer value of a variable in structure
* using hdata
*/
static int
weechat_lua_api_hdata_pointer (lua_State *L)
{
const char *hdata, *pointer, *name;
char *result;
int n;
/* make C compiler happy */
(void) L;
if (!lua_current_script || !lua_current_script->name)
{
WEECHAT_SCRIPT_MSG_NOT_INIT(LUA_CURRENT_SCRIPT_NAME, "hdata_pointer");
LUA_RETURN_EMPTY;
}
n = lua_gettop (lua_current_interpreter);
if (n < 3)
{
WEECHAT_SCRIPT_MSG_WRONG_ARGS(LUA_CURRENT_SCRIPT_NAME, "hdata_pointer");
LUA_RETURN_EMPTY;
}
hdata = lua_tostring (lua_current_interpreter, -3);
pointer = lua_tostring (lua_current_interpreter, -2);
name = lua_tostring (lua_current_interpreter, -1);
result = script_ptr2str (weechat_hdata_pointer (script_str2ptr (hdata),
script_str2ptr (pointer),
name));
LUA_RETURN_STRING_FREE(result);
}
/*
* weechat_lua_api_hdata_time: get time value of a variable in structure using
* hdata
*/
static int
weechat_lua_api_hdata_time (lua_State *L)
{
const char *hdata, *pointer, *name;
time_t time;
char timebuffer[64], *result;
int n;
/* make C compiler happy */
(void) L;
if (!lua_current_script || !lua_current_script->name)
{
WEECHAT_SCRIPT_MSG_NOT_INIT(LUA_CURRENT_SCRIPT_NAME, "hdata_time");
LUA_RETURN_EMPTY;
}
n = lua_gettop (lua_current_interpreter);
if (n < 3)
{
WEECHAT_SCRIPT_MSG_WRONG_ARGS(LUA_CURRENT_SCRIPT_NAME, "hdata_time");
LUA_RETURN_EMPTY;
}
hdata = lua_tostring (lua_current_interpreter, -3);
pointer = lua_tostring (lua_current_interpreter, -2);
name = lua_tostring (lua_current_interpreter, -1);
time = weechat_hdata_time (script_str2ptr (hdata),
script_str2ptr (pointer),
name);
strftime (timebuffer, sizeof (timebuffer), "%F %T", localtime (&time));
result = strdup (timebuffer);
LUA_RETURN_STRING_FREE(result);
}
/*
* weechat_lua_api_hdata_get_string: get hdata property as string
*/
static int
weechat_lua_api_hdata_get_string (lua_State *L)
{
const char *hdata, *property, *result;
int n;
/* make C compiler happy */
(void) L;
if (!lua_current_script || !lua_current_script->name)
{
WEECHAT_SCRIPT_MSG_NOT_INIT(LUA_CURRENT_SCRIPT_NAME, "hdata_get_string");
LUA_RETURN_EMPTY;
}
n = lua_gettop (lua_current_interpreter);
if (n < 2)
{
WEECHAT_SCRIPT_MSG_WRONG_ARGS(LUA_CURRENT_SCRIPT_NAME, "hdata_get_string");
LUA_RETURN_EMPTY;
}
hdata = lua_tostring (lua_current_interpreter, -2);
property = lua_tostring (lua_current_interpreter, -1);
result = weechat_hdata_get_string (script_str2ptr (hdata), property);
LUA_RETURN_STRING(result);
}
/*
* weechat_lua_api_upgrade_new: create an upgrade file
*/
static int
@ -7931,6 +8317,16 @@ const struct luaL_reg weechat_lua_api_funcs[] = {
{ "infolist_pointer", &weechat_lua_api_infolist_pointer },
{ "infolist_time", &weechat_lua_api_infolist_time },
{ "infolist_free", &weechat_lua_api_infolist_free },
{ "hdata_get", &weechat_lua_api_hdata_get },
{ "hdata_get_var_type_string", &weechat_lua_api_hdata_get_var_type_string },
{ "hdata_get_list", &weechat_lua_api_hdata_get_list },
{ "hdata_move", &weechat_lua_api_hdata_move },
{ "hdata_integer", &weechat_lua_api_hdata_integer },
{ "hdata_long", &weechat_lua_api_hdata_long },
{ "hdata_string", &weechat_lua_api_hdata_string },
{ "hdata_pointer", &weechat_lua_api_hdata_pointer },
{ "hdata_time", &weechat_lua_api_hdata_time },
{ "hdata_get_string", &weechat_lua_api_hdata_get_string },
{ "upgrade_new", &weechat_lua_api_upgrade_new },
{ "upgrade_write_object", &weechat_lua_api_upgrade_write_object },
{ "upgrade_read", &weechat_lua_api_upgrade_read },

View File

@ -39,29 +39,32 @@
#define PERL_RETURN_OK XSRETURN_YES
#define PERL_RETURN_ERROR XSRETURN_NO
#define PERL_RETURN_EMPTY XSRETURN_EMPTY
#define PERL_RETURN_STRING(__string) \
if (__string) \
{ \
XST_mPV (0, __string); \
XSRETURN (1); \
} \
XST_mPV (0, ""); \
#define PERL_RETURN_STRING(__string) \
if (__string) \
{ \
XST_mPV (0, __string); \
XSRETURN (1); \
} \
XST_mPV (0, ""); \
XSRETURN (1)
#define PERL_RETURN_STRING_FREE(__string) \
if (__string) \
{ \
XST_mPV (0, __string); \
free (__string); \
XSRETURN (1); \
} \
XST_mPV (0, ""); \
#define PERL_RETURN_STRING_FREE(__string) \
if (__string) \
{ \
XST_mPV (0, __string); \
free (__string); \
XSRETURN (1); \
} \
XST_mPV (0, ""); \
XSRETURN (1)
#define PERL_RETURN_INT(__int) \
XST_mIV (0, __int); \
#define PERL_RETURN_INT(__int) \
XST_mIV (0, __int); \
XSRETURN (1);
#define PERL_RETURN_OBJ(__obj) \
ST (0) = newRV_inc((SV *)__obj); \
if (SvREFCNT(ST(0))) sv_2mortal(ST(0)); \
#define PERL_RETURN_LONG(__long) \
XST_mIV (0, __long); \
XSRETURN (1);
#define PERL_RETURN_OBJ(__obj) \
ST (0) = newRV_inc((SV *)__obj); \
if (SvREFCNT(ST(0))) sv_2mortal(ST(0)); \
XSRETURN (1);
@ -6501,6 +6504,358 @@ XS (XS_weechat_api_infolist_free)
PERL_RETURN_OK;
}
/*
* weechat::hdata_get: get hdata
*/
XS (XS_weechat_api_hdata_get)
{
char *result, *name;
dXSARGS;
/* make C compiler happy */
(void) cv;
if (!perl_current_script || !perl_current_script->name)
{
WEECHAT_SCRIPT_MSG_NOT_INIT(PERL_CURRENT_SCRIPT_NAME, "hdata_get");
PERL_RETURN_EMPTY;
}
if (items < 1)
{
WEECHAT_SCRIPT_MSG_WRONG_ARGS(PERL_CURRENT_SCRIPT_NAME, "hdata_get");
PERL_RETURN_EMPTY;
}
name = SvPV (ST (0), PL_na);
result = script_ptr2str (weechat_hdata_get (name));
PERL_RETURN_STRING_FREE(result);
}
/*
* weechat::hdata_get_var_type_string: get type of variable as string in hdata
*/
XS (XS_weechat_api_hdata_get_var_type_string)
{
const char *result;
char *hdata, *name;
dXSARGS;
/* make C compiler happy */
(void) cv;
if (!perl_current_script || !perl_current_script->name)
{
WEECHAT_SCRIPT_MSG_NOT_INIT(PERL_CURRENT_SCRIPT_NAME, "hdata_get_var_type_string");
PERL_RETURN_EMPTY;
}
if (items < 2)
{
WEECHAT_SCRIPT_MSG_WRONG_ARGS(PERL_CURRENT_SCRIPT_NAME, "hdata_get_var_type_string");
PERL_RETURN_EMPTY;
}
hdata = SvPV (ST (0), PL_na);
name = SvPV (ST (1), PL_na);
result = weechat_hdata_get_var_type_string (script_str2ptr (hdata), name);
PERL_RETURN_STRING(result);
}
/*
* weechat::hdata_get_list: get list pointer in hdata
*/
XS (XS_weechat_api_hdata_get_list)
{
char *hdata, *name;
char *result;
dXSARGS;
/* make C compiler happy */
(void) cv;
if (!perl_current_script || !perl_current_script->name)
{
WEECHAT_SCRIPT_MSG_NOT_INIT(PERL_CURRENT_SCRIPT_NAME, "hdata_get_list");
PERL_RETURN_EMPTY;
}
if (items < 2)
{
WEECHAT_SCRIPT_MSG_WRONG_ARGS(PERL_CURRENT_SCRIPT_NAME, "hdata_get_list");
PERL_RETURN_EMPTY;
}
hdata = SvPV (ST (0), PL_na);
name = SvPV (ST (1), PL_na);
result = script_ptr2str (weechat_hdata_get_list (script_str2ptr (hdata),
name));
PERL_RETURN_STRING_FREE(result);
}
/*
* weechat::hdata_move: move pointer to another element in list
*/
XS (XS_weechat_api_hdata_move)
{
char *result, *hdata, *pointer;
int count;
dXSARGS;
/* make C compiler happy */
(void) cv;
if (!perl_current_script || !perl_current_script->name)
{
WEECHAT_SCRIPT_MSG_NOT_INIT(PERL_CURRENT_SCRIPT_NAME, "hdata_move");
PERL_RETURN_EMPTY;
}
if (items < 3)
{
WEECHAT_SCRIPT_MSG_WRONG_ARGS(PERL_CURRENT_SCRIPT_NAME, "hdata_move");
PERL_RETURN_EMPTY;
}
hdata = SvPV (ST (0), PL_na);
pointer = SvPV (ST (1), PL_na);
count = SvIV(ST (2));
result = script_ptr2str (weechat_hdata_move (script_str2ptr (hdata),
script_str2ptr (pointer),
count));
PERL_RETURN_STRING_FREE(result);
}
/*
* weechat::hdata_integer: get integer value of a variable in structure using
* hdata
*/
XS (XS_weechat_api_hdata_integer)
{
char *hdata, *pointer, *name;
int value;
dXSARGS;
/* make C compiler happy */
(void) cv;
if (!perl_current_script || !perl_current_script->name)
{
WEECHAT_SCRIPT_MSG_NOT_INIT(PERL_CURRENT_SCRIPT_NAME, "hdata_integer");
PERL_RETURN_INT(0);
}
if (items < 3)
{
WEECHAT_SCRIPT_MSG_WRONG_ARGS(PERL_CURRENT_SCRIPT_NAME, "hdata_integer");
PERL_RETURN_INT(0);
}
hdata = SvPV (ST (0), PL_na);
pointer = SvPV (ST (1), PL_na);
name = SvPV (ST (2), PL_na);
value = weechat_hdata_integer (script_str2ptr (hdata),
script_str2ptr (pointer),
name);
PERL_RETURN_INT(value);
}
/*
* weechat::hdata_long: get long value of a variable in structure using hdata
*/
XS (XS_weechat_api_hdata_long)
{
char *hdata, *pointer, *name;
long value;
dXSARGS;
/* make C compiler happy */
(void) cv;
if (!perl_current_script || !perl_current_script->name)
{
WEECHAT_SCRIPT_MSG_NOT_INIT(PERL_CURRENT_SCRIPT_NAME, "hdata_long");
PERL_RETURN_LONG(0);
}
if (items < 3)
{
WEECHAT_SCRIPT_MSG_WRONG_ARGS(PERL_CURRENT_SCRIPT_NAME, "hdata_long");
PERL_RETURN_LONG(0);
}
hdata = SvPV (ST (0), PL_na);
pointer = SvPV (ST (1), PL_na);
name = SvPV (ST (2), PL_na);
value = weechat_hdata_long (script_str2ptr (hdata),
script_str2ptr (pointer),
name);
PERL_RETURN_LONG(value);
}
/*
* weechat::hdata_string: get string value of a variable in structure using
* hdata
*/
XS (XS_weechat_api_hdata_string)
{
char *hdata, *pointer, *name;
const char *result;
dXSARGS;
/* make C compiler happy */
(void) cv;
if (!perl_current_script || !perl_current_script->name)
{
WEECHAT_SCRIPT_MSG_NOT_INIT(PERL_CURRENT_SCRIPT_NAME, "hdata_string");
PERL_RETURN_EMPTY;
}
if (items < 3)
{
WEECHAT_SCRIPT_MSG_WRONG_ARGS(PERL_CURRENT_SCRIPT_NAME, "hdata_string");
PERL_RETURN_EMPTY;
}
hdata = SvPV (ST (0), PL_na);
pointer = SvPV (ST (1), PL_na);
name = SvPV (ST (2), PL_na);
result = weechat_hdata_string (script_str2ptr (hdata),
script_str2ptr (pointer),
name);
PERL_RETURN_STRING(result);
}
/*
* weechat::hdata_pointer: get pointer value of a variable in structure using
* hdata
*/
XS (XS_weechat_api_hdata_pointer)
{
char *hdata, *pointer, *name;
char *result;
dXSARGS;
/* make C compiler happy */
(void) cv;
if (!perl_current_script || !perl_current_script->name)
{
WEECHAT_SCRIPT_MSG_NOT_INIT(PERL_CURRENT_SCRIPT_NAME, "hdata_pointer");
PERL_RETURN_EMPTY;
}
if (items < 3)
{
WEECHAT_SCRIPT_MSG_WRONG_ARGS(PERL_CURRENT_SCRIPT_NAME, "hdata_pointer");
PERL_RETURN_EMPTY;
}
hdata = SvPV (ST (0), PL_na);
pointer = SvPV (ST (1), PL_na);
name = SvPV (ST (2), PL_na);
result = script_ptr2str (weechat_hdata_pointer (script_str2ptr (hdata),
script_str2ptr (pointer),
name));
PERL_RETURN_STRING_FREE(result);
}
/*
* weechat::hdata_time: get time value of a variable in structure using hdata
*/
XS (XS_weechat_api_hdata_time)
{
time_t time;
char timebuffer[64], *result, *hdata, *pointer, *name;
dXSARGS;
/* make C compiler happy */
(void) cv;
if (!perl_current_script || !perl_current_script->name)
{
WEECHAT_SCRIPT_MSG_NOT_INIT(PERL_CURRENT_SCRIPT_NAME, "hdata_time");
PERL_RETURN_EMPTY;
}
if (items < 3)
{
WEECHAT_SCRIPT_MSG_WRONG_ARGS(PERL_CURRENT_SCRIPT_NAME, "hdata_time");
PERL_RETURN_EMPTY;
}
hdata = SvPV (ST (0), PL_na);
pointer = SvPV (ST (1), PL_na);
name = SvPV (ST (2), PL_na);
time = weechat_hdata_time (script_str2ptr (hdata),
script_str2ptr (pointer),
name);
strftime (timebuffer, sizeof (timebuffer), "%F %T", localtime (&time));
result = strdup (timebuffer);
PERL_RETURN_STRING_FREE(result);
}
/*
* weechat::hdata_get_string: get hdata property as string
*/
XS (XS_weechat_api_hdata_get_string)
{
char *hdata, *property;
const char *result;
dXSARGS;
/* make C compiler happy */
(void) cv;
if (!perl_current_script || !perl_current_script->name)
{
WEECHAT_SCRIPT_MSG_NOT_INIT(PERL_CURRENT_SCRIPT_NAME, "hdata_get_string");
PERL_RETURN_EMPTY;
}
if (items < 2)
{
WEECHAT_SCRIPT_MSG_WRONG_ARGS(PERL_CURRENT_SCRIPT_NAME, "hdata_get_string");
PERL_RETURN_EMPTY;
}
hdata = SvPV (ST (0), PL_na);
property = SvPV (ST (1), PL_na);
result = weechat_hdata_get_string (script_str2ptr (hdata), property);
PERL_RETURN_STRING(result);
}
/*
* weechat::upgrade_new: create an upgrade file
*/
@ -6857,6 +7212,16 @@ weechat_perl_api_init (pTHX)
newXS ("weechat::infolist_pointer", XS_weechat_api_infolist_pointer, "weechat");
newXS ("weechat::infolist_time", XS_weechat_api_infolist_time, "weechat");
newXS ("weechat::infolist_free", XS_weechat_api_infolist_free, "weechat");
newXS ("weechat::hdata_get", XS_weechat_api_hdata_get, "weechat");
newXS ("weechat::hdata_get_var_type_string", XS_weechat_api_hdata_get_var_type_string, "weechat");
newXS ("weechat::hdata_get_list", XS_weechat_api_hdata_get_list, "weechat");
newXS ("weechat::hdata_move", XS_weechat_api_hdata_move, "weechat");
newXS ("weechat::hdata_integer", XS_weechat_api_hdata_integer, "weechat");
newXS ("weechat::hdata_long", XS_weechat_api_hdata_long, "weechat");
newXS ("weechat::hdata_string", XS_weechat_api_hdata_string, "weechat");
newXS ("weechat::hdata_pointer", XS_weechat_api_hdata_pointer, "weechat");
newXS ("weechat::hdata_time", XS_weechat_api_hdata_time, "weechat");
newXS ("weechat::hdata_get_string", XS_weechat_api_hdata_get_string, "weechat");
newXS ("weechat::upgrade_new", XS_weechat_api_upgrade_new, "weechat");
newXS ("weechat::upgrade_write_object", XS_weechat_api_upgrade_write_object, "weechat");
newXS ("weechat::upgrade_read", XS_weechat_api_upgrade_read, "weechat");

View File

@ -36,23 +36,25 @@
#define PYTHON_RETURN_OK return Py_BuildValue ("i", 1);
#define PYTHON_RETURN_ERROR return Py_BuildValue ("i", 0);
#define PYTHON_RETURN_EMPTY \
Py_INCREF(Py_None); \
#define PYTHON_RETURN_EMPTY \
Py_INCREF(Py_None); \
return Py_None;
#define PYTHON_RETURN_STRING(__string) \
if (__string) \
return Py_BuildValue ("s", __string); \
#define PYTHON_RETURN_STRING(__string) \
if (__string) \
return Py_BuildValue ("s", __string); \
return Py_BuildValue ("s", "")
#define PYTHON_RETURN_STRING_FREE(__string) \
if (__string) \
{ \
object = Py_BuildValue ("s", __string); \
free (__string); \
return object; \
} \
#define PYTHON_RETURN_STRING_FREE(__string) \
if (__string) \
{ \
object = Py_BuildValue ("s", __string); \
free (__string); \
return object; \
} \
return Py_BuildValue ("s", "")
#define PYTHON_RETURN_INT(__int) \
#define PYTHON_RETURN_INT(__int) \
return Py_BuildValue("i", __int);
#define PYTHON_RETURN_LONG(__long) \
return Py_BuildValue("l", __long);
/*
@ -6841,6 +6843,364 @@ weechat_python_api_infolist_free (PyObject *self, PyObject *args)
PYTHON_RETURN_OK;
}
/*
* weechat_python_api_hdata_get: get hdata
*/
static PyObject *
weechat_python_api_hdata_get (PyObject *self, PyObject *args)
{
char *name, *result;
PyObject *object;
/* make C compiler happy */
(void) self;
if (!python_current_script || !python_current_script->name)
{
WEECHAT_SCRIPT_MSG_NOT_INIT(PYTHON_CURRENT_SCRIPT_NAME, "hdata_get");
PYTHON_RETURN_EMPTY;
}
name = NULL;
if (!PyArg_ParseTuple (args, "s", &name))
{
WEECHAT_SCRIPT_MSG_WRONG_ARGS(PYTHON_CURRENT_SCRIPT_NAME, "hdata_get");
PYTHON_RETURN_EMPTY;
}
result = script_ptr2str (weechat_hdata_get (name));
PYTHON_RETURN_STRING_FREE(result);
}
/*
* weechat_python_api_hdata_get_var_type_string: get type of variable as string
* in hdata
*/
static PyObject *
weechat_python_api_hdata_get_var_type_string (PyObject *self, PyObject *args)
{
char *hdata, *name;
const char *result;
/* make C compiler happy */
(void) self;
if (!python_current_script || !python_current_script->name)
{
WEECHAT_SCRIPT_MSG_NOT_INIT(PYTHON_CURRENT_SCRIPT_NAME, "hdata_get_var_type_string");
PYTHON_RETURN_EMPTY;
}
hdata = NULL;
name = NULL;
if (!PyArg_ParseTuple (args, "ss", &hdata, &name))
{
WEECHAT_SCRIPT_MSG_WRONG_ARGS(PYTHON_CURRENT_SCRIPT_NAME, "hdata_get_var_type_string");
PYTHON_RETURN_EMPTY;
}
result = weechat_hdata_get_var_type_string (script_str2ptr (hdata), name);
PYTHON_RETURN_STRING(result);
}
/*
* weechat_python_api_hdata_get_list: get list pointer in hdata
*/
static PyObject *
weechat_python_api_hdata_get_list (PyObject *self, PyObject *args)
{
char *hdata, *name, *result;
PyObject *object;
/* make C compiler happy */
(void) self;
if (!python_current_script || !python_current_script->name)
{
WEECHAT_SCRIPT_MSG_NOT_INIT(PYTHON_CURRENT_SCRIPT_NAME, "hdata_get_list");
PYTHON_RETURN_EMPTY;
}
hdata = NULL;
name = NULL;
if (!PyArg_ParseTuple (args, "ss", &hdata, &name))
{
WEECHAT_SCRIPT_MSG_WRONG_ARGS(PYTHON_CURRENT_SCRIPT_NAME, "hdata_get_list");
PYTHON_RETURN_EMPTY;
}
result = script_ptr2str (weechat_hdata_get_list (script_str2ptr (hdata),
name));
PYTHON_RETURN_STRING_FREE(result);
}
/*
* weechat_python_api_hdata_move: move pointer to another element in list
*/
static PyObject *
weechat_python_api_hdata_move (PyObject *self, PyObject *args)
{
char *result, *hdata, *pointer;
int count;
PyObject *object;
/* make C compiler happy */
(void) self;
if (!python_current_script || !python_current_script->name)
{
WEECHAT_SCRIPT_MSG_NOT_INIT(PYTHON_CURRENT_SCRIPT_NAME, "hdata_move");
PYTHON_RETURN_EMPTY;
}
hdata = NULL;
pointer = NULL;
count = 0;
if (!PyArg_ParseTuple (args, "ssi", &hdata, &pointer, &count))
{
WEECHAT_SCRIPT_MSG_WRONG_ARGS(PYTHON_CURRENT_SCRIPT_NAME, "hdata_move");
PYTHON_RETURN_EMPTY;
}
result = script_ptr2str (weechat_hdata_move (script_str2ptr (hdata),
script_str2ptr (pointer),
count));
PYTHON_RETURN_STRING_FREE(result);
}
/*
* weechat_python_api_hdata_integer: get integer value of a variable in
* structure using hdata
*/
static PyObject *
weechat_python_api_hdata_integer (PyObject *self, PyObject *args)
{
char *hdata, *pointer, *name;
int value;
/* make C compiler happy */
(void) self;
if (!python_current_script || !python_current_script->name)
{
WEECHAT_SCRIPT_MSG_NOT_INIT(PYTHON_CURRENT_SCRIPT_NAME, "hdata_integer");
PYTHON_RETURN_INT(0);
}
hdata = NULL;
pointer = NULL;
name = NULL;
if (!PyArg_ParseTuple (args, "sss", &hdata, &pointer, &name))
{
WEECHAT_SCRIPT_MSG_WRONG_ARGS(PYTHON_CURRENT_SCRIPT_NAME, "hdata_integer");
PYTHON_RETURN_INT(0);
}
value = weechat_hdata_integer (script_str2ptr (hdata),
script_str2ptr (pointer),
name);
PYTHON_RETURN_INT(value);
}
/*
* weechat_python_api_hdata_long: get long value of a variable in structure
* using hdata
*/
static PyObject *
weechat_python_api_hdata_long (PyObject *self, PyObject *args)
{
char *hdata, *pointer, *name;
long value;
/* make C compiler happy */
(void) self;
if (!python_current_script || !python_current_script->name)
{
WEECHAT_SCRIPT_MSG_NOT_INIT(PYTHON_CURRENT_SCRIPT_NAME, "hdata_long");
PYTHON_RETURN_LONG(0);
}
hdata = NULL;
pointer = NULL;
name = NULL;
if (!PyArg_ParseTuple (args, "sss", &hdata, &pointer, &name))
{
WEECHAT_SCRIPT_MSG_WRONG_ARGS(PYTHON_CURRENT_SCRIPT_NAME, "hdata_long");
PYTHON_RETURN_LONG(0);
}
value = weechat_hdata_long (script_str2ptr (hdata),
script_str2ptr (pointer),
name);
PYTHON_RETURN_LONG(value);
}
/*
* weechat_python_api_hdata_string: get string value of a variable in structure
* using hdata
*/
static PyObject *
weechat_python_api_hdata_string (PyObject *self, PyObject *args)
{
char *hdata, *pointer, *name;
const char *result;
/* make C compiler happy */
(void) self;
if (!python_current_script || !python_current_script->name)
{
WEECHAT_SCRIPT_MSG_NOT_INIT(PYTHON_CURRENT_SCRIPT_NAME, "hdata_string");
PYTHON_RETURN_EMPTY;
}
hdata = NULL;
pointer = NULL;
name = NULL;
if (!PyArg_ParseTuple (args, "sss", &hdata, &pointer, &name))
{
WEECHAT_SCRIPT_MSG_WRONG_ARGS(PYTHON_CURRENT_SCRIPT_NAME, "hdata_string");
PYTHON_RETURN_EMPTY;
}
result = weechat_hdata_string (script_str2ptr (hdata),
script_str2ptr (pointer),
name);
PYTHON_RETURN_STRING(result);
}
/*
* weechat_python_api_hdata_pointer: get pointer value of a variable in
* structure using hdata
*/
static PyObject *
weechat_python_api_hdata_pointer (PyObject *self, PyObject *args)
{
char *hdata, *pointer, *name, *result;
PyObject *object;
/* make C compiler happy */
(void) self;
if (!python_current_script || !python_current_script->name)
{
WEECHAT_SCRIPT_MSG_NOT_INIT(PYTHON_CURRENT_SCRIPT_NAME, "hdata_pointer");
PYTHON_RETURN_EMPTY;
}
hdata = NULL;
pointer = NULL;
name = NULL;
if (!PyArg_ParseTuple (args, "sss", &hdata, &pointer, &name))
{
WEECHAT_SCRIPT_MSG_WRONG_ARGS(PYTHON_CURRENT_SCRIPT_NAME, "hdata_pointer");
PYTHON_RETURN_EMPTY;
}
result = script_ptr2str (weechat_hdata_pointer (script_str2ptr (hdata),
script_str2ptr (pointer),
name));
PYTHON_RETURN_STRING_FREE(result);
}
/*
* weechat_python_api_hdata_time: get time value of a variable in structure
* using hdata
*/
static PyObject *
weechat_python_api_hdata_time (PyObject *self, PyObject *args)
{
char *hdata, *pointer, *name, timebuffer[64], *result;
time_t time;
PyObject *object;
/* make C compiler happy */
(void) self;
if (!python_current_script || !python_current_script->name)
{
WEECHAT_SCRIPT_MSG_NOT_INIT(PYTHON_CURRENT_SCRIPT_NAME, "hdata_time");
PYTHON_RETURN_EMPTY;
}
hdata = NULL;
pointer = NULL;
name = NULL;
if (!PyArg_ParseTuple (args, "sss", &hdata, &pointer, &name))
{
WEECHAT_SCRIPT_MSG_WRONG_ARGS(PYTHON_CURRENT_SCRIPT_NAME, "hdata_time");
PYTHON_RETURN_EMPTY;
}
time = weechat_hdata_time (script_str2ptr (hdata),
script_str2ptr (pointer),
name);
strftime (timebuffer, sizeof (timebuffer), "%F %T", localtime (&time));
result = strdup (timebuffer);
PYTHON_RETURN_STRING_FREE(result);
}
/*
* weechat_python_api_hdata_get_string: get hdata property as string
*/
static PyObject *
weechat_python_api_hdata_get_string (PyObject *self, PyObject *args)
{
char *hdata, *property;
const char *result;
/* make C compiler happy */
(void) self;
if (!python_current_script || !python_current_script->name)
{
WEECHAT_SCRIPT_MSG_NOT_INIT(PYTHON_CURRENT_SCRIPT_NAME, "hdata_get_string");
PYTHON_RETURN_EMPTY;
}
hdata = NULL;
property = NULL;
if (!PyArg_ParseTuple (args, "ss", &hdata, &property))
{
WEECHAT_SCRIPT_MSG_WRONG_ARGS(PYTHON_CURRENT_SCRIPT_NAME, "hdata_get_string");
PYTHON_RETURN_EMPTY;
}
result = weechat_hdata_get_string (script_str2ptr (hdata), property);
PYTHON_RETURN_STRING(result);
}
/*
* weechat_python_api_upgrade_new: create an upgrade file
*/
@ -7194,6 +7554,16 @@ PyMethodDef weechat_python_funcs[] =
{ "infolist_pointer", &weechat_python_api_infolist_pointer, METH_VARARGS, "" },
{ "infolist_time", &weechat_python_api_infolist_time, METH_VARARGS, "" },
{ "infolist_free", &weechat_python_api_infolist_free, METH_VARARGS, "" },
{ "hdata_get", &weechat_python_api_hdata_get, METH_VARARGS, "" },
{ "hdata_get_var_type_string", &weechat_python_api_hdata_get_var_type_string, METH_VARARGS, "" },
{ "hdata_get_list", &weechat_python_api_hdata_get_list, METH_VARARGS, "" },
{ "hdata_move", &weechat_python_api_hdata_move, METH_VARARGS, "" },
{ "hdata_integer", &weechat_python_api_hdata_integer, METH_VARARGS, "" },
{ "hdata_long", &weechat_python_api_hdata_long, METH_VARARGS, "" },
{ "hdata_string", &weechat_python_api_hdata_string, METH_VARARGS, "" },
{ "hdata_pointer", &weechat_python_api_hdata_pointer, METH_VARARGS, "" },
{ "hdata_time", &weechat_python_api_hdata_time, METH_VARARGS, "" },
{ "hdata_get_string", &weechat_python_api_hdata_get_string, METH_VARARGS, "" },
{ "upgrade_new", &weechat_python_api_upgrade_new, METH_VARARGS, "" },
{ "upgrade_write_object", &weechat_python_api_upgrade_write_object, METH_VARARGS, "" },
{ "upgrade_read", &weechat_python_api_upgrade_read, METH_VARARGS, "" },

View File

@ -36,20 +36,22 @@
#define RUBY_RETURN_OK return INT2FIX (1);
#define RUBY_RETURN_ERROR return INT2FIX (0);
#define RUBY_RETURN_EMPTY return Qnil;
#define RUBY_RETURN_STRING(__string) \
if (__string) \
return rb_str_new2 (__string); \
#define RUBY_RETURN_STRING(__string) \
if (__string) \
return rb_str_new2 (__string); \
return rb_str_new2 ("")
#define RUBY_RETURN_STRING_FREE(__string) \
if (__string) \
{ \
return_value = rb_str_new2 (__string); \
free (__string); \
return return_value; \
} \
#define RUBY_RETURN_STRING_FREE(__string) \
if (__string) \
{ \
return_value = rb_str_new2 (__string); \
free (__string); \
return return_value; \
} \
return rb_str_new2 ("")
#define RUBY_RETURN_INT(__int) \
#define RUBY_RETURN_INT(__int) \
return INT2FIX(__int);
#define RUBY_RETURN_LONG(__long) \
return LONG2FIX(__long);
/*
@ -7454,6 +7456,407 @@ weechat_ruby_api_infolist_free (VALUE class, VALUE infolist)
RUBY_RETURN_OK;
}
/*
* weechat_ruby_api_hdata_get: get hdata
*/
static VALUE
weechat_ruby_api_hdata_get (VALUE class, VALUE name)
{
char *c_name, *result;
VALUE return_value;
/* make C compiler happy */
(void) class;
if (!ruby_current_script || !ruby_current_script->name)
{
WEECHAT_SCRIPT_MSG_NOT_INIT(RUBY_CURRENT_SCRIPT_NAME, "hdata_get");
RUBY_RETURN_EMPTY;
}
if (NIL_P (name))
{
WEECHAT_SCRIPT_MSG_WRONG_ARGS(RUBY_CURRENT_SCRIPT_NAME, "hdata_get");
RUBY_RETURN_EMPTY;
}
Check_Type (name, T_STRING);
c_name = StringValuePtr (name);
result = script_ptr2str (weechat_hdata_get (c_name));
RUBY_RETURN_STRING_FREE(result);
}
/*
* weechat_ruby_api_hdata_get_var_type_string: get type of variable as string
* in hdata
*/
static VALUE
weechat_ruby_api_hdata_get_var_type_string (VALUE class, VALUE hdata,
VALUE name)
{
char *c_hdata, *c_name;
const char *result;
/* make C compiler happy */
(void) class;
if (!ruby_current_script || !ruby_current_script->name)
{
WEECHAT_SCRIPT_MSG_NOT_INIT(RUBY_CURRENT_SCRIPT_NAME, "hdata_get_var_type_string");
RUBY_RETURN_EMPTY;
}
if (NIL_P (hdata) || NIL_P (name))
{
WEECHAT_SCRIPT_MSG_WRONG_ARGS(RUBY_CURRENT_SCRIPT_NAME, "hdata_get_var_type_string");
RUBY_RETURN_EMPTY;
}
Check_Type (hdata, T_STRING);
Check_Type (name, T_STRING);
c_hdata = StringValuePtr (hdata);
c_name = StringValuePtr (name);
result = weechat_hdata_get_var_type_string (script_str2ptr (c_hdata), c_name);
RUBY_RETURN_STRING(result);
}
/*
* weechat_ruby_api_hdata_get_list: get list pointer in hdata
*/
static VALUE
weechat_ruby_api_hdata_get_list (VALUE class, VALUE hdata, VALUE name)
{
char *c_hdata, *c_name, *result;
VALUE return_value;
/* make C compiler happy */
(void) class;
if (!ruby_current_script || !ruby_current_script->name)
{
WEECHAT_SCRIPT_MSG_NOT_INIT(RUBY_CURRENT_SCRIPT_NAME, "hdata_get_list");
RUBY_RETURN_EMPTY;
}
if (NIL_P (hdata) || NIL_P (name))
{
WEECHAT_SCRIPT_MSG_WRONG_ARGS(RUBY_CURRENT_SCRIPT_NAME, "hdata_get_list");
RUBY_RETURN_EMPTY;
}
Check_Type (hdata, T_STRING);
Check_Type (name, T_STRING);
c_hdata = StringValuePtr (hdata);
c_name = StringValuePtr (name);
result = script_ptr2str (weechat_hdata_get_list (script_str2ptr (c_hdata),
c_name));
RUBY_RETURN_STRING_FREE(result);
}
/*
* weechat_ruby_api_hdata_move: move pointer to another element in list
*/
static VALUE
weechat_ruby_api_hdata_move (VALUE class, VALUE hdata, VALUE pointer,
VALUE count)
{
char *c_hdata, *c_pointer, *result;
int c_count;
VALUE return_value;
/* make C compiler happy */
(void) class;
if (!ruby_current_script || !ruby_current_script->name)
{
WEECHAT_SCRIPT_MSG_NOT_INIT(RUBY_CURRENT_SCRIPT_NAME, "hdata_move");
RUBY_RETURN_EMPTY;
}
if (NIL_P (hdata) || NIL_P (pointer) || NIL_P (count))
{
WEECHAT_SCRIPT_MSG_WRONG_ARGS(RUBY_CURRENT_SCRIPT_NAME, "hdata_move");
RUBY_RETURN_EMPTY;
}
Check_Type (hdata, T_STRING);
Check_Type (pointer, T_STRING);
Check_Type (count, T_FIXNUM);
c_hdata = StringValuePtr (hdata);
c_pointer = StringValuePtr (pointer);
c_count = FIX2INT (count);
result = weechat_hdata_move (script_str2ptr (c_hdata),
script_str2ptr (c_pointer),
c_count);
RUBY_RETURN_STRING_FREE(result);
}
/*
* weechat_ruby_api_hdata_integer: get integer value of a variable in structure
* using hdata
*/
static VALUE
weechat_ruby_api_hdata_integer (VALUE class, VALUE hdata, VALUE pointer,
VALUE name)
{
char *c_hdata, *c_pointer, *c_name;
int value;
/* make C compiler happy */
(void) class;
if (!ruby_current_script || !ruby_current_script->name)
{
WEECHAT_SCRIPT_MSG_NOT_INIT(RUBY_CURRENT_SCRIPT_NAME, "hdata_integer");
RUBY_RETURN_INT(0);
}
if (NIL_P (hdata) || NIL_P (pointer) || NIL_P (name))
{
WEECHAT_SCRIPT_MSG_WRONG_ARGS(RUBY_CURRENT_SCRIPT_NAME, "hdata_integer");
RUBY_RETURN_INT(0);
}
Check_Type (hdata, T_STRING);
Check_Type (pointer, T_STRING);
Check_Type (name, T_STRING);
c_hdata = StringValuePtr (hdata);
c_pointer = StringValuePtr (pointer);
c_name = StringValuePtr (name);
value = weechat_hdata_integer (script_str2ptr (c_hdata),
script_str2ptr (c_pointer),
c_name);
RUBY_RETURN_INT(value);
}
/*
* weechat_ruby_api_hdata_long: get long value of a variable in structure using
* hdata
*/
static VALUE
weechat_ruby_api_hdata_long (VALUE class, VALUE hdata, VALUE pointer,
VALUE name)
{
char *c_hdata, *c_pointer, *c_name;
long value;
/* make C compiler happy */
(void) class;
if (!ruby_current_script || !ruby_current_script->name)
{
WEECHAT_SCRIPT_MSG_NOT_INIT(RUBY_CURRENT_SCRIPT_NAME, "hdata_long");
RUBY_RETURN_LONG(0);
}
if (NIL_P (hdata) || NIL_P (pointer) || NIL_P (name))
{
WEECHAT_SCRIPT_MSG_WRONG_ARGS(RUBY_CURRENT_SCRIPT_NAME, "hdata_long");
RUBY_RETURN_LONG(0);
}
Check_Type (hdata, T_STRING);
Check_Type (pointer, T_STRING);
Check_Type (name, T_STRING);
c_hdata = StringValuePtr (hdata);
c_pointer = StringValuePtr (pointer);
c_name = StringValuePtr (name);
value = weechat_hdata_long (script_str2ptr (c_hdata),
script_str2ptr (c_pointer),
c_name);
RUBY_RETURN_LONG(value);
}
/*
* weechat_ruby_api_hdata_string: get string value of a variable in structure
* using hdata
*/
static VALUE
weechat_ruby_api_hdata_string (VALUE class, VALUE hdata, VALUE pointer,
VALUE name)
{
char *c_hdata, *c_pointer, *c_name;
const char *result;
/* make C compiler happy */
(void) class;
if (!ruby_current_script || !ruby_current_script->name)
{
WEECHAT_SCRIPT_MSG_NOT_INIT(RUBY_CURRENT_SCRIPT_NAME, "hdata_string");
RUBY_RETURN_EMPTY;
}
if (NIL_P (hdata) || NIL_P (pointer) || NIL_P (name))
{
WEECHAT_SCRIPT_MSG_WRONG_ARGS(RUBY_CURRENT_SCRIPT_NAME, "hdata_string");
RUBY_RETURN_EMPTY;
}
Check_Type (hdata, T_STRING);
Check_Type (pointer, T_STRING);
Check_Type (name, T_STRING);
c_hdata = StringValuePtr (hdata);
c_pointer = StringValuePtr (pointer);
c_name = StringValuePtr (name);
result = weechat_hdata_string (script_str2ptr (c_hdata),
script_str2ptr (c_pointer),
c_name);
RUBY_RETURN_STRING(result);
}
/*
* weechat_ruby_api_hdata_pointer: get pointer value of a variable in structure
* using hdata
*/
static VALUE
weechat_ruby_api_hdata_pointer (VALUE class, VALUE hdata, VALUE pointer,
VALUE name)
{
char *c_hdata, *c_pointer, *c_name, *result;
VALUE return_value;
/* make C compiler happy */
(void) class;
if (!ruby_current_script || !ruby_current_script->name)
{
WEECHAT_SCRIPT_MSG_NOT_INIT(RUBY_CURRENT_SCRIPT_NAME, "hdata_pointer");
RUBY_RETURN_EMPTY;
}
if (NIL_P (hdata) || NIL_P (pointer) || NIL_P (name))
{
WEECHAT_SCRIPT_MSG_WRONG_ARGS(RUBY_CURRENT_SCRIPT_NAME, "hdata_pointer");
RUBY_RETURN_EMPTY;
}
Check_Type (hdata, T_STRING);
Check_Type (pointer, T_STRING);
Check_Type (name, T_STRING);
c_hdata = StringValuePtr (hdata);
c_pointer = StringValuePtr (pointer);
c_name = StringValuePtr (name);
result = script_ptr2str (weechat_hdata_pointer (script_str2ptr (c_hdata),
script_str2ptr (c_pointer),
c_name));
RUBY_RETURN_STRING_FREE(result);
}
/*
* weechat_ruby_api_hdata_time: get time value of a variable in structure using
* hdata
*/
static VALUE
weechat_ruby_api_hdata_time (VALUE class, VALUE hdata, VALUE pointer,
VALUE name)
{
char *c_hdata, *c_pointer, *c_name, timebuffer[64], *result;
time_t time;
VALUE return_value;
/* make C compiler happy */
(void) class;
if (!ruby_current_script || !ruby_current_script->name)
{
WEECHAT_SCRIPT_MSG_NOT_INIT(RUBY_CURRENT_SCRIPT_NAME, "hdata_time");
RUBY_RETURN_EMPTY;
}
if (NIL_P (hdata) || NIL_P (pointer) || NIL_P (name))
{
WEECHAT_SCRIPT_MSG_WRONG_ARGS(RUBY_CURRENT_SCRIPT_NAME, "hdata_time");
RUBY_RETURN_EMPTY;
}
Check_Type (hdata, T_STRING);
Check_Type (pointer, T_STRING);
Check_Type (name, T_STRING);
c_hdata = StringValuePtr (hdata);
c_pointer = StringValuePtr (pointer);
c_name = StringValuePtr (name);
time = weechat_hdata_time (script_str2ptr (c_hdata),
script_str2ptr (c_pointer),
c_name);
strftime (timebuffer, sizeof (timebuffer), "%F %T", localtime (&time));
result = strdup (timebuffer);
RUBY_RETURN_STRING_FREE(result);
}
/*
* weechat_ruby_api_hdata_get_string: get hdata property as string
*/
static VALUE
weechat_ruby_api_hdata_get_string (VALUE class, VALUE hdata, VALUE property)
{
char *c_hdata, *c_property;
const char *result;
/* make C compiler happy */
(void) class;
if (!ruby_current_script || !ruby_current_script->name)
{
WEECHAT_SCRIPT_MSG_NOT_INIT(RUBY_CURRENT_SCRIPT_NAME, "hdata_get_string");
RUBY_RETURN_EMPTY;
}
if (NIL_P (hdata) || NIL_P (property))
{
WEECHAT_SCRIPT_MSG_WRONG_ARGS(RUBY_CURRENT_SCRIPT_NAME, "hdata_get_string");
RUBY_RETURN_EMPTY;
}
Check_Type (hdata, T_STRING);
Check_Type (property, T_STRING);
c_hdata = StringValuePtr (hdata);
c_property = StringValuePtr (property);
result = weechat_hdata_get_var_type_string (script_str2ptr (c_hdata),
c_property);
RUBY_RETURN_STRING(result);
}
/*
* weechat_ruby_api_upgrade_new: create an upgrade file
*/
@ -7869,6 +8272,16 @@ weechat_ruby_api_init (VALUE ruby_mWeechat)
rb_define_module_function (ruby_mWeechat, "infolist_pointer", &weechat_ruby_api_infolist_pointer, 2);
rb_define_module_function (ruby_mWeechat, "infolist_time", &weechat_ruby_api_infolist_time, 2);
rb_define_module_function (ruby_mWeechat, "infolist_free", &weechat_ruby_api_infolist_free, 1);
rb_define_module_function (ruby_mWeechat, "hdata_get", &weechat_ruby_api_hdata_get, 1);
rb_define_module_function (ruby_mWeechat, "hdata_get_var_type_string", &weechat_ruby_api_hdata_get_var_type_string, 2);
rb_define_module_function (ruby_mWeechat, "hdata_get_list", &weechat_ruby_api_hdata_get_list, 2);
rb_define_module_function (ruby_mWeechat, "hdata_move", &weechat_ruby_api_hdata_move, 3);
rb_define_module_function (ruby_mWeechat, "hdata_integer", &weechat_ruby_api_hdata_integer, 3);
rb_define_module_function (ruby_mWeechat, "hdata_long", &weechat_ruby_api_hdata_long, 3);
rb_define_module_function (ruby_mWeechat, "hdata_string", &weechat_ruby_api_hdata_string, 3);
rb_define_module_function (ruby_mWeechat, "hdata_pointer", &weechat_ruby_api_hdata_pointer, 3);
rb_define_module_function (ruby_mWeechat, "hdata_time", &weechat_ruby_api_hdata_time, 3);
rb_define_module_function (ruby_mWeechat, "hdata_get_string", &weechat_ruby_api_hdata_get_string, 2);
rb_define_module_function (ruby_mWeechat, "upgrade_new", &weechat_ruby_api_upgrade_new, 2);
rb_define_module_function (ruby_mWeechat, "upgrade_write_object", &weechat_ruby_api_upgrade_write_object, 3);
rb_define_module_function (ruby_mWeechat, "upgrade_read", &weechat_ruby_api_upgrade_read, 3);

View File

@ -36,130 +36,145 @@
#include "../script-callback.h"
#include "weechat-tcl.h"
#define TCL_RETURN_OK \
{ \
objp = Tcl_GetObjResult (interp); \
if (Tcl_IsShared (objp)) \
{ \
objp = Tcl_DuplicateObj (objp); \
Tcl_IncrRefCount (objp); \
Tcl_SetIntObj (objp, 1); \
Tcl_SetObjResult (interp, objp); \
Tcl_DecrRefCount (objp); \
} \
else \
Tcl_SetIntObj (objp, 1); \
return TCL_OK; \
#define TCL_RETURN_OK \
{ \
objp = Tcl_GetObjResult (interp); \
if (Tcl_IsShared (objp)) \
{ \
objp = Tcl_DuplicateObj (objp); \
Tcl_IncrRefCount (objp); \
Tcl_SetIntObj (objp, 1); \
Tcl_SetObjResult (interp, objp); \
Tcl_DecrRefCount (objp); \
} \
else \
Tcl_SetIntObj (objp, 1); \
return TCL_OK; \
}
#define TCL_RETURN_ERROR \
{ \
objp = Tcl_GetObjResult (interp); \
if (Tcl_IsShared (objp)) \
{ \
objp = Tcl_DuplicateObj (objp); \
Tcl_IncrRefCount (objp); \
Tcl_SetIntObj (objp, 0); \
Tcl_SetObjResult (interp, objp); \
Tcl_DecrRefCount (objp); \
} \
else \
Tcl_SetIntObj (objp, 0); \
return TCL_ERROR; \
#define TCL_RETURN_ERROR \
{ \
objp = Tcl_GetObjResult (interp); \
if (Tcl_IsShared (objp)) \
{ \
objp = Tcl_DuplicateObj (objp); \
Tcl_IncrRefCount (objp); \
Tcl_SetIntObj (objp, 0); \
Tcl_SetObjResult (interp, objp); \
Tcl_DecrRefCount (objp); \
} \
else \
Tcl_SetIntObj (objp, 0); \
return TCL_ERROR; \
}
#define TCL_RETURN_EMPTY \
{ \
objp = Tcl_GetObjResult (interp); \
if (Tcl_IsShared (objp)) \
{ \
objp = Tcl_DuplicateObj (objp); \
Tcl_IncrRefCount (objp); \
Tcl_SetStringObj (objp, "", -1); \
Tcl_SetObjResult (interp, objp); \
Tcl_DecrRefCount (objp); \
} \
else \
Tcl_SetStringObj (objp, "", -1); \
return TCL_OK; \
#define TCL_RETURN_EMPTY \
{ \
objp = Tcl_GetObjResult (interp); \
if (Tcl_IsShared (objp)) \
{ \
objp = Tcl_DuplicateObj (objp); \
Tcl_IncrRefCount (objp); \
Tcl_SetStringObj (objp, "", -1); \
Tcl_SetObjResult (interp, objp); \
Tcl_DecrRefCount (objp); \
} \
else \
Tcl_SetStringObj (objp, "", -1); \
return TCL_OK; \
}
#define TCL_RETURN_STRING(__string) \
{ \
objp = Tcl_GetObjResult (interp); \
if (Tcl_IsShared (objp)) \
{ \
objp = Tcl_DuplicateObj (objp); \
Tcl_IncrRefCount (objp); \
if (__string) \
{ \
Tcl_SetStringObj (objp, __string, -1); \
Tcl_SetObjResult (interp, objp); \
Tcl_DecrRefCount (objp); \
return TCL_OK; \
} \
Tcl_SetStringObj (objp, "", -1); \
Tcl_SetObjResult (interp, objp); \
Tcl_DecrRefCount (objp); \
} \
else \
{ \
if (__string) \
{ \
Tcl_SetStringObj (objp, __string, -1); \
return TCL_OK; \
} \
Tcl_SetStringObj (objp, "", -1); \
} \
return TCL_OK; \
#define TCL_RETURN_STRING(__string) \
{ \
objp = Tcl_GetObjResult (interp); \
if (Tcl_IsShared (objp)) \
{ \
objp = Tcl_DuplicateObj (objp); \
Tcl_IncrRefCount (objp); \
if (__string) \
{ \
Tcl_SetStringObj (objp, __string, -1); \
Tcl_SetObjResult (interp, objp); \
Tcl_DecrRefCount (objp); \
return TCL_OK; \
} \
Tcl_SetStringObj (objp, "", -1); \
Tcl_SetObjResult (interp, objp); \
Tcl_DecrRefCount (objp); \
} \
else \
{ \
if (__string) \
{ \
Tcl_SetStringObj (objp, __string, -1); \
return TCL_OK; \
} \
Tcl_SetStringObj (objp, "", -1); \
} \
return TCL_OK; \
}
#define TCL_RETURN_STRING_FREE(__string) \
{ \
objp = Tcl_GetObjResult (interp); \
if (Tcl_IsShared (objp)) \
{ \
objp = Tcl_DuplicateObj (objp); \
Tcl_IncrRefCount (objp); \
if (__string) \
{ \
Tcl_SetStringObj (objp, __string, -1); \
Tcl_SetObjResult (interp, objp); \
Tcl_DecrRefCount (objp); \
free (__string); \
return TCL_OK; \
} \
Tcl_SetStringObj (objp, "", -1); \
Tcl_SetObjResult (interp, objp); \
Tcl_DecrRefCount (objp); \
} \
else \
{ \
if (__string) \
{ \
Tcl_SetStringObj (objp, __string, -1); \
free (__string); \
return TCL_OK; \
} \
Tcl_SetStringObj (objp, "", -1); \
} \
return TCL_OK; \
#define TCL_RETURN_STRING_FREE(__string) \
{ \
objp = Tcl_GetObjResult (interp); \
if (Tcl_IsShared (objp)) \
{ \
objp = Tcl_DuplicateObj (objp); \
Tcl_IncrRefCount (objp); \
if (__string) \
{ \
Tcl_SetStringObj (objp, __string, -1); \
Tcl_SetObjResult (interp, objp); \
Tcl_DecrRefCount (objp); \
free (__string); \
return TCL_OK; \
} \
Tcl_SetStringObj (objp, "", -1); \
Tcl_SetObjResult (interp, objp); \
Tcl_DecrRefCount (objp); \
} \
else \
{ \
if (__string) \
{ \
Tcl_SetStringObj (objp, __string, -1); \
free (__string); \
return TCL_OK; \
} \
Tcl_SetStringObj (objp, "", -1); \
} \
return TCL_OK; \
}
#define TCL_RETURN_INT(__int) \
{ \
objp = Tcl_GetObjResult (interp); \
if (Tcl_IsShared (objp)) \
{ \
objp = Tcl_DuplicateObj (objp); \
Tcl_IncrRefCount (objp); \
Tcl_SetIntObj (objp, __int); \
Tcl_SetObjResult (interp, objp); \
Tcl_DecrRefCount (objp); \
} \
else \
Tcl_SetIntObj (objp, __int); \
return TCL_OK; \
#define TCL_RETURN_INT(__int) \
{ \
objp = Tcl_GetObjResult (interp); \
if (Tcl_IsShared (objp)) \
{ \
objp = Tcl_DuplicateObj (objp); \
Tcl_IncrRefCount (objp); \
Tcl_SetIntObj (objp, __int); \
Tcl_SetObjResult (interp, objp); \
Tcl_DecrRefCount (objp); \
} \
else \
Tcl_SetIntObj (objp, __int); \
return TCL_OK; \
}
#define TCL_RETURN_OBJ(__obj) \
{ \
Tcl_SetObjResult (interp, __obj); \
return TCL_OK; \
#define TCL_RETURN_LONG(__long) \
{ \
objp = Tcl_GetObjResult (interp); \
if (Tcl_IsShared (objp)) \
{ \
objp = Tcl_DuplicateObj (objp); \
Tcl_IncrRefCount (objp); \
Tcl_SetLongObj (objp, __long); \
Tcl_SetObjResult (interp, objp); \
Tcl_DecrRefCount (objp); \
} \
else \
Tcl_SetLongObj (objp, __long); \
return TCL_OK; \
}
#define TCL_RETURN_OBJ(__obj) \
{ \
Tcl_SetObjResult (interp, __obj); \
return TCL_OK; \
}
@ -7234,6 +7249,393 @@ weechat_tcl_api_infolist_free (ClientData clientData, Tcl_Interp *interp,
TCL_RETURN_OK;
}
/*
* weechat_tcl_api_hdata_get: get hdata
*/
static int
weechat_tcl_api_hdata_get (ClientData clientData, Tcl_Interp *interp,
int objc, Tcl_Obj *CONST objv[])
{
Tcl_Obj *objp;
char *result, *name;
int i;
/* make C compiler happy */
(void) clientData;
if (!tcl_current_script || !tcl_current_script->name)
{
WEECHAT_SCRIPT_MSG_NOT_INIT(TCL_CURRENT_SCRIPT_NAME, "hdata_get");
TCL_RETURN_EMPTY;
}
if (objc < 2)
{
WEECHAT_SCRIPT_MSG_WRONG_ARGS(TCL_CURRENT_SCRIPT_NAME, "hdata_get");
TCL_RETURN_EMPTY;
}
name = Tcl_GetStringFromObj (objv[1], &i);
result = script_ptr2str (weechat_hdata_get (name));
TCL_RETURN_STRING_FREE(result);
}
/*
* weechat_tcl_api_hdata_get_var_type_string: get type of variable as string in
* hdata
*/
static int
weechat_tcl_api_hdata_get_var_type_string (ClientData clientData,
Tcl_Interp *interp,
int objc, Tcl_Obj *CONST objv[])
{
Tcl_Obj *objp;
char *hdata, *name;
const char *result;
int i;
/* make C compiler happy */
(void) clientData;
if (!tcl_current_script || !tcl_current_script->name)
{
WEECHAT_SCRIPT_MSG_NOT_INIT(TCL_CURRENT_SCRIPT_NAME, "hdata_get_var_type_string");
TCL_RETURN_EMPTY;
}
if (objc < 3)
{
WEECHAT_SCRIPT_MSG_WRONG_ARGS(TCL_CURRENT_SCRIPT_NAME, "hdata_get_var_type_string");
TCL_RETURN_EMPTY;
}
hdata = Tcl_GetStringFromObj (objv[1], &i);
name = Tcl_GetStringFromObj (objv[2], &i);
result = weechat_hdata_get_var_type_string (script_str2ptr (hdata), name);
TCL_RETURN_STRING(result);
}
/*
* weechat_tcl_api_hdata_get_list: get list pointer in hdata
*/
static int
weechat_tcl_api_hdata_get_list (ClientData clientData, Tcl_Interp *interp,
int objc, Tcl_Obj *CONST objv[])
{
Tcl_Obj *objp;
char *hdata, *name, *result;
int i;
/* make C compiler happy */
(void) clientData;
if (!tcl_current_script || !tcl_current_script->name)
{
WEECHAT_SCRIPT_MSG_NOT_INIT(TCL_CURRENT_SCRIPT_NAME, "hdata_get_list");
TCL_RETURN_EMPTY;
}
if (objc < 3)
{
WEECHAT_SCRIPT_MSG_WRONG_ARGS(TCL_CURRENT_SCRIPT_NAME, "hdata_get_list");
TCL_RETURN_EMPTY;
}
hdata = Tcl_GetStringFromObj (objv[1], &i);
name = Tcl_GetStringFromObj (objv[2], &i);
result = script_ptr2str (weechat_hdata_get_list (script_str2ptr (hdata),
name));
TCL_RETURN_STRING_FREE(result);
}
/*
* weechat_tcl_api_hdata_move: move pointer to another element in list
*/
static int
weechat_tcl_api_hdata_move (ClientData clientData, Tcl_Interp *interp,
int objc, Tcl_Obj *CONST objv[])
{
Tcl_Obj *objp;
char *hdata, *pointer, *result;
int i, count;
/* make C compiler happy */
(void) clientData;
if (!tcl_current_script || !tcl_current_script->name)
{
WEECHAT_SCRIPT_MSG_NOT_INIT(TCL_CURRENT_SCRIPT_NAME, "hdata_move");
TCL_RETURN_EMPTY;
}
if (objc < 4)
{
WEECHAT_SCRIPT_MSG_WRONG_ARGS(TCL_CURRENT_SCRIPT_NAME, "hdata_move");
TCL_RETURN_EMPTY;
}
hdata = Tcl_GetStringFromObj (objv[1], &i);
pointer = Tcl_GetStringFromObj (objv[2], &i);
if (Tcl_GetIntFromObj (interp, objv[3], &count) != TCL_OK)
{
WEECHAT_SCRIPT_MSG_WRONG_ARGS(TCL_CURRENT_SCRIPT_NAME, "hdata_move");
TCL_RETURN_EMPTY;
}
result = script_ptr2str (weechat_hdata_move (script_str2ptr (hdata),
script_str2ptr (pointer),
count));
TCL_RETURN_STRING_FREE(result);
}
/*
* weechat_tcl_api_hdata_integer: get integer value of a variable in structure
* using hdata
*/
static int
weechat_tcl_api_hdata_integer (ClientData clientData, Tcl_Interp *interp,
int objc, Tcl_Obj *CONST objv[])
{
Tcl_Obj *objp;
char *hdata, *pointer, *name;
int result, i;
/* make C compiler happy */
(void) clientData;
if (!tcl_current_script || !tcl_current_script->name)
{
WEECHAT_SCRIPT_MSG_NOT_INIT(TCL_CURRENT_SCRIPT_NAME, "hdata_integer");
TCL_RETURN_INT(0);
}
if (objc < 4)
{
WEECHAT_SCRIPT_MSG_WRONG_ARGS(TCL_CURRENT_SCRIPT_NAME, "hdata_integer");
TCL_RETURN_INT(0);
}
hdata = Tcl_GetStringFromObj (objv[1], &i);
pointer = Tcl_GetStringFromObj (objv[2], &i);
name = Tcl_GetStringFromObj (objv[3], &i);
result = weechat_hdata_integer (script_str2ptr (hdata),
script_str2ptr (pointer),
name);
TCL_RETURN_INT(result);
}
/*
* weechat_tcl_api_hdata_long: get long value of a variable in structure using
* hdata
*/
static int
weechat_tcl_api_hdata_long (ClientData clientData, Tcl_Interp *interp,
int objc, Tcl_Obj *CONST objv[])
{
Tcl_Obj *objp;
char *hdata, *pointer, *name;
int result, i;
/* make C compiler happy */
(void) clientData;
if (!tcl_current_script || !tcl_current_script->name)
{
WEECHAT_SCRIPT_MSG_NOT_INIT(TCL_CURRENT_SCRIPT_NAME, "hdata_long");
TCL_RETURN_LONG(0);
}
if (objc < 4)
{
WEECHAT_SCRIPT_MSG_WRONG_ARGS(TCL_CURRENT_SCRIPT_NAME, "hdata_long");
TCL_RETURN_LONG(0);
}
hdata = Tcl_GetStringFromObj (objv[1], &i);
pointer = Tcl_GetStringFromObj (objv[2], &i);
name = Tcl_GetStringFromObj (objv[3], &i);
result = weechat_hdata_long (script_str2ptr (hdata),
script_str2ptr (pointer),
name);
TCL_RETURN_LONG(result);
}
/*
* weechat_tcl_api_hdata_string: get string value of a variable in structure
* using hdata
*/
static int
weechat_tcl_api_hdata_string (ClientData clientData, Tcl_Interp *interp,
int objc, Tcl_Obj *CONST objv[])
{
Tcl_Obj *objp;
char *hdata, *pointer, *name;
const char *result;
int i;
/* make C compiler happy */
(void) clientData;
if (!tcl_current_script || !tcl_current_script->name)
{
WEECHAT_SCRIPT_MSG_NOT_INIT(TCL_CURRENT_SCRIPT_NAME, "hdata_string");
TCL_RETURN_EMPTY;
}
if (objc < 4)
{
WEECHAT_SCRIPT_MSG_WRONG_ARGS(TCL_CURRENT_SCRIPT_NAME, "hdata_string");
TCL_RETURN_EMPTY;
}
hdata = Tcl_GetStringFromObj (objv[1], &i);
pointer = Tcl_GetStringFromObj (objv[2], &i);
name = Tcl_GetStringFromObj (objv[3], &i);
result = weechat_hdata_string (script_str2ptr (hdata),
script_str2ptr (pointer),
name);
TCL_RETURN_STRING(result);
}
/*
* weechat_tcl_api_hdata_pointer: get pointer value of a variable in structure
* using hdata
*/
static int
weechat_tcl_api_hdata_pointer (ClientData clientData, Tcl_Interp *interp,
int objc, Tcl_Obj *CONST objv[])
{
Tcl_Obj *objp;
char *hdata, *pointer, *name, *result;
int i;
/* make C compiler happy */
(void) clientData;
if (!tcl_current_script || !tcl_current_script->name)
{
WEECHAT_SCRIPT_MSG_NOT_INIT(TCL_CURRENT_SCRIPT_NAME, "hdata_pointer");
TCL_RETURN_EMPTY;
}
if (objc < 4)
{
WEECHAT_SCRIPT_MSG_WRONG_ARGS(TCL_CURRENT_SCRIPT_NAME, "hdata_pointer");
TCL_RETURN_EMPTY;
}
hdata = Tcl_GetStringFromObj (objv[1], &i);
pointer = Tcl_GetStringFromObj (objv[2], &i);
name = Tcl_GetStringFromObj (objv[3], &i);
result = script_ptr2str (weechat_hdata_pointer (script_str2ptr (hdata),
script_str2ptr (pointer),
name));
TCL_RETURN_STRING_FREE(result);
}
/*
* weechat_tcl_api_hdata_time: get time value of a variable in structure using
* hdata
*/
static int
weechat_tcl_api_hdata_time (ClientData clientData, Tcl_Interp *interp,
int objc, Tcl_Obj *CONST objv[])
{
Tcl_Obj *objp;
time_t time;
char timebuffer[64], *result, *hdata, *pointer, *name;
int i;
/* make C compiler happy */
(void) clientData;
if (!tcl_current_script || !tcl_current_script->name)
{
WEECHAT_SCRIPT_MSG_NOT_INIT(TCL_CURRENT_SCRIPT_NAME, "hdata_time");
TCL_RETURN_EMPTY;
}
if (objc < 4)
{
WEECHAT_SCRIPT_MSG_WRONG_ARGS(TCL_CURRENT_SCRIPT_NAME, "hdata_time");
TCL_RETURN_EMPTY;
}
hdata = Tcl_GetStringFromObj (objv[1], &i);
pointer = Tcl_GetStringFromObj (objv[2], &i);
name = Tcl_GetStringFromObj (objv[3], &i);
time = weechat_hdata_time (script_str2ptr (hdata),
script_str2ptr (pointer),
name);
strftime (timebuffer, sizeof (timebuffer), "%F %T", localtime (&time));
result = strdup (timebuffer);
TCL_RETURN_STRING_FREE(result);
}
/*
* weechat_tcl_api_hdata_get_string: get hdata property as string
*/
static int
weechat_tcl_api_hdata_get_string (ClientData clientData, Tcl_Interp *interp,
int objc, Tcl_Obj *CONST objv[])
{
Tcl_Obj *objp;
char *hdata, *property;
const char *result;
int i;
/* make C compiler happy */
(void) clientData;
if (!tcl_current_script || !tcl_current_script->name)
{
WEECHAT_SCRIPT_MSG_NOT_INIT(TCL_CURRENT_SCRIPT_NAME, "hdata_get_string");
TCL_RETURN_EMPTY;
}
if (objc < 3)
{
WEECHAT_SCRIPT_MSG_WRONG_ARGS(TCL_CURRENT_SCRIPT_NAME, "hdata_get_string");
TCL_RETURN_EMPTY;
}
hdata = Tcl_GetStringFromObj (objv[1], &i);
property = Tcl_GetStringFromObj (objv[2], &i);
result = weechat_hdata_get_string (script_str2ptr (hdata), property);
TCL_RETURN_STRING(result);
}
/*
* weechat_tcl_api_upgrade_new: create an upgrade file
*/
@ -7862,6 +8264,26 @@ void weechat_tcl_api_init (Tcl_Interp *interp)
weechat_tcl_api_infolist_time, (ClientData)NULL, (Tcl_CmdDeleteProc*)NULL);
Tcl_CreateObjCommand (interp, "weechat::infolist_free",
weechat_tcl_api_infolist_free, (ClientData)NULL, (Tcl_CmdDeleteProc*)NULL);
Tcl_CreateObjCommand (interp, "weechat::hdata_get",
weechat_tcl_api_hdata_get, (ClientData)NULL, (Tcl_CmdDeleteProc*)NULL);
Tcl_CreateObjCommand (interp, "weechat::hdata_get_var_type_string",
weechat_tcl_api_hdata_get_var_type_string, (ClientData)NULL, (Tcl_CmdDeleteProc*)NULL);
Tcl_CreateObjCommand (interp, "weechat::hdata_get_list",
weechat_tcl_api_hdata_get_list, (ClientData)NULL, (Tcl_CmdDeleteProc*)NULL);
Tcl_CreateObjCommand (interp, "weechat::hdata_move",
weechat_tcl_api_hdata_move, (ClientData)NULL, (Tcl_CmdDeleteProc*)NULL);
Tcl_CreateObjCommand (interp, "weechat::hdata_integer",
weechat_tcl_api_hdata_integer, (ClientData)NULL, (Tcl_CmdDeleteProc*)NULL);
Tcl_CreateObjCommand (interp, "weechat::hdata_long",
weechat_tcl_api_hdata_long, (ClientData)NULL, (Tcl_CmdDeleteProc*)NULL);
Tcl_CreateObjCommand (interp, "weechat::hdata_string",
weechat_tcl_api_hdata_string, (ClientData)NULL, (Tcl_CmdDeleteProc*)NULL);
Tcl_CreateObjCommand (interp, "weechat::hdata_pointer",
weechat_tcl_api_hdata_pointer, (ClientData)NULL, (Tcl_CmdDeleteProc*)NULL);
Tcl_CreateObjCommand (interp, "weechat::hdata_time",
weechat_tcl_api_hdata_time, (ClientData)NULL, (Tcl_CmdDeleteProc*)NULL);
Tcl_CreateObjCommand (interp, "weechat::hdata_get_string",
weechat_tcl_api_hdata_get_string, (ClientData)NULL, (Tcl_CmdDeleteProc*)NULL);
Tcl_CreateObjCommand (interp, "weechat::upgrade_new",
weechat_tcl_api_upgrade_new, (ClientData)NULL, (Tcl_CmdDeleteProc*)NULL);
Tcl_CreateObjCommand (interp, "weechat::upgrade_write_object",

View File

@ -37,6 +37,7 @@ struct t_infolist;
struct t_infolist_item;
struct t_weelist;
struct t_hashtable;
struct t_hdata;
struct timeval;
/*
@ -45,7 +46,7 @@ struct timeval;
*/
/* API version (used to check that plugin has same API and can be loaded) */
#define WEECHAT_PLUGIN_API_VERSION "20110428-01"
#define WEECHAT_PLUGIN_API_VERSION "20110613-01"
/* macros for defining plugin infos */
#define WEECHAT_PLUGIN_NAME(__name) \
@ -102,6 +103,14 @@ struct timeval;
#define WEECHAT_HASHTABLE_BUFFER "buffer"
#define WEECHAT_HASHTABLE_TIME "time"
/* types for hdata */
#define WEECHAT_HDATA_OTHER 0
#define WEECHAT_HDATA_INTEGER 1
#define WEECHAT_HDATA_LONG 2
#define WEECHAT_HDATA_STRING 3
#define WEECHAT_HDATA_POINTER 4
#define WEECHAT_HDATA_TIME 5
/* buffer hotlist */
#define WEECHAT_HOTLIST_LOW "0"
#define WEECHAT_HOTLIST_MESSAGE "1"
@ -569,6 +578,12 @@ struct t_weechat_plugin
void *pointer,
const char *arguments),
void *callback_data);
struct t_hook *(*hook_hdata) (struct t_weechat_plugin *plugin,
const char *hdata_name,
const char *description,
struct t_hdata *(*callback)(void *data,
const char *hdata_name),
void *callback_data);
void (*unhook) (struct t_hook *hook);
void (*unhook_all) (struct t_weechat_plugin *plugin);
@ -745,7 +760,39 @@ struct t_weechat_plugin
int *size);
time_t (*infolist_time) (struct t_infolist *infolist, const char *var);
void (*infolist_free) (struct t_infolist *infolist);
/* hdata */
struct t_hdata *(*hdata_new) (const char *hdata_name, const char *var_prev,
const char *var_next);
void (*hdata_new_var) (struct t_hdata *hdata, const char *name, int offset,
int type);
void (*hdata_new_list) (struct t_hdata *hdata, const char *name,
void *pointer);
struct t_hdata *(*hdata_get) (struct t_weechat_plugin *plugin,
const char *hdata_name);
int (*hdata_get_var_offset) (struct t_hdata *hdata, const char *name);
int (*hdata_get_var_type) (struct t_hdata *hdata, const char *name);
const char *(*hdata_get_var_type_string) (struct t_hdata *hdata,
const char *name);
void *(*hdata_get_var) (struct t_hdata *hdata, void *pointer,
const char *name);
void *(*hdata_get_var_at_offset) (struct t_hdata *hdata, void *pointer,
int offset);
void *(*hdata_get_list) (struct t_hdata *hdata, const char *name);
void *(*hdata_move) (struct t_hdata *hdata, void *pointer, int count);
int (*hdata_integer) (struct t_hdata *hdata, void *pointer,
const char *name);
long (*hdata_long) (struct t_hdata *hdata, void *pointer,
const char *name);
const char *(*hdata_string) (struct t_hdata *hdata, void *pointer,
const char *name);
void *(*hdata_pointer) (struct t_hdata *hdata, void *pointer,
const char *name);
time_t (*hdata_time) (struct t_hdata *hdata, void *pointer,
const char *name);
const char *(*hdata_get_string) (struct t_hdata *hdata,
const char *property);
/* upgrade */
struct t_upgrade_file *(*upgrade_new) (const char *filename,
int write);
@ -1227,6 +1274,10 @@ extern int weechat_plugin_end (struct t_weechat_plugin *plugin);
__description, __pointer_description, \
__args_description, __callback, \
__data)
#define weechat_hook_hdata(__hdata_name, __description, __callback, \
__data) \
weechat_plugin->hook_hdata(weechat_plugin, __hdata_name, \
__description, __callback, __data)
#define weechat_unhook(__hook) \
weechat_plugin->unhook( __hook)
#define weechat_unhook_all() \
@ -1424,6 +1475,48 @@ extern int weechat_plugin_end (struct t_weechat_plugin *plugin);
#define weechat_infolist_free(__list) \
weechat_plugin->infolist_free(__list)
/* hdata */
#define weechat_hdata_new(__hdata_name, __var_prev, __var_next) \
weechat_plugin->hdata_new(__hdata_name, __var_prev, __var_next)
#define weechat_hdata_new_var(__hdata, __name, __offset, __type) \
weechat_plugin->hdata_new_var(__hdata, __name, __offset, __type)
#define WEECHAT_HDATA_VAR(__struct, __name, __type) \
weechat_hdata_new_var (hdata, #__name, offsetof (__struct, __name), \
WEECHAT_HDATA_##__type);
#define weechat_hdata_new_list(__hdata, __name, __pointer) \
weechat_plugin->hdata_new_list(__hdata, __name, __pointer)
#define WEECHAT_HDATA_LIST(__name) \
weechat_hdata_new_list (hdata, #__name, &(__name));
#define weechat_hdata_get(__hdata_name) \
weechat_plugin->hdata_get(weechat_plugin, __hdata_name)
#define weechat_hdata_get_var_offset(__hdata, __name) \
weechat_plugin->hdata_get_var_offset(__hdata, __name)
#define weechat_hdata_get_var_type(__hdata, __name) \
weechat_plugin->hdata_get_var_type(__hdata, __name)
#define weechat_hdata_get_var_type_string(__hdata, __name) \
weechat_plugin->hdata_get_var_type_string(__hdata, __name)
#define weechat_hdata_get_var(__hdata, __pointer, __name) \
weechat_plugin->hdata_get_var(__hdata, __pointer, __name)
#define weechat_hdata_get_var_at_offset(__hdata, __pointer, __offset) \
weechat_plugin->hdata_get_var_at_offset(__hdata, __pointer, \
__offset)
#define weechat_hdata_get_list(__hdata, __name) \
weechat_plugin->hdata_get_list(__hdata, __name)
#define weechat_hdata_move(__hdata, __pointer, __count) \
weechat_plugin->hdata_move(__hdata, __pointer, __count)
#define weechat_hdata_integer(__hdata, __pointer, __name) \
weechat_plugin->hdata_integer(__hdata, __pointer, __name)
#define weechat_hdata_long(__hdata, __pointer, __name) \
weechat_plugin->hdata_long(__hdata, __pointer, __name)
#define weechat_hdata_string(__hdata, __pointer, __name) \
weechat_plugin->hdata_string(__hdata, __pointer, __name)
#define weechat_hdata_pointer(__hdata, __pointer, __name) \
weechat_plugin->hdata_pointer(__hdata, __pointer, __name)
#define weechat_hdata_time(__hdata, __pointer, __name) \
weechat_plugin->hdata_time(__hdata, __pointer, __name)
#define weechat_hdata_get_string(__hdata, __property) \
weechat_plugin->hdata_get_string(__hdata, __property)
/* upgrade */
#define weechat_upgrade_new(__filename, __write) \
weechat_plugin->upgrade_new(__filename, __write)