about summary refs log tree commit diff stats
path: root/src/ui
diff options
context:
space:
mode:
authorMarcoPolo-PasTonMolo <marcopolopastonmolo@protonmail.com>2022-07-05 11:30:04 +0300
committerMarcoPolo-PasTonMolo <marcopolopastonmolo@protonmail.com>2022-07-05 11:30:04 +0300
commitb03c3bda980056f65cd696fd65883a1c351ac8d7 (patch)
tree24e8ce54e944df6063b8d042943728cfe85ed5fc /src/ui
parent4d6e95d6911eab8fc9f6ddc0706c7b2ac5a25437 (diff)
downloadprofani-tty-b03c3bda980056f65cd696fd65883a1c351ac8d7.tar.gz
Cleanup
Diffstat (limited to 'src/ui')
-rw-r--r--src/ui/chatwin.c7
-rw-r--r--src/ui/window.c9
-rw-r--r--src/ui/window.h1
3 files changed, 5 insertions, 12 deletions
diff --git a/src/ui/chatwin.c b/src/ui/chatwin.c
index a89e4626..ec7f3f7a 100644
--- a/src/ui/chatwin.c
+++ b/src/ui/chatwin.c
@@ -66,11 +66,8 @@ chatwin_new(const char* const barejid)
     ProfWin* window = wins_new_chat(barejid);
     ProfChatWin* chatwin = (ProfChatWin*)window;
 
-    if (!prefs_get_boolean(PREF_MAM) || (prefs_get_boolean(PREF_CHLOG) && prefs_get_boolean(PREF_HISTORY))) {
-        if (0) {
-            
+    if (!prefs_get_boolean(PREF_MAM) && (prefs_get_boolean(PREF_CHLOG) && prefs_get_boolean(PREF_HISTORY))) {
         _chatwin_history(chatwin, barejid);
-        }
     }
 
     // if the contact is offline, show a message
@@ -311,7 +308,7 @@ chatwin_incoming_msg(ProfChatWin* chatwin, ProfMessage* message, gboolean win_cr
         // MUCPMs also get printed here. In their case we don't save any logs (because nick owners can change) and thus we shouldn't read logs
         // (and if we do we need to check the resourcepart)
         if (!prefs_get_boolean(PREF_MAM) && prefs_get_boolean(PREF_CHLOG) && prefs_get_boolean(PREF_HISTORY) && message->type == PROF_MSG_TYPE_CHAT) {
-            /* _chatwin_history(chatwin, chatwin->barejid); */
+            _chatwin_history(chatwin, chatwin->barejid);
         }
 
         // show users status first, when receiving message via delayed delivery
diff --git a/src/ui/window.c b/src/ui/window.c
index e168b70c..3bbdad01 100644
--- a/src/ui/window.c
+++ b/src/ui/window.c
@@ -604,16 +604,12 @@ win_page_up(ProfWin* window)
     if (*page_start == -page_space && prefs_get_boolean(PREF_MAM) && 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;
-        char* loading_text = "Loading older messages ...";
 
         // Don't do anything if still fetching mam messages
-        if (first_entry && !(first_entry->theme_item == THEME_ROOMINFO && g_strcmp0(first_entry->message, loading_text) == 0)) {
+        if (first_entry && !(first_entry->theme_item == THEME_ROOMINFO && g_strcmp0(first_entry->message, LOADING_MESSAGE) == 0)) {
             if (!chatwin_old_history(chatwin, NULL)) {
-                cons_show("Fetched mam");
                 win_print_loading_history(window);
                 iq_mam_request_older(chatwin);
-            } else {
-                cons_show("Showed history");
             }
         }
     }
@@ -1857,9 +1853,8 @@ win_redraw(ProfWin* window)
 void
 win_print_loading_history(ProfWin* window)
 {
-    char* loading_text = "Loading older messages ...";
     GDateTime* timestamp = buffer_size(window->layout->buffer) != 0 ? buffer_get_entry(window->layout->buffer, 0)->time : g_date_time_new_now_local();
-    buffer_prepend(window->layout->buffer, "-", 0, timestamp, NO_DATE, THEME_ROOMINFO, NULL, NULL, loading_text, NULL, NULL);
+    buffer_prepend(window->layout->buffer, "-", 0, timestamp, NO_DATE, THEME_ROOMINFO, NULL, NULL, LOADING_MESSAGE, NULL, NULL);
     win_redraw(window);
 }
 
diff --git a/src/ui/window.h b/src/ui/window.h
index 822f12b0..c8a5e03a 100644
--- a/src/ui/window.h
+++ b/src/ui/window.h
@@ -57,6 +57,7 @@
 #include "xmpp/muc.h"
 
 #define PAD_SIZE 1000
+#define LOADING_MESSAGE "Loading older messages ..."
 
 void win_move_to_end(ProfWin* window);
 void win_show_status_string(ProfWin* window, const char* const from,