about summary refs log tree commit diff stats
path: root/src
diff options
context:
space:
mode:
Diffstat (limited to 'src')
-rw-r--r--src/ui/core.c15
-rw-r--r--src/ui/window.c4
-rw-r--r--src/ui/window.h2
3 files changed, 10 insertions, 11 deletions
diff --git a/src/ui/core.c b/src/ui/core.c
index 7cb0e010..2838edf3 100644
--- a/src/ui/core.c
+++ b/src/ui/core.c
@@ -81,8 +81,7 @@ static GTimer *ui_idle_time;
 
 static void _win_handle_switch(const wint_t * const ch);
 static void _win_handle_page(const wint_t * const ch, const int result);
-static void _win_show_history(WINDOW *win, int win_index,
-    const char * const contact);
+static void _win_show_history(int win_index, const char * const contact);
 static void _ui_draw_term_title(void);
 static void _ui_roster_contact(PContact contact);
 
@@ -368,7 +367,7 @@ _ui_incoming_msg(const char * const from, const char * const message,
 
         window->unread++;
         if (prefs_get_boolean(PREF_CHLOG) && prefs_get_boolean(PREF_HISTORY)) {
-            _win_show_history(window->win, num, from);
+            _win_show_history(num, from);
         }
 
         // show users status first, when receiving message via delayed delivery
@@ -1339,7 +1338,7 @@ _ui_new_chat_win(const char * const to)
         num = wins_get_num(window);
 
         if (prefs_get_boolean(PREF_CHLOG) && prefs_get_boolean(PREF_HISTORY)) {
-            _win_show_history(window->win, num, to);
+            _win_show_history(num, to);
         }
 
         if (contact != NULL) {
@@ -1401,7 +1400,7 @@ _ui_outgoing_msg(const char * const from, const char * const to,
         num = wins_get_num(window);
 
         if (prefs_get_boolean(PREF_CHLOG) && prefs_get_boolean(PREF_HISTORY)) {
-            _win_show_history(window->win, num, to);
+            _win_show_history(num, to);
         }
 
         if (contact != NULL) {
@@ -3311,10 +3310,10 @@ _win_handle_page(const wint_t * const ch, const int result)
 }
 
 static void
-_win_show_history(WINDOW *win, int win_index, const char * const contact)
+_win_show_history(int win_index, const char * const contact)
 {
     ProfWin *window = wins_get_by_num(win_index);
-    if (!window->history_shown) {
+    if (window->type == WIN_CHAT && !window->wins.chat.history_shown) {
         Jid *jid = jid_create(jabber_get_fulljid());
         GSList *history = chat_log_get_previous(jid->barejid, contact);
         jid_destroy(jid);
@@ -3337,7 +3336,7 @@ _win_show_history(WINDOW *win, int win_index, const char * const contact)
             }
             curr = g_slist_next(curr);
         }
-        window->history_shown = 1;
+        window->wins.chat.history_shown = TRUE;
 
         g_slist_free_full(history, free);
     }
diff --git a/src/ui/window.c b/src/ui/window.c
index ee096a98..8a6cc18d 100644
--- a/src/ui/window.c
+++ b/src/ui/window.c
@@ -117,12 +117,12 @@ win_create(const char * const title, win_type_t type)
     new_win->y_pos = 0;
     new_win->paged = 0;
     new_win->unread = 0;
-    new_win->history_shown = 0;
 
     if (new_win->type == WIN_CHAT) {
+        new_win->wins.chat.resource = NULL;
         new_win->wins.chat.is_otr = FALSE;
         new_win->wins.chat.is_trusted = FALSE;
-        new_win->wins.chat.resource = NULL;
+        new_win->wins.chat.history_shown = FALSE;
     }
 
     scrollok(new_win->win, TRUE);
diff --git a/src/ui/window.h b/src/ui/window.h
index fd81aa06..4f855e39 100644
--- a/src/ui/window.h
+++ b/src/ui/window.h
@@ -74,7 +74,6 @@ typedef struct prof_win_t {
     int y_pos;
     int paged;
     int unread;
-    int history_shown;
     union {
         // WIN_CONSOLE
         struct {
@@ -87,6 +86,7 @@ typedef struct prof_win_t {
             gboolean is_otr;
             gboolean is_trusted;
             char *resource;
+            gboolean history_shown;
         } chat;
 
         // WIN_MUC