about summary refs log tree commit diff stats
path: root/src/ui
diff options
context:
space:
mode:
authorJames Booth <boothj5@gmail.com>2014-11-10 23:23:02 +0000
committerJames Booth <boothj5@gmail.com>2014-11-10 23:23:02 +0000
commit497b07c1c3563efdfc147b22bd8afd094caf619a (patch)
tree9dd060a249b450e24cbd2602301cecd4f75cb27e /src/ui
parent5d59d17642848ddd8b969cb59b120a65b9d98241 (diff)
downloadprofani-tty-497b07c1c3563efdfc147b22bd8afd094caf619a.tar.gz
Added /roster show|hide command, only show roster on connect success
Diffstat (limited to 'src/ui')
-rw-r--r--src/ui/console.c11
-rw-r--r--src/ui/core.c21
-rw-r--r--src/ui/ui.h3
-rw-r--r--src/ui/window.c2
4 files changed, 36 insertions, 1 deletions
diff --git a/src/ui/console.c b/src/ui/console.c
index 6a995a1a..831b1b7d 100644
--- a/src/ui/console.c
+++ b/src/ui/console.c
@@ -942,6 +942,15 @@ _cons_titlebar_setting(void)
 }
 
 static void
+_cons_roster_setting(void)
+{
+    if (prefs_get_boolean(PREF_ROSTER))
+        cons_show("Roster (/roster)              : show");
+    else
+        cons_show("Roster (/roster)              : hide");
+}
+
+static void
 _cons_show_ui_prefs(void)
 {
     cons_show("UI preferences:");
@@ -955,6 +964,7 @@ _cons_show_ui_prefs(void)
     cons_mouse_setting();
     cons_statuses_setting();
     cons_occupants_setting();
+    cons_roster_setting();
     cons_privileges_setting();
     cons_titlebar_setting();
     cons_presence_setting();
@@ -1573,6 +1583,7 @@ console_init_module(void)
     cons_splash_setting = _cons_splash_setting;
     cons_autoconnect_setting = _cons_autoconnect_setting;
     cons_occupants_setting = _cons_occupants_setting;
+    cons_roster_setting = _cons_roster_setting;
     cons_vercheck_setting = _cons_vercheck_setting;
     cons_mouse_setting = _cons_mouse_setting;
     cons_statuses_setting = _cons_statuses_setting;
diff --git a/src/ui/core.c b/src/ui/core.c
index 7bf1b20d..66b5fa2b 100644
--- a/src/ui/core.c
+++ b/src/ui/core.c
@@ -2986,6 +2986,25 @@ _ui_room_hide_occupants(const char * const room)
 }
 
 static void
+_ui_show_roster(void)
+{
+    ProfWin *window = wins_get_console();
+    if (window && !window->subwin) {
+        wins_show_subwin(window);
+        ui_roster();
+    }
+}
+
+static void
+_ui_hide_roster(void)
+{
+    ProfWin *window = wins_get_console();
+    if (window && window->subwin) {
+        wins_hide_subwin(window);
+    }
+}
+
+static void
 _win_handle_switch(const wint_t * const ch)
 {
     if (*ch == KEY_F(1)) {
@@ -3291,6 +3310,8 @@ ui_init_module(void)
     ui_roster = _ui_roster;
     ui_room_show_occupants = _ui_room_show_occupants;
     ui_room_hide_occupants = _ui_room_hide_occupants;
+    ui_show_roster = _ui_show_roster;
+    ui_hide_roster = _ui_hide_roster;
     ui_room_role_change = _ui_room_role_change;
     ui_room_affiliation_change = _ui_room_affiliation_change;
     ui_switch_to_room = _ui_switch_to_room;
diff --git a/src/ui/ui.h b/src/ui/ui.h
index 74171235..e1f48fbd 100644
--- a/src/ui/ui.h
+++ b/src/ui/ui.h
@@ -175,6 +175,8 @@ void (*ui_room_member_presence)(const char * const room,
     const char * const nick, const char * const show, const char * const status);
 void (*ui_room_show_occupants)(const char * const room);
 void (*ui_room_hide_occupants)(const char * const room);
+void (*ui_show_roster)(void);
+void (*ui_hide_roster)(void);
 void (*ui_roster_add)(const char * const barejid, const char * const name);
 void (*ui_roster_remove)(const char * const barejid);
 void (*ui_contact_already_in_group)(const char * const contact, const char * const group);
@@ -298,6 +300,7 @@ void (*cons_flash_setting)(void);
 void (*cons_splash_setting)(void);
 void (*cons_vercheck_setting)(void);
 void (*cons_occupants_setting)(void);
+void (*cons_roster_setting)(void);
 void (*cons_presence_setting)(void);
 void (*cons_wrap_setting)(void);
 void (*cons_mouse_setting)(void);
diff --git a/src/ui/window.c b/src/ui/window.c
index f5b1679d..fa02ff95 100644
--- a/src/ui/window.c
+++ b/src/ui/window.c
@@ -71,7 +71,7 @@ win_create(const char * const title, win_type_t type)
     new_win->from = strdup(title);
     int cols = getmaxx(stdscr);
 
-    if ((type == WIN_MUC && prefs_get_boolean(PREF_OCCUPANTS)) || (type == WIN_CONSOLE)) {
+    if (type == WIN_MUC && prefs_get_boolean(PREF_OCCUPANTS)) {
         int main_cols = win_main_width();
         new_win->win = newpad(PAD_SIZE, main_cols);
         wbkgd(new_win->win, COLOUR_TEXT);