about summary refs log tree commit diff stats
path: root/src
diff options
context:
space:
mode:
authorMichael Vetter <jubalh@iodoru.org>2020-03-24 21:46:40 +0100
committerMichael Vetter <jubalh@iodoru.org>2020-03-24 21:46:40 +0100
commitfd090d384da14a6fe65cfb4ecb23f02c29d10eba (patch)
tree1cadb73e461a67ff08c14f87d8149543abff99d3 /src
parent3c56b289ed04f8525affd532d0192d653e1dcd95 (diff)
downloadprofani-tty-fd090d384da14a6fe65cfb4ecb23f02c29d10eba.tar.gz
move titlebar code in correct function
Diffstat (limited to 'src')
-rw-r--r--src/ui/titlebar.c20
-rw-r--r--src/ui/window.c10
2 files changed, 10 insertions, 20 deletions
diff --git a/src/ui/titlebar.c b/src/ui/titlebar.c
index 724837d0..fd73012b 100644
--- a/src/ui/titlebar.c
+++ b/src/ui/titlebar.c
@@ -191,25 +191,7 @@ _title_bar_draw(void)
         waddch(win, ' ');
     }
 
-    char *title = NULL;
-    if (current && current->type == WIN_MUC) {
-        char *use_as_name = prefs_get_string(PREF_TITLEBAR_MUC_TITLE);
-
-        if ((g_strcmp0(use_as_name, "name") == 0)) {
-            ProfMucWin *mucwin = (ProfMucWin*) current;
-            assert(mucwin->memcheck == PROFMUCWIN_MEMCHECK);
-
-            if (mucwin->room_name) {
-                title = strdup(mucwin->room_name);
-            }
-        }
-
-        prefs_free_string(use_as_name);
-    }
-
-    if (title == NULL) {
-        title = win_get_title(current);
-    }
+    char *title = win_get_title(current);
 
     mvwprintw(win, 0, 0, " %s", title);
     free(title);
diff --git a/src/ui/window.c b/src/ui/window.c
index 1a7cfc21..9ccc19ee 100644
--- a/src/ui/window.c
+++ b/src/ui/window.c
@@ -299,7 +299,15 @@ win_get_title(ProfWin *window)
     if (window->type == WIN_MUC) {
         ProfMucWin *mucwin = (ProfMucWin*) window;
         assert(mucwin->memcheck == PROFMUCWIN_MEMCHECK);
-        return strdup(mucwin->roomjid);
+
+        char *use_as_name = prefs_get_string(PREF_TITLEBAR_MUC_TITLE);
+        if ((g_strcmp0(use_as_name, "name") == 0) && mucwin->room_name) {
+            prefs_free_string(use_as_name);
+            return strdup(mucwin->room_name);
+        } else {
+            prefs_free_string(use_as_name);
+            return strdup(mucwin->roomjid);
+        }
     }
     if (window->type == WIN_CONFIG) {
         ProfConfWin *confwin = (ProfConfWin*) window;