mirror of
https://github.com/weechat/weechat.git
synced 2026-06-26 04:46:37 +02:00
api: allow update for some variables of hdata, add new functions hdata_update and hdata_set
This commit is contained in:
@@ -5102,7 +5102,6 @@ weechat_guile_api_hdata_time (SCM hdata, SCM pointer, SCM name)
|
||||
{
|
||||
char timebuffer[64], *result;
|
||||
time_t time;
|
||||
struct tm *date_tmp;
|
||||
SCM return_value;
|
||||
|
||||
API_FUNC(1, "hdata_time", API_RETURN_EMPTY);
|
||||
@@ -5113,9 +5112,7 @@ weechat_guile_api_hdata_time (SCM hdata, SCM pointer, SCM name)
|
||||
time = weechat_hdata_time (API_STR2PTR(scm_i_string_chars (hdata)),
|
||||
API_STR2PTR(scm_i_string_chars (pointer)),
|
||||
scm_i_string_chars (name));
|
||||
date_tmp = localtime (&time);
|
||||
if (date_tmp)
|
||||
strftime (timebuffer, sizeof (timebuffer), "%F %T", date_tmp);
|
||||
snprintf (timebuffer, sizeof (timebuffer), "%ld", (long int)time);
|
||||
result = strdup (timebuffer);
|
||||
|
||||
API_RETURN_STRING_FREE(result);
|
||||
@@ -5144,6 +5141,33 @@ weechat_guile_api_hdata_hashtable (SCM hdata, SCM pointer, SCM name)
|
||||
return result_alist;
|
||||
}
|
||||
|
||||
/*
|
||||
* weechat_guile_api_hdata_update: update data in a hdata
|
||||
*/
|
||||
|
||||
SCM
|
||||
weechat_guile_api_hdata_update (SCM hdata, SCM pointer, SCM hashtable)
|
||||
{
|
||||
struct t_hashtable *c_hashtable;
|
||||
int value;
|
||||
|
||||
API_FUNC(1, "hdata_update", API_RETURN_INT(0));
|
||||
if (!scm_is_string (hdata) || !scm_is_string (pointer) || !scm_list_p (hashtable))
|
||||
API_WRONG_ARGS(API_RETURN_INT(0));
|
||||
|
||||
c_hashtable = weechat_guile_alist_to_hashtable (hashtable,
|
||||
WEECHAT_SCRIPT_HASHTABLE_DEFAULT_SIZE);
|
||||
|
||||
value = weechat_hdata_update (API_STR2PTR(scm_i_string_chars (hdata)),
|
||||
API_STR2PTR(scm_i_string_chars (pointer)),
|
||||
c_hashtable);
|
||||
|
||||
if (c_hashtable)
|
||||
weechat_hashtable_free (c_hashtable);
|
||||
|
||||
API_RETURN_INT(value);
|
||||
}
|
||||
|
||||
/*
|
||||
* weechat_guile_api_hdata_get_string: get hdata property as string
|
||||
*/
|
||||
@@ -5494,6 +5518,7 @@ weechat_guile_api_module_init (void *data)
|
||||
API_DEF_FUNC(hdata_pointer, 3);
|
||||
API_DEF_FUNC(hdata_time, 3);
|
||||
API_DEF_FUNC(hdata_hashtable, 3);
|
||||
API_DEF_FUNC(hdata_update, 3);
|
||||
API_DEF_FUNC(hdata_get_string, 2);
|
||||
API_DEF_FUNC(upgrade_new, 2);
|
||||
API_DEF_FUNC(upgrade_write_object, 3);
|
||||
|
||||
@@ -876,34 +876,35 @@ irc_channel_hdata_channel_cb (void *data, const char *hdata_name)
|
||||
/* make C compiler happy */
|
||||
(void) data;
|
||||
|
||||
hdata = weechat_hdata_new (hdata_name, "prev_channel", "next_channel");
|
||||
hdata = weechat_hdata_new (hdata_name, "prev_channel", "next_channel",
|
||||
0, NULL, NULL);
|
||||
if (hdata)
|
||||
{
|
||||
WEECHAT_HDATA_VAR(struct t_irc_channel, type, INTEGER, NULL, NULL);
|
||||
WEECHAT_HDATA_VAR(struct t_irc_channel, name, STRING, NULL, NULL);
|
||||
WEECHAT_HDATA_VAR(struct t_irc_channel, topic, STRING, NULL, NULL);
|
||||
WEECHAT_HDATA_VAR(struct t_irc_channel, modes, STRING, NULL, NULL);
|
||||
WEECHAT_HDATA_VAR(struct t_irc_channel, limit, INTEGER, NULL, NULL);
|
||||
WEECHAT_HDATA_VAR(struct t_irc_channel, key, STRING, NULL, NULL);
|
||||
WEECHAT_HDATA_VAR(struct t_irc_channel, names_received, INTEGER, NULL, NULL);
|
||||
WEECHAT_HDATA_VAR(struct t_irc_channel, checking_away, INTEGER, NULL, NULL);
|
||||
WEECHAT_HDATA_VAR(struct t_irc_channel, away_message, STRING, NULL, NULL);
|
||||
WEECHAT_HDATA_VAR(struct t_irc_channel, has_quit_server, INTEGER, NULL, NULL);
|
||||
WEECHAT_HDATA_VAR(struct t_irc_channel, cycle, INTEGER, NULL, NULL);
|
||||
WEECHAT_HDATA_VAR(struct t_irc_channel, part, INTEGER, NULL, NULL);
|
||||
WEECHAT_HDATA_VAR(struct t_irc_channel, nick_completion_reset, INTEGER, NULL, NULL);
|
||||
WEECHAT_HDATA_VAR(struct t_irc_channel, pv_remote_nick_color, STRING, NULL, NULL);
|
||||
WEECHAT_HDATA_VAR(struct t_irc_channel, hook_autorejoin, POINTER, NULL, NULL);
|
||||
WEECHAT_HDATA_VAR(struct t_irc_channel, nicks_count, INTEGER, NULL, NULL);
|
||||
WEECHAT_HDATA_VAR(struct t_irc_channel, nicks, POINTER, NULL, "irc_nick");
|
||||
WEECHAT_HDATA_VAR(struct t_irc_channel, last_nick, POINTER, NULL, "irc_nick");
|
||||
WEECHAT_HDATA_VAR(struct t_irc_channel, nicks_speaking, POINTER, NULL, NULL);
|
||||
WEECHAT_HDATA_VAR(struct t_irc_channel, nicks_speaking_time, POINTER, NULL, "irc_channel_speaking");
|
||||
WEECHAT_HDATA_VAR(struct t_irc_channel, last_nick_speaking_time, POINTER, NULL, "irc_channel_speaking");
|
||||
WEECHAT_HDATA_VAR(struct t_irc_channel, buffer, POINTER, NULL, "buffer");
|
||||
WEECHAT_HDATA_VAR(struct t_irc_channel, buffer_as_string, STRING, NULL, NULL);
|
||||
WEECHAT_HDATA_VAR(struct t_irc_channel, prev_channel, POINTER, NULL, hdata_name);
|
||||
WEECHAT_HDATA_VAR(struct t_irc_channel, next_channel, POINTER, NULL, hdata_name);
|
||||
WEECHAT_HDATA_VAR(struct t_irc_channel, type, INTEGER, 0, NULL, NULL);
|
||||
WEECHAT_HDATA_VAR(struct t_irc_channel, name, STRING, 0, NULL, NULL);
|
||||
WEECHAT_HDATA_VAR(struct t_irc_channel, topic, STRING, 0, NULL, NULL);
|
||||
WEECHAT_HDATA_VAR(struct t_irc_channel, modes, STRING, 0, NULL, NULL);
|
||||
WEECHAT_HDATA_VAR(struct t_irc_channel, limit, INTEGER, 0, NULL, NULL);
|
||||
WEECHAT_HDATA_VAR(struct t_irc_channel, key, STRING, 0, NULL, NULL);
|
||||
WEECHAT_HDATA_VAR(struct t_irc_channel, names_received, INTEGER, 0, NULL, NULL);
|
||||
WEECHAT_HDATA_VAR(struct t_irc_channel, checking_away, INTEGER, 0, NULL, NULL);
|
||||
WEECHAT_HDATA_VAR(struct t_irc_channel, away_message, STRING, 0, NULL, NULL);
|
||||
WEECHAT_HDATA_VAR(struct t_irc_channel, has_quit_server, INTEGER, 0, NULL, NULL);
|
||||
WEECHAT_HDATA_VAR(struct t_irc_channel, cycle, INTEGER, 0, NULL, NULL);
|
||||
WEECHAT_HDATA_VAR(struct t_irc_channel, part, INTEGER, 0, NULL, NULL);
|
||||
WEECHAT_HDATA_VAR(struct t_irc_channel, nick_completion_reset, INTEGER, 0, NULL, NULL);
|
||||
WEECHAT_HDATA_VAR(struct t_irc_channel, pv_remote_nick_color, STRING, 0, NULL, NULL);
|
||||
WEECHAT_HDATA_VAR(struct t_irc_channel, hook_autorejoin, POINTER, 0, NULL, NULL);
|
||||
WEECHAT_HDATA_VAR(struct t_irc_channel, nicks_count, INTEGER, 0, NULL, NULL);
|
||||
WEECHAT_HDATA_VAR(struct t_irc_channel, nicks, POINTER, 0, NULL, "irc_nick");
|
||||
WEECHAT_HDATA_VAR(struct t_irc_channel, last_nick, POINTER, 0, NULL, "irc_nick");
|
||||
WEECHAT_HDATA_VAR(struct t_irc_channel, nicks_speaking, POINTER, 0, NULL, NULL);
|
||||
WEECHAT_HDATA_VAR(struct t_irc_channel, nicks_speaking_time, POINTER, 0, NULL, "irc_channel_speaking");
|
||||
WEECHAT_HDATA_VAR(struct t_irc_channel, last_nick_speaking_time, POINTER, 0, NULL, "irc_channel_speaking");
|
||||
WEECHAT_HDATA_VAR(struct t_irc_channel, buffer, POINTER, 0, NULL, "buffer");
|
||||
WEECHAT_HDATA_VAR(struct t_irc_channel, buffer_as_string, STRING, 0, NULL, NULL);
|
||||
WEECHAT_HDATA_VAR(struct t_irc_channel, prev_channel, POINTER, 0, NULL, hdata_name);
|
||||
WEECHAT_HDATA_VAR(struct t_irc_channel, next_channel, POINTER, 0, NULL, hdata_name);
|
||||
}
|
||||
return hdata;
|
||||
}
|
||||
@@ -920,13 +921,14 @@ irc_channel_hdata_channel_speaking_cb (void *data, const char *hdata_name)
|
||||
/* make C compiler happy */
|
||||
(void) data;
|
||||
|
||||
hdata = weechat_hdata_new (hdata_name, "prev_nick", "next_nick");
|
||||
hdata = weechat_hdata_new (hdata_name, "prev_nick", "next_nick",
|
||||
0, NULL, NULL);
|
||||
if (hdata)
|
||||
{
|
||||
WEECHAT_HDATA_VAR(struct t_irc_channel_speaking, nick, STRING, NULL, NULL);
|
||||
WEECHAT_HDATA_VAR(struct t_irc_channel_speaking, time_last_message, TIME, NULL, NULL);
|
||||
WEECHAT_HDATA_VAR(struct t_irc_channel_speaking, prev_nick, POINTER, NULL, hdata_name);
|
||||
WEECHAT_HDATA_VAR(struct t_irc_channel_speaking, next_nick, POINTER, NULL, hdata_name);
|
||||
WEECHAT_HDATA_VAR(struct t_irc_channel_speaking, nick, STRING, 0, NULL, NULL);
|
||||
WEECHAT_HDATA_VAR(struct t_irc_channel_speaking, time_last_message, TIME, 0, NULL, NULL);
|
||||
WEECHAT_HDATA_VAR(struct t_irc_channel_speaking, prev_nick, POINTER, 0, NULL, hdata_name);
|
||||
WEECHAT_HDATA_VAR(struct t_irc_channel_speaking, next_nick, POINTER, 0, NULL, hdata_name);
|
||||
}
|
||||
return hdata;
|
||||
}
|
||||
|
||||
@@ -318,16 +318,17 @@ irc_ignore_hdata_ignore_cb (void *data, const char *hdata_name)
|
||||
/* make C compiler happy */
|
||||
(void) data;
|
||||
|
||||
hdata = weechat_hdata_new (hdata_name, "prev_ignore", "next_ignore");
|
||||
hdata = weechat_hdata_new (hdata_name, "prev_ignore", "next_ignore",
|
||||
0, NULL, NULL);
|
||||
if (hdata)
|
||||
{
|
||||
WEECHAT_HDATA_VAR(struct t_irc_ignore, number, INTEGER, NULL, NULL);
|
||||
WEECHAT_HDATA_VAR(struct t_irc_ignore, mask, STRING, NULL, NULL);
|
||||
WEECHAT_HDATA_VAR(struct t_irc_ignore, regex_mask, POINTER, NULL, NULL);
|
||||
WEECHAT_HDATA_VAR(struct t_irc_ignore, server, STRING, NULL, NULL);
|
||||
WEECHAT_HDATA_VAR(struct t_irc_ignore, channel, STRING, NULL, NULL);
|
||||
WEECHAT_HDATA_VAR(struct t_irc_ignore, prev_ignore, POINTER, NULL, hdata_name);
|
||||
WEECHAT_HDATA_VAR(struct t_irc_ignore, next_ignore, POINTER, NULL, hdata_name);
|
||||
WEECHAT_HDATA_VAR(struct t_irc_ignore, number, INTEGER, 0, NULL, NULL);
|
||||
WEECHAT_HDATA_VAR(struct t_irc_ignore, mask, STRING, 0, NULL, NULL);
|
||||
WEECHAT_HDATA_VAR(struct t_irc_ignore, regex_mask, POINTER, 0, NULL, NULL);
|
||||
WEECHAT_HDATA_VAR(struct t_irc_ignore, server, STRING, 0, NULL, NULL);
|
||||
WEECHAT_HDATA_VAR(struct t_irc_ignore, channel, STRING, 0, NULL, NULL);
|
||||
WEECHAT_HDATA_VAR(struct t_irc_ignore, prev_ignore, POINTER, 0, NULL, hdata_name);
|
||||
WEECHAT_HDATA_VAR(struct t_irc_ignore, next_ignore, POINTER, 0, NULL, hdata_name);
|
||||
WEECHAT_HDATA_LIST(irc_ignore_list);
|
||||
WEECHAT_HDATA_LIST(last_irc_ignore);
|
||||
}
|
||||
|
||||
@@ -1031,17 +1031,18 @@ irc_nick_hdata_nick_cb (void *data, const char *hdata_name)
|
||||
/* make C compiler happy */
|
||||
(void) data;
|
||||
|
||||
hdata = weechat_hdata_new (hdata_name, "prev_nick", "next_nick");
|
||||
hdata = weechat_hdata_new (hdata_name, "prev_nick", "next_nick",
|
||||
0, NULL, NULL);
|
||||
if (hdata)
|
||||
{
|
||||
WEECHAT_HDATA_VAR(struct t_irc_nick, name, STRING, NULL, NULL);
|
||||
WEECHAT_HDATA_VAR(struct t_irc_nick, host, STRING, NULL, NULL);
|
||||
WEECHAT_HDATA_VAR(struct t_irc_nick, prefixes, STRING, NULL, NULL);
|
||||
WEECHAT_HDATA_VAR(struct t_irc_nick, prefix, STRING, NULL, NULL);
|
||||
WEECHAT_HDATA_VAR(struct t_irc_nick, away, INTEGER, NULL, NULL);
|
||||
WEECHAT_HDATA_VAR(struct t_irc_nick, color, STRING, NULL, NULL);
|
||||
WEECHAT_HDATA_VAR(struct t_irc_nick, prev_nick, POINTER, NULL, hdata_name);
|
||||
WEECHAT_HDATA_VAR(struct t_irc_nick, next_nick, POINTER, NULL, hdata_name);
|
||||
WEECHAT_HDATA_VAR(struct t_irc_nick, name, STRING, 0, NULL, NULL);
|
||||
WEECHAT_HDATA_VAR(struct t_irc_nick, host, STRING, 0, NULL, NULL);
|
||||
WEECHAT_HDATA_VAR(struct t_irc_nick, prefixes, STRING, 0, NULL, NULL);
|
||||
WEECHAT_HDATA_VAR(struct t_irc_nick, prefix, STRING, 0, NULL, NULL);
|
||||
WEECHAT_HDATA_VAR(struct t_irc_nick, away, INTEGER, 0, NULL, NULL);
|
||||
WEECHAT_HDATA_VAR(struct t_irc_nick, color, STRING, 0, NULL, NULL);
|
||||
WEECHAT_HDATA_VAR(struct t_irc_nick, prev_nick, POINTER, 0, NULL, hdata_name);
|
||||
WEECHAT_HDATA_VAR(struct t_irc_nick, next_nick, POINTER, 0, NULL, hdata_name);
|
||||
}
|
||||
return hdata;
|
||||
}
|
||||
|
||||
@@ -963,17 +963,18 @@ irc_notify_hdata_notify_cb (void *data, const char *hdata_name)
|
||||
/* make C compiler happy */
|
||||
(void) data;
|
||||
|
||||
hdata = weechat_hdata_new (hdata_name, "prev_notify", "next_notify");
|
||||
hdata = weechat_hdata_new (hdata_name, "prev_notify", "next_notify",
|
||||
0, NULL, NULL);
|
||||
if (hdata)
|
||||
{
|
||||
WEECHAT_HDATA_VAR(struct t_irc_notify, server, POINTER, NULL, "irc_server");
|
||||
WEECHAT_HDATA_VAR(struct t_irc_notify, nick, STRING, NULL, NULL);
|
||||
WEECHAT_HDATA_VAR(struct t_irc_notify, check_away, INTEGER, NULL, NULL);
|
||||
WEECHAT_HDATA_VAR(struct t_irc_notify, is_on_server, INTEGER, NULL, NULL);
|
||||
WEECHAT_HDATA_VAR(struct t_irc_notify, away_message, STRING, NULL, NULL);
|
||||
WEECHAT_HDATA_VAR(struct t_irc_notify, ison_received, INTEGER, NULL, NULL);
|
||||
WEECHAT_HDATA_VAR(struct t_irc_notify, prev_notify, POINTER, NULL, hdata_name);
|
||||
WEECHAT_HDATA_VAR(struct t_irc_notify, next_notify, POINTER, NULL, hdata_name);
|
||||
WEECHAT_HDATA_VAR(struct t_irc_notify, server, POINTER, 0, NULL, "irc_server");
|
||||
WEECHAT_HDATA_VAR(struct t_irc_notify, nick, STRING, 0, NULL, NULL);
|
||||
WEECHAT_HDATA_VAR(struct t_irc_notify, check_away, INTEGER, 0, NULL, NULL);
|
||||
WEECHAT_HDATA_VAR(struct t_irc_notify, is_on_server, INTEGER, 0, NULL, NULL);
|
||||
WEECHAT_HDATA_VAR(struct t_irc_notify, away_message, STRING, 0, NULL, NULL);
|
||||
WEECHAT_HDATA_VAR(struct t_irc_notify, ison_received, INTEGER, 0, NULL, NULL);
|
||||
WEECHAT_HDATA_VAR(struct t_irc_notify, prev_notify, POINTER, 0, NULL, hdata_name);
|
||||
WEECHAT_HDATA_VAR(struct t_irc_notify, next_notify, POINTER, 0, NULL, hdata_name);
|
||||
}
|
||||
return hdata;
|
||||
}
|
||||
|
||||
@@ -975,17 +975,18 @@ irc_redirect_hdata_redirect_pattern_cb (void *data, const char *hdata_name)
|
||||
/* make C compiler happy */
|
||||
(void) data;
|
||||
|
||||
hdata = weechat_hdata_new (hdata_name, "prev_redirect", "next_redirect");
|
||||
hdata = weechat_hdata_new (hdata_name, "prev_redirect", "next_redirect",
|
||||
0, NULL, NULL);
|
||||
if (hdata)
|
||||
{
|
||||
WEECHAT_HDATA_VAR(struct t_irc_redirect_pattern, name, STRING, NULL, NULL);
|
||||
WEECHAT_HDATA_VAR(struct t_irc_redirect_pattern, temp_pattern, INTEGER, NULL, NULL);
|
||||
WEECHAT_HDATA_VAR(struct t_irc_redirect_pattern, timeout, INTEGER, NULL, NULL);
|
||||
WEECHAT_HDATA_VAR(struct t_irc_redirect_pattern, cmd_start, STRING, NULL, NULL);
|
||||
WEECHAT_HDATA_VAR(struct t_irc_redirect_pattern, cmd_stop, STRING, NULL, NULL);
|
||||
WEECHAT_HDATA_VAR(struct t_irc_redirect_pattern, cmd_extra, STRING, NULL, NULL);
|
||||
WEECHAT_HDATA_VAR(struct t_irc_redirect_pattern, prev_redirect, POINTER, NULL, hdata_name);
|
||||
WEECHAT_HDATA_VAR(struct t_irc_redirect_pattern, next_redirect, POINTER, NULL, hdata_name);
|
||||
WEECHAT_HDATA_VAR(struct t_irc_redirect_pattern, name, STRING, 0, NULL, NULL);
|
||||
WEECHAT_HDATA_VAR(struct t_irc_redirect_pattern, temp_pattern, INTEGER, 0, NULL, NULL);
|
||||
WEECHAT_HDATA_VAR(struct t_irc_redirect_pattern, timeout, INTEGER, 0, NULL, NULL);
|
||||
WEECHAT_HDATA_VAR(struct t_irc_redirect_pattern, cmd_start, STRING, 0, NULL, NULL);
|
||||
WEECHAT_HDATA_VAR(struct t_irc_redirect_pattern, cmd_stop, STRING, 0, NULL, NULL);
|
||||
WEECHAT_HDATA_VAR(struct t_irc_redirect_pattern, cmd_extra, STRING, 0, NULL, NULL);
|
||||
WEECHAT_HDATA_VAR(struct t_irc_redirect_pattern, prev_redirect, POINTER, 0, NULL, hdata_name);
|
||||
WEECHAT_HDATA_VAR(struct t_irc_redirect_pattern, next_redirect, POINTER, 0, NULL, hdata_name);
|
||||
WEECHAT_HDATA_LIST(irc_redirect_patterns);
|
||||
WEECHAT_HDATA_LIST(last_irc_redirect_pattern);
|
||||
}
|
||||
@@ -1004,29 +1005,30 @@ irc_redirect_hdata_redirect_cb (void *data, const char *hdata_name)
|
||||
/* make C compiler happy */
|
||||
(void) data;
|
||||
|
||||
hdata = weechat_hdata_new (hdata_name, "prev_redirect", "next_redirect");
|
||||
hdata = weechat_hdata_new (hdata_name, "prev_redirect", "next_redirect",
|
||||
0, NULL, NULL);
|
||||
if (hdata)
|
||||
{
|
||||
WEECHAT_HDATA_VAR(struct t_irc_redirect, server, POINTER, NULL, "irc_server");
|
||||
WEECHAT_HDATA_VAR(struct t_irc_redirect, pattern, STRING, NULL, NULL);
|
||||
WEECHAT_HDATA_VAR(struct t_irc_redirect, signal, STRING, NULL, NULL);
|
||||
WEECHAT_HDATA_VAR(struct t_irc_redirect, count, INTEGER, NULL, NULL);
|
||||
WEECHAT_HDATA_VAR(struct t_irc_redirect, current_count, INTEGER, NULL, NULL);
|
||||
WEECHAT_HDATA_VAR(struct t_irc_redirect, string, STRING, NULL, NULL);
|
||||
WEECHAT_HDATA_VAR(struct t_irc_redirect, timeout, INTEGER, NULL, NULL);
|
||||
WEECHAT_HDATA_VAR(struct t_irc_redirect, command, STRING, NULL, NULL);
|
||||
WEECHAT_HDATA_VAR(struct t_irc_redirect, assigned_to_command, INTEGER, NULL, NULL);
|
||||
WEECHAT_HDATA_VAR(struct t_irc_redirect, start_time, TIME, NULL, NULL);
|
||||
WEECHAT_HDATA_VAR(struct t_irc_redirect, cmd_start, HASHTABLE, NULL, NULL);
|
||||
WEECHAT_HDATA_VAR(struct t_irc_redirect, cmd_stop, HASHTABLE, NULL, NULL);
|
||||
WEECHAT_HDATA_VAR(struct t_irc_redirect, cmd_extra, HASHTABLE, NULL, NULL);
|
||||
WEECHAT_HDATA_VAR(struct t_irc_redirect, cmd_start_received, INTEGER, NULL, NULL);
|
||||
WEECHAT_HDATA_VAR(struct t_irc_redirect, cmd_stop_received, INTEGER, NULL, NULL);
|
||||
WEECHAT_HDATA_VAR(struct t_irc_redirect, cmd_filter, HASHTABLE, NULL, NULL);
|
||||
WEECHAT_HDATA_VAR(struct t_irc_redirect, output, STRING, NULL, NULL);
|
||||
WEECHAT_HDATA_VAR(struct t_irc_redirect, output_size, INTEGER, NULL, NULL);
|
||||
WEECHAT_HDATA_VAR(struct t_irc_redirect, prev_redirect, POINTER, NULL, hdata_name);
|
||||
WEECHAT_HDATA_VAR(struct t_irc_redirect, next_redirect, POINTER, NULL, hdata_name);
|
||||
WEECHAT_HDATA_VAR(struct t_irc_redirect, server, POINTER, 0, NULL, "irc_server");
|
||||
WEECHAT_HDATA_VAR(struct t_irc_redirect, pattern, STRING, 0, NULL, NULL);
|
||||
WEECHAT_HDATA_VAR(struct t_irc_redirect, signal, STRING, 0, NULL, NULL);
|
||||
WEECHAT_HDATA_VAR(struct t_irc_redirect, count, INTEGER, 0, NULL, NULL);
|
||||
WEECHAT_HDATA_VAR(struct t_irc_redirect, current_count, INTEGER, 0, NULL, NULL);
|
||||
WEECHAT_HDATA_VAR(struct t_irc_redirect, string, STRING, 0, NULL, NULL);
|
||||
WEECHAT_HDATA_VAR(struct t_irc_redirect, timeout, INTEGER, 0, NULL, NULL);
|
||||
WEECHAT_HDATA_VAR(struct t_irc_redirect, command, STRING, 0, NULL, NULL);
|
||||
WEECHAT_HDATA_VAR(struct t_irc_redirect, assigned_to_command, INTEGER, 0, NULL, NULL);
|
||||
WEECHAT_HDATA_VAR(struct t_irc_redirect, start_time, TIME, 0, NULL, NULL);
|
||||
WEECHAT_HDATA_VAR(struct t_irc_redirect, cmd_start, HASHTABLE, 0, NULL, NULL);
|
||||
WEECHAT_HDATA_VAR(struct t_irc_redirect, cmd_stop, HASHTABLE, 0, NULL, NULL);
|
||||
WEECHAT_HDATA_VAR(struct t_irc_redirect, cmd_extra, HASHTABLE, 0, NULL, NULL);
|
||||
WEECHAT_HDATA_VAR(struct t_irc_redirect, cmd_start_received, INTEGER, 0, NULL, NULL);
|
||||
WEECHAT_HDATA_VAR(struct t_irc_redirect, cmd_stop_received, INTEGER, 0, NULL, NULL);
|
||||
WEECHAT_HDATA_VAR(struct t_irc_redirect, cmd_filter, HASHTABLE, 0, NULL, NULL);
|
||||
WEECHAT_HDATA_VAR(struct t_irc_redirect, output, STRING, 0, NULL, NULL);
|
||||
WEECHAT_HDATA_VAR(struct t_irc_redirect, output_size, INTEGER, 0, NULL, NULL);
|
||||
WEECHAT_HDATA_VAR(struct t_irc_redirect, prev_redirect, POINTER, 0, NULL, hdata_name);
|
||||
WEECHAT_HDATA_VAR(struct t_irc_redirect, next_redirect, POINTER, 0, NULL, hdata_name);
|
||||
}
|
||||
return hdata;
|
||||
}
|
||||
|
||||
@@ -4367,75 +4367,76 @@ irc_server_hdata_server_cb (void *data, const char *hdata_name)
|
||||
/* make C compiler happy */
|
||||
(void) data;
|
||||
|
||||
hdata = weechat_hdata_new (hdata_name, "prev_server", "next_server");
|
||||
hdata = weechat_hdata_new (hdata_name, "prev_server", "next_server",
|
||||
0, NULL, NULL);
|
||||
if (hdata)
|
||||
{
|
||||
WEECHAT_HDATA_VAR(struct t_irc_server, name, STRING, NULL, NULL);
|
||||
WEECHAT_HDATA_VAR(struct t_irc_server, options, POINTER, NULL, NULL);
|
||||
WEECHAT_HDATA_VAR(struct t_irc_server, temp_server, INTEGER, NULL, NULL);
|
||||
WEECHAT_HDATA_VAR(struct t_irc_server, reloading_from_config, INTEGER, NULL, NULL);
|
||||
WEECHAT_HDATA_VAR(struct t_irc_server, reloaded_from_config, INTEGER, NULL, NULL);
|
||||
WEECHAT_HDATA_VAR(struct t_irc_server, addresses_count, INTEGER, NULL, NULL);
|
||||
WEECHAT_HDATA_VAR(struct t_irc_server, addresses_array, STRING, "addresses_count", NULL);
|
||||
WEECHAT_HDATA_VAR(struct t_irc_server, ports_array, INTEGER, "addresses_count", NULL);
|
||||
WEECHAT_HDATA_VAR(struct t_irc_server, index_current_address, INTEGER, NULL, NULL);
|
||||
WEECHAT_HDATA_VAR(struct t_irc_server, current_address, STRING, NULL, NULL);
|
||||
WEECHAT_HDATA_VAR(struct t_irc_server, current_ip, STRING, NULL, NULL);
|
||||
WEECHAT_HDATA_VAR(struct t_irc_server, current_port, INTEGER, NULL, NULL);
|
||||
WEECHAT_HDATA_VAR(struct t_irc_server, sock, INTEGER, NULL, NULL);
|
||||
WEECHAT_HDATA_VAR(struct t_irc_server, hook_connect, POINTER, NULL, "hook");
|
||||
WEECHAT_HDATA_VAR(struct t_irc_server, hook_fd, POINTER, NULL, "hook");
|
||||
WEECHAT_HDATA_VAR(struct t_irc_server, hook_timer_connection, POINTER, NULL, "hook");
|
||||
WEECHAT_HDATA_VAR(struct t_irc_server, hook_timer_sasl, POINTER, NULL, "hook");
|
||||
WEECHAT_HDATA_VAR(struct t_irc_server, is_connected, INTEGER, NULL, NULL);
|
||||
WEECHAT_HDATA_VAR(struct t_irc_server, ssl_connected, INTEGER, NULL, NULL);
|
||||
WEECHAT_HDATA_VAR(struct t_irc_server, name, STRING, 0, NULL, NULL);
|
||||
WEECHAT_HDATA_VAR(struct t_irc_server, options, POINTER, 0, NULL, NULL);
|
||||
WEECHAT_HDATA_VAR(struct t_irc_server, temp_server, INTEGER, 0, NULL, NULL);
|
||||
WEECHAT_HDATA_VAR(struct t_irc_server, reloading_from_config, INTEGER, 0, NULL, NULL);
|
||||
WEECHAT_HDATA_VAR(struct t_irc_server, reloaded_from_config, INTEGER, 0, NULL, NULL);
|
||||
WEECHAT_HDATA_VAR(struct t_irc_server, addresses_count, INTEGER, 0, NULL, NULL);
|
||||
WEECHAT_HDATA_VAR(struct t_irc_server, addresses_array, STRING, 0, "addresses_count", NULL);
|
||||
WEECHAT_HDATA_VAR(struct t_irc_server, ports_array, INTEGER, 0, "addresses_count", NULL);
|
||||
WEECHAT_HDATA_VAR(struct t_irc_server, index_current_address, INTEGER, 0, NULL, NULL);
|
||||
WEECHAT_HDATA_VAR(struct t_irc_server, current_address, STRING, 0, NULL, NULL);
|
||||
WEECHAT_HDATA_VAR(struct t_irc_server, current_ip, STRING, 0, NULL, NULL);
|
||||
WEECHAT_HDATA_VAR(struct t_irc_server, current_port, INTEGER, 0, NULL, NULL);
|
||||
WEECHAT_HDATA_VAR(struct t_irc_server, sock, INTEGER, 0, NULL, NULL);
|
||||
WEECHAT_HDATA_VAR(struct t_irc_server, hook_connect, POINTER, 0, NULL, "hook");
|
||||
WEECHAT_HDATA_VAR(struct t_irc_server, hook_fd, POINTER, 0, NULL, "hook");
|
||||
WEECHAT_HDATA_VAR(struct t_irc_server, hook_timer_connection, POINTER, 0, NULL, "hook");
|
||||
WEECHAT_HDATA_VAR(struct t_irc_server, hook_timer_sasl, POINTER, 0, NULL, "hook");
|
||||
WEECHAT_HDATA_VAR(struct t_irc_server, is_connected, INTEGER, 0, NULL, NULL);
|
||||
WEECHAT_HDATA_VAR(struct t_irc_server, ssl_connected, INTEGER, 0, NULL, NULL);
|
||||
#ifdef HAVE_GNUTLS
|
||||
WEECHAT_HDATA_VAR(struct t_irc_server, gnutls_sess, OTHER, NULL, NULL);
|
||||
WEECHAT_HDATA_VAR(struct t_irc_server, tls_cert, OTHER, NULL, NULL);
|
||||
WEECHAT_HDATA_VAR(struct t_irc_server, tls_cert_key, OTHER, NULL, NULL);
|
||||
WEECHAT_HDATA_VAR(struct t_irc_server, gnutls_sess, OTHER, 0, NULL, NULL);
|
||||
WEECHAT_HDATA_VAR(struct t_irc_server, tls_cert, OTHER, 0, NULL, NULL);
|
||||
WEECHAT_HDATA_VAR(struct t_irc_server, tls_cert_key, OTHER, 0, NULL, NULL);
|
||||
#endif
|
||||
WEECHAT_HDATA_VAR(struct t_irc_server, unterminated_message, STRING, NULL, NULL);
|
||||
WEECHAT_HDATA_VAR(struct t_irc_server, nicks_count, INTEGER, NULL, NULL);
|
||||
WEECHAT_HDATA_VAR(struct t_irc_server, nicks_array, STRING, "nicks_count", NULL);
|
||||
WEECHAT_HDATA_VAR(struct t_irc_server, nick_first_tried, INTEGER, NULL, NULL);
|
||||
WEECHAT_HDATA_VAR(struct t_irc_server, nick_alternate_number, INTEGER, NULL, NULL);
|
||||
WEECHAT_HDATA_VAR(struct t_irc_server, nick, STRING, NULL, NULL);
|
||||
WEECHAT_HDATA_VAR(struct t_irc_server, nick_modes, STRING, NULL, NULL);
|
||||
WEECHAT_HDATA_VAR(struct t_irc_server, isupport, STRING, NULL, NULL);
|
||||
WEECHAT_HDATA_VAR(struct t_irc_server, prefix_modes, STRING, NULL, NULL);
|
||||
WEECHAT_HDATA_VAR(struct t_irc_server, prefix_chars, STRING, NULL, NULL);
|
||||
WEECHAT_HDATA_VAR(struct t_irc_server, nick_max_length, INTEGER, NULL, NULL);
|
||||
WEECHAT_HDATA_VAR(struct t_irc_server, casemapping, INTEGER, NULL, NULL);
|
||||
WEECHAT_HDATA_VAR(struct t_irc_server, chantypes, STRING, NULL, NULL);
|
||||
WEECHAT_HDATA_VAR(struct t_irc_server, chanmodes, STRING, NULL, NULL);
|
||||
WEECHAT_HDATA_VAR(struct t_irc_server, reconnect_delay, INTEGER, NULL, NULL);
|
||||
WEECHAT_HDATA_VAR(struct t_irc_server, reconnect_start, TIME, NULL, NULL);
|
||||
WEECHAT_HDATA_VAR(struct t_irc_server, command_time, TIME, NULL, NULL);
|
||||
WEECHAT_HDATA_VAR(struct t_irc_server, reconnect_join, INTEGER, NULL, NULL);
|
||||
WEECHAT_HDATA_VAR(struct t_irc_server, disable_autojoin, INTEGER, NULL, NULL);
|
||||
WEECHAT_HDATA_VAR(struct t_irc_server, is_away, INTEGER, NULL, NULL);
|
||||
WEECHAT_HDATA_VAR(struct t_irc_server, away_message, STRING, NULL, NULL);
|
||||
WEECHAT_HDATA_VAR(struct t_irc_server, away_time, TIME, NULL, NULL);
|
||||
WEECHAT_HDATA_VAR(struct t_irc_server, lag, INTEGER, NULL, NULL);
|
||||
WEECHAT_HDATA_VAR(struct t_irc_server, lag_check_time, OTHER, NULL, NULL);
|
||||
WEECHAT_HDATA_VAR(struct t_irc_server, lag_next_check, TIME, NULL, NULL);
|
||||
WEECHAT_HDATA_VAR(struct t_irc_server, lag_last_refresh, TIME, NULL, NULL);
|
||||
WEECHAT_HDATA_VAR(struct t_irc_server, cmd_list_regexp, POINTER, NULL, NULL);
|
||||
WEECHAT_HDATA_VAR(struct t_irc_server, last_user_message, TIME, NULL, NULL);
|
||||
WEECHAT_HDATA_VAR(struct t_irc_server, last_away_check, TIME, NULL, NULL);
|
||||
WEECHAT_HDATA_VAR(struct t_irc_server, outqueue, POINTER, NULL, NULL);
|
||||
WEECHAT_HDATA_VAR(struct t_irc_server, last_outqueue, POINTER, NULL, NULL);
|
||||
WEECHAT_HDATA_VAR(struct t_irc_server, redirects, POINTER, NULL, "irc_redirect");
|
||||
WEECHAT_HDATA_VAR(struct t_irc_server, last_redirect, POINTER, NULL, "irc_redirect");
|
||||
WEECHAT_HDATA_VAR(struct t_irc_server, notify_list, POINTER, NULL, "irc_notify");
|
||||
WEECHAT_HDATA_VAR(struct t_irc_server, last_notify, POINTER, NULL, "irc_notify");
|
||||
WEECHAT_HDATA_VAR(struct t_irc_server, manual_joins, HASHTABLE, NULL, NULL);
|
||||
WEECHAT_HDATA_VAR(struct t_irc_server, buffer, POINTER, NULL, "buffer");
|
||||
WEECHAT_HDATA_VAR(struct t_irc_server, buffer_as_string, STRING, NULL, NULL);
|
||||
WEECHAT_HDATA_VAR(struct t_irc_server, channels, POINTER, NULL, "irc_channel");
|
||||
WEECHAT_HDATA_VAR(struct t_irc_server, last_channel, POINTER, NULL, "irc_channel");
|
||||
WEECHAT_HDATA_VAR(struct t_irc_server, prev_server, POINTER, NULL, hdata_name);
|
||||
WEECHAT_HDATA_VAR(struct t_irc_server, next_server, POINTER, NULL, hdata_name);
|
||||
WEECHAT_HDATA_VAR(struct t_irc_server, unterminated_message, STRING, 0, NULL, NULL);
|
||||
WEECHAT_HDATA_VAR(struct t_irc_server, nicks_count, INTEGER, 0, NULL, NULL);
|
||||
WEECHAT_HDATA_VAR(struct t_irc_server, nicks_array, STRING, 0, "nicks_count", NULL);
|
||||
WEECHAT_HDATA_VAR(struct t_irc_server, nick_first_tried, INTEGER, 0, NULL, NULL);
|
||||
WEECHAT_HDATA_VAR(struct t_irc_server, nick_alternate_number, INTEGER, 0, NULL, NULL);
|
||||
WEECHAT_HDATA_VAR(struct t_irc_server, nick, STRING, 0, NULL, NULL);
|
||||
WEECHAT_HDATA_VAR(struct t_irc_server, nick_modes, STRING, 0, NULL, NULL);
|
||||
WEECHAT_HDATA_VAR(struct t_irc_server, isupport, STRING, 0, NULL, NULL);
|
||||
WEECHAT_HDATA_VAR(struct t_irc_server, prefix_modes, STRING, 0, NULL, NULL);
|
||||
WEECHAT_HDATA_VAR(struct t_irc_server, prefix_chars, STRING, 0, NULL, NULL);
|
||||
WEECHAT_HDATA_VAR(struct t_irc_server, nick_max_length, INTEGER, 0, NULL, NULL);
|
||||
WEECHAT_HDATA_VAR(struct t_irc_server, casemapping, INTEGER, 0, NULL, NULL);
|
||||
WEECHAT_HDATA_VAR(struct t_irc_server, chantypes, STRING, 0, NULL, NULL);
|
||||
WEECHAT_HDATA_VAR(struct t_irc_server, chanmodes, STRING, 0, NULL, NULL);
|
||||
WEECHAT_HDATA_VAR(struct t_irc_server, reconnect_delay, INTEGER, 0, NULL, NULL);
|
||||
WEECHAT_HDATA_VAR(struct t_irc_server, reconnect_start, TIME, 0, NULL, NULL);
|
||||
WEECHAT_HDATA_VAR(struct t_irc_server, command_time, TIME, 0, NULL, NULL);
|
||||
WEECHAT_HDATA_VAR(struct t_irc_server, reconnect_join, INTEGER, 0, NULL, NULL);
|
||||
WEECHAT_HDATA_VAR(struct t_irc_server, disable_autojoin, INTEGER, 0, NULL, NULL);
|
||||
WEECHAT_HDATA_VAR(struct t_irc_server, is_away, INTEGER, 0, NULL, NULL);
|
||||
WEECHAT_HDATA_VAR(struct t_irc_server, away_message, STRING, 0, NULL, NULL);
|
||||
WEECHAT_HDATA_VAR(struct t_irc_server, away_time, TIME, 0, NULL, NULL);
|
||||
WEECHAT_HDATA_VAR(struct t_irc_server, lag, INTEGER, 0, NULL, NULL);
|
||||
WEECHAT_HDATA_VAR(struct t_irc_server, lag_check_time, OTHER, 0, NULL, NULL);
|
||||
WEECHAT_HDATA_VAR(struct t_irc_server, lag_next_check, TIME, 0, NULL, NULL);
|
||||
WEECHAT_HDATA_VAR(struct t_irc_server, lag_last_refresh, TIME, 0, NULL, NULL);
|
||||
WEECHAT_HDATA_VAR(struct t_irc_server, cmd_list_regexp, POINTER, 0, NULL, NULL);
|
||||
WEECHAT_HDATA_VAR(struct t_irc_server, last_user_message, TIME, 0, NULL, NULL);
|
||||
WEECHAT_HDATA_VAR(struct t_irc_server, last_away_check, TIME, 0, NULL, NULL);
|
||||
WEECHAT_HDATA_VAR(struct t_irc_server, outqueue, POINTER, 0, NULL, NULL);
|
||||
WEECHAT_HDATA_VAR(struct t_irc_server, last_outqueue, POINTER, 0, NULL, NULL);
|
||||
WEECHAT_HDATA_VAR(struct t_irc_server, redirects, POINTER, 0, NULL, "irc_redirect");
|
||||
WEECHAT_HDATA_VAR(struct t_irc_server, last_redirect, POINTER, 0, NULL, "irc_redirect");
|
||||
WEECHAT_HDATA_VAR(struct t_irc_server, notify_list, POINTER, 0, NULL, "irc_notify");
|
||||
WEECHAT_HDATA_VAR(struct t_irc_server, last_notify, POINTER, 0, NULL, "irc_notify");
|
||||
WEECHAT_HDATA_VAR(struct t_irc_server, manual_joins, HASHTABLE, 0, NULL, NULL);
|
||||
WEECHAT_HDATA_VAR(struct t_irc_server, buffer, POINTER, 0, NULL, "buffer");
|
||||
WEECHAT_HDATA_VAR(struct t_irc_server, buffer_as_string, STRING, 0, NULL, NULL);
|
||||
WEECHAT_HDATA_VAR(struct t_irc_server, channels, POINTER, 0, NULL, "irc_channel");
|
||||
WEECHAT_HDATA_VAR(struct t_irc_server, last_channel, POINTER, 0, NULL, "irc_channel");
|
||||
WEECHAT_HDATA_VAR(struct t_irc_server, prev_server, POINTER, 0, NULL, hdata_name);
|
||||
WEECHAT_HDATA_VAR(struct t_irc_server, next_server, POINTER, 0, NULL, hdata_name);
|
||||
WEECHAT_HDATA_LIST(irc_servers);
|
||||
WEECHAT_HDATA_LIST(last_irc_server);
|
||||
}
|
||||
|
||||
@@ -5627,7 +5627,6 @@ weechat_lua_api_hdata_time (lua_State *L)
|
||||
{
|
||||
const char *hdata, *pointer, *name;
|
||||
time_t time;
|
||||
struct tm *date_tmp;
|
||||
char timebuffer[64], *result;
|
||||
|
||||
API_FUNC(1, "hdata_time", API_RETURN_EMPTY);
|
||||
@@ -5642,9 +5641,7 @@ weechat_lua_api_hdata_time (lua_State *L)
|
||||
time = weechat_hdata_time (API_STR2PTR(hdata),
|
||||
API_STR2PTR(pointer),
|
||||
name);
|
||||
date_tmp = localtime (&time);
|
||||
if (date_tmp)
|
||||
strftime (timebuffer, sizeof (timebuffer), "%F %T", date_tmp);
|
||||
snprintf (timebuffer, sizeof (timebuffer), "%ld", (long int)time);
|
||||
result = strdup (timebuffer);
|
||||
|
||||
API_RETURN_STRING_FREE(result);
|
||||
@@ -5676,6 +5673,36 @@ weechat_lua_api_hdata_hashtable (lua_State *L)
|
||||
return 1;
|
||||
}
|
||||
|
||||
/*
|
||||
* weechat_lua_api_hdata_update: update data in a hdata
|
||||
*/
|
||||
|
||||
static int
|
||||
weechat_lua_api_hdata_update (lua_State *L)
|
||||
{
|
||||
const char *hdata, *pointer;
|
||||
struct t_hashtable *hashtable;
|
||||
int value;
|
||||
|
||||
API_FUNC(1, "hdata_update", API_RETURN_INT(0));
|
||||
if (lua_gettop (lua_current_interpreter) < 3)
|
||||
API_WRONG_ARGS(API_RETURN_INT(0));
|
||||
|
||||
hdata = lua_tostring (lua_current_interpreter, -3);
|
||||
pointer = lua_tostring (lua_current_interpreter, -2);
|
||||
hashtable = weechat_lua_tohashtable (lua_current_interpreter, -1,
|
||||
WEECHAT_SCRIPT_HASHTABLE_DEFAULT_SIZE);
|
||||
|
||||
value = weechat_hdata_update (API_STR2PTR(hdata),
|
||||
API_STR2PTR(pointer),
|
||||
hashtable);
|
||||
|
||||
if (hashtable)
|
||||
weechat_hashtable_free (hashtable);
|
||||
|
||||
API_RETURN_INT(value);
|
||||
}
|
||||
|
||||
/*
|
||||
* weechat_lua_api_hdata_get_string: get hdata property as string
|
||||
*/
|
||||
@@ -6419,6 +6446,7 @@ const struct luaL_Reg weechat_lua_api_funcs[] = {
|
||||
API_DEF_FUNC(hdata_pointer),
|
||||
API_DEF_FUNC(hdata_time),
|
||||
API_DEF_FUNC(hdata_hashtable),
|
||||
API_DEF_FUNC(hdata_update),
|
||||
API_DEF_FUNC(hdata_get_string),
|
||||
API_DEF_FUNC(upgrade_new),
|
||||
API_DEF_FUNC(upgrade_write_object),
|
||||
|
||||
@@ -5358,7 +5358,6 @@ XS (XS_weechat_api_hdata_pointer)
|
||||
XS (XS_weechat_api_hdata_time)
|
||||
{
|
||||
time_t time;
|
||||
struct tm *date_tmp;
|
||||
char timebuffer[64], *result, *hdata, *pointer, *name;
|
||||
dXSARGS;
|
||||
|
||||
@@ -5374,9 +5373,7 @@ XS (XS_weechat_api_hdata_time)
|
||||
time = weechat_hdata_time (API_STR2PTR(hdata),
|
||||
API_STR2PTR(pointer),
|
||||
name);
|
||||
date_tmp = localtime (&time);
|
||||
if (date_tmp)
|
||||
strftime (timebuffer, sizeof (timebuffer), "%F %T", date_tmp);
|
||||
snprintf (timebuffer, sizeof (timebuffer), "%ld", (long int)time);
|
||||
result = strdup (timebuffer);
|
||||
|
||||
API_RETURN_STRING_FREE(result);
|
||||
@@ -5409,6 +5406,36 @@ XS (XS_weechat_api_hdata_hashtable)
|
||||
API_RETURN_OBJ(result_hash);
|
||||
}
|
||||
|
||||
/*
|
||||
* weechat::hdata_update: update data in a hdata
|
||||
*/
|
||||
|
||||
XS (XS_weechat_api_hdata_update)
|
||||
{
|
||||
char *hdata, *pointer;
|
||||
struct t_hashtable *hashtable;
|
||||
int value;
|
||||
dXSARGS;
|
||||
|
||||
API_FUNC(1, "hdata_update", API_RETURN_INT(0));
|
||||
if (items < 3)
|
||||
API_WRONG_ARGS(API_RETURN_INT(0));
|
||||
|
||||
hdata = SvPV_nolen (ST (0));
|
||||
pointer = SvPV_nolen (ST (1));
|
||||
hashtable = weechat_perl_hash_to_hashtable (ST (2),
|
||||
WEECHAT_SCRIPT_HASHTABLE_DEFAULT_SIZE);
|
||||
|
||||
value = weechat_hdata_update (API_STR2PTR(hdata),
|
||||
API_STR2PTR(pointer),
|
||||
hashtable);
|
||||
|
||||
if (hashtable)
|
||||
weechat_hashtable_free (hashtable);
|
||||
|
||||
API_RETURN_INT(value);
|
||||
}
|
||||
|
||||
/*
|
||||
* weechat::hdata_get_string: get hdata property as string
|
||||
*/
|
||||
@@ -5763,6 +5790,7 @@ weechat_perl_api_init (pTHX)
|
||||
API_DEF_FUNC(hdata_pointer);
|
||||
API_DEF_FUNC(hdata_time);
|
||||
API_DEF_FUNC(hdata_hashtable);
|
||||
API_DEF_FUNC(hdata_update);
|
||||
API_DEF_FUNC(hdata_get_string);
|
||||
API_DEF_FUNC(upgrade_new);
|
||||
API_DEF_FUNC(upgrade_write_object);
|
||||
|
||||
+15
-14
@@ -1202,22 +1202,23 @@ plugin_script_hdata_script (struct t_weechat_plugin *weechat_plugin,
|
||||
{
|
||||
struct t_hdata *hdata;
|
||||
|
||||
hdata = weechat_hdata_new (hdata_name, "prev_script", "next_script");
|
||||
hdata = weechat_hdata_new (hdata_name, "prev_script", "next_script",
|
||||
0, NULL, NULL);
|
||||
if (hdata)
|
||||
{
|
||||
WEECHAT_HDATA_VAR(struct t_plugin_script, filename, STRING, NULL, NULL);
|
||||
WEECHAT_HDATA_VAR(struct t_plugin_script, interpreter, POINTER, NULL, NULL);
|
||||
WEECHAT_HDATA_VAR(struct t_plugin_script, name, STRING, NULL, NULL);
|
||||
WEECHAT_HDATA_VAR(struct t_plugin_script, author, STRING, NULL, NULL);
|
||||
WEECHAT_HDATA_VAR(struct t_plugin_script, version, STRING, NULL, NULL);
|
||||
WEECHAT_HDATA_VAR(struct t_plugin_script, license, STRING, NULL, NULL);
|
||||
WEECHAT_HDATA_VAR(struct t_plugin_script, description, STRING, NULL, NULL);
|
||||
WEECHAT_HDATA_VAR(struct t_plugin_script, shutdown_func, STRING, NULL, NULL);
|
||||
WEECHAT_HDATA_VAR(struct t_plugin_script, charset, STRING, NULL, NULL);
|
||||
WEECHAT_HDATA_VAR(struct t_plugin_script, callbacks, POINTER, NULL, NULL);
|
||||
WEECHAT_HDATA_VAR(struct t_plugin_script, unloading, INTEGER, NULL, NULL);
|
||||
WEECHAT_HDATA_VAR(struct t_plugin_script, prev_script, POINTER, NULL, hdata_name);
|
||||
WEECHAT_HDATA_VAR(struct t_plugin_script, next_script, POINTER, NULL, hdata_name);
|
||||
WEECHAT_HDATA_VAR(struct t_plugin_script, filename, STRING, 0, NULL, NULL);
|
||||
WEECHAT_HDATA_VAR(struct t_plugin_script, interpreter, POINTER, 0, NULL, NULL);
|
||||
WEECHAT_HDATA_VAR(struct t_plugin_script, name, STRING, 0, NULL, NULL);
|
||||
WEECHAT_HDATA_VAR(struct t_plugin_script, author, STRING, 0, NULL, NULL);
|
||||
WEECHAT_HDATA_VAR(struct t_plugin_script, version, STRING, 0, NULL, NULL);
|
||||
WEECHAT_HDATA_VAR(struct t_plugin_script, license, STRING, 0, NULL, NULL);
|
||||
WEECHAT_HDATA_VAR(struct t_plugin_script, description, STRING, 0, NULL, NULL);
|
||||
WEECHAT_HDATA_VAR(struct t_plugin_script, shutdown_func, STRING, 0, NULL, NULL);
|
||||
WEECHAT_HDATA_VAR(struct t_plugin_script, charset, STRING, 0, NULL, NULL);
|
||||
WEECHAT_HDATA_VAR(struct t_plugin_script, callbacks, POINTER, 0, NULL, NULL);
|
||||
WEECHAT_HDATA_VAR(struct t_plugin_script, unloading, INTEGER, 0, NULL, NULL);
|
||||
WEECHAT_HDATA_VAR(struct t_plugin_script, prev_script, POINTER, 0, NULL, hdata_name);
|
||||
WEECHAT_HDATA_VAR(struct t_plugin_script, next_script, POINTER, 0, NULL, hdata_name);
|
||||
weechat_hdata_new_list (hdata, "scripts", scripts);
|
||||
weechat_hdata_new_list (hdata, "last_script", last_script);
|
||||
}
|
||||
|
||||
+15
-12
@@ -756,6 +756,8 @@ plugin_load (const char *filename, int argc, char **argv)
|
||||
new_plugin->hdata_pointer = &hdata_pointer;
|
||||
new_plugin->hdata_time = &hdata_time;
|
||||
new_plugin->hdata_hashtable = &hdata_hashtable;
|
||||
new_plugin->hdata_set = &hdata_set;
|
||||
new_plugin->hdata_update = &hdata_update;
|
||||
new_plugin->hdata_get_string = &hdata_get_string;
|
||||
|
||||
new_plugin->upgrade_new = &upgrade_file_new;
|
||||
@@ -1211,20 +1213,21 @@ plugin_hdata_plugin_cb (void *data, const char *hdata_name)
|
||||
/* make C compiler happy */
|
||||
(void) data;
|
||||
|
||||
hdata = hdata_new (NULL, hdata_name, "prev_plugin", "next_plugin");
|
||||
hdata = hdata_new (NULL, hdata_name, "prev_plugin", "next_plugin",
|
||||
0, NULL, NULL);
|
||||
if (hdata)
|
||||
{
|
||||
HDATA_VAR(struct t_weechat_plugin, filename, STRING, NULL, NULL);
|
||||
HDATA_VAR(struct t_weechat_plugin, handle, POINTER, NULL, NULL);
|
||||
HDATA_VAR(struct t_weechat_plugin, name, STRING, NULL, NULL);
|
||||
HDATA_VAR(struct t_weechat_plugin, description, STRING, NULL, NULL);
|
||||
HDATA_VAR(struct t_weechat_plugin, author, STRING, NULL, NULL);
|
||||
HDATA_VAR(struct t_weechat_plugin, version, STRING, NULL, NULL);
|
||||
HDATA_VAR(struct t_weechat_plugin, license, STRING, NULL, NULL);
|
||||
HDATA_VAR(struct t_weechat_plugin, charset, STRING, NULL, NULL);
|
||||
HDATA_VAR(struct t_weechat_plugin, debug, INTEGER, NULL, NULL);
|
||||
HDATA_VAR(struct t_weechat_plugin, prev_plugin, POINTER, NULL, hdata_name);
|
||||
HDATA_VAR(struct t_weechat_plugin, next_plugin, POINTER, NULL, hdata_name);
|
||||
HDATA_VAR(struct t_weechat_plugin, filename, STRING, 0, NULL, NULL);
|
||||
HDATA_VAR(struct t_weechat_plugin, handle, POINTER, 0, NULL, NULL);
|
||||
HDATA_VAR(struct t_weechat_plugin, name, STRING, 0, NULL, NULL);
|
||||
HDATA_VAR(struct t_weechat_plugin, description, STRING, 0, NULL, NULL);
|
||||
HDATA_VAR(struct t_weechat_plugin, author, STRING, 0, NULL, NULL);
|
||||
HDATA_VAR(struct t_weechat_plugin, version, STRING, 0, NULL, NULL);
|
||||
HDATA_VAR(struct t_weechat_plugin, license, STRING, 0, NULL, NULL);
|
||||
HDATA_VAR(struct t_weechat_plugin, charset, STRING, 0, NULL, NULL);
|
||||
HDATA_VAR(struct t_weechat_plugin, debug, INTEGER, 0, NULL, NULL);
|
||||
HDATA_VAR(struct t_weechat_plugin, prev_plugin, POINTER, 0, NULL, hdata_name);
|
||||
HDATA_VAR(struct t_weechat_plugin, next_plugin, POINTER, 0, NULL, hdata_name);
|
||||
HDATA_LIST(weechat_plugins);
|
||||
HDATA_LIST(last_weechat_plugin);
|
||||
}
|
||||
|
||||
@@ -388,7 +388,7 @@ weechat_python_api_string_remove_color (PyObject *self, PyObject *args)
|
||||
char *string, *replacement, *result;
|
||||
PyObject *return_value;
|
||||
|
||||
API_FUNC(1, "string_remove_color2", API_RETURN_EMPTY);
|
||||
API_FUNC(1, "string_remove_color", API_RETURN_EMPTY);
|
||||
string = NULL;
|
||||
replacement = NULL;
|
||||
if (!PyArg_ParseTuple (args, "ss", &string, &replacement))
|
||||
@@ -2075,6 +2075,7 @@ weechat_python_api_key_bind (PyObject *self, PyObject *args)
|
||||
|
||||
API_FUNC(1, "key_bind", API_RETURN_INT(0));
|
||||
context = NULL;
|
||||
dict = NULL;
|
||||
if (!PyArg_ParseTuple (args, "sO", &context, &dict))
|
||||
API_WRONG_ARGS(API_RETURN_INT(0));
|
||||
|
||||
@@ -2641,6 +2642,7 @@ weechat_python_api_hook_process_hashtable (PyObject *self, PyObject *args)
|
||||
|
||||
API_FUNC(1, "hook_process_hashtable", API_RETURN_EMPTY);
|
||||
command = NULL;
|
||||
dict = NULL;
|
||||
options = NULL;
|
||||
timeout = 0;
|
||||
function = NULL;
|
||||
@@ -3066,6 +3068,7 @@ weechat_python_api_hook_hsignal_send (PyObject *self, PyObject *args)
|
||||
|
||||
API_FUNC(1, "hook_hsignal_send", API_RETURN_ERROR);
|
||||
signal = NULL;
|
||||
dict = NULL;
|
||||
if (!PyArg_ParseTuple (args, "sO", &signal, &dict))
|
||||
API_WRONG_ARGS(API_RETURN_ERROR);
|
||||
|
||||
@@ -4829,6 +4832,7 @@ weechat_python_api_info_get_hashtable (PyObject *self, PyObject *args)
|
||||
|
||||
API_FUNC(1, "info_get_hashtable", API_RETURN_EMPTY);
|
||||
info_name = NULL;
|
||||
dict = NULL;
|
||||
if (!PyArg_ParseTuple (args, "sO", &info_name, &dict))
|
||||
API_WRONG_ARGS(API_RETURN_EMPTY);
|
||||
hashtable = weechat_python_dict_to_hashtable (dict,
|
||||
@@ -5543,10 +5547,8 @@ weechat_python_api_hdata_pointer (PyObject *self, PyObject *args)
|
||||
static PyObject *
|
||||
weechat_python_api_hdata_time (PyObject *self, PyObject *args)
|
||||
{
|
||||
char *hdata, *pointer, *name, timebuffer[64], *result;
|
||||
char *hdata, *pointer, *name;
|
||||
time_t time;
|
||||
struct tm *date_tmp;
|
||||
PyObject *return_value;
|
||||
|
||||
API_FUNC(1, "hdata_time", API_RETURN_EMPTY);
|
||||
hdata = NULL;
|
||||
@@ -5555,16 +5557,11 @@ weechat_python_api_hdata_time (PyObject *self, PyObject *args)
|
||||
if (!PyArg_ParseTuple (args, "sss", &hdata, &pointer, &name))
|
||||
API_WRONG_ARGS(API_RETURN_EMPTY);
|
||||
|
||||
timebuffer[0] = '\0';
|
||||
time = weechat_hdata_time (API_STR2PTR(hdata),
|
||||
API_STR2PTR(pointer),
|
||||
name);
|
||||
date_tmp = localtime (&time);
|
||||
if (date_tmp)
|
||||
strftime (timebuffer, sizeof (timebuffer), "%F %T", date_tmp);
|
||||
result = strdup (timebuffer);
|
||||
|
||||
API_RETURN_STRING_FREE(result);
|
||||
API_RETURN_LONG(time);
|
||||
}
|
||||
|
||||
/*
|
||||
@@ -5593,6 +5590,37 @@ weechat_python_api_hdata_hashtable (PyObject *self, PyObject *args)
|
||||
return result_dict;
|
||||
}
|
||||
|
||||
/*
|
||||
* weechat_python_api_hdata_update: updata data in a hdata
|
||||
*/
|
||||
|
||||
static PyObject *
|
||||
weechat_python_api_hdata_update (PyObject *self, PyObject *args)
|
||||
{
|
||||
char *hdata, *pointer;
|
||||
struct t_hashtable *hashtable;
|
||||
PyObject *dict;
|
||||
int value;
|
||||
|
||||
API_FUNC(1, "hdata_update", API_RETURN_INT(0));
|
||||
hdata = NULL;
|
||||
pointer = NULL;
|
||||
dict = NULL;
|
||||
if (!PyArg_ParseTuple (args, "ssO", &hdata, &pointer, &dict))
|
||||
API_WRONG_ARGS(API_RETURN_INT(0));
|
||||
hashtable = weechat_python_dict_to_hashtable (dict,
|
||||
WEECHAT_SCRIPT_HASHTABLE_DEFAULT_SIZE);
|
||||
|
||||
value = weechat_hdata_update (API_STR2PTR(hdata),
|
||||
API_STR2PTR(pointer),
|
||||
hashtable);
|
||||
|
||||
if (hashtable)
|
||||
weechat_hashtable_free (hashtable);
|
||||
|
||||
API_RETURN_INT(value);
|
||||
}
|
||||
|
||||
/*
|
||||
* weechat_python_api_hdata_get_string: get hdata property as string
|
||||
*/
|
||||
@@ -5939,6 +5967,7 @@ PyMethodDef weechat_python_funcs[] =
|
||||
API_DEF_FUNC(hdata_pointer),
|
||||
API_DEF_FUNC(hdata_time),
|
||||
API_DEF_FUNC(hdata_hashtable),
|
||||
API_DEF_FUNC(hdata_update),
|
||||
API_DEF_FUNC(hdata_get_string),
|
||||
API_DEF_FUNC(upgrade_new),
|
||||
API_DEF_FUNC(upgrade_write_object),
|
||||
|
||||
@@ -6382,7 +6382,6 @@ weechat_ruby_api_hdata_time (VALUE class, VALUE hdata, VALUE pointer,
|
||||
{
|
||||
char *c_hdata, *c_pointer, *c_name, timebuffer[64], *result;
|
||||
time_t time;
|
||||
struct tm *date_tmp;
|
||||
VALUE return_value;
|
||||
|
||||
API_FUNC(1, "hdata_time", API_RETURN_EMPTY);
|
||||
@@ -6401,9 +6400,7 @@ weechat_ruby_api_hdata_time (VALUE class, VALUE hdata, VALUE pointer,
|
||||
time = weechat_hdata_time (API_STR2PTR(c_hdata),
|
||||
API_STR2PTR(c_pointer),
|
||||
c_name);
|
||||
date_tmp = localtime (&time);
|
||||
if (date_tmp)
|
||||
strftime (timebuffer, sizeof (timebuffer), "%F %T", date_tmp);
|
||||
snprintf (timebuffer, sizeof (timebuffer), "%ld", (long int)time);
|
||||
result = strdup (timebuffer);
|
||||
|
||||
API_RETURN_STRING_FREE(result);
|
||||
@@ -6441,6 +6438,41 @@ weechat_ruby_api_hdata_hashtable (VALUE class, VALUE hdata, VALUE pointer,
|
||||
return result_hash;
|
||||
}
|
||||
|
||||
/*
|
||||
* weechat_ruby_api_hdata_update: update data in a hdata
|
||||
*/
|
||||
|
||||
static VALUE
|
||||
weechat_ruby_api_hdata_update (VALUE class, VALUE hdata, VALUE pointer,
|
||||
VALUE hashtable)
|
||||
{
|
||||
char *c_hdata, *c_pointer;
|
||||
struct t_hashtable *c_hashtable;
|
||||
int value;
|
||||
|
||||
API_FUNC(1, "hdata_update", API_RETURN_INT(0));
|
||||
if (NIL_P (hdata) || NIL_P (pointer) || NIL_P (hashtable))
|
||||
API_WRONG_ARGS(API_RETURN_INT(0));
|
||||
|
||||
Check_Type (hdata, T_STRING);
|
||||
Check_Type (pointer, T_STRING);
|
||||
Check_Type (hashtable, T_HASH);
|
||||
|
||||
c_hdata = StringValuePtr (hdata);
|
||||
c_pointer = StringValuePtr (pointer);
|
||||
c_hashtable = weechat_ruby_hash_to_hashtable (hashtable,
|
||||
WEECHAT_SCRIPT_HASHTABLE_DEFAULT_SIZE);
|
||||
|
||||
value = weechat_hdata_update (API_STR2PTR(c_hdata),
|
||||
API_STR2PTR(c_pointer),
|
||||
c_hashtable);
|
||||
|
||||
if (c_hashtable)
|
||||
weechat_hashtable_free (c_hashtable);
|
||||
|
||||
API_RETURN_INT(value);
|
||||
}
|
||||
|
||||
/*
|
||||
* weechat_ruby_api_hdata_get_string: get hdata property as string
|
||||
*/
|
||||
@@ -6859,6 +6891,7 @@ weechat_ruby_api_init (VALUE ruby_mWeechat)
|
||||
API_DEF_FUNC(hdata_pointer, 3);
|
||||
API_DEF_FUNC(hdata_time, 3);
|
||||
API_DEF_FUNC(hdata_hashtable, 3);
|
||||
API_DEF_FUNC(hdata_update, 3);
|
||||
API_DEF_FUNC(hdata_get_string, 2);
|
||||
API_DEF_FUNC(upgrade_new, 2);
|
||||
API_DEF_FUNC(upgrade_write_object, 3);
|
||||
|
||||
@@ -1318,32 +1318,33 @@ script_repo_hdata_script_cb (void *data, const char *hdata_name)
|
||||
/* make C compiler happy */
|
||||
(void) data;
|
||||
|
||||
hdata = weechat_hdata_new (hdata_name, "prev_script", "next_script");
|
||||
hdata = weechat_hdata_new (hdata_name, "prev_script", "next_script",
|
||||
0, NULL, NULL);
|
||||
if (hdata)
|
||||
{
|
||||
WEECHAT_HDATA_VAR(struct t_repo_script, name, STRING, NULL, NULL);
|
||||
WEECHAT_HDATA_VAR(struct t_repo_script, name_with_extension, STRING, NULL, NULL);
|
||||
WEECHAT_HDATA_VAR(struct t_repo_script, language, INTEGER, NULL, NULL);
|
||||
WEECHAT_HDATA_VAR(struct t_repo_script, author, STRING, NULL, NULL);
|
||||
WEECHAT_HDATA_VAR(struct t_repo_script, mail, STRING, NULL, NULL);
|
||||
WEECHAT_HDATA_VAR(struct t_repo_script, version, STRING, NULL, NULL);
|
||||
WEECHAT_HDATA_VAR(struct t_repo_script, license, STRING, NULL, NULL);
|
||||
WEECHAT_HDATA_VAR(struct t_repo_script, description, STRING, NULL, NULL);
|
||||
WEECHAT_HDATA_VAR(struct t_repo_script, tags, STRING, NULL, NULL);
|
||||
WEECHAT_HDATA_VAR(struct t_repo_script, requirements, STRING, NULL, NULL);
|
||||
WEECHAT_HDATA_VAR(struct t_repo_script, min_weechat, STRING, NULL, NULL);
|
||||
WEECHAT_HDATA_VAR(struct t_repo_script, max_weechat, STRING, NULL, NULL);
|
||||
WEECHAT_HDATA_VAR(struct t_repo_script, md5sum, STRING, NULL, NULL);
|
||||
WEECHAT_HDATA_VAR(struct t_repo_script, url, STRING, NULL, NULL);
|
||||
WEECHAT_HDATA_VAR(struct t_repo_script, popularity, INTEGER, NULL, NULL);
|
||||
WEECHAT_HDATA_VAR(struct t_repo_script, date_added, TIME, NULL, NULL);
|
||||
WEECHAT_HDATA_VAR(struct t_repo_script, date_updated, TIME, NULL, NULL);
|
||||
WEECHAT_HDATA_VAR(struct t_repo_script, status, INTEGER, NULL, NULL);
|
||||
WEECHAT_HDATA_VAR(struct t_repo_script, version_loaded, STRING, NULL, NULL);
|
||||
WEECHAT_HDATA_VAR(struct t_repo_script, displayed, INTEGER, NULL, NULL);
|
||||
WEECHAT_HDATA_VAR(struct t_repo_script, install_order, INTEGER, NULL, NULL);
|
||||
WEECHAT_HDATA_VAR(struct t_repo_script, prev_script, POINTER, NULL, hdata_name);
|
||||
WEECHAT_HDATA_VAR(struct t_repo_script, next_script, POINTER, NULL, hdata_name);
|
||||
WEECHAT_HDATA_VAR(struct t_repo_script, name, STRING, 0, NULL, NULL);
|
||||
WEECHAT_HDATA_VAR(struct t_repo_script, name_with_extension, STRING, 0, NULL, NULL);
|
||||
WEECHAT_HDATA_VAR(struct t_repo_script, language, INTEGER, 0, NULL, NULL);
|
||||
WEECHAT_HDATA_VAR(struct t_repo_script, author, STRING, 0, NULL, NULL);
|
||||
WEECHAT_HDATA_VAR(struct t_repo_script, mail, STRING, 0, NULL, NULL);
|
||||
WEECHAT_HDATA_VAR(struct t_repo_script, version, STRING, 0, NULL, NULL);
|
||||
WEECHAT_HDATA_VAR(struct t_repo_script, license, STRING, 0, NULL, NULL);
|
||||
WEECHAT_HDATA_VAR(struct t_repo_script, description, STRING, 0, NULL, NULL);
|
||||
WEECHAT_HDATA_VAR(struct t_repo_script, tags, STRING, 0, NULL, NULL);
|
||||
WEECHAT_HDATA_VAR(struct t_repo_script, requirements, STRING, 0, NULL, NULL);
|
||||
WEECHAT_HDATA_VAR(struct t_repo_script, min_weechat, STRING, 0, NULL, NULL);
|
||||
WEECHAT_HDATA_VAR(struct t_repo_script, max_weechat, STRING, 0, NULL, NULL);
|
||||
WEECHAT_HDATA_VAR(struct t_repo_script, md5sum, STRING, 0, NULL, NULL);
|
||||
WEECHAT_HDATA_VAR(struct t_repo_script, url, STRING, 0, NULL, NULL);
|
||||
WEECHAT_HDATA_VAR(struct t_repo_script, popularity, INTEGER, 0, NULL, NULL);
|
||||
WEECHAT_HDATA_VAR(struct t_repo_script, date_added, TIME, 0, NULL, NULL);
|
||||
WEECHAT_HDATA_VAR(struct t_repo_script, date_updated, TIME, 0, NULL, NULL);
|
||||
WEECHAT_HDATA_VAR(struct t_repo_script, status, INTEGER, 0, NULL, NULL);
|
||||
WEECHAT_HDATA_VAR(struct t_repo_script, version_loaded, STRING, 0, NULL, NULL);
|
||||
WEECHAT_HDATA_VAR(struct t_repo_script, displayed, INTEGER, 0, NULL, NULL);
|
||||
WEECHAT_HDATA_VAR(struct t_repo_script, install_order, INTEGER, 0, NULL, NULL);
|
||||
WEECHAT_HDATA_VAR(struct t_repo_script, prev_script, POINTER, 0, NULL, hdata_name);
|
||||
WEECHAT_HDATA_VAR(struct t_repo_script, next_script, POINTER, 0, NULL, hdata_name);
|
||||
WEECHAT_HDATA_LIST(repo_scripts);
|
||||
WEECHAT_HDATA_LIST(last_repo_script);
|
||||
}
|
||||
|
||||
@@ -6103,7 +6103,6 @@ weechat_tcl_api_hdata_time (ClientData clientData, Tcl_Interp *interp,
|
||||
{
|
||||
Tcl_Obj *objp;
|
||||
time_t time;
|
||||
struct tm *date_tmp;
|
||||
char timebuffer[64], *result, *hdata, *pointer, *name;
|
||||
int i;
|
||||
|
||||
@@ -6119,9 +6118,7 @@ weechat_tcl_api_hdata_time (ClientData clientData, Tcl_Interp *interp,
|
||||
time = weechat_hdata_time (API_STR2PTR(hdata),
|
||||
API_STR2PTR(pointer),
|
||||
name);
|
||||
date_tmp = localtime (&time);
|
||||
if (date_tmp)
|
||||
strftime (timebuffer, sizeof (timebuffer), "%F %T", date_tmp);
|
||||
snprintf (timebuffer, sizeof (timebuffer), "%ld", (long int)time);
|
||||
result = strdup (timebuffer);
|
||||
|
||||
API_RETURN_STRING_FREE(result);
|
||||
@@ -6157,6 +6154,38 @@ weechat_tcl_api_hdata_hashtable (ClientData clientData, Tcl_Interp *interp,
|
||||
API_RETURN_OBJ(result_dict);
|
||||
}
|
||||
|
||||
/*
|
||||
* weechat_tcl_api_hdata_update: update data in a hdata
|
||||
*/
|
||||
|
||||
static int
|
||||
weechat_tcl_api_hdata_update (ClientData clientData, Tcl_Interp *interp,
|
||||
int objc, Tcl_Obj *CONST objv[])
|
||||
{
|
||||
Tcl_Obj *objp;
|
||||
char *hdata, *pointer;
|
||||
struct t_hashtable *hashtable;
|
||||
int i, value;
|
||||
|
||||
API_FUNC(1, "hdata_update", API_RETURN_INT(0));
|
||||
if (objc < 4)
|
||||
API_WRONG_ARGS(API_RETURN_INT(0));
|
||||
|
||||
hdata = Tcl_GetStringFromObj (objv[1], &i);
|
||||
pointer = Tcl_GetStringFromObj (objv[2], &i);
|
||||
hashtable = weechat_tcl_dict_to_hashtable (interp, objv[3],
|
||||
WEECHAT_SCRIPT_HASHTABLE_DEFAULT_SIZE);
|
||||
|
||||
value = weechat_hdata_update (API_STR2PTR(hdata),
|
||||
API_STR2PTR(pointer),
|
||||
hashtable);
|
||||
|
||||
if (hashtable)
|
||||
weechat_hashtable_free (hashtable);
|
||||
|
||||
API_RETURN_INT(value);
|
||||
}
|
||||
|
||||
/*
|
||||
* weechat_tcl_api_hdata_get_string: get hdata property as string
|
||||
*/
|
||||
@@ -6624,6 +6653,7 @@ void weechat_tcl_api_init (Tcl_Interp *interp)
|
||||
API_DEF_FUNC(hdata_pointer);
|
||||
API_DEF_FUNC(hdata_time);
|
||||
API_DEF_FUNC(hdata_hashtable);
|
||||
API_DEF_FUNC(hdata_update);
|
||||
API_DEF_FUNC(hdata_get_string);
|
||||
API_DEF_FUNC(upgrade_new);
|
||||
API_DEF_FUNC(upgrade_write_object);
|
||||
|
||||
@@ -46,7 +46,7 @@ struct timeval;
|
||||
*/
|
||||
|
||||
/* API version (used to check that plugin has same API and can be loaded) */
|
||||
#define WEECHAT_PLUGIN_API_VERSION "20120804-01"
|
||||
#define WEECHAT_PLUGIN_API_VERSION "20120827-01"
|
||||
|
||||
/* macros for defining plugin infos */
|
||||
#define WEECHAT_PLUGIN_NAME(__name) \
|
||||
@@ -833,9 +833,15 @@ struct t_weechat_plugin
|
||||
/* hdata */
|
||||
struct t_hdata *(*hdata_new) (struct t_weechat_plugin *plugin,
|
||||
const char *hdata_name, const char *var_prev,
|
||||
const char *var_next);
|
||||
const char *var_next,
|
||||
int delete_allowed,
|
||||
int (*callback_update)(void *data,
|
||||
struct t_hdata *hdata,
|
||||
void *pointer,
|
||||
struct t_hashtable *hashtable),
|
||||
void *callback_update_data);
|
||||
void (*hdata_new_var) (struct t_hdata *hdata, const char *name, int offset,
|
||||
int type, const char *array_size,
|
||||
int type, int update_allowed, const char *array_size,
|
||||
const char *hdata_name);
|
||||
void (*hdata_new_list) (struct t_hdata *hdata, const char *name,
|
||||
void *pointer);
|
||||
@@ -874,6 +880,10 @@ struct t_weechat_plugin
|
||||
const char *name);
|
||||
struct t_hashtable *(*hdata_hashtable) (struct t_hdata *hdata,
|
||||
void *pointer, const char *name);
|
||||
int (*hdata_set) (struct t_hdata *hdata, void *pointer, const char *name,
|
||||
const char *value);
|
||||
int (*hdata_update) (struct t_hdata *hdata, void *pointer,
|
||||
struct t_hashtable *hashtable);
|
||||
const char *(*hdata_get_string) (struct t_hdata *hdata,
|
||||
const char *property);
|
||||
|
||||
@@ -1598,18 +1608,24 @@ extern int weechat_plugin_end (struct t_weechat_plugin *plugin);
|
||||
weechat_plugin->infolist_free(__list)
|
||||
|
||||
/* hdata */
|
||||
#define weechat_hdata_new(__hdata_name, __var_prev, __var_next) \
|
||||
#define weechat_hdata_new(__hdata_name, __var_prev, __var_next, \
|
||||
__delete_allowed, __callback_update, \
|
||||
__callback_update_data) \
|
||||
weechat_plugin->hdata_new(weechat_plugin, __hdata_name, __var_prev, \
|
||||
__var_next)
|
||||
__var_next, __delete_allowed, \
|
||||
__callback_update, \
|
||||
__callback_update_data)
|
||||
#define weechat_hdata_new_var(__hdata, __name, __offset, __type, \
|
||||
__array_size, __hdata_name) \
|
||||
__update_allowed, __array_size, \
|
||||
__hdata_name) \
|
||||
weechat_plugin->hdata_new_var(__hdata, __name, __offset, __type, \
|
||||
__array_size, __hdata_name)
|
||||
#define WEECHAT_HDATA_VAR(__struct, __name, __type, __array_size, \
|
||||
__hdata_name) \
|
||||
__update_allowed, __array_size, \
|
||||
__hdata_name)
|
||||
#define WEECHAT_HDATA_VAR(__struct, __name, __type, __update_allowed, \
|
||||
__array_size, __hdata_name) \
|
||||
weechat_hdata_new_var (hdata, #__name, offsetof (__struct, __name), \
|
||||
WEECHAT_HDATA_##__type, __array_size, \
|
||||
__hdata_name)
|
||||
WEECHAT_HDATA_##__type, __update_allowed, \
|
||||
__array_size, __hdata_name)
|
||||
#define weechat_hdata_new_list(__hdata, __name, __pointer) \
|
||||
weechat_plugin->hdata_new_list(__hdata, __name, __pointer)
|
||||
#define WEECHAT_HDATA_LIST(__name) \
|
||||
@@ -1656,6 +1672,10 @@ extern int weechat_plugin_end (struct t_weechat_plugin *plugin);
|
||||
weechat_plugin->hdata_time(__hdata, __pointer, __name)
|
||||
#define weechat_hdata_hashtable(__hdata, __pointer, __name) \
|
||||
weechat_plugin->hdata_hashtable(__hdata, __pointer, __name)
|
||||
#define weechat_hdata_set(__hdata, __pointer, __name, __value) \
|
||||
weechat_plugin->hdata_set(__hdata, __pointer, __name, __value)
|
||||
#define weechat_hdata_update(__hdata, __pointer, __hashtable) \
|
||||
weechat_plugin->hdata_update(__hdata, __pointer, __hashtable)
|
||||
#define weechat_hdata_get_string(__hdata, __property) \
|
||||
weechat_plugin->hdata_get_string(__hdata, __property)
|
||||
|
||||
|
||||
Reference in New Issue
Block a user