diff options
Diffstat (limited to 'src')
-rw-r--r-- | src/plugins/scripts/lua/weechat-lua.c | 8 | ||||
-rw-r--r-- | src/plugins/scripts/perl/weechat-perl.c | 7 | ||||
-rw-r--r-- | src/plugins/scripts/python/weechat-python.c | 6 | ||||
-rw-r--r-- | src/plugins/scripts/ruby/weechat-ruby.c | 6 |
4 files changed, 26 insertions, 1 deletions
diff --git a/src/plugins/scripts/lua/weechat-lua.c b/src/plugins/scripts/lua/weechat-lua.c index 4ff0c1f38..2008f649c 100644 --- a/src/plugins/scripts/lua/weechat-lua.c +++ b/src/plugins/scripts/lua/weechat-lua.c @@ -1744,6 +1744,7 @@ weechat_lua_get_buffer_data (lua_State *L) { t_plugin_buffer_line *buffer_data, *ptr_data; const char *server, *channel; + char timebuffer[64]; int i, n; /* make gcc happy */ @@ -1796,6 +1797,13 @@ weechat_lua_get_buffer_data (lua_State *L) lua_pushnumber (lua_current_interpreter, i); lua_newtable (lua_current_interpreter); + strftime(timebuffer, sizeof(timebuffer), "%F %T", + localtime(&ptr_data->date)); + + lua_pushstring (lua_current_interpreter, "date"); + lua_pushstring (lua_current_interpreter, timebuffer); + lua_rawset (lua_current_interpreter, -3); + lua_pushstring (lua_current_interpreter, "nick"); lua_pushstring (lua_current_interpreter, ptr_data->nick == NULL ? "" : ptr_data->nick); diff --git a/src/plugins/scripts/perl/weechat-perl.c b/src/plugins/scripts/perl/weechat-perl.c index 906492592..21ffaeb07 100644 --- a/src/plugins/scripts/perl/weechat-perl.c +++ b/src/plugins/scripts/perl/weechat-perl.c @@ -169,7 +169,7 @@ weechat_perl_exec (t_weechat_plugin *plugin, return_code = PLUGIN_RC_KO; if (SvTRUE (sv)) { - plugin->print_server (plugin, "Perl error: %s", SvPV (sv, count)); + plugin->print_server (plugin, "Perl error: %s", SvPV_nolen (sv)); POPs; } else @@ -1510,6 +1510,7 @@ static XS (XS_weechat_get_buffer_data) t_plugin_buffer_line *buffer_data, *ptr_data; HV *data_list_member; char *server, *channel; + char timebuffer[64]; int count; dXSARGS; @@ -1552,7 +1553,11 @@ static XS (XS_weechat_get_buffer_data) for (ptr_data = buffer_data; ptr_data; ptr_data = ptr_data->next_line) { data_list_member = (HV *) sv_2mortal((SV *) newHV()); + + strftime(timebuffer, sizeof(timebuffer), "%F %T", + localtime(&ptr_data->date)); + hv_store (data_list_member, "date", 4, newSVpv (timebuffer, 0), 0); hv_store (data_list_member, "nick", 4, newSVpv (ptr_data->nick == NULL ? "" : ptr_data->nick, 0), 0); hv_store (data_list_member, "data", 4, diff --git a/src/plugins/scripts/python/weechat-python.c b/src/plugins/scripts/python/weechat-python.c index 380af33e3..c8091260d 100644 --- a/src/plugins/scripts/python/weechat-python.c +++ b/src/plugins/scripts/python/weechat-python.c @@ -1445,6 +1445,7 @@ weechat_python_get_buffer_data (PyObject *self, PyObject *args) t_plugin_buffer_line *buffer_data, *ptr_data; PyObject *data_list, *data_list_member; char *server, *channel; + char timebuffer[64]; /* make gcc happy */ (void) self; @@ -1480,6 +1481,11 @@ weechat_python_get_buffer_data (PyObject *self, PyObject *args) if (data_list_member) { + strftime(timebuffer, sizeof(timebuffer), "%F %T", + localtime(&ptr_data->date)); + + PyDict_SetItem(data_list_member, Py_BuildValue("s", "date"), + Py_BuildValue("s", timebuffer)); PyDict_SetItem(data_list_member, Py_BuildValue("s", "nick"), Py_BuildValue("s", ptr_data->nick == NULL ? "" : ptr_data->nick)); PyDict_SetItem(data_list_member, Py_BuildValue("s", "data"), diff --git a/src/plugins/scripts/ruby/weechat-ruby.c b/src/plugins/scripts/ruby/weechat-ruby.c index 8bc084b69..5001c10d3 100644 --- a/src/plugins/scripts/ruby/weechat-ruby.c +++ b/src/plugins/scripts/ruby/weechat-ruby.c @@ -1682,6 +1682,7 @@ weechat_ruby_get_buffer_data (int argc, VALUE *argv, VALUE class) VALUE data_list, data_list_member; VALUE server, channel; char *c_server, *c_channel; + char timebuffer[64]; /* make gcc happy */ (void) class; @@ -1727,6 +1728,11 @@ weechat_ruby_get_buffer_data (int argc, VALUE *argv, VALUE class) if (!NIL_P (data_list_member)) { + strftime(timebuffer, sizeof(timebuffer), "%F %T", + localtime(&ptr_data->date)); + + rb_hash_aset (data_list_member, rb_str_new2("date"), + rb_str_new2(timebuffer)); rb_hash_aset (data_list_member, rb_str_new2("nick"), rb_str_new2(ptr_data->nick == NULL ? "" : ptr_data->nick)); rb_hash_aset (data_list_member, rb_str_new2("data"), |