about summary refs log tree commit diff stats
path: root/src/ui
diff options
context:
space:
mode:
authorMarcoPolo-PasTonMolo <marcopolopastonmolo@protonmail.com>2021-10-22 10:24:51 +0300
committerMarcoPolo-PasTonMolo <marcopolopastonmolo@protonmail.com>2021-10-22 10:24:51 +0300
commitda3a6d87437ce14215acbb5f1740cb81066df39d (patch)
treeb1ad228c653e53176928e7bc3fcfd288f85e2a9d /src/ui
parent6b0f15a1c90116a01463a8c9e26c32f4112810e7 (diff)
downloadprofani-tty-da3a6d87437ce14215acbb5f1740cb81066df39d.tar.gz
Move declaration and definition of win_get_last_sent_message to the correct place
Diffstat (limited to 'src/ui')
-rw-r--r--src/ui/ui.h1
-rw-r--r--src/ui/window.c29
2 files changed, 30 insertions, 0 deletions
diff --git a/src/ui/ui.h b/src/ui/ui.h
index bb81dfc3..5257df60 100644
--- a/src/ui/ui.h
+++ b/src/ui/ui.h
@@ -398,6 +398,7 @@ void win_command_exec_error(ProfWin* window, const char* const command, const ch
 void win_handle_command_list(ProfWin* window, GSList* cmds);
 void win_handle_command_exec_status(ProfWin* window, const char* const type, const char* const value);
 void win_handle_command_exec_result_note(ProfWin* window, const char* const type, const char* const value);
+char* win_get_last_sent_message(ProfWin* window);
 
 // desktop notifications
 void notifier_initialise(void);
diff --git a/src/ui/window.c b/src/ui/window.c
index 3123e211..7442ce9c 100644
--- a/src/ui/window.c
+++ b/src/ui/window.c
@@ -399,6 +399,35 @@ win_get_tab_identifier(ProfWin* window)
 }
 
 char*
+win_get_last_sent_message(ProfWin* window)
+{
+    char* last_message = NULL;
+    switch (window->type) {
+    case WIN_CHAT:
+    {
+        ProfChatWin* chatwin = (ProfChatWin*)window;
+        assert(chatwin->memcheck == PROFCHATWIN_MEMCHECK);
+        last_message = chatwin->last_message;
+        break;
+    }
+    case WIN_MUC:
+    {
+        ProfMucWin* mucwin = (ProfMucWin*)window;
+        assert(mucwin->memcheck == PROFMUCWIN_MEMCHECK);
+        last_message = mucwin->last_message;
+    }
+    default:
+        break;
+    }
+
+    if (last_message == NULL) {
+        return NULL;
+    }
+
+    return last_message;
+}
+
+char*
 win_to_string(ProfWin* window)
 {
     assert(window != NULL);