mirror of
https://github.com/weechat/weechat.git
synced 2026-07-04 08:43:13 +02:00
core: many improvements on hdata
New features: - add optional hdata name for variables in hdata - add plugin API functions: hdata_get_var_hdata - use hashtable to store hdata (created by WeeChat and plugins) - free hdata and infolists created by plugin on plugin unload - free all hdata on exit - add "free" option to command /debug hdata - remove hdata for hooks
This commit is contained in:
@@ -40,10 +40,6 @@
|
||||
#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
|
||||
@@ -849,40 +845,36 @@ irc_channel_hdata_channel_cb (void *data, const char *hdata_name)
|
||||
/* 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);
|
||||
WEECHAT_HDATA_VAR(struct t_irc_channel, type, INTEGER, NULL);
|
||||
WEECHAT_HDATA_VAR(struct t_irc_channel, name, STRING, NULL);
|
||||
WEECHAT_HDATA_VAR(struct t_irc_channel, topic, STRING, NULL);
|
||||
WEECHAT_HDATA_VAR(struct t_irc_channel, modes, STRING, NULL);
|
||||
WEECHAT_HDATA_VAR(struct t_irc_channel, limit, INTEGER, NULL);
|
||||
WEECHAT_HDATA_VAR(struct t_irc_channel, key, STRING, NULL);
|
||||
WEECHAT_HDATA_VAR(struct t_irc_channel, checking_away, INTEGER, NULL);
|
||||
WEECHAT_HDATA_VAR(struct t_irc_channel, away_message, STRING, NULL);
|
||||
WEECHAT_HDATA_VAR(struct t_irc_channel, has_quit_server, INTEGER, NULL);
|
||||
WEECHAT_HDATA_VAR(struct t_irc_channel, cycle, INTEGER, NULL);
|
||||
WEECHAT_HDATA_VAR(struct t_irc_channel, part, INTEGER, NULL);
|
||||
WEECHAT_HDATA_VAR(struct t_irc_channel, display_creation_date, INTEGER, NULL);
|
||||
WEECHAT_HDATA_VAR(struct t_irc_channel, nick_completion_reset, INTEGER, NULL);
|
||||
WEECHAT_HDATA_VAR(struct t_irc_channel, pv_remote_nick_color, STRING, NULL);
|
||||
WEECHAT_HDATA_VAR(struct t_irc_channel, hook_autorejoin, POINTER, NULL);
|
||||
WEECHAT_HDATA_VAR(struct t_irc_channel, nicks_count, INTEGER, NULL);
|
||||
WEECHAT_HDATA_VAR(struct t_irc_channel, nicks, POINTER, "irc_nick");
|
||||
WEECHAT_HDATA_VAR(struct t_irc_channel, last_nick, POINTER, "irc_nick");
|
||||
WEECHAT_HDATA_VAR(struct t_irc_channel, nicks_speaking, POINTER, NULL);
|
||||
WEECHAT_HDATA_VAR(struct t_irc_channel, nicks_speaking_time, POINTER, "irc_channel_speaking");
|
||||
WEECHAT_HDATA_VAR(struct t_irc_channel, last_nick_speaking_time, POINTER, "irc_channel_speaking");
|
||||
WEECHAT_HDATA_VAR(struct t_irc_channel, buffer, POINTER, "buffer");
|
||||
WEECHAT_HDATA_VAR(struct t_irc_channel, buffer_as_string, STRING, NULL);
|
||||
WEECHAT_HDATA_VAR(struct t_irc_channel, prev_channel, POINTER, hdata_name);
|
||||
WEECHAT_HDATA_VAR(struct t_irc_channel, next_channel, POINTER, hdata_name);
|
||||
}
|
||||
return irc_channel_hdata_channel;
|
||||
return hdata;
|
||||
}
|
||||
|
||||
/*
|
||||
@@ -897,19 +889,15 @@ irc_channel_hdata_channel_speaking_cb (void *data, const char *hdata_name)
|
||||
/* 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);
|
||||
WEECHAT_HDATA_VAR(struct t_irc_channel_speaking, nick, STRING, NULL);
|
||||
WEECHAT_HDATA_VAR(struct t_irc_channel_speaking, time_last_message, TIME, NULL);
|
||||
WEECHAT_HDATA_VAR(struct t_irc_channel_speaking, prev_nick, POINTER, hdata_name);
|
||||
WEECHAT_HDATA_VAR(struct t_irc_channel_speaking, next_nick, POINTER, hdata_name);
|
||||
}
|
||||
return irc_channel_hdata_channel_speaking;
|
||||
return hdata;
|
||||
}
|
||||
|
||||
/*
|
||||
|
||||
@@ -35,8 +35,6 @@
|
||||
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
|
||||
@@ -316,24 +314,20 @@ irc_ignore_hdata_ignore_cb (void *data, const char *hdata_name)
|
||||
/* 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_VAR(struct t_irc_ignore, number, INTEGER, NULL);
|
||||
WEECHAT_HDATA_VAR(struct t_irc_ignore, mask, STRING, NULL);
|
||||
WEECHAT_HDATA_VAR(struct t_irc_ignore, regex_mask, POINTER, NULL);
|
||||
WEECHAT_HDATA_VAR(struct t_irc_ignore, server, STRING, NULL);
|
||||
WEECHAT_HDATA_VAR(struct t_irc_ignore, channel, STRING, NULL);
|
||||
WEECHAT_HDATA_VAR(struct t_irc_ignore, prev_ignore, POINTER, hdata_name);
|
||||
WEECHAT_HDATA_VAR(struct t_irc_ignore, next_ignore, POINTER, hdata_name);
|
||||
WEECHAT_HDATA_LIST(irc_ignore_list);
|
||||
WEECHAT_HDATA_LIST(last_irc_ignore);
|
||||
}
|
||||
return irc_ignore_hdata_ignore;
|
||||
return hdata;
|
||||
}
|
||||
|
||||
/*
|
||||
|
||||
@@ -37,9 +37,6 @@
|
||||
#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
|
||||
@@ -943,23 +940,19 @@ irc_nick_hdata_nick_cb (void *data, const char *hdata_name)
|
||||
/* 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);
|
||||
WEECHAT_HDATA_VAR(struct t_irc_nick, name, STRING, NULL);
|
||||
WEECHAT_HDATA_VAR(struct t_irc_nick, host, STRING, NULL);
|
||||
WEECHAT_HDATA_VAR(struct t_irc_nick, prefixes, STRING, NULL);
|
||||
WEECHAT_HDATA_VAR(struct t_irc_nick, prefix, STRING, NULL);
|
||||
WEECHAT_HDATA_VAR(struct t_irc_nick, away, INTEGER, NULL);
|
||||
WEECHAT_HDATA_VAR(struct t_irc_nick, color, STRING, NULL);
|
||||
WEECHAT_HDATA_VAR(struct t_irc_nick, prev_nick, POINTER, hdata_name);
|
||||
WEECHAT_HDATA_VAR(struct t_irc_nick, next_nick, POINTER, hdata_name);
|
||||
}
|
||||
return irc_nick_hdata_nick;
|
||||
return hdata;
|
||||
}
|
||||
|
||||
/*
|
||||
|
||||
@@ -43,8 +43,6 @@ 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
|
||||
@@ -823,23 +821,19 @@ irc_notify_hdata_notify_cb (void *data, const char *hdata_name)
|
||||
/* 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);
|
||||
WEECHAT_HDATA_VAR(struct t_irc_notify, server, POINTER, "irc_server");
|
||||
WEECHAT_HDATA_VAR(struct t_irc_notify, nick, STRING, NULL);
|
||||
WEECHAT_HDATA_VAR(struct t_irc_notify, check_away, INTEGER, NULL);
|
||||
WEECHAT_HDATA_VAR(struct t_irc_notify, is_on_server, INTEGER, NULL);
|
||||
WEECHAT_HDATA_VAR(struct t_irc_notify, away_message, STRING, NULL);
|
||||
WEECHAT_HDATA_VAR(struct t_irc_notify, ison_received, INTEGER, NULL);
|
||||
WEECHAT_HDATA_VAR(struct t_irc_notify, prev_notify, POINTER, hdata_name);
|
||||
WEECHAT_HDATA_VAR(struct t_irc_notify, next_notify, POINTER, hdata_name);
|
||||
}
|
||||
return irc_notify_hdata_notify;
|
||||
return hdata;
|
||||
}
|
||||
|
||||
/*
|
||||
|
||||
@@ -37,9 +37,6 @@
|
||||
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[] =
|
||||
{
|
||||
@@ -967,25 +964,21 @@ irc_redirect_hdata_redirect_pattern_cb (void *data, const char *hdata_name)
|
||||
/* 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_VAR(struct t_irc_redirect_pattern, name, STRING, NULL);
|
||||
WEECHAT_HDATA_VAR(struct t_irc_redirect_pattern, temp_pattern, INTEGER, NULL);
|
||||
WEECHAT_HDATA_VAR(struct t_irc_redirect_pattern, timeout, INTEGER, NULL);
|
||||
WEECHAT_HDATA_VAR(struct t_irc_redirect_pattern, cmd_start, STRING, NULL);
|
||||
WEECHAT_HDATA_VAR(struct t_irc_redirect_pattern, cmd_stop, STRING, NULL);
|
||||
WEECHAT_HDATA_VAR(struct t_irc_redirect_pattern, cmd_extra, STRING, NULL);
|
||||
WEECHAT_HDATA_VAR(struct t_irc_redirect_pattern, prev_redirect, POINTER, hdata_name);
|
||||
WEECHAT_HDATA_VAR(struct t_irc_redirect_pattern, next_redirect, POINTER, hdata_name);
|
||||
WEECHAT_HDATA_LIST(irc_redirect_patterns);
|
||||
WEECHAT_HDATA_LIST(last_irc_redirect_pattern);
|
||||
}
|
||||
return irc_redirect_hdata_redirect_pattern;
|
||||
return hdata;
|
||||
}
|
||||
|
||||
/*
|
||||
@@ -1000,34 +993,30 @@ irc_redirect_hdata_redirect_cb (void *data, const char *hdata_name)
|
||||
/* 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);
|
||||
WEECHAT_HDATA_VAR(struct t_irc_redirect, server, POINTER, "irc_server");
|
||||
WEECHAT_HDATA_VAR(struct t_irc_redirect, pattern, STRING, NULL);
|
||||
WEECHAT_HDATA_VAR(struct t_irc_redirect, signal, STRING, NULL);
|
||||
WEECHAT_HDATA_VAR(struct t_irc_redirect, count, INTEGER, NULL);
|
||||
WEECHAT_HDATA_VAR(struct t_irc_redirect, current_count, INTEGER, NULL);
|
||||
WEECHAT_HDATA_VAR(struct t_irc_redirect, string, STRING, NULL);
|
||||
WEECHAT_HDATA_VAR(struct t_irc_redirect, timeout, INTEGER, NULL);
|
||||
WEECHAT_HDATA_VAR(struct t_irc_redirect, command, STRING, NULL);
|
||||
WEECHAT_HDATA_VAR(struct t_irc_redirect, start_time, TIME, NULL);
|
||||
WEECHAT_HDATA_VAR(struct t_irc_redirect, cmd_start, POINTER, NULL);
|
||||
WEECHAT_HDATA_VAR(struct t_irc_redirect, cmd_stop, POINTER, NULL);
|
||||
WEECHAT_HDATA_VAR(struct t_irc_redirect, cmd_extra, POINTER, NULL);
|
||||
WEECHAT_HDATA_VAR(struct t_irc_redirect, cmd_start_received, INTEGER, NULL);
|
||||
WEECHAT_HDATA_VAR(struct t_irc_redirect, cmd_stop_received, INTEGER, NULL);
|
||||
WEECHAT_HDATA_VAR(struct t_irc_redirect, cmd_filter, POINTER, NULL);
|
||||
WEECHAT_HDATA_VAR(struct t_irc_redirect, output, STRING, NULL);
|
||||
WEECHAT_HDATA_VAR(struct t_irc_redirect, output_size, INTEGER, NULL);
|
||||
WEECHAT_HDATA_VAR(struct t_irc_redirect, prev_redirect, POINTER, hdata_name);
|
||||
WEECHAT_HDATA_VAR(struct t_irc_redirect, next_redirect, POINTER, hdata_name);
|
||||
}
|
||||
return irc_redirect_hdata_redirect;
|
||||
return hdata;
|
||||
}
|
||||
|
||||
/*
|
||||
|
||||
@@ -65,8 +65,6 @@ 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",
|
||||
@@ -3949,78 +3947,74 @@ irc_server_hdata_server_cb (void *data, const char *hdata_name)
|
||||
/* 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);
|
||||
WEECHAT_HDATA_VAR(struct t_irc_server, name, STRING, NULL);
|
||||
WEECHAT_HDATA_VAR(struct t_irc_server, options, POINTER, NULL);
|
||||
WEECHAT_HDATA_VAR(struct t_irc_server, temp_server, INTEGER, NULL);
|
||||
WEECHAT_HDATA_VAR(struct t_irc_server, reloading_from_config, INTEGER, NULL);
|
||||
WEECHAT_HDATA_VAR(struct t_irc_server, reloaded_from_config, INTEGER, NULL);
|
||||
WEECHAT_HDATA_VAR(struct t_irc_server, addresses_count, INTEGER, NULL);
|
||||
WEECHAT_HDATA_VAR(struct t_irc_server, addresses_array, POINTER, NULL);
|
||||
WEECHAT_HDATA_VAR(struct t_irc_server, ports_array, POINTER, NULL);
|
||||
WEECHAT_HDATA_VAR(struct t_irc_server, index_current_address, INTEGER, NULL);
|
||||
WEECHAT_HDATA_VAR(struct t_irc_server, current_address, STRING, NULL);
|
||||
WEECHAT_HDATA_VAR(struct t_irc_server, current_ip, STRING, NULL);
|
||||
WEECHAT_HDATA_VAR(struct t_irc_server, current_port, INTEGER, NULL);
|
||||
WEECHAT_HDATA_VAR(struct t_irc_server, sock, INTEGER, NULL);
|
||||
WEECHAT_HDATA_VAR(struct t_irc_server, hook_connect, POINTER, "hook");
|
||||
WEECHAT_HDATA_VAR(struct t_irc_server, hook_fd, POINTER, "hook");
|
||||
WEECHAT_HDATA_VAR(struct t_irc_server, hook_timer_connection, POINTER, "hook");
|
||||
WEECHAT_HDATA_VAR(struct t_irc_server, hook_timer_sasl, POINTER, "hook");
|
||||
WEECHAT_HDATA_VAR(struct t_irc_server, is_connected, INTEGER, NULL);
|
||||
WEECHAT_HDATA_VAR(struct t_irc_server, ssl_connected, INTEGER, NULL);
|
||||
#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);
|
||||
WEECHAT_HDATA_VAR(struct t_irc_server, gnutls_sess, OTHER, NULL);
|
||||
WEECHAT_HDATA_VAR(struct t_irc_server, tls_cert, OTHER, NULL);
|
||||
WEECHAT_HDATA_VAR(struct t_irc_server, tls_cert_key, OTHER, NULL);
|
||||
#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_VAR(struct t_irc_server, unterminated_message, STRING, NULL);
|
||||
WEECHAT_HDATA_VAR(struct t_irc_server, nicks_count, INTEGER, NULL);
|
||||
WEECHAT_HDATA_VAR(struct t_irc_server, nicks_array, POINTER, NULL);
|
||||
WEECHAT_HDATA_VAR(struct t_irc_server, nick_first_tried, INTEGER, NULL);
|
||||
WEECHAT_HDATA_VAR(struct t_irc_server, nick, STRING, NULL);
|
||||
WEECHAT_HDATA_VAR(struct t_irc_server, nick_modes, STRING, NULL);
|
||||
WEECHAT_HDATA_VAR(struct t_irc_server, isupport, STRING, NULL);
|
||||
WEECHAT_HDATA_VAR(struct t_irc_server, prefix_modes, STRING, NULL);
|
||||
WEECHAT_HDATA_VAR(struct t_irc_server, prefix_chars, STRING, NULL);
|
||||
WEECHAT_HDATA_VAR(struct t_irc_server, reconnect_delay, INTEGER, NULL);
|
||||
WEECHAT_HDATA_VAR(struct t_irc_server, reconnect_start, TIME, NULL);
|
||||
WEECHAT_HDATA_VAR(struct t_irc_server, command_time, TIME, NULL);
|
||||
WEECHAT_HDATA_VAR(struct t_irc_server, reconnect_join, INTEGER, NULL);
|
||||
WEECHAT_HDATA_VAR(struct t_irc_server, disable_autojoin, INTEGER, NULL);
|
||||
WEECHAT_HDATA_VAR(struct t_irc_server, is_away, INTEGER, NULL);
|
||||
WEECHAT_HDATA_VAR(struct t_irc_server, away_message, STRING, NULL);
|
||||
WEECHAT_HDATA_VAR(struct t_irc_server, away_time, TIME, NULL);
|
||||
WEECHAT_HDATA_VAR(struct t_irc_server, lag, INTEGER, NULL);
|
||||
WEECHAT_HDATA_VAR(struct t_irc_server, lag_check_time, OTHER, NULL);
|
||||
WEECHAT_HDATA_VAR(struct t_irc_server, lag_next_check, TIME, NULL);
|
||||
WEECHAT_HDATA_VAR(struct t_irc_server, lag_last_refresh, TIME, NULL);
|
||||
WEECHAT_HDATA_VAR(struct t_irc_server, cmd_list_regexp, POINTER, NULL);
|
||||
WEECHAT_HDATA_VAR(struct t_irc_server, last_user_message, TIME, NULL);
|
||||
WEECHAT_HDATA_VAR(struct t_irc_server, last_away_check, TIME, NULL);
|
||||
WEECHAT_HDATA_VAR(struct t_irc_server, outqueue, POINTER, NULL);
|
||||
WEECHAT_HDATA_VAR(struct t_irc_server, last_outqueue, POINTER, NULL);
|
||||
WEECHAT_HDATA_VAR(struct t_irc_server, redirects, POINTER, "irc_redirect");
|
||||
WEECHAT_HDATA_VAR(struct t_irc_server, last_redirect, POINTER, "irc_redirect");
|
||||
WEECHAT_HDATA_VAR(struct t_irc_server, notify_list, POINTER, "irc_notify");
|
||||
WEECHAT_HDATA_VAR(struct t_irc_server, last_notify, POINTER, "irc_notify");
|
||||
WEECHAT_HDATA_VAR(struct t_irc_server, manual_joins, POINTER, NULL);
|
||||
WEECHAT_HDATA_VAR(struct t_irc_server, buffer, POINTER, "buffer");
|
||||
WEECHAT_HDATA_VAR(struct t_irc_server, buffer_as_string, STRING, NULL);
|
||||
WEECHAT_HDATA_VAR(struct t_irc_server, channels, POINTER, "irc_channel");
|
||||
WEECHAT_HDATA_VAR(struct t_irc_server, last_channel, POINTER, "irc_channel");
|
||||
WEECHAT_HDATA_VAR(struct t_irc_server, prev_server, POINTER, hdata_name);
|
||||
WEECHAT_HDATA_VAR(struct t_irc_server, next_server, POINTER, hdata_name);
|
||||
WEECHAT_HDATA_LIST(irc_servers);
|
||||
WEECHAT_HDATA_LIST(last_irc_server);
|
||||
}
|
||||
return irc_server_hdata_server;
|
||||
return hdata;
|
||||
}
|
||||
|
||||
/*
|
||||
|
||||
@@ -1071,40 +1071,6 @@ plugin_api_init ()
|
||||
&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_("structure with undo for input line"),
|
||||
&gui_buffer_hdata_input_undo_cb, NULL);
|
||||
hook_hdata (NULL, "key", N_("a key (keyboard shortcut)"),
|
||||
@@ -1119,6 +1085,8 @@ plugin_api_init ()
|
||||
&gui_nicklist_hdata_nick_group_cb, NULL);
|
||||
hook_hdata (NULL, "nick", N_("nick in nicklist"),
|
||||
&gui_nicklist_hdata_nick_cb, NULL);
|
||||
hook_hdata (NULL, "plugin", N_("plugin"),
|
||||
&plugin_hdata_plugin_cb, NULL);
|
||||
hook_hdata (NULL, "window", N_("window"),
|
||||
&gui_window_hdata_window_cb, NULL);
|
||||
hook_hdata (NULL, "window_scroll", N_("scroll info in window"),
|
||||
|
||||
@@ -690,6 +690,7 @@ plugin_load (const char *filename)
|
||||
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 = &hdata_get_var_hdata;
|
||||
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;
|
||||
@@ -927,6 +928,12 @@ plugin_remove (struct t_weechat_plugin *plugin)
|
||||
/* remove all hooks */
|
||||
unhook_all_plugin (plugin);
|
||||
|
||||
/* remove all infolists */
|
||||
infolist_free_all_plugin (plugin);
|
||||
|
||||
/* remove all hdata */
|
||||
hdata_free_all_plugin (plugin);
|
||||
|
||||
/* remove all bar items */
|
||||
gui_bar_item_free_all_plugin (plugin);
|
||||
|
||||
@@ -1155,6 +1162,38 @@ plugin_end ()
|
||||
plugin_config_end ();
|
||||
}
|
||||
|
||||
/*
|
||||
* plugin_hdata_plugin_cb: return hdata for plugin
|
||||
*/
|
||||
|
||||
struct t_hdata *
|
||||
plugin_hdata_plugin_cb (void *data, const char *hdata_name)
|
||||
{
|
||||
struct t_hdata *hdata;
|
||||
|
||||
/* make C compiler happy */
|
||||
(void) data;
|
||||
|
||||
hdata = hdata_new (NULL, hdata_name, "prev_plugin", "next_plugin");
|
||||
if (hdata)
|
||||
{
|
||||
HDATA_VAR(struct t_weechat_plugin, filename, STRING, NULL);
|
||||
HDATA_VAR(struct t_weechat_plugin, handle, POINTER, NULL);
|
||||
HDATA_VAR(struct t_weechat_plugin, name, STRING, NULL);
|
||||
HDATA_VAR(struct t_weechat_plugin, description, STRING, NULL);
|
||||
HDATA_VAR(struct t_weechat_plugin, author, STRING, NULL);
|
||||
HDATA_VAR(struct t_weechat_plugin, version, STRING, NULL);
|
||||
HDATA_VAR(struct t_weechat_plugin, license, STRING, NULL);
|
||||
HDATA_VAR(struct t_weechat_plugin, charset, STRING, NULL);
|
||||
HDATA_VAR(struct t_weechat_plugin, debug, INTEGER, NULL);
|
||||
HDATA_VAR(struct t_weechat_plugin, prev_plugin, POINTER, hdata_name);
|
||||
HDATA_VAR(struct t_weechat_plugin, next_plugin, POINTER, hdata_name);
|
||||
HDATA_LIST(weechat_plugins);
|
||||
HDATA_LIST(last_weechat_plugin);
|
||||
}
|
||||
return hdata;
|
||||
}
|
||||
|
||||
/*
|
||||
* plugin_add_to_infolist: add a plugin in an infolist
|
||||
* return 1 if ok, 0 if error
|
||||
|
||||
@@ -42,6 +42,8 @@ extern void plugin_unload_all ();
|
||||
extern void plugin_reload_name (const char *name);
|
||||
extern void plugin_init (int auto_load, int argc, char *argv[]);
|
||||
extern void plugin_end ();
|
||||
extern struct t_hdata *plugin_hdata_plugin_cb (void *data,
|
||||
const char *hdata_name);
|
||||
extern int plugin_add_to_infolist (struct t_infolist *infolist,
|
||||
struct t_weechat_plugin *plugin);
|
||||
extern void plugin_print_log ();
|
||||
|
||||
@@ -7224,6 +7224,41 @@ weechat_lua_api_hdata_get (lua_State *L)
|
||||
LUA_RETURN_STRING_FREE(result);
|
||||
}
|
||||
|
||||
/*
|
||||
* weechat_lua_api_hdata_get_var_offset: get offset of variable in hdata
|
||||
*/
|
||||
|
||||
static int
|
||||
weechat_lua_api_hdata_get_var_offset (lua_State *L)
|
||||
{
|
||||
const char *hdata, *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_get_var_offset");
|
||||
LUA_RETURN_INT(0);
|
||||
}
|
||||
|
||||
n = lua_gettop (lua_current_interpreter);
|
||||
|
||||
if (n < 2)
|
||||
{
|
||||
WEECHAT_SCRIPT_MSG_WRONG_ARGS(LUA_CURRENT_SCRIPT_NAME, "hdata_get_var_offset");
|
||||
LUA_RETURN_INT(0);
|
||||
}
|
||||
|
||||
hdata = lua_tostring (lua_current_interpreter, -2);
|
||||
name = lua_tostring (lua_current_interpreter, -1);
|
||||
|
||||
value = weechat_hdata_get_var_offset (script_str2ptr (hdata), name);
|
||||
|
||||
LUA_RETURN_INT(value);
|
||||
}
|
||||
|
||||
/*
|
||||
* weechat_lua_api_hdata_get_var_type_string: get type of variable as string in
|
||||
* hdata
|
||||
@@ -7260,6 +7295,41 @@ weechat_lua_api_hdata_get_var_type_string (lua_State *L)
|
||||
LUA_RETURN_STRING(result);
|
||||
}
|
||||
|
||||
/*
|
||||
* weechat_lua_api_hdata_get_var_hdata: get hdata for variable in hdata
|
||||
*/
|
||||
|
||||
static int
|
||||
weechat_lua_api_hdata_get_var_hdata (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_hdata");
|
||||
LUA_RETURN_EMPTY;
|
||||
}
|
||||
|
||||
n = lua_gettop (lua_current_interpreter);
|
||||
|
||||
if (n < 2)
|
||||
{
|
||||
WEECHAT_SCRIPT_MSG_WRONG_ARGS(LUA_CURRENT_SCRIPT_NAME, "hdata_get_var_hdata");
|
||||
LUA_RETURN_EMPTY;
|
||||
}
|
||||
|
||||
hdata = lua_tostring (lua_current_interpreter, -2);
|
||||
name = lua_tostring (lua_current_interpreter, -1);
|
||||
|
||||
result = weechat_hdata_get_var_hdata (script_str2ptr (hdata), name);
|
||||
|
||||
LUA_RETURN_STRING(result);
|
||||
}
|
||||
|
||||
/*
|
||||
* weechat_lua_api_hdata_get_list: get list pointer in hdata
|
||||
*/
|
||||
@@ -8318,7 +8388,9 @@ const struct luaL_reg weechat_lua_api_funcs[] = {
|
||||
{ "infolist_time", &weechat_lua_api_infolist_time },
|
||||
{ "infolist_free", &weechat_lua_api_infolist_free },
|
||||
{ "hdata_get", &weechat_lua_api_hdata_get },
|
||||
{ "hdata_get_var_offset", &weechat_lua_api_hdata_get_var_offset },
|
||||
{ "hdata_get_var_type_string", &weechat_lua_api_hdata_get_var_type_string },
|
||||
{ "hdata_get_var_hdata", &weechat_lua_api_hdata_get_var_hdata },
|
||||
{ "hdata_get_list", &weechat_lua_api_hdata_get_list },
|
||||
{ "hdata_move", &weechat_lua_api_hdata_move },
|
||||
{ "hdata_integer", &weechat_lua_api_hdata_integer },
|
||||
|
||||
@@ -6535,6 +6535,39 @@ XS (XS_weechat_api_hdata_get)
|
||||
PERL_RETURN_STRING_FREE(result);
|
||||
}
|
||||
|
||||
/*
|
||||
* weechat::hdata_get_var_offset: get offset of variable in hdata
|
||||
*/
|
||||
|
||||
XS (XS_weechat_api_hdata_get_var_offset)
|
||||
{
|
||||
char *hdata, *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_get_var_offset");
|
||||
PERL_RETURN_INT(0);
|
||||
}
|
||||
|
||||
if (items < 2)
|
||||
{
|
||||
WEECHAT_SCRIPT_MSG_WRONG_ARGS(PERL_CURRENT_SCRIPT_NAME, "hdata_get_var_offset");
|
||||
PERL_RETURN_INT(0);
|
||||
}
|
||||
|
||||
hdata = SvPV (ST (0), PL_na);
|
||||
name = SvPV (ST (1), PL_na);
|
||||
|
||||
value = weechat_hdata_get_var_offset (script_str2ptr (hdata), name);
|
||||
|
||||
PERL_RETURN_INT(value);
|
||||
}
|
||||
|
||||
/*
|
||||
* weechat::hdata_get_var_type_string: get type of variable as string in hdata
|
||||
*/
|
||||
@@ -6568,6 +6601,39 @@ XS (XS_weechat_api_hdata_get_var_type_string)
|
||||
PERL_RETURN_STRING(result);
|
||||
}
|
||||
|
||||
/*
|
||||
* weechat::hdata_get_var_hdata: get hdata for variable in hdata
|
||||
*/
|
||||
|
||||
XS (XS_weechat_api_hdata_get_var_hdata)
|
||||
{
|
||||
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_hdata");
|
||||
PERL_RETURN_EMPTY;
|
||||
}
|
||||
|
||||
if (items < 2)
|
||||
{
|
||||
WEECHAT_SCRIPT_MSG_WRONG_ARGS(PERL_CURRENT_SCRIPT_NAME, "hdata_get_var_hdata");
|
||||
PERL_RETURN_EMPTY;
|
||||
}
|
||||
|
||||
hdata = SvPV (ST (0), PL_na);
|
||||
name = SvPV (ST (1), PL_na);
|
||||
|
||||
result = weechat_hdata_get_var_hdata (script_str2ptr (hdata), name);
|
||||
|
||||
PERL_RETURN_STRING(result);
|
||||
}
|
||||
|
||||
/*
|
||||
* weechat::hdata_get_list: get list pointer in hdata
|
||||
*/
|
||||
@@ -7213,7 +7279,9 @@ weechat_perl_api_init (pTHX)
|
||||
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_offset", XS_weechat_api_hdata_get_var_offset, "weechat");
|
||||
newXS ("weechat::hdata_get_var_type_string", XS_weechat_api_hdata_get_var_type_string, "weechat");
|
||||
newXS ("weechat::hdata_get_var_hdata", XS_weechat_api_hdata_get_var_hdata, "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");
|
||||
|
||||
@@ -6875,6 +6875,39 @@ weechat_python_api_hdata_get (PyObject *self, PyObject *args)
|
||||
PYTHON_RETURN_STRING_FREE(result);
|
||||
}
|
||||
|
||||
/*
|
||||
* weechat_python_api_hdata_get_var_offset: get offset of variable in hdata
|
||||
*/
|
||||
|
||||
static PyObject *
|
||||
weechat_python_api_hdata_get_var_offset (PyObject *self, PyObject *args)
|
||||
{
|
||||
char *hdata, *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_get_var_offset");
|
||||
PYTHON_RETURN_INT(0);
|
||||
}
|
||||
|
||||
hdata = NULL;
|
||||
name = NULL;
|
||||
|
||||
if (!PyArg_ParseTuple (args, "ss", &hdata, &name))
|
||||
{
|
||||
WEECHAT_SCRIPT_MSG_WRONG_ARGS(PYTHON_CURRENT_SCRIPT_NAME, "hdata_get_var_offset");
|
||||
PYTHON_RETURN_INT(0);
|
||||
}
|
||||
|
||||
value = weechat_hdata_get_var_offset (script_str2ptr (hdata), name);
|
||||
|
||||
PYTHON_RETURN_INT(value);
|
||||
}
|
||||
|
||||
/*
|
||||
* weechat_python_api_hdata_get_var_type_string: get type of variable as string
|
||||
* in hdata
|
||||
@@ -6909,6 +6942,39 @@ weechat_python_api_hdata_get_var_type_string (PyObject *self, PyObject *args)
|
||||
PYTHON_RETURN_STRING(result);
|
||||
}
|
||||
|
||||
/*
|
||||
* weechat_python_api_hdata_get_var_hdata: get hdata for variable in hdata
|
||||
*/
|
||||
|
||||
static PyObject *
|
||||
weechat_python_api_hdata_get_var_hdata (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_hdata");
|
||||
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_hdata");
|
||||
PYTHON_RETURN_EMPTY;
|
||||
}
|
||||
|
||||
result = weechat_hdata_get_var_hdata (script_str2ptr (hdata), name);
|
||||
|
||||
PYTHON_RETURN_STRING(result);
|
||||
}
|
||||
|
||||
/*
|
||||
* weechat_python_api_hdata_get_list: get list pointer in hdata
|
||||
*/
|
||||
@@ -7555,7 +7621,9 @@ PyMethodDef weechat_python_funcs[] =
|
||||
{ "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_offset", &weechat_python_api_hdata_get_var_offset, METH_VARARGS, "" },
|
||||
{ "hdata_get_var_type_string", &weechat_python_api_hdata_get_var_type_string, METH_VARARGS, "" },
|
||||
{ "hdata_get_var_hdata", &weechat_python_api_hdata_get_var_hdata, 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, "" },
|
||||
|
||||
@@ -7490,6 +7490,42 @@ weechat_ruby_api_hdata_get (VALUE class, VALUE name)
|
||||
RUBY_RETURN_STRING_FREE(result);
|
||||
}
|
||||
|
||||
/*
|
||||
* weechat_ruby_api_hdata_get_var_offset: get offset of variable in hdata
|
||||
*/
|
||||
|
||||
static VALUE
|
||||
weechat_ruby_api_hdata_get_var_offset (VALUE class, VALUE hdata, VALUE name)
|
||||
{
|
||||
char *c_hdata, *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_get_var_offset");
|
||||
RUBY_RETURN_INT(0);
|
||||
}
|
||||
|
||||
if (NIL_P (hdata) || NIL_P (name))
|
||||
{
|
||||
WEECHAT_SCRIPT_MSG_WRONG_ARGS(RUBY_CURRENT_SCRIPT_NAME, "hdata_get_var_offset");
|
||||
RUBY_RETURN_INT(0);
|
||||
}
|
||||
|
||||
Check_Type (hdata, T_STRING);
|
||||
Check_Type (name, T_STRING);
|
||||
|
||||
c_hdata = StringValuePtr (hdata);
|
||||
c_name = StringValuePtr (name);
|
||||
|
||||
value = weechat_hdata_get_var_offset (script_str2ptr (c_hdata), c_name);
|
||||
|
||||
RUBY_RETURN_INT(value);
|
||||
}
|
||||
|
||||
/*
|
||||
* weechat_ruby_api_hdata_get_var_type_string: get type of variable as string
|
||||
* in hdata
|
||||
@@ -7528,6 +7564,42 @@ weechat_ruby_api_hdata_get_var_type_string (VALUE class, VALUE hdata,
|
||||
RUBY_RETURN_STRING(result);
|
||||
}
|
||||
|
||||
/*
|
||||
* weechat_ruby_api_hdata_get_var_hdata: get hdata for variable in hdata
|
||||
*/
|
||||
|
||||
static VALUE
|
||||
weechat_ruby_api_hdata_get_var_hdata (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_hdata");
|
||||
RUBY_RETURN_EMPTY;
|
||||
}
|
||||
|
||||
if (NIL_P (hdata) || NIL_P (name))
|
||||
{
|
||||
WEECHAT_SCRIPT_MSG_WRONG_ARGS(RUBY_CURRENT_SCRIPT_NAME, "hdata_get_var_hdata");
|
||||
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_hdata (script_str2ptr (c_hdata), c_name);
|
||||
|
||||
RUBY_RETURN_STRING(result);
|
||||
}
|
||||
|
||||
/*
|
||||
* weechat_ruby_api_hdata_get_list: get list pointer in hdata
|
||||
*/
|
||||
@@ -8273,7 +8345,9 @@ weechat_ruby_api_init (VALUE ruby_mWeechat)
|
||||
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_offset", &weechat_ruby_api_hdata_get_var_offset, 2);
|
||||
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_var_hdata", &weechat_ruby_api_hdata_get_var_hdata, 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);
|
||||
|
||||
@@ -7283,6 +7283,41 @@ weechat_tcl_api_hdata_get (ClientData clientData, Tcl_Interp *interp,
|
||||
TCL_RETURN_STRING_FREE(result);
|
||||
}
|
||||
|
||||
/*
|
||||
* weechat_tcl_api_hdata_get_var_offset: get offset of variable in hdata
|
||||
*/
|
||||
|
||||
static int
|
||||
weechat_tcl_api_hdata_get_var_offset (ClientData clientData, Tcl_Interp *interp,
|
||||
int objc, Tcl_Obj *CONST objv[])
|
||||
{
|
||||
Tcl_Obj *objp;
|
||||
char *hdata, *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_get_var_offset");
|
||||
TCL_RETURN_INT(0);
|
||||
}
|
||||
|
||||
if (objc < 3)
|
||||
{
|
||||
WEECHAT_SCRIPT_MSG_WRONG_ARGS(TCL_CURRENT_SCRIPT_NAME, "hdata_get_var_offset");
|
||||
TCL_RETURN_INT(0);
|
||||
}
|
||||
|
||||
hdata = Tcl_GetStringFromObj (objv[1], &i);
|
||||
name = Tcl_GetStringFromObj (objv[2], &i);
|
||||
|
||||
result = weechat_hdata_get_var_offset (script_str2ptr (hdata), name);
|
||||
|
||||
TCL_RETURN_INT(result);
|
||||
}
|
||||
|
||||
/*
|
||||
* weechat_tcl_api_hdata_get_var_type_string: get type of variable as string in
|
||||
* hdata
|
||||
@@ -7321,6 +7356,42 @@ weechat_tcl_api_hdata_get_var_type_string (ClientData clientData,
|
||||
TCL_RETURN_STRING(result);
|
||||
}
|
||||
|
||||
/*
|
||||
* weechat_tcl_api_hdata_get_var_hdata: get hdata for variable in hdata
|
||||
*/
|
||||
|
||||
static int
|
||||
weechat_tcl_api_hdata_get_var_hdata (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_hdata");
|
||||
TCL_RETURN_EMPTY;
|
||||
}
|
||||
|
||||
if (objc < 3)
|
||||
{
|
||||
WEECHAT_SCRIPT_MSG_WRONG_ARGS(TCL_CURRENT_SCRIPT_NAME, "hdata_get_var_hdata");
|
||||
TCL_RETURN_EMPTY;
|
||||
}
|
||||
|
||||
hdata = Tcl_GetStringFromObj (objv[1], &i);
|
||||
name = Tcl_GetStringFromObj (objv[2], &i);
|
||||
|
||||
result = weechat_hdata_get_var_hdata (script_str2ptr (hdata), name);
|
||||
|
||||
TCL_RETURN_STRING(result);
|
||||
}
|
||||
|
||||
/*
|
||||
* weechat_tcl_api_hdata_get_list: get list pointer in hdata
|
||||
*/
|
||||
@@ -8266,8 +8337,12 @@ void weechat_tcl_api_init (Tcl_Interp *interp)
|
||||
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_offset",
|
||||
weechat_tcl_api_hdata_get_var_offset, (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_var_hdata",
|
||||
weechat_tcl_api_hdata_get_var_hdata, (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",
|
||||
|
||||
@@ -762,10 +762,11 @@ struct t_weechat_plugin
|
||||
void (*infolist_free) (struct t_infolist *infolist);
|
||||
|
||||
/* hdata */
|
||||
struct t_hdata *(*hdata_new) (const char *hdata_name, const char *var_prev,
|
||||
struct t_hdata *(*hdata_new) (struct t_weechat_plugin *plugin,
|
||||
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);
|
||||
int type, const char *hdata_name);
|
||||
void (*hdata_new_list) (struct t_hdata *hdata, const char *name,
|
||||
void *pointer);
|
||||
struct t_hdata *(*hdata_get) (struct t_weechat_plugin *plugin,
|
||||
@@ -774,6 +775,8 @@ struct t_weechat_plugin
|
||||
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);
|
||||
const char *(*hdata_get_var_hdata) (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,
|
||||
@@ -1477,12 +1480,15 @@ extern int weechat_plugin_end (struct t_weechat_plugin *plugin);
|
||||
|
||||
/* 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_plugin->hdata_new(weechat_plugin, __hdata_name, __var_prev, \
|
||||
__var_next)
|
||||
#define weechat_hdata_new_var(__hdata, __name, __offset, __type, \
|
||||
__hdata_name) \
|
||||
weechat_plugin->hdata_new_var(__hdata, __name, __offset, __type, \
|
||||
__hdata_name)
|
||||
#define WEECHAT_HDATA_VAR(__struct, __name, __type, __hdata_name) \
|
||||
weechat_hdata_new_var (hdata, #__name, offsetof (__struct, __name), \
|
||||
WEECHAT_HDATA_##__type);
|
||||
WEECHAT_HDATA_##__type, __hdata_name)
|
||||
#define weechat_hdata_new_list(__hdata, __name, __pointer) \
|
||||
weechat_plugin->hdata_new_list(__hdata, __name, __pointer)
|
||||
#define WEECHAT_HDATA_LIST(__name) \
|
||||
@@ -1495,6 +1501,8 @@ extern int weechat_plugin_end (struct t_weechat_plugin *plugin);
|
||||
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(__hdata, __name) \
|
||||
weechat_plugin->hdata_get_var_hdata(__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) \
|
||||
|
||||
Reference in New Issue
Block a user