From c857705c93291a640dc8f0d3b4ccb6a97c7742b0 Mon Sep 17 00:00:00 2001 From: SoniEx2 Date: Sun, 1 May 2022 00:14:29 -0300 Subject: Expose raw time_t values --- src/list.rs | 23 ++++++++++++----------- 1 file changed, 12 insertions(+), 11 deletions(-) (limited to 'src/list.rs') diff --git a/src/list.rs b/src/list.rs index d042d21..8a7c632 100644 --- a/src/list.rs +++ b/src/list.rs @@ -183,10 +183,11 @@ macro_rules! field_str { macro_rules! field_time { + ($(#[$m:meta])* $f:ident, unsafe { $n:expr }) => { + field!($(#[$m])* $f, unsafe { $n }, libc::time_t, ph, hexchat_list_time, r => r as libc::time_t); + }; ($(#[$m:meta])* $f:ident) => { - $(#[$m])* pub fn $f(&self) -> ! { - todo!() - } + field_time!($(#[$m])* $f, unsafe { ::std::concat!(::std::stringify!($f), "\0") }); }; } @@ -347,16 +348,16 @@ impl<'a, 'ph> Fields<'a, 'ph, Notify> { raw_flags, unsafe { "flags\0" } ); field_time!( - /// Time when the user went online. [NYI] - on + /// Time when the user went online. + raw_on, unsafe { "on\0" } ); field_time!( - /// Time when the user went offline. [NYI] - off + /// Time when the user went offline. + raw_off, unsafe { "off\0" } ); field_time!( - /// Time when the user was last seen. [NYI] - seen + /// Time when the user was last seen. + raw_seen, unsafe { "seen\0" } ); } @@ -371,8 +372,8 @@ impl<'a, 'ph> Fields<'a, 'ph, Users> { away ); field_time!( - /// Time when the user last talked. [NYI] - lasttalk + /// Time when the user last talked. + raw_lasttalk, unsafe { "lasttalk\0" } ); field_str!( /// User's nick. -- cgit 1.4.1