summaryrefslogtreecommitdiff
path: root/src/plugins/perl/weechat-perl-api.c
diff options
context:
space:
mode:
Diffstat (limited to 'src/plugins/perl/weechat-perl-api.c')
-rw-r--r--src/plugins/perl/weechat-perl-api.c36
1 files changed, 32 insertions, 4 deletions
diff --git a/src/plugins/perl/weechat-perl-api.c b/src/plugins/perl/weechat-perl-api.c
index cb79f3fbf..c0e05ac8e 100644
--- a/src/plugins/perl/weechat-perl-api.c
+++ b/src/plugins/perl/weechat-perl-api.c
@@ -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);
@@ -5410,6 +5407,36 @@ XS (XS_weechat_api_hdata_hashtable)
}
/*
+ * 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);