about summary refs log tree commit diff stats
diff options
context:
space:
mode:
authorJames Booth <boothj5@gmail.com>2015-10-26 22:54:06 +0000
committerJames Booth <boothj5@gmail.com>2015-10-26 22:54:06 +0000
commit2efaa464bf6629a4f59be2834ce646d7abb8ecda (patch)
tree740c6dad2069d1c143be8c5ab9b9b03d1fb1219d
parent8f45f332ade58b188f1f51d86304f525f1951647 (diff)
downloadprofani-tty-2efaa464bf6629a4f59be2834ce646d7abb8ecda.tar.gz
ui_message_receipt takes ProfChatWin
-rw-r--r--src/event/server_events.c6
-rw-r--r--src/ui/chatwin.c9
-rw-r--r--src/ui/ui.h2
-rw-r--r--tests/unittests/ui/stub_ui.c2
4 files changed, 10 insertions, 9 deletions
diff --git a/src/event/server_events.c b/src/event/server_events.c
index 4173fa7f..1f8d53cc 100644
--- a/src/event/server_events.c
+++ b/src/event/server_events.c
@@ -311,7 +311,11 @@ sv_ev_delayed_private_message(const char *const fulljid, char *message, GDateTim
 void
 sv_ev_message_receipt(char *barejid, char *id)
 {
-    ui_message_receipt(barejid, id);
+    ProfChatWin *chatwin = wins_get_chat(barejid);
+    if (!chatwin)
+        return;
+
+    ui_message_receipt(chatwin, id);
 }
 
 void
diff --git a/src/ui/chatwin.c b/src/ui/chatwin.c
index 7f394b47..1f25d642 100644
--- a/src/ui/chatwin.c
+++ b/src/ui/chatwin.c
@@ -47,13 +47,10 @@
 static void _win_show_history(ProfChatWin *chatwin, const char *const contact);
 
 void
-ui_message_receipt(const char *const barejid, const char *const id)
+ui_message_receipt(ProfChatWin *chatwin, const char *const id)
 {
-    ProfChatWin *chatwin = wins_get_chat(barejid);
-    if (chatwin) {
-        ProfWin *win = (ProfWin*) chatwin;
-        win_mark_received(win, id);
-    }
+    ProfWin *win = (ProfWin*) chatwin;
+    win_mark_received(win, id);
 }
 
 void
diff --git a/src/ui/ui.h b/src/ui/ui.h
index a6795e25..c4d8d8cb 100644
--- a/src/ui/ui.h
+++ b/src/ui/ui.h
@@ -112,7 +112,7 @@ 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, GDateTime *timestamp, gboolean win_created, prof_enc_t enc_mode);
 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_message_receipt(ProfChatWin *chatwin, const char *const id);
 
 void ui_disconnected(void);
 void ui_recipient_gone(const char *const barejid, const char *const resource);
diff --git a/tests/unittests/ui/stub_ui.c b/tests/unittests/ui/stub_ui.c
index 47e7e9e9..8c648551 100644
--- a/tests/unittests/ui/stub_ui.c
+++ b/tests/unittests/ui/stub_ui.c
@@ -185,7 +185,7 @@ 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, GDateTime *timestamp, gboolean win_created, prof_enc_t enc_mode) {}
-void ui_message_receipt(const char * const barejid, const char * const id) {}
+void ui_message_receipt(ProfChatWin *chatwin, const char * const id) {}
 
 void ui_incoming_private_msg(const char * const fulljid, const char * const message, GDateTime *timestamp) {}