about summary refs log tree commit diff stats
diff options
context:
space:
mode:
-rw-r--r--src/event/server_events.c14
-rw-r--r--src/event/server_events.h6
-rw-r--r--src/log.c20
-rw-r--r--src/log.h2
-rw-r--r--src/ui/core.c26
-rw-r--r--src/ui/ui.h10
-rw-r--r--src/ui/window.c22
-rw-r--r--src/ui/window.h2
-rw-r--r--src/xmpp/message.c24
-rw-r--r--src/xmpp/stanza.c19
-rw-r--r--src/xmpp/stanza.h2
-rw-r--r--tests/unittests/log/stub_log.c2
-rw-r--r--tests/unittests/ui/stub_ui.c10
13 files changed, 72 insertions, 87 deletions
diff --git a/src/event/server_events.c b/src/event/server_events.c
index f5bc49cf..df7a4418 100644
--- a/src/event/server_events.c
+++ b/src/event/server_events.c
@@ -146,9 +146,9 @@ sv_ev_room_subject(const char * const room, const char * const nick, const char
 
 void
 sv_ev_room_history(const char * const room_jid, const char * const nick,
-    GTimeVal tv_stamp, const char * const message)
+    GDateTime *timestamp, const char * const message)
 {
-    ui_room_history(room_jid, nick, tv_stamp, message);
+    ui_room_history(room_jid, nick, timestamp, message);
 }
 
 void
@@ -293,13 +293,13 @@ sv_ev_incoming_message(char *barejid, char *resource, char *message, char *enc_m
 }
 
 void
-sv_ev_delayed_private_message(const char * const fulljid, char *message, GTimeVal tv_stamp)
+sv_ev_delayed_private_message(const char * const fulljid, char *message, GDateTime *timestamp)
 {
-    ui_incoming_private_msg(fulljid, message, &tv_stamp);
+    ui_incoming_private_msg(fulljid, message, timestamp);
 }
 
 void
-sv_ev_delayed_message(char *barejid, char *message, GTimeVal tv_stamp)
+sv_ev_delayed_message(char *barejid, char *message, GDateTime *timestamp)
 {
     gboolean new_win = FALSE;
     ProfChatWin *chatwin = wins_get_chat(barejid);
@@ -309,8 +309,8 @@ sv_ev_delayed_message(char *barejid, char *message, GTimeVal tv_stamp)
         new_win = TRUE;
     }
 
-    ui_incoming_msg(chatwin, NULL, message, &tv_stamp, new_win);
-    chat_log_msg_in_delayed(barejid, message, &tv_stamp);
+    ui_incoming_msg(chatwin, NULL, message, timestamp, new_win);
+    chat_log_msg_in_delayed(barejid, message, timestamp);
 }
 
 void
diff --git a/src/event/server_events.h b/src/event/server_events.h
index 51564d5c..4a3f86c2 100644
--- a/src/event/server_events.h
+++ b/src/event/server_events.h
@@ -47,13 +47,13 @@ void sv_ev_room_broadcast(const char *const room_jid,
     const char * const message);
 void sv_ev_room_subject(const char * const room, const char * const nick, const char * const subject);
 void sv_ev_room_history(const char * const room_jid, const char * const nick,
-    GTimeVal tv_stamp, const char * const message);
+    GDateTime *timestamp, const char * const message);
 void sv_ev_room_message(const char * const room_jid, const char * const nick,
     const char * const message);
 void sv_ev_incoming_message(char *barejid, char *resource, char *message, char *enc_message);
 void sv_ev_incoming_private_message(const char * const fulljid, char *message);
-void sv_ev_delayed_message(char *fulljid, char *message, GTimeVal tv_stamp);
-void sv_ev_delayed_private_message(const char * const fulljid, char *message, GTimeVal tv_stamp);
+void sv_ev_delayed_message(char *fulljid, char *message, GDateTime *timestamp);
+void sv_ev_delayed_private_message(const char * const fulljid, char *message, GDateTime *timestamp);
 void sv_ev_typing(char *barejid, char *resource);
 void sv_ev_paused(char *barejid, char *resource);
 void sv_ev_inactive(char *barejid, char *resource);
diff --git a/src/log.c b/src/log.c
index ce0cf7b0..e4c7f305 100644
--- a/src/log.c
+++ b/src/log.c
@@ -91,7 +91,7 @@ static gchar * _get_main_log_file(void);
 static void _rotate_log_file(void);
 static char* _log_string_from_level(log_level_t level);
 static void _chat_log_chat(const char * const login, const char * const other,
-    const gchar * const msg, chat_log_direction_t direction, GTimeVal *tv_stamp);
+    const gchar * const msg, chat_log_direction_t direction, GDateTime *timestamp);
 
 void
 log_debug(const char * const msg, ...)
@@ -353,19 +353,19 @@ chat_log_msg_in(const char * const barejid, const char * const msg)
 }
 
 void
-chat_log_msg_in_delayed(const char * const barejid, const char * msg, GTimeVal *tv_stamp)
+chat_log_msg_in_delayed(const char * const barejid, const char * msg, GDateTime *timestamp)
 {
     if (prefs_get_boolean(PREF_CHLOG)) {
         const char *jid = jabber_get_fulljid();
         Jid *jidp = jid_create(jid);
-        _chat_log_chat(jidp->barejid, barejid, msg, PROF_IN_LOG, tv_stamp);
+        _chat_log_chat(jidp->barejid, barejid, msg, PROF_IN_LOG, timestamp);
         jid_destroy(jidp);
     }
 }
 
 static void
 _chat_log_chat(const char * const login, const char * const other,
-    const char * const msg, chat_log_direction_t direction, GTimeVal *tv_stamp)
+    const char * const msg, chat_log_direction_t direction, GDateTime *timestamp)
 {
     struct dated_chat_log *dated_log = g_hash_table_lookup(logs, other);
 
@@ -380,16 +380,9 @@ _chat_log_chat(const char * const login, const char * const other,
         g_hash_table_replace(logs, strdup(other), dated_log);
     }
 
-    gchar *date_fmt = NULL;
-    GDateTime *dt = NULL;
-    if (tv_stamp == NULL) {
-        dt = g_date_time_new_now_local();
-    } else {
-        dt = g_date_time_new_from_timeval_utc(tv_stamp);
-    }
-
-    date_fmt = g_date_time_format(dt, "%H:%M:%S");
+    if (timestamp == NULL) timestamp = g_date_time_new_now_local();
 
+    gchar *date_fmt = g_date_time_format(timestamp, "%H:%M:%S");
     FILE *logp = fopen(dated_log->filename, "a");
     g_chmod(dated_log->filename, S_IRUSR | S_IWUSR);
     if (logp) {
@@ -414,7 +407,6 @@ _chat_log_chat(const char * const login, const char * const other,
     }
 
     g_free(date_fmt);
-    g_date_time_unref(dt);
 }
 
 void
diff --git a/src/log.h b/src/log.h
index df36b453..99975670 100644
--- a/src/log.h
+++ b/src/log.h
@@ -74,7 +74,7 @@ void chat_log_otr_msg_out(const char * const barejid, const char * const msg);
 void chat_log_pgp_msg_out(const char * const barejid, const char * const msg);
 
 void chat_log_msg_in(const char * const barejid, const char * const msg);
-void chat_log_msg_in_delayed(const char * const barejid, const char * msg, GTimeVal *tv_stamp);
+void chat_log_msg_in_delayed(const char * const barejid, const char * msg, GDateTime *timestamp);
 void chat_log_otr_msg_in(const char * const barejid, const char * const msg, gboolean was_decrypted);
 void chat_log_pgp_msg_in(const char * const barejid, const char * const msg);
 
diff --git a/src/ui/core.c b/src/ui/core.c
index a7e46437..fa419e45 100644
--- a/src/ui/core.c
+++ b/src/ui/core.c
@@ -416,7 +416,7 @@ ui_message_receipt(const char * const barejid, const char * const id)
 }
 
 void
-ui_incoming_msg(ProfChatWin *chatwin, const char * const resource, const char * const message, GTimeVal *tv_stamp, gboolean win_created)
+ui_incoming_msg(ProfChatWin *chatwin, const char * const resource, const char * const message, GDateTime *timestamp, gboolean win_created)
 {
     ProfWin *window = (ProfWin*)chatwin;
     int num = wins_get_num(window);
@@ -425,7 +425,7 @@ ui_incoming_msg(ProfChatWin *chatwin, const char * const resource, const char *
 
     // currently viewing chat window with sender
     if (wins_is_current(window)) {
-        win_print_incoming_message(window, tv_stamp, display_name, message);
+        win_print_incoming_message(window, timestamp, display_name, message);
         title_bar_set_typing(FALSE);
         status_bar_active(num);
 
@@ -444,14 +444,14 @@ ui_incoming_msg(ProfChatWin *chatwin, const char * const resource, const char *
         }
 
         // show users status first, when receiving message via delayed delivery
-        if (tv_stamp && win_created) {
+        if (timestamp && win_created) {
             PContact pcontact = roster_get_contact(chatwin->barejid);
             if (pcontact) {
                 win_show_contact(window, pcontact);
             }
         }
 
-        win_print_incoming_message(window, tv_stamp, display_name, message);
+        win_print_incoming_message(window, timestamp, display_name, message);
     }
 
     if (prefs_get_boolean(PREF_BEEP)) {
@@ -466,7 +466,7 @@ ui_incoming_msg(ProfChatWin *chatwin, const char * const resource, const char *
 }
 
 void
-ui_incoming_private_msg(const char * const fulljid, const char * const message, GTimeVal *tv_stamp)
+ui_incoming_private_msg(const char * const fulljid, const char * const message, GDateTime *timestamp)
 {
     char *display_from = NULL;
     display_from = get_nick_from_full_jid(fulljid);
@@ -482,7 +482,7 @@ ui_incoming_private_msg(const char * const fulljid, const char * const message,
 
     // currently viewing chat window with sender
     if (wins_is_current(window)) {
-        win_print_incoming_message(window, tv_stamp, display_from, message);
+        win_print_incoming_message(window, timestamp, display_from, message);
         title_bar_set_typing(FALSE);
         status_bar_active(num);
 
@@ -491,7 +491,7 @@ ui_incoming_private_msg(const char * const fulljid, const char * const message,
         privatewin->unread++;
         status_bar_new(num);
         cons_show_incoming_message(display_from, num);
-        win_print_incoming_message(window, tv_stamp, display_from, message);
+        win_print_incoming_message(window, timestamp, display_from, message);
 
         if (prefs_get_boolean(PREF_FLASH)) {
             flash();
@@ -1665,7 +1665,7 @@ ui_room_nick_change(const char * const roomjid, const char * const nick)
 
 void
 ui_room_history(const char * const roomjid, const char * const nick,
-    GTimeVal tv_stamp, const char * const message)
+    GDateTime *timestamp, const char * const message)
 {
     ProfWin *window = (ProfWin*)wins_get_muc(roomjid);
     if (window == NULL) {
@@ -1684,7 +1684,7 @@ ui_room_history(const char * const roomjid, const char * const nick,
             g_string_append(line, message);
         }
 
-        win_print(window, '-', &tv_stamp, NO_COLOUR_DATE, 0, "", line->str);
+        win_print(window, '-', timestamp, NO_COLOUR_DATE, 0, "", line->str);
         g_string_free(line, TRUE);
     }
 }
@@ -2808,11 +2808,9 @@ _win_show_history(ProfChatWin *chatwin, const char * const contact)
                 char hh[3]; memcpy(hh, &line[0], 2); hh[2] = '\0'; int ihh = atoi(hh);
                 char mm[3]; memcpy(mm, &line[3], 2); mm[2] = '\0'; int imm = atoi(mm);
                 char ss[3]; memcpy(ss, &line[6], 2); ss[2] = '\0'; int iss = atoi(ss);
-                GDateTime *time = g_date_time_new_local(2000, 1, 1, ihh, imm, iss);
-                GTimeVal tv;
-                g_date_time_to_timeval(time, &tv);
-                win_print((ProfWin*)chatwin, '-', &tv, NO_COLOUR_DATE, 0, "", curr->data+11);
-                g_date_time_unref(time);
+                GDateTime *timestamp = g_date_time_new_local(2000, 1, 1, ihh, imm, iss);
+                win_print((ProfWin*)chatwin, '-', timestamp, NO_COLOUR_DATE, 0, "", curr->data+11);
+                g_date_time_unref(timestamp);
             // header
             } else {
                 win_print((ProfWin*)chatwin, '-', NULL, 0, 0, "", curr->data);
diff --git a/src/ui/ui.h b/src/ui/ui.h
index 80fc6997..7682f57b 100644
--- a/src/ui/ui.h
+++ b/src/ui/ui.h
@@ -101,8 +101,8 @@ void ui_handle_stanza(const char * const msg);
 // ui events
 void ui_contact_online(char *barejid, Resource *resource, GDateTime *last_activity);
 void ui_contact_typing(const char * const barejid, const char * const resource);
-void ui_incoming_msg(ProfChatWin *chatwin, const char * const resource,  const char * const message, GTimeVal *tv_stamp, gboolean win_created);
-void ui_incoming_private_msg(const char * const fulljid, const char * const message, GTimeVal *tv_stamp);
+void ui_incoming_msg(ProfChatWin *chatwin, const char * const resource,  const char * const message, GDateTime *timestamp, gboolean win_created);
+void ui_incoming_private_msg(const char * const fulljid, const char * const message, GDateTime *timestamp);
 void ui_message_receipt(const char * const barejid, const char * const id);
 
 void ui_disconnected(void);
@@ -129,7 +129,7 @@ void ui_room_occupant_role_and_affiliation_change(const char * const roomjid, co
     const char * const affiliation, const char * const actor, const char * const reason);
 void ui_room_roster(const char * const roomjid, GList *occupants, const char * const presence);
 void ui_room_history(const char * const roomjid, const char * const nick,
-    GTimeVal tv_stamp, const char * const message);
+    GDateTime *timestamp, const char * const message);
 void ui_room_message(const char * const roomjid, const char * const nick,
     const char * const message);
 void ui_room_subject(const char * const roomjid, const char * const nick, const char * const subject);
@@ -350,8 +350,8 @@ void win_hide_subwin(ProfWin *window);
 void win_show_subwin(ProfWin *window);
 void win_refresh_without_subwin(ProfWin *window);
 void win_refresh_with_subwin(ProfWin *window);
-void win_print(ProfWin *window, const char show_char, GTimeVal *tstamp, int flags, theme_item_t theme_item, const char * const from, const char * const message);
-void win_vprint(ProfWin *window, const char show_char, GTimeVal *tstamp, int flags, theme_item_t theme_item, const char * const from, const char * const message, ...);
+void win_print(ProfWin *window, const char show_char, GDateTime *timestamp, int flags, theme_item_t theme_item, const char * const from, const char * const message);
+void win_vprint(ProfWin *window, const char show_char, GDateTime *timestamp, int flags, theme_item_t theme_item, const char * const from, const char * const message, ...);
 char* win_get_title(ProfWin *window);
 void win_show_occupant(ProfWin *window, Occupant *occupant);
 void win_show_occupant_info(ProfWin *window, const char * const room, Occupant *occupant);
diff --git a/src/ui/window.c b/src/ui/window.c
index 92db25fa..9db4f854 100644
--- a/src/ui/window.c
+++ b/src/ui/window.c
@@ -922,14 +922,14 @@ win_show_status_string(ProfWin *window, const char * const from,
 }
 
 void
-win_print_incoming_message(ProfWin *window, GTimeVal *tv_stamp,
+win_print_incoming_message(ProfWin *window, GDateTime *timestamp,
     const char * const from, const char * const message)
 {
     switch (window->type)
     {
         case WIN_CHAT:
         case WIN_PRIVATE:
-            win_print(window, '-', tv_stamp, NO_ME, THEME_TEXT_THEM, from, message);
+            win_print(window, '-', timestamp, NO_ME, THEME_TEXT_THEM, from, message);
             break;
         default:
             assert(FALSE);
@@ -938,31 +938,25 @@ win_print_incoming_message(ProfWin *window, GTimeVal *tv_stamp,
 }
 
 void
-win_vprint(ProfWin *window, const char show_char, GTimeVal *tstamp,
+win_vprint(ProfWin *window, const char show_char, GDateTime *timestamp,
     int flags, theme_item_t theme_item, const char * const from, const char * const message, ...)
 {
     va_list arg;
     va_start(arg, message);
     GString *fmt_msg = g_string_new(NULL);
     g_string_vprintf(fmt_msg, message, arg);
-    win_print(window, show_char, tstamp, flags, theme_item, from, fmt_msg->str);
+    win_print(window, show_char, timestamp, flags, theme_item, from, fmt_msg->str);
     g_string_free(fmt_msg, TRUE);
 }
 
 void
-win_print(ProfWin *window, const char show_char, GTimeVal *tstamp,
+win_print(ProfWin *window, const char show_char, GDateTime *timestamp,
     int flags, theme_item_t theme_item, const char * const from, const char * const message)
 {
-    GDateTime *time;
-
-    if (tstamp == NULL) {
-        time = g_date_time_new_now_local();
-    } else {
-        time = g_date_time_new_from_timeval_utc(tstamp);
-    }
+    if (timestamp == NULL) timestamp = g_date_time_new_now_local();
 
-    buffer_push(window->layout->buffer, show_char, time, flags, theme_item, from, message, NULL);
-    _win_print(window, show_char, time, flags, theme_item, from, message, NULL);
+    buffer_push(window->layout->buffer, show_char, timestamp, flags, theme_item, from, message, NULL);
+    _win_print(window, show_char, timestamp, flags, theme_item, from, message, NULL);
     // TODO: cross-reference.. this should be replaced by a real event-based system
     ui_input_nonblocking(TRUE);
 }
diff --git a/src/ui/window.h b/src/ui/window.h
index 4b11ade0..2728c66c 100644
--- a/src/ui/window.h
+++ b/src/ui/window.h
@@ -59,7 +59,7 @@ void win_show_status_string(ProfWin *window, const char * const from,
     const char * const show, const char * const status,
     GDateTime *last_activity, const char * const pre,
     const char * const default_show);
-void win_print_incoming_message(ProfWin *window, GTimeVal *tv_stamp,
+void win_print_incoming_message(ProfWin *window, GDateTime *timestamp,
     const char * const from, const char * const message);
 void win_print_with_receipt(ProfWin *window, const char show_char, GTimeVal *tstamp, int flags,
     theme_item_t theme_item, const char * const from, const char * const message, char *id);
diff --git a/src/xmpp/message.c b/src/xmpp/message.c
index 863c2d87..0d305496 100644
--- a/src/xmpp/message.c
+++ b/src/xmpp/message.c
@@ -559,10 +559,9 @@ _groupchat_handler(xmpp_conn_t * const conn, xmpp_stanza_t * const stanza, void
     }
 
     // determine if the notifications happened whilst offline
-    GTimeVal tv_stamp;
-    gboolean delayed = stanza_get_delay(stanza, &tv_stamp);
-    if (delayed) {
-        sv_ev_room_history(jid->barejid, jid->resourcepart, tv_stamp, message);
+    GDateTime *timestamp = stanza_get_delay(stanza);
+    if (timestamp) {
+        sv_ev_room_history(jid->barejid, jid->resourcepart, timestamp, message);
     } else {
         sv_ev_room_message(jid->barejid, jid->resourcepart, message);
     }
@@ -663,10 +662,9 @@ _private_chat_handler(xmpp_stanza_t * const stanza, const char * const fulljid)
         return;
     }
 
-    GTimeVal tv_stamp;
-    gboolean delayed = stanza_get_delay(stanza, &tv_stamp);
-    if (delayed) {
-        sv_ev_delayed_private_message(fulljid, message, tv_stamp);
+    GDateTime *timestamp = stanza_get_delay(stanza);
+    if (timestamp) {
+        sv_ev_delayed_private_message(fulljid, message, timestamp);
     } else {
         sv_ev_incoming_private_message(fulljid, message);
     }
@@ -761,15 +759,13 @@ _chat_handler(xmpp_conn_t * const conn, xmpp_stanza_t * const stanza, void * con
     }
 
     // standard chat message, use jid without resource
-    GTimeVal tv_stamp;
-    gboolean delayed = stanza_get_delay(stanza, &tv_stamp);
-
+    GDateTime *timestamp = stanza_get_delay(stanza);
     xmpp_stanza_t *body = xmpp_stanza_get_child_by_name(stanza, STANZA_NAME_BODY);
     if (body) {
         char *message = xmpp_stanza_get_text(body);
         if (message) {
-            if (delayed) {
-                sv_ev_delayed_message(jid->barejid, message, tv_stamp);
+            if (timestamp) {
+                sv_ev_delayed_message(jid->barejid, message, timestamp);
             } else {
                 char *enc_message = NULL;
                 xmpp_stanza_t *x = xmpp_stanza_get_child_by_ns(stanza, STANZA_NS_ENCRYPTED);
@@ -787,7 +783,7 @@ _chat_handler(xmpp_conn_t * const conn, xmpp_stanza_t * const stanza, void * con
     }
 
     // handle chat sessions and states
-    if (!delayed && jid->resourcepart) {
+    if (!timestamp && jid->resourcepart) {
         gboolean gone = xmpp_stanza_get_child_by_name(stanza, STANZA_NAME_GONE) != NULL;
         gboolean typing = xmpp_stanza_get_child_by_name(stanza, STANZA_NAME_COMPOSING) != NULL;
         gboolean paused = xmpp_stanza_get_child_by_name(stanza, STANZA_NAME_PAUSED) != NULL;
diff --git a/src/xmpp/stanza.c b/src/xmpp/stanza.c
index 1f25239b..4999c81b 100644
--- a/src/xmpp/stanza.c
+++ b/src/xmpp/stanza.c
@@ -982,17 +982,20 @@ stanza_create_ping_iq(xmpp_ctx_t *ctx, const char * const target)
     return iq;
 }
 
-gboolean
-stanza_get_delay(xmpp_stanza_t * const stanza, GTimeVal *tv_stamp)
+GDateTime*
+stanza_get_delay(xmpp_stanza_t * const stanza)
 {
+    GTimeVal utc_stamp;
     // first check for XEP-0203 delayed delivery
     xmpp_stanza_t *delay = xmpp_stanza_get_child_by_name(stanza, STANZA_NAME_DELAY);
     if (delay) {
         char *xmlns = xmpp_stanza_get_attribute(delay, STANZA_ATTR_XMLNS);
         if (xmlns && (strcmp(xmlns, "urn:xmpp:delay") == 0)) {
             char *stamp = xmpp_stanza_get_attribute(delay, STANZA_ATTR_STAMP);
-            if (stamp && (g_time_val_from_iso8601(stamp, tv_stamp))) {
-                return TRUE;
+            if (stamp && (g_time_val_from_iso8601(stamp, &utc_stamp))) {
+                GDateTime *utc_datetime = g_date_time_new_from_timeval_utc(&utc_stamp);
+                GDateTime *local_datetime = g_date_time_to_local(utc_datetime);
+                return local_datetime;
             }
         }
     }
@@ -1004,13 +1007,15 @@ stanza_get_delay(xmpp_stanza_t * const stanza, GTimeVal *tv_stamp)
         char *xmlns = xmpp_stanza_get_attribute(x, STANZA_ATTR_XMLNS);
         if (xmlns && (strcmp(xmlns, "jabber:x:delay") == 0)) {
             char *stamp = xmpp_stanza_get_attribute(x, STANZA_ATTR_STAMP);
-            if (stamp && (g_time_val_from_iso8601(stamp, tv_stamp))) {
-                return TRUE;
+            if (stamp && (g_time_val_from_iso8601(stamp, &utc_stamp))) {
+                GDateTime *utc_datetime = g_date_time_new_from_timeval_utc(&utc_stamp);
+                GDateTime *local_datetime = g_date_time_to_local(utc_datetime);
+                return local_datetime;
             }
         }
     }
 
-    return FALSE;
+    return NULL;
 }
 
 char *
diff --git a/src/xmpp/stanza.h b/src/xmpp/stanza.h
index 042b6aea..2dd1a141 100644
--- a/src/xmpp/stanza.h
+++ b/src/xmpp/stanza.h
@@ -223,7 +223,7 @@ xmpp_stanza_t* stanza_create_mediated_invite(xmpp_ctx_t *ctx, const char * const
 
 gboolean stanza_contains_chat_state(xmpp_stanza_t *stanza);
 
-gboolean stanza_get_delay(xmpp_stanza_t * const stanza, GTimeVal *tv_stamp);
+GDateTime* stanza_get_delay(xmpp_stanza_t * const stanza);
 
 gboolean stanza_is_muc_presence(xmpp_stanza_t * const stanza);
 gboolean stanza_is_muc_self_presence(xmpp_stanza_t * const stanza,
diff --git a/tests/unittests/log/stub_log.c b/tests/unittests/log/stub_log.c
index bf9d6975..3baddb69 100644
--- a/tests/unittests/log/stub_log.c
+++ b/tests/unittests/log/stub_log.c
@@ -60,7 +60,7 @@ void chat_log_otr_msg_out(const char * const barejid, const char * const msg) {}
 void chat_log_pgp_msg_out(const char * const barejid, const char * const msg) {}
 
 void chat_log_msg_in(const char * const barejid, const char * const msg) {}
-void chat_log_msg_in_delayed(const char * const barejid, const char * msg, GTimeVal *tv_stamp) {}
+void chat_log_msg_in_delayed(const char * const barejid, const char * msg, GDateTime *timestamp) {}
 void chat_log_otr_msg_in(const char * const barejid, const char * const msg, gboolean was_decrypted) {}
 void chat_log_pgp_msg_in(const char * const barejid, const char * const msg) {}
 
diff --git a/tests/unittests/ui/stub_ui.c b/tests/unittests/ui/stub_ui.c
index 8fea64a7..71a577f5 100644
--- a/tests/unittests/ui/stub_ui.c
+++ b/tests/unittests/ui/stub_ui.c
@@ -179,10 +179,10 @@ void ui_contact_online(char *barejid, Resource *resource, GDateTime *last_activi
 }
 
 void ui_contact_typing(const char * const barejid, const char * const resource) {}
-void ui_incoming_msg(ProfChatWin *chatwin, const char * const resource, const char * const message, GTimeVal *tv_stamp, gboolean win_created) {}
+void ui_incoming_msg(ProfChatWin *chatwin, const char * const resource, const char * const message, GDateTime *timestamp, gboolean win_created) {}
 void ui_message_receipt(const char * const barejid, const char * const id) {}
 
-void ui_incoming_private_msg(const char * const fulljid, const char * const message, GTimeVal *tv_stamp) {}
+void ui_incoming_private_msg(const char * const fulljid, const char * const message, GDateTime *timestamp) {}
 
 void ui_disconnected(void) {}
 void ui_recipient_gone(const char * const barejid, const char * const resource) {}
@@ -208,7 +208,7 @@ void ui_room_occupant_role_and_affiliation_change(const char * const roomjid, co
     const char * const affiliation, const char * const actor, const char * const reason) {}
 void ui_room_roster(const char * const roomjid, GList *occupants, const char * const presence) {}
 void ui_room_history(const char * const roomjid, const char * const nick,
-    GTimeVal tv_stamp, const char * const message) {}
+    GDateTime *timestamp, const char * const message) {}
 void ui_room_message(const char * const roomjid, const char * const nick,
     const char * const message) {}
 void ui_room_subject(const char * const roomjid, const char * const nick, const char * const subject) {}
@@ -531,8 +531,8 @@ void win_hide_subwin(ProfWin *window) {}
 void win_show_subwin(ProfWin *window) {}
 void win_refresh_without_subwin(ProfWin *window) {}
 void win_refresh_with_subwin(ProfWin *window) {}
-void win_print(ProfWin *window, const char show_char, GTimeVal *tstamp, int flags, theme_item_t theme_item, const char * const from, const char * const message) {}
-void win_vprint(ProfWin *window, const char show_char, GTimeVal *tstamp, int flags, theme_item_t theme_item, const char * const from, const char * const message, ...) {}
+void win_print(ProfWin *window, const char show_char, GDateTime *timestamp, int flags, theme_item_t theme_item, const char * const from, const char * const message) {}
+void win_vprint(ProfWin *window, const char show_char, GDateTime *timestamp, int flags, theme_item_t theme_item, const char * const from, const char * const message, ...) {}
 char* win_get_title(ProfWin *window)
 {
     return NULL;