Dynamically load UI functions, fixed tests
This commit is contained in:
352
src/ui/core.c
352
src/ui/core.c
@@ -69,8 +69,8 @@ static void _win_show_history(WINDOW *win, int win_index,
|
||||
const char * const contact);
|
||||
static void _ui_draw_win_title(void);
|
||||
|
||||
void
|
||||
ui_init(void)
|
||||
static void
|
||||
_ui_init(void)
|
||||
{
|
||||
log_info("Initialising UI");
|
||||
initscr();
|
||||
@@ -95,18 +95,20 @@ ui_init(void)
|
||||
ui_idle_time = g_timer_new();
|
||||
wins_refresh_current();
|
||||
}
|
||||
void (*ui_init)(void) = _ui_init;
|
||||
|
||||
void
|
||||
ui_refresh(void)
|
||||
static void
|
||||
_ui_refresh(void)
|
||||
{
|
||||
_ui_draw_win_title();
|
||||
title_bar_refresh();
|
||||
status_bar_refresh();
|
||||
inp_put_back();
|
||||
}
|
||||
void (*ui_refresh)(void) = _ui_refresh;
|
||||
|
||||
unsigned long
|
||||
ui_get_idle_time(void)
|
||||
static unsigned long
|
||||
_ui_get_idle_time(void)
|
||||
{
|
||||
// if compiled with libxss, get the x sessions idle time
|
||||
#ifdef HAVE_LIBXSS
|
||||
@@ -123,23 +125,26 @@ ui_get_idle_time(void)
|
||||
unsigned long ms_elapsed = seconds_elapsed * 1000.0;
|
||||
return ms_elapsed;
|
||||
}
|
||||
unsigned long (*ui_get_idle_time)(void) = _ui_get_idle_time;
|
||||
|
||||
void
|
||||
ui_reset_idle_time(void)
|
||||
static void
|
||||
_ui_reset_idle_time(void)
|
||||
{
|
||||
g_timer_start(ui_idle_time);
|
||||
}
|
||||
void (*ui_reset_idle_time)(void) = _ui_reset_idle_time;
|
||||
|
||||
void
|
||||
ui_close(void)
|
||||
static void
|
||||
_ui_close(void)
|
||||
{
|
||||
notifier_uninit();
|
||||
wins_destroy();
|
||||
endwin();
|
||||
}
|
||||
void (*ui_close)(void) = _ui_close;
|
||||
|
||||
void
|
||||
ui_resize(const int ch, const char * const input, const int size)
|
||||
static void
|
||||
_ui_resize(const int ch, const char * const input, const int size)
|
||||
{
|
||||
log_info("Resizing UI");
|
||||
title_bar_resize();
|
||||
@@ -148,9 +153,10 @@ ui_resize(const int ch, const char * const input, const int size)
|
||||
inp_win_resize(input, size);
|
||||
wins_refresh_current();
|
||||
}
|
||||
void (*ui_resize)(const int, const char * const, const int) = _ui_resize;
|
||||
|
||||
void
|
||||
ui_load_colours(void)
|
||||
static void
|
||||
_ui_load_colours(void)
|
||||
{
|
||||
if (has_colors()) {
|
||||
use_default_colors();
|
||||
@@ -158,22 +164,25 @@ ui_load_colours(void)
|
||||
theme_init_colours();
|
||||
}
|
||||
}
|
||||
void (*ui_load_colours)(void) = _ui_load_colours;
|
||||
|
||||
gboolean
|
||||
ui_win_exists(int index)
|
||||
static gboolean
|
||||
_ui_win_exists(int index)
|
||||
{
|
||||
ProfWin *window = wins_get_by_num(index);
|
||||
return (window != NULL);
|
||||
}
|
||||
gboolean (*ui_win_exists)(int) = _ui_win_exists;
|
||||
|
||||
gboolean
|
||||
ui_duck_exists(void)
|
||||
static gboolean
|
||||
_ui_duck_exists(void)
|
||||
{
|
||||
return wins_duck_exists();
|
||||
}
|
||||
gboolean (*ui_duck_exists)(void) = _ui_duck_exists;
|
||||
|
||||
void
|
||||
ui_contact_typing(const char * const barejid)
|
||||
static void
|
||||
_ui_contact_typing(const char * const barejid)
|
||||
{
|
||||
ProfWin *window = wins_get_by_recipient(barejid);
|
||||
|
||||
@@ -209,16 +218,18 @@ ui_contact_typing(const char * const barejid)
|
||||
notify_typing(display_usr);
|
||||
}
|
||||
}
|
||||
void (*ui_contact_typing)(const char * const) = _ui_contact_typing;
|
||||
|
||||
GSList *
|
||||
ui_get_recipients(void)
|
||||
static GSList *
|
||||
_ui_get_recipients(void)
|
||||
{
|
||||
GSList *recipients = wins_get_chat_recipients();
|
||||
return recipients;
|
||||
}
|
||||
GSList * (*ui_get_recipients)(void) = _ui_get_recipients;
|
||||
|
||||
void
|
||||
ui_incoming_msg(const char * const from, const char * const message,
|
||||
static void
|
||||
_ui_incoming_msg(const char * const from, const char * const message,
|
||||
GTimeVal *tv_stamp, gboolean priv)
|
||||
{
|
||||
gboolean win_created = FALSE;
|
||||
@@ -293,9 +304,11 @@ ui_incoming_msg(const char * const from, const char * const message,
|
||||
|
||||
free(display_from);
|
||||
}
|
||||
void (*ui_incoming_msg)(const char * const, const char * const,
|
||||
GTimeVal*, gboolean) = _ui_incoming_msg;
|
||||
|
||||
void
|
||||
ui_roster_add(const char * const barejid, const char * const name)
|
||||
static void
|
||||
_ui_roster_add(const char * const barejid, const char * const name)
|
||||
{
|
||||
if (name != NULL) {
|
||||
cons_show("Roster item added: %s (%s)", barejid, name);
|
||||
@@ -303,39 +316,45 @@ ui_roster_add(const char * const barejid, const char * const name)
|
||||
cons_show("Roster item added: %s", barejid);
|
||||
}
|
||||
}
|
||||
void (*ui_roster_add)(const char * const, const char * const) = _ui_roster_add;
|
||||
|
||||
void
|
||||
ui_roster_remove(const char * const barejid)
|
||||
static void
|
||||
_ui_roster_remove(const char * const barejid)
|
||||
{
|
||||
cons_show("Roster item removed: %s", barejid);
|
||||
}
|
||||
void (*ui_roster_remove)(const char * const) = _ui_roster_remove;
|
||||
|
||||
void
|
||||
ui_contact_already_in_group(const char * const contact, const char * const group)
|
||||
static void
|
||||
_ui_contact_already_in_group(const char * const contact, const char * const group)
|
||||
{
|
||||
cons_show("%s already in group %s", contact, group);
|
||||
}
|
||||
void (*ui_contact_already_in_group)(const char * const, const char * const) = _ui_contact_already_in_group;
|
||||
|
||||
void
|
||||
ui_contact_not_in_group(const char * const contact, const char * const group)
|
||||
static void
|
||||
_ui_contact_not_in_group(const char * const contact, const char * const group)
|
||||
{
|
||||
cons_show("%s is not currently in group %s", contact, group);
|
||||
}
|
||||
void (*ui_contact_not_in_group)(const char * const, const char * const) = _ui_contact_not_in_group;
|
||||
|
||||
void
|
||||
ui_group_added(const char * const contact, const char * const group)
|
||||
static void
|
||||
_ui_group_added(const char * const contact, const char * const group)
|
||||
{
|
||||
cons_show("%s added to group %s", contact, group);
|
||||
}
|
||||
void (*ui_group_added)(const char * const, const char * const) = _ui_group_added;
|
||||
|
||||
void
|
||||
ui_group_removed(const char * const contact, const char * const group)
|
||||
static void
|
||||
_ui_group_removed(const char * const contact, const char * const group)
|
||||
{
|
||||
cons_show("%s removed from group %s", contact, group);
|
||||
}
|
||||
void (*ui_group_removed)(const char * const, const char * const) = _ui_group_removed;
|
||||
|
||||
void
|
||||
ui_handle_error_message(const char * const from, const char * const err_msg)
|
||||
static void
|
||||
_ui_handle_error_message(const char * const from, const char * const err_msg)
|
||||
{
|
||||
if (err_msg == NULL) {
|
||||
cons_show_error("Unknown error received from service.");
|
||||
@@ -349,9 +368,11 @@ ui_handle_error_message(const char * const from, const char * const err_msg)
|
||||
|
||||
ui_print_error_from_recipient(from, err_msg);
|
||||
}
|
||||
void (*ui_handle_error_message)(const char * const,
|
||||
const char * const) = _ui_handle_error_message;
|
||||
|
||||
void
|
||||
ui_contact_online(const char * const barejid, const char * const resource,
|
||||
static void
|
||||
_ui_contact_online(const char * const barejid, const char * const resource,
|
||||
const char * const show, const char * const status, GDateTime *last_activity)
|
||||
{
|
||||
PContact contact = roster_get_contact(barejid);
|
||||
@@ -375,9 +396,11 @@ ui_contact_online(const char * const barejid, const char * const resource,
|
||||
wins_refresh_current();
|
||||
}
|
||||
}
|
||||
void (*ui_contact_online)(const char * const, const char * const,
|
||||
const char * const, const char * const, GDateTime*) = _ui_contact_online;
|
||||
|
||||
void
|
||||
ui_contact_offline(const char * const from, const char * const show,
|
||||
static void
|
||||
_ui_contact_offline(const char * const from, const char * const show,
|
||||
const char * const status)
|
||||
{
|
||||
Jid *jidp = jid_create(from);
|
||||
@@ -403,18 +426,21 @@ ui_contact_offline(const char * const from, const char * const show,
|
||||
wins_refresh_current();
|
||||
}
|
||||
}
|
||||
void (*ui_contact_offline)(const char * const, const char * const,
|
||||
const char * const) = _ui_contact_offline;
|
||||
|
||||
void
|
||||
ui_disconnected(void)
|
||||
static void
|
||||
_ui_disconnected(void)
|
||||
{
|
||||
wins_lost_connection();
|
||||
title_bar_set_status(CONTACT_OFFLINE);
|
||||
status_bar_clear_message();
|
||||
status_bar_refresh();
|
||||
}
|
||||
void (*ui_disconnected)(void) = _ui_disconnected;
|
||||
|
||||
void
|
||||
ui_handle_special_keys(const wint_t * const ch, const char * const inp,
|
||||
static void
|
||||
_ui_handle_special_keys(const wint_t * const ch, const char * const inp,
|
||||
const int size)
|
||||
{
|
||||
_win_handle_switch(ch);
|
||||
@@ -424,9 +450,11 @@ ui_handle_special_keys(const wint_t * const ch, const char * const inp,
|
||||
}
|
||||
|
||||
}
|
||||
void (*ui_handle_special_keys)(const wint_t * const, const char * const,
|
||||
const int) = _ui_handle_special_keys;
|
||||
|
||||
void
|
||||
ui_close_connected_win(int index)
|
||||
static void
|
||||
_ui_close_connected_win(int index)
|
||||
{
|
||||
win_type_t win_type = ui_win_type(index);
|
||||
if (win_type == WIN_MUC) {
|
||||
@@ -446,9 +474,10 @@ ui_close_connected_win(int index)
|
||||
}
|
||||
}
|
||||
}
|
||||
void (*ui_close_connected_win)(int index) = _ui_close_connected_win;
|
||||
|
||||
int
|
||||
ui_close_all_wins(void)
|
||||
static int
|
||||
_ui_close_all_wins(void)
|
||||
{
|
||||
int count = 0;
|
||||
jabber_conn_status_t conn_status = jabber_get_connection_status();
|
||||
@@ -473,9 +502,10 @@ ui_close_all_wins(void)
|
||||
|
||||
return count;
|
||||
}
|
||||
int (*ui_close_all_wins)(void) = _ui_close_all_wins;
|
||||
|
||||
int
|
||||
ui_close_read_wins(void)
|
||||
static int
|
||||
_ui_close_read_wins(void)
|
||||
{
|
||||
int count = 0;
|
||||
jabber_conn_status_t conn_status = jabber_get_connection_status();
|
||||
@@ -500,9 +530,10 @@ ui_close_read_wins(void)
|
||||
|
||||
return count;
|
||||
}
|
||||
int (*ui_close_read_wins)(void) = _ui_close_read_wins;
|
||||
|
||||
void
|
||||
ui_switch_win(const int i)
|
||||
static void
|
||||
_ui_switch_win(const int i)
|
||||
{
|
||||
ui_current_page_off();
|
||||
ProfWin *new_current = wins_get_by_num(i);
|
||||
@@ -534,9 +565,10 @@ ui_switch_win(const int i)
|
||||
wins_refresh_current();
|
||||
}
|
||||
}
|
||||
void (*ui_switch_win)(const int) = _ui_switch_win;
|
||||
|
||||
void
|
||||
ui_next_win(void)
|
||||
static void
|
||||
_ui_next_win(void)
|
||||
{
|
||||
ui_current_page_off();
|
||||
ProfWin *new_current = wins_get_next();
|
||||
@@ -567,9 +599,10 @@ ui_next_win(void)
|
||||
}
|
||||
wins_refresh_current();
|
||||
}
|
||||
void (*ui_next_win)(void) = _ui_next_win;
|
||||
|
||||
void
|
||||
ui_previous_win(void)
|
||||
static void
|
||||
_ui_previous_win(void)
|
||||
{
|
||||
ui_current_page_off();
|
||||
ProfWin *new_current = wins_get_previous();
|
||||
@@ -600,15 +633,17 @@ ui_previous_win(void)
|
||||
}
|
||||
wins_refresh_current();
|
||||
}
|
||||
void (*ui_previous_win)(void) = _ui_previous_win;
|
||||
|
||||
void
|
||||
ui_clear_current(void)
|
||||
static void
|
||||
_ui_clear_current(void)
|
||||
{
|
||||
wins_clear_current();
|
||||
}
|
||||
void (*ui_clear_current)(void) = _ui_clear_current;
|
||||
|
||||
void
|
||||
ui_close_current(void)
|
||||
static void
|
||||
_ui_close_current(void)
|
||||
{
|
||||
int current_index = wins_get_current_num();
|
||||
status_bar_inactive(current_index);
|
||||
@@ -617,9 +652,10 @@ ui_close_current(void)
|
||||
status_bar_active(1);
|
||||
title_bar_title();
|
||||
}
|
||||
void (*ui_close_current)(void) = _ui_close_current;
|
||||
|
||||
void
|
||||
ui_close_win(int index)
|
||||
static void
|
||||
_ui_close_win(int index)
|
||||
{
|
||||
wins_close_by_num(index);
|
||||
status_bar_current(1);
|
||||
@@ -628,9 +664,10 @@ ui_close_win(int index)
|
||||
|
||||
wins_refresh_current();
|
||||
}
|
||||
void (*ui_close_win)(int) = _ui_close_win;
|
||||
|
||||
void
|
||||
ui_tidy_wins(void)
|
||||
static void
|
||||
_ui_tidy_wins(void)
|
||||
{
|
||||
gboolean tidied = wins_tidy();
|
||||
|
||||
@@ -640,9 +677,10 @@ ui_tidy_wins(void)
|
||||
cons_show("No tidy needed.");
|
||||
}
|
||||
}
|
||||
void (*ui_tidy_wins)(void) = _ui_tidy_wins;
|
||||
|
||||
void
|
||||
ui_prune_wins(void)
|
||||
static void
|
||||
_ui_prune_wins(void)
|
||||
{
|
||||
jabber_conn_status_t conn_status = jabber_get_connection_status();
|
||||
gboolean pruned = FALSE;
|
||||
@@ -685,43 +723,49 @@ ui_prune_wins(void)
|
||||
cons_show("No prune needed.");
|
||||
}
|
||||
}
|
||||
void (*ui_prune_wins)(void) = _ui_prune_wins;
|
||||
|
||||
win_type_t
|
||||
ui_current_win_type(void)
|
||||
static win_type_t
|
||||
_ui_current_win_type(void)
|
||||
{
|
||||
ProfWin *current = wins_get_current();
|
||||
return current->type;
|
||||
}
|
||||
win_type_t (*ui_current_win_type)(void) = _ui_current_win_type;
|
||||
|
||||
int
|
||||
ui_current_win_index(void)
|
||||
static int
|
||||
_ui_current_win_index(void)
|
||||
{
|
||||
return wins_get_current_num();
|
||||
}
|
||||
int (*ui_current_win_index)(void) = _ui_current_win_index;
|
||||
|
||||
win_type_t
|
||||
ui_win_type(int index)
|
||||
static win_type_t
|
||||
_ui_win_type(int index)
|
||||
{
|
||||
ProfWin *window = wins_get_by_num(index);
|
||||
return window->type;
|
||||
}
|
||||
win_type_t (*ui_win_type)(int index) = _ui_win_type;
|
||||
|
||||
char *
|
||||
ui_recipient(int index)
|
||||
static char *
|
||||
_ui_recipient(int index)
|
||||
{
|
||||
ProfWin *window = wins_get_by_num(index);
|
||||
return window->from;
|
||||
}
|
||||
char * (*ui_recipient)(int) = _ui_recipient;
|
||||
|
||||
char *
|
||||
ui_current_recipient(void)
|
||||
static char *
|
||||
_ui_current_recipient(void)
|
||||
{
|
||||
ProfWin *current = wins_get_current();
|
||||
return current->from;
|
||||
}
|
||||
char* (*ui_current_recipient)(void) = _ui_current_recipient;
|
||||
|
||||
void
|
||||
ui_current_print_line(const char * const msg, ...)
|
||||
static void
|
||||
_ui_current_print_line(const char * const msg, ...)
|
||||
{
|
||||
ProfWin *current = wins_get_current();
|
||||
va_list arg;
|
||||
@@ -730,25 +774,28 @@ ui_current_print_line(const char * const msg, ...)
|
||||
va_end(arg);
|
||||
win_refresh(current);
|
||||
}
|
||||
void (*ui_current_print_line)(const char * const, ...) = _ui_current_print_line;
|
||||
|
||||
void
|
||||
ui_current_error_line(const char * const msg)
|
||||
static void
|
||||
_ui_current_error_line(const char * const msg)
|
||||
{
|
||||
ProfWin *current = wins_get_current();
|
||||
win_print_line(current, '-', COLOUR_ERROR, msg);
|
||||
win_refresh(current);
|
||||
}
|
||||
void (*ui_current_error_line)(const char * const) = _ui_current_error_line;
|
||||
|
||||
void
|
||||
ui_current_page_off(void)
|
||||
static void
|
||||
_ui_current_page_off(void)
|
||||
{
|
||||
ProfWin *current = wins_get_current();
|
||||
win_page_off(current);
|
||||
win_refresh(current);
|
||||
}
|
||||
void (*ui_current_page_off)(void) = _ui_current_page_off;
|
||||
|
||||
void
|
||||
ui_print_error_from_recipient(const char * const from, const char *err_msg)
|
||||
static void
|
||||
_ui_print_error_from_recipient(const char * const from, const char *err_msg)
|
||||
{
|
||||
if (from == NULL || err_msg == NULL)
|
||||
return;
|
||||
@@ -761,9 +808,10 @@ ui_print_error_from_recipient(const char * const from, const char *err_msg)
|
||||
}
|
||||
}
|
||||
}
|
||||
void (*ui_print_error_from_recipient)(const char * const, const char *) = _ui_print_error_from_recipient;
|
||||
|
||||
void
|
||||
ui_print_system_msg_from_recipient(const char * const from, const char *message)
|
||||
static void
|
||||
_ui_print_system_msg_from_recipient(const char * const from, const char *message)
|
||||
{
|
||||
int num = 0;
|
||||
char from_cpy[strlen(from) + 1];
|
||||
@@ -796,9 +844,11 @@ ui_print_system_msg_from_recipient(const char * const from, const char *message)
|
||||
wins_refresh_current();
|
||||
}
|
||||
}
|
||||
void (*ui_print_system_msg_from_recipient)(const char * const,
|
||||
const char *) = _ui_print_system_msg_from_recipient;
|
||||
|
||||
void
|
||||
ui_recipient_gone(const char * const barejid)
|
||||
static void
|
||||
_ui_recipient_gone(const char * const barejid)
|
||||
{
|
||||
if (barejid == NULL)
|
||||
return;
|
||||
@@ -819,9 +869,10 @@ ui_recipient_gone(const char * const barejid)
|
||||
}
|
||||
}
|
||||
}
|
||||
void (*ui_recipient_gone)(const char * const) = _ui_recipient_gone;
|
||||
|
||||
void
|
||||
ui_new_chat_win(const char * const to)
|
||||
static void
|
||||
_ui_new_chat_win(const char * const to)
|
||||
{
|
||||
// if the contact is offline, show a message
|
||||
PContact contact = roster_get_contact(to);
|
||||
@@ -858,18 +909,20 @@ ui_new_chat_win(const char * const to)
|
||||
|
||||
ui_switch_win(num);
|
||||
}
|
||||
void (*ui_new_chat_win)(const char * const) = _ui_new_chat_win;
|
||||
|
||||
void
|
||||
ui_create_duck_win(void)
|
||||
static void
|
||||
_ui_create_duck_win(void)
|
||||
{
|
||||
ProfWin *window = wins_new("DuckDuckGo search", WIN_DUCK);
|
||||
int num = wins_get_num(window);
|
||||
ui_switch_win(num);
|
||||
win_print_line(window, '-', 0, "Type ':help' to find out more.");
|
||||
}
|
||||
void (*ui_create_duck_win)(void) = _ui_create_duck_win;
|
||||
|
||||
void
|
||||
ui_open_duck_win(void)
|
||||
static void
|
||||
_ui_open_duck_win(void)
|
||||
{
|
||||
ProfWin *window = wins_get_by_recipient("DuckDuckGo search");
|
||||
if (window != NULL) {
|
||||
@@ -877,9 +930,10 @@ ui_open_duck_win(void)
|
||||
ui_switch_win(num);
|
||||
}
|
||||
}
|
||||
void (*ui_open_duck_win)(void) = _ui_open_duck_win;
|
||||
|
||||
void
|
||||
ui_duck(const char * const query)
|
||||
static void
|
||||
_ui_duck(const char * const query)
|
||||
{
|
||||
ProfWin *window = wins_get_by_recipient("DuckDuckGo search");
|
||||
if (window != NULL) {
|
||||
@@ -893,9 +947,10 @@ ui_duck(const char * const query)
|
||||
wprintw(window->win, "\n");
|
||||
}
|
||||
}
|
||||
void (*ui_duck)(const char * const) = _ui_duck;
|
||||
|
||||
void
|
||||
ui_duck_result(const char * const result)
|
||||
static void
|
||||
_ui_duck_result(const char * const result)
|
||||
{
|
||||
ProfWin *window = wins_get_by_recipient("DuckDuckGo search");
|
||||
|
||||
@@ -926,9 +981,10 @@ ui_duck_result(const char * const result)
|
||||
wprintw(window->win, "\n");
|
||||
}
|
||||
}
|
||||
void (*ui_duck_result)(const char * const) = _ui_duck_result;
|
||||
|
||||
void
|
||||
ui_outgoing_msg(const char * const from, const char * const to,
|
||||
static void
|
||||
_ui_outgoing_msg(const char * const from, const char * const to,
|
||||
const char * const message)
|
||||
{
|
||||
PContact contact = roster_get_contact(to);
|
||||
@@ -978,9 +1034,11 @@ ui_outgoing_msg(const char * const from, const char * const to,
|
||||
}
|
||||
ui_switch_win(num);
|
||||
}
|
||||
void (*ui_outgoing_msg)(const char * const, const char * const,
|
||||
const char * const) = _ui_outgoing_msg;
|
||||
|
||||
void
|
||||
ui_room_join(Jid *jid)
|
||||
static void
|
||||
_ui_room_join(Jid *jid)
|
||||
{
|
||||
ProfWin *window = wins_get_by_recipient(jid->barejid);
|
||||
int num = 0;
|
||||
@@ -993,9 +1051,10 @@ ui_room_join(Jid *jid)
|
||||
num = wins_get_num(window);
|
||||
ui_switch_win(num);
|
||||
}
|
||||
void (*ui_room_join)(Jid *) = _ui_room_join;
|
||||
|
||||
void
|
||||
ui_room_roster(const char * const room, GList *roster, const char * const presence)
|
||||
static void
|
||||
_ui_room_roster(const char * const room, GList *roster, const char * const presence)
|
||||
{
|
||||
ProfWin *window = wins_get_by_recipient(room);
|
||||
|
||||
@@ -1048,9 +1107,10 @@ ui_room_roster(const char * const room, GList *roster, const char * const presen
|
||||
wins_refresh_current();
|
||||
}
|
||||
}
|
||||
void (*ui_room_roster)(const char * const, GList*, const char * const) = _ui_room_roster;
|
||||
|
||||
void
|
||||
ui_room_member_offline(const char * const room, const char * const nick)
|
||||
static void
|
||||
_ui_room_member_offline(const char * const room, const char * const nick)
|
||||
{
|
||||
ProfWin *window = wins_get_by_recipient(room);
|
||||
|
||||
@@ -1063,9 +1123,10 @@ ui_room_member_offline(const char * const room, const char * const nick)
|
||||
wins_refresh_current();
|
||||
}
|
||||
}
|
||||
void (*ui_room_member_offline)(const char * const, const char * const) = _ui_room_member_offline;
|
||||
|
||||
void
|
||||
ui_room_member_online(const char * const room, const char * const nick,
|
||||
static void
|
||||
_ui_room_member_online(const char * const room, const char * const nick,
|
||||
const char * const show, const char * const status)
|
||||
{
|
||||
ProfWin *window = wins_get_by_recipient(room);
|
||||
@@ -1079,9 +1140,11 @@ ui_room_member_online(const char * const room, const char * const nick,
|
||||
wins_refresh_current();
|
||||
}
|
||||
}
|
||||
void (*ui_room_member_online)(const char * const, const char * const,
|
||||
const char * const, const char * const) = _ui_room_member_online;
|
||||
|
||||
void
|
||||
ui_room_member_presence(const char * const room, const char * const nick,
|
||||
static void
|
||||
_ui_room_member_presence(const char * const room, const char * const nick,
|
||||
const char * const show, const char * const status)
|
||||
{
|
||||
ProfWin *window = wins_get_by_recipient(room);
|
||||
@@ -1094,9 +1157,11 @@ ui_room_member_presence(const char * const room, const char * const nick,
|
||||
wins_refresh_current();
|
||||
}
|
||||
}
|
||||
void (*ui_room_member_presence)(const char * const, const char * const,
|
||||
const char * const, const char * const) = _ui_room_member_presence;
|
||||
|
||||
void
|
||||
ui_room_member_nick_change(const char * const room,
|
||||
static void
|
||||
_ui_room_member_nick_change(const char * const room,
|
||||
const char * const old_nick, const char * const nick)
|
||||
{
|
||||
ProfWin *window = wins_get_by_recipient(room);
|
||||
@@ -1110,9 +1175,11 @@ ui_room_member_nick_change(const char * const room,
|
||||
wins_refresh_current();
|
||||
}
|
||||
}
|
||||
void (*ui_room_member_nick_change)(const char * const,
|
||||
const char * const, const char * const) = _ui_room_member_nick_change;
|
||||
|
||||
void
|
||||
ui_room_nick_change(const char * const room, const char * const nick)
|
||||
static void
|
||||
_ui_room_nick_change(const char * const room, const char * const nick)
|
||||
{
|
||||
ProfWin *window = wins_get_by_recipient(room);
|
||||
|
||||
@@ -1125,9 +1192,10 @@ ui_room_nick_change(const char * const room, const char * const nick)
|
||||
wins_refresh_current();
|
||||
}
|
||||
}
|
||||
void (*ui_room_nick_change)(const char * const, const char * const) = _ui_room_nick_change;
|
||||
|
||||
void
|
||||
ui_room_history(const char * const room_jid, const char * const nick,
|
||||
static void
|
||||
_ui_room_history(const char * const room_jid, const char * const nick,
|
||||
GTimeVal tv_stamp, const char * const message)
|
||||
{
|
||||
ProfWin *window = wins_get_by_recipient(room_jid);
|
||||
@@ -1151,9 +1219,11 @@ ui_room_history(const char * const room_jid, const char * const nick,
|
||||
wins_refresh_current();
|
||||
}
|
||||
}
|
||||
void (*ui_room_history)(const char * const, const char * const,
|
||||
GTimeVal, const char * const) = _ui_room_history;
|
||||
|
||||
void
|
||||
ui_room_message(const char * const room_jid, const char * const nick,
|
||||
static void
|
||||
_ui_room_message(const char * const room_jid, const char * const nick,
|
||||
const char * const message)
|
||||
{
|
||||
ProfWin *window = wins_get_by_recipient(room_jid);
|
||||
@@ -1223,9 +1293,11 @@ ui_room_message(const char * const room_jid, const char * const nick,
|
||||
}
|
||||
}
|
||||
}
|
||||
void (*ui_room_message)(const char * const, const char * const,
|
||||
const char * const) = _ui_room_message;
|
||||
|
||||
void
|
||||
ui_room_subject(const char * const room_jid, const char * const subject)
|
||||
static void
|
||||
_ui_room_subject(const char * const room_jid, const char * const subject)
|
||||
{
|
||||
ProfWin *window = wins_get_by_recipient(room_jid);
|
||||
int num = wins_get_num(window);
|
||||
@@ -1246,9 +1318,10 @@ ui_room_subject(const char * const room_jid, const char * const subject)
|
||||
status_bar_new(num);
|
||||
}
|
||||
}
|
||||
void (*ui_room_subject)(const char * const, const char * const) = _ui_room_subject;
|
||||
|
||||
void
|
||||
ui_room_broadcast(const char * const room_jid, const char * const message)
|
||||
static void
|
||||
_ui_room_broadcast(const char * const room_jid, const char * const message)
|
||||
{
|
||||
ProfWin *window = wins_get_by_recipient(room_jid);
|
||||
int num = wins_get_num(window);
|
||||
@@ -1269,9 +1342,10 @@ ui_room_broadcast(const char * const room_jid, const char * const message)
|
||||
status_bar_new(num);
|
||||
}
|
||||
}
|
||||
void (*ui_room_broadcast)(const char * const, const char * const) = _ui_room_broadcast;
|
||||
|
||||
void
|
||||
ui_status(void)
|
||||
static void
|
||||
_ui_status(void)
|
||||
{
|
||||
char *recipient = ui_current_recipient();
|
||||
PContact pcontact = roster_get_contact(recipient);
|
||||
@@ -1283,9 +1357,10 @@ ui_status(void)
|
||||
win_print_line(current, '-', 0, "Error getting contact info.");
|
||||
}
|
||||
}
|
||||
void (*ui_status)(void) = _ui_status;
|
||||
|
||||
void
|
||||
ui_status_private(void)
|
||||
static void
|
||||
_ui_status_private(void)
|
||||
{
|
||||
Jid *jid = jid_create(ui_current_recipient());
|
||||
PContact pcontact = muc_get_participant(jid->barejid, jid->resourcepart);
|
||||
@@ -1299,9 +1374,10 @@ ui_status_private(void)
|
||||
|
||||
jid_destroy(jid);
|
||||
}
|
||||
void (*ui_status_private)(void) = _ui_status_private;
|
||||
|
||||
void
|
||||
ui_status_room(const char * const contact)
|
||||
static void
|
||||
_ui_status_room(const char * const contact)
|
||||
{
|
||||
PContact pcontact = muc_get_participant(ui_current_recipient(), contact);
|
||||
ProfWin *current = wins_get_current();
|
||||
@@ -1312,15 +1388,17 @@ ui_status_room(const char * const contact)
|
||||
win_print_line(current, '-', 0, "No such participant \"%s\" in room.", contact);
|
||||
}
|
||||
}
|
||||
void (*ui_status_room)(const char * const) = _ui_status_room;
|
||||
|
||||
gint
|
||||
ui_unread(void)
|
||||
static gint
|
||||
_ui_unread(void)
|
||||
{
|
||||
return wins_get_total_unread();
|
||||
}
|
||||
gint (*ui_unread)(void) = _ui_unread;
|
||||
|
||||
int
|
||||
ui_win_unread(int index)
|
||||
static int
|
||||
_ui_win_unread(int index)
|
||||
{
|
||||
ProfWin *window = wins_get_by_num(index);
|
||||
if (window != NULL) {
|
||||
@@ -1329,9 +1407,10 @@ ui_win_unread(int index)
|
||||
return 0;
|
||||
}
|
||||
}
|
||||
int (*ui_win_unread)(int) = _ui_win_unread;
|
||||
|
||||
char *
|
||||
ui_ask_password(void)
|
||||
static char *
|
||||
_ui_ask_password(void)
|
||||
{
|
||||
char *passwd = malloc(sizeof(char) * (MAX_PASSWORD_SIZE + 1));
|
||||
status_bar_get_password();
|
||||
@@ -1342,6 +1421,7 @@ ui_ask_password(void)
|
||||
|
||||
return passwd;
|
||||
}
|
||||
char * (*ui_ask_password)(void) = _ui_ask_password;
|
||||
|
||||
static void
|
||||
_ui_draw_win_title(void)
|
||||
|
||||
Reference in New Issue
Block a user