mirror of
https://github.com/profanity-im/profanity.git
synced 2024-12-04 14:46:46 -05:00
Implemented /occupants show
This commit is contained in:
parent
73262221f5
commit
cbe14d6e4e
@ -987,6 +987,7 @@ static Autocomplete room_role_ac;
|
||||
static Autocomplete room_cmd_ac;
|
||||
static Autocomplete room_subject_ac;
|
||||
static Autocomplete form_ac;
|
||||
static Autocomplete occupants_ac;
|
||||
|
||||
/*
|
||||
* Initialise command autocompleter and history
|
||||
@ -1295,6 +1296,10 @@ cmd_init(void)
|
||||
autocomplete_add(form_ac, "remove");
|
||||
autocomplete_add(form_ac, "help");
|
||||
|
||||
occupants_ac = autocomplete_new();
|
||||
autocomplete_add(occupants_ac, "show");
|
||||
autocomplete_add(occupants_ac, "hide");
|
||||
|
||||
cmd_history_init();
|
||||
}
|
||||
|
||||
@ -1343,6 +1348,7 @@ cmd_uninit(void)
|
||||
autocomplete_free(room_cmd_ac);
|
||||
autocomplete_free(room_subject_ac);
|
||||
autocomplete_free(form_ac);
|
||||
autocomplete_free(occupants_ac);
|
||||
}
|
||||
|
||||
gboolean
|
||||
@ -1474,6 +1480,7 @@ cmd_reset_autocomplete()
|
||||
autocomplete_reset(room_cmd_ac);
|
||||
autocomplete_reset(room_subject_ac);
|
||||
autocomplete_reset(form_ac);
|
||||
autocomplete_reset(occupants_ac);
|
||||
|
||||
if (ui_current_win_type() == WIN_MUC_CONFIG) {
|
||||
ProfWin *window = wins_get_current();
|
||||
@ -1731,8 +1738,8 @@ _cmd_complete_parameters(char *input, int *size)
|
||||
}
|
||||
}
|
||||
|
||||
gchar *cmds[] = { "/help", "/prefs", "/disco", "/close", "/wins" };
|
||||
Autocomplete completers[] = { help_ac, prefs_ac, disco_ac, close_ac, wins_ac };
|
||||
gchar *cmds[] = { "/help", "/prefs", "/disco", "/close", "/wins", "/occupants" };
|
||||
Autocomplete completers[] = { help_ac, prefs_ac, disco_ac, close_ac, wins_ac, occupants_ac };
|
||||
|
||||
for (i = 0; i < ARRAY_SIZE(cmds); i++) {
|
||||
result = autocomplete_param_with_ac(input, size, cmds[i], completers[i], TRUE);
|
||||
|
@ -2788,7 +2788,8 @@ _ui_room_show_occupants(const char * const room)
|
||||
{
|
||||
ProfWin *window = wins_get_by_recipient(room);
|
||||
if (window && !window->subwin) {
|
||||
cons_debug("Showing occupants");
|
||||
wins_show_subwin(window);
|
||||
ui_muc_roster(room);
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -102,6 +102,19 @@ win_hide_subwin(ProfWin *window)
|
||||
win_redraw(window);
|
||||
}
|
||||
|
||||
void
|
||||
win_show_subwin(ProfWin *window)
|
||||
{
|
||||
if (!window->subwin) {
|
||||
window->subwin = newpad(PAD_SIZE, OCCUPANT_WIN_WIDTH);
|
||||
wbkgd(window->subwin, COLOUR_TEXT);
|
||||
|
||||
int cols = getmaxx(stdscr);
|
||||
wresize(window->win, PAD_SIZE, (cols/OCCUPANT_WIN_RATIO) * (OCCUPANT_WIN_RATIO-1));
|
||||
win_redraw(window);
|
||||
}
|
||||
}
|
||||
|
||||
void
|
||||
win_free(ProfWin* window)
|
||||
{
|
||||
|
@ -103,5 +103,6 @@ void win_save_println(ProfWin *window, const char * const message);
|
||||
void win_save_newline(ProfWin *window);
|
||||
void win_redraw(ProfWin *window);
|
||||
void win_hide_subwin(ProfWin *window);
|
||||
void win_show_subwin(ProfWin *window);
|
||||
|
||||
#endif
|
||||
|
@ -294,7 +294,7 @@ wins_resize_all(void)
|
||||
GList *curr = values;
|
||||
while (curr != NULL) {
|
||||
ProfWin *window = curr->data;
|
||||
if (window->type == WIN_MUC) {
|
||||
if ((window->type == WIN_MUC) && (window->subwin)) {
|
||||
wresize(window->win, PAD_SIZE, (cols/OCCUPANT_WIN_RATIO) * (OCCUPANT_WIN_RATIO-1));
|
||||
} else {
|
||||
wresize(window->win, PAD_SIZE, cols);
|
||||
@ -320,12 +320,28 @@ wins_hide_subwin(ProfWin *window)
|
||||
getmaxyx(stdscr, rows, cols);
|
||||
|
||||
win_hide_subwin(window);
|
||||
|
||||
ProfWin *current_win = wins_get_current();
|
||||
if (current_win->type == WIN_MUC) {
|
||||
pnoutrefresh(current_win->win, current_win->y_pos, 0, 1, 0, rows-3, cols-1);
|
||||
}
|
||||
}
|
||||
|
||||
void
|
||||
wins_show_subwin(ProfWin *window)
|
||||
{
|
||||
int rows, cols;
|
||||
getmaxyx(stdscr, rows, cols);
|
||||
|
||||
win_show_subwin(window);
|
||||
|
||||
ProfWin *current_win = wins_get_current();
|
||||
if (current_win->type == WIN_MUC) {
|
||||
pnoutrefresh(current_win->win, current_win->y_pos, 0, 1, 0, rows-3, ((cols/OCCUPANT_WIN_RATIO) * (OCCUPANT_WIN_RATIO-1)) -1);
|
||||
pnoutrefresh(current_win->subwin, current_win->sub_y_pos, 0, 1, (cols/OCCUPANT_WIN_RATIO) * (OCCUPANT_WIN_RATIO-1), rows-3, cols-1);
|
||||
}
|
||||
}
|
||||
|
||||
gboolean
|
||||
wins_duck_exists(void)
|
||||
{
|
||||
|
@ -64,5 +64,6 @@ gboolean wins_xmlconsole_exists(void);
|
||||
ProfWin * wins_get_xmlconsole(void);
|
||||
gboolean wins_swap(int source_win, int target_win);
|
||||
void wins_hide_subwin(ProfWin *window);
|
||||
void wins_show_subwin(ProfWin *window);
|
||||
|
||||
#endif
|
||||
|
Loading…
Reference in New Issue
Block a user