Add option to display MUC name or JID in titlebar

Add `/titlebar use [name|jid]`.
This commit is contained in:
Michael Vetter
2020-01-23 19:42:22 +01:00
parent 0401412c64
commit 56b7482b08
9 changed files with 77 additions and 9 deletions

View File

@@ -1158,6 +1158,10 @@ cons_titlebar_setting(void)
} else {
cons_show("Titlebar presence (/titlebar) : OFF");
}
char *muctitle = prefs_get_string(PREF_TITLEBAR_MUC_TITLE);
cons_show("MUC window title (/titlebar) : %s", muctitle);
prefs_free_string(muctitle);
}
void

View File

@@ -190,14 +190,26 @@ _title_bar_draw(void)
waddch(win, ' ');
}
char *title;
char *title = NULL;
if (current && current->type == WIN_MUC) {
ProfMucWin *mucwin = (ProfMucWin*) current;
assert(mucwin->memcheck == PROFMUCWIN_MEMCHECK);
title = strdup(mucwin->room_name);
} else {
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);
}
mvwprintw(win, 0, 0, " %s", title);
free(title);