about summary refs log tree commit diff stats
diff options
context:
space:
mode:
-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) {}