1
0
mirror of https://github.com/profanity-im/profanity.git synced 2024-12-04 14:46:46 -05:00

Added window creation and status bar changes to plugin api

This commit is contained in:
James Booth 2014-06-05 21:13:29 +01:00
parent 57416634d5
commit b8d0f36684
3 changed files with 37 additions and 1 deletions

View File

@ -140,6 +140,11 @@ api_win_create(const char *tag, void *callback,
window->callback_func = callback_func; window->callback_func = callback_func;
callbacks_add_window_handler(tag, window); callbacks_add_window_handler(tag, window);
wins_new(tag, WIN_PLUGIN); wins_new(tag, WIN_PLUGIN);
// set status bar active
ProfWin *win = wins_get_by_recipient(tag);
int num = wins_get_num(win);
ui_status_bar_active(num);
} }
void void
@ -163,4 +168,10 @@ api_win_show(const char *tag, const char *line)
ProfWin *window = wins_get_by_recipient(tag); ProfWin *window = wins_get_by_recipient(tag);
win_print_time(window, '-'); win_print_time(window, '-');
wprintw(window->win, "%s\n", line); wprintw(window->win, "%s\n", line);
}
// refresh if current
if (wins_is_current(window)) {
int num = wins_get_num(window);
ui_switch_win(num);
}
}

View File

@ -2144,6 +2144,24 @@ _win_show_history(WINDOW *win, int win_index, const char * const contact)
} }
} }
static void
_ui_status_bar_inactive(const int win)
{
status_bar_inactive(win);
}
static void
_ui_status_bar_active(const int win)
{
status_bar_active(win);
}
static void
_ui_status_bar_new(const int win)
{
status_bar_new(win);
}
void void
ui_init_module(void) ui_init_module(void)
{ {
@ -2256,4 +2274,7 @@ ui_init_module(void)
ui_open_xmlconsole_win = _ui_open_xmlconsole_win; ui_open_xmlconsole_win = _ui_open_xmlconsole_win;
ui_handle_room_join_error = _ui_handle_room_join_error; ui_handle_room_join_error = _ui_handle_room_join_error;
ui_swap_wins = _ui_swap_wins; ui_swap_wins = _ui_swap_wins;
ui_status_bar_inactive = _ui_status_bar_inactive;
ui_status_bar_active = _ui_status_bar_active;
ui_status_bar_new = _ui_status_bar_new;
} }

View File

@ -258,6 +258,10 @@ void (*cons_autoconnect_setting)(void);
void (*cons_show_contact_online)(PContact contact, Resource *resource, GDateTime *last_activity); void (*cons_show_contact_online)(PContact contact, Resource *resource, GDateTime *last_activity);
void (*cons_show_contact_offline)(PContact contact, char *resource, char *status); void (*cons_show_contact_offline)(PContact contact, char *resource, char *status);
void (*ui_status_bar_inactive)(const int win);
void (*ui_status_bar_active)(const int win);
void (*ui_status_bar_new)(const int win);
// desktop notifier actions // desktop notifier actions
void (*notifier_init)(void); void (*notifier_init)(void);
void (*notifier_uninit)(void); void (*notifier_uninit)(void);