about summary refs log tree commit diff stats
path: root/src/ui
diff options
context:
space:
mode:
authorMarcoPolo-PasTonMolo <marcopolopastonmolo@protonmail.com>2022-07-10 10:44:06 +0300
committerMarcoPolo-PasTonMolo <marcopolopastonmolo@protonmail.com>2022-07-10 11:17:35 +0300
commit85aaf40432d50a99c50ae8d1baa7c02ff5ae43ba (patch)
tree3cc4780ad08c598086e7e99e863593152afe4088 /src/ui
parent47b3e528e2c13a63316fa7ad2c02d9b702741dea (diff)
downloadprofani-tty-85aaf40432d50a99c50ae8d1baa7c02ff5ae43ba.tar.gz
Have ability to scroll through history even without MAM
Diffstat (limited to 'src/ui')
-rw-r--r--src/ui/chatwin.c4
-rw-r--r--src/ui/window.c6
2 files changed, 5 insertions, 5 deletions
diff --git a/src/ui/chatwin.c b/src/ui/chatwin.c
index 0b2724d3..530739ae 100644
--- a/src/ui/chatwin.c
+++ b/src/ui/chatwin.c
@@ -519,7 +519,7 @@ static void
 _chatwin_history(ProfChatWin* chatwin, const char* const contact_barejid)
 {
     if (!chatwin->history_shown) {
-        GSList* history = log_database_get_previous_chat(contact_barejid, NULL, NULL, FALSE);
+        GSList* history = log_database_get_previous_chat(contact_barejid, NULL, NULL, FALSE, FALSE);
         GSList* curr = history;
 
         while (curr) {
@@ -547,7 +547,7 @@ chatwin_db_history(ProfChatWin* chatwin, char* start_time, char* end_time, gbool
         end_time = buffer_size(((ProfWin*)chatwin)->layout->buffer) == 0 ? NULL : g_date_time_format_iso8601(buffer_get_entry(((ProfWin*)chatwin)->layout->buffer, 0)->time);
     }
 
-    GSList* history = log_database_get_previous_chat(chatwin->barejid, start_time, end_time, flip);
+    GSList* history = log_database_get_previous_chat(chatwin->barejid, start_time, end_time, !flip, flip);
     gboolean has_items = g_slist_length(history) != 0;
     GSList* curr = history;
 
diff --git a/src/ui/window.c b/src/ui/window.c
index e56b14fa..4ac45f9c 100644
--- a/src/ui/window.c
+++ b/src/ui/window.c
@@ -601,13 +601,13 @@ win_page_up(ProfWin* window)
 
     *page_start -= page_space;
 
-    if (*page_start == -page_space && prefs_get_boolean(PREF_MAM) && window->type == WIN_CHAT) {
+    if (*page_start == -page_space && window->type == WIN_CHAT) {
         ProfChatWin* chatwin = (ProfChatWin*) window;
         ProfBuffEntry* first_entry = buffer_size(window->layout->buffer) != 0 ? buffer_get_entry(window->layout->buffer, 0) : NULL;
 
         // Don't do anything if still fetching mam messages
         if (first_entry && !(first_entry->theme_item == THEME_ROOMINFO && g_strcmp0(first_entry->message, LOADING_MESSAGE) == 0)) {
-            if (!chatwin_db_history(chatwin, NULL, NULL, TRUE)) {
+            if (!chatwin_db_history(chatwin, NULL, NULL, TRUE) && prefs_get_boolean(PREF_MAM)) {
                 win_print_loading_history(window);
                 iq_mam_request_older(chatwin);
             }
@@ -638,7 +638,7 @@ win_page_down(ProfWin* window)
     *page_start += page_space;
 
     // Scrolled down after reaching the bottom of the page
-    if ((*page_start == y || (*page_start == page_space && *page_start >= y)) && prefs_get_boolean(PREF_MAM) && window->type == WIN_CHAT) {
+    if ((*page_start == y || (*page_start == page_space && *page_start >= y)) && window->type == WIN_CHAT) {
         int bf_size = buffer_size(window->layout->buffer);
         if (bf_size > 0) {
             char* start = g_date_time_format_iso8601(buffer_get_entry(window->layout->buffer, bf_size - 1)->time);