From 06c4cf414435f14f463732886e06ccfa699fc815 Mon Sep 17 00:00:00 2001 From: Emmanuel Bouthenot Date: Mon, 16 Oct 2006 20:19:12 +0000 Subject: adding date field 'date' in get_buffer_data() function of plugins/scripts API --- src/plugins/scripts/lua/weechat-lua.c | 8 ++++++++ 1 file changed, 8 insertions(+) (limited to 'src/plugins/scripts/lua') 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); -- cgit v1.2.3