diff options
author | James Booth <boothj5@gmail.com> | 2015-09-08 20:18:31 +0100 |
---|---|---|
committer | James Booth <boothj5@gmail.com> | 2015-09-08 20:18:31 +0100 |
commit | b266e4d03512fe337c811b8cda52627c477a9350 (patch) | |
tree | 366ab6891e76681ae75bbdc92ac2b6c2313daa0d /src/event/server_events.c | |
parent | 3883e04d248ea7522d71e135338087b5d2a8e91f (diff) | |
download | profani-tty-b266e4d03512fe337c811b8cda52627c477a9350.tar.gz |
Pass delay timestamp to all incoming chat events
Diffstat (limited to 'src/event/server_events.c')
-rw-r--r-- | src/event/server_events.c | 55 |
1 files changed, 20 insertions, 35 deletions
diff --git a/src/event/server_events.c b/src/event/server_events.c index 74aa4d74..160d4472 100644 --- a/src/event/server_events.c +++ b/src/event/server_events.c @@ -188,22 +188,22 @@ sv_ev_incoming_carbon(char *barejid, char *resource, char *message) } ui_incoming_msg(chatwin, resource, message, NULL, new_win, PROF_MSG_PLAIN); - chat_log_msg_in(barejid, message); + chat_log_msg_in(barejid, message, NULL); } #ifdef HAVE_LIBGPGME static void -_sv_ev_incoming_pgp(ProfChatWin *chatwin, gboolean new_win, char *barejid, char *resource, char *message, char *pgp_message) +_sv_ev_incoming_pgp(ProfChatWin *chatwin, gboolean new_win, char *barejid, char *resource, char *message, char *pgp_message, GDateTime *timestamp) { char *decrypted = p_gpg_decrypt(pgp_message); if (decrypted) { - ui_incoming_msg(chatwin, resource, decrypted, NULL, new_win, PROF_MSG_PGP); - chat_log_pgp_msg_in(barejid, decrypted); + ui_incoming_msg(chatwin, resource, decrypted, timestamp, new_win, PROF_MSG_PGP); + chat_log_pgp_msg_in(barejid, decrypted, timestamp); chatwin->pgp_recv = TRUE; p_gpg_free_decrypted(decrypted); } else { - ui_incoming_msg(chatwin, resource, message, NULL, new_win, PROF_MSG_PLAIN); - chat_log_msg_in(barejid, message); + ui_incoming_msg(chatwin, resource, message, timestamp, new_win, PROF_MSG_PLAIN); + chat_log_msg_in(barejid, message, timestamp); chatwin->pgp_recv = FALSE; } } @@ -211,18 +211,18 @@ _sv_ev_incoming_pgp(ProfChatWin *chatwin, gboolean new_win, char *barejid, char #ifdef HAVE_LIBOTR static void -_sv_ev_incoming_otr(ProfChatWin *chatwin, gboolean new_win, char *barejid, char *resource, char *message) +_sv_ev_incoming_otr(ProfChatWin *chatwin, gboolean new_win, char *barejid, char *resource, char *message, GDateTime *timestamp) { gboolean decrypted = FALSE; char *otr_res = otr_on_message_recv(barejid, resource, message, &decrypted); if (otr_res) { if (decrypted) { - ui_incoming_msg(chatwin, resource, otr_res, NULL, new_win, PROF_MSG_OTR); + ui_incoming_msg(chatwin, resource, otr_res, timestamp, new_win, PROF_MSG_OTR); chatwin->pgp_send = FALSE; } else { - ui_incoming_msg(chatwin, resource, otr_res, NULL, new_win, PROF_MSG_PLAIN); + ui_incoming_msg(chatwin, resource, otr_res, timestamp, new_win, PROF_MSG_PLAIN); } - chat_log_otr_msg_in(barejid, otr_res, decrypted); + chat_log_otr_msg_in(barejid, otr_res, decrypted, timestamp); otr_free_message(otr_res); chatwin->pgp_recv = FALSE; } @@ -231,16 +231,16 @@ _sv_ev_incoming_otr(ProfChatWin *chatwin, gboolean new_win, char *barejid, char #ifndef HAVE_LIBOTR static void -_sv_ev_incoming_plain(ProfChatWin *chatwin, gboolean new_win, char *barejid, char *resource, char *message) +_sv_ev_incoming_plain(ProfChatWin *chatwin, gboolean new_win, char *barejid, char *resource, char *message, GDateTime *timestamp) { - ui_incoming_msg(chatwin, resource, message, NULL, new_win, PROF_MSG_PLAIN); - chat_log_msg_in(barejid, message); + ui_incoming_msg(chatwin, resource, message, timestamp, new_win, PROF_MSG_PLAIN); + chat_log_msg_in(barejid, message, timestamp); chatwin->pgp_recv = FALSE; } #endif void -sv_ev_incoming_message(char *barejid, char *resource, char *message, char *pgp_message) +sv_ev_incoming_message(char *barejid, char *resource, char *message, char *pgp_message, GDateTime *timestamp) { gboolean new_win = FALSE; ProfChatWin *chatwin = wins_get_chat(barejid); @@ -257,10 +257,10 @@ sv_ev_incoming_message(char *barejid, char *resource, char *message, char *pgp_m if (chatwin->is_otr) { win_println((ProfWin*)chatwin, 0, "PGP encrypted message received whilst in OTR session."); } else { // PROF_ENC_NONE, PROF_ENC_PGP - _sv_ev_incoming_pgp(chatwin, new_win, barejid, resource, message, pgp_message); + _sv_ev_incoming_pgp(chatwin, new_win, barejid, resource, message, pgp_message, timestamp); } } else { - _sv_ev_incoming_otr(chatwin, new_win, barejid, resource, message); + _sv_ev_incoming_otr(chatwin, new_win, barejid, resource, message, timestamp); } return; #endif @@ -269,7 +269,7 @@ sv_ev_incoming_message(char *barejid, char *resource, char *message, char *pgp_m // OTR supported, PGP unsupported #ifdef HAVE_LIBOTR #ifndef HAVE_LIBGPGME - _sv_ev_incoming_otr(chatwin, new_win, barejid, resource, message); + _sv_ev_incoming_otr(chatwin, new_win, barejid, resource, message, timestamp); return; #endif #endif @@ -278,9 +278,9 @@ sv_ev_incoming_message(char *barejid, char *resource, char *message, char *pgp_m #ifndef HAVE_LIBOTR #ifdef HAVE_LIBGPGME if (pgp_message) { - _sv_ev_incoming_pgp(chatwin, new_win, barejid, resource, message, pgp_message); + _sv_ev_incoming_pgp(chatwin, new_win, barejid, resource, message, pgp_message, timestamp); } else { - _sv_ev_incoming_plain(chatwin, new_win, barejid, resource, message); + _sv_ev_incoming_plain(chatwin, new_win, barejid, resource, message, timestamp); } return; #endif @@ -289,7 +289,7 @@ sv_ev_incoming_message(char *barejid, char *resource, char *message, char *pgp_m // OTR unsupported, PGP unsupported #ifndef HAVE_LIBOTR #ifndef HAVE_LIBGPGME - _sv_ev_incoming_plain(chatwin, new_win, barejid, resource, message); + _sv_ev_incoming_plain(chatwin, new_win, barejid, resource, message, timestamp); return; #endif #endif @@ -302,21 +302,6 @@ sv_ev_delayed_private_message(const char * const fulljid, char *message, GDateTi } void -sv_ev_delayed_message(char *barejid, char *message, GDateTime *timestamp) -{ - gboolean new_win = FALSE; - ProfChatWin *chatwin = wins_get_chat(barejid); - if (!chatwin) { - ProfWin *window = wins_new_chat(barejid); - chatwin = (ProfChatWin*)window; - new_win = TRUE; - } - - ui_incoming_msg(chatwin, NULL, message, timestamp, new_win, PROF_MSG_PLAIN); - chat_log_msg_in_delayed(barejid, message, timestamp); -} - -void sv_ev_message_receipt(char *barejid, char *id) { ui_message_receipt(barejid, id); |