From 5a5b1340aa799ee1d56961123a4770ebadb287bc Mon Sep 17 00:00:00 2001 From: James Booth Date: Sun, 22 Dec 2013 22:14:15 +0000 Subject: Dynamically load UI functions, fixed tests --- src/ui/core.c | 352 +++++++++++++++++++++++++++++++++++----------------------- 1 file changed, 216 insertions(+), 136 deletions(-) (limited to 'src/ui/core.c') diff --git a/src/ui/core.c b/src/ui/core.c index 1ff41b7d..b68d2edc 100644 --- a/src/ui/core.c +++ b/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) -- cgit 1.4.1-2-gfad0 From 581f58e47f0b52b60b0aa7ec6746c7bd1d24e6ee Mon Sep 17 00:00:00 2001 From: James Booth Date: Sun, 22 Dec 2013 23:07:41 +0000 Subject: Bind jabber functions in main.c --- src/main.c | 9 +++++++++ src/ui/core.c | 1 + src/xmpp/connection.c | 31 +++++++++++++++++-------------- src/xmpp/xmpp.h | 2 ++ 4 files changed, 29 insertions(+), 14 deletions(-) (limited to 'src/ui/core.c') diff --git a/src/main.c b/src/main.c index c3065bd3..4c733daf 100644 --- a/src/main.c +++ b/src/main.c @@ -29,11 +29,19 @@ #include "profanity.h" +#include "xmpp/xmpp.h" + static gboolean disable_tls = FALSE; static gboolean version = FALSE; static char *log = "INFO"; static char *account_name = NULL; +static void +_init_modules(void) +{ + jabber_init_module(); +} + int main(int argc, char **argv) { @@ -79,6 +87,7 @@ main(int argc, char **argv) return 0; } + _init_modules(); prof_run(disable_tls, log, account_name); return 0; diff --git a/src/ui/core.c b/src/ui/core.c index b68d2edc..241814bd 100644 --- a/src/ui/core.c +++ b/src/ui/core.c @@ -125,6 +125,7 @@ _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; unsigned long (*ui_get_idle_time)(void) = _ui_get_idle_time; static void diff --git a/src/xmpp/connection.c b/src/xmpp/connection.c index 10fb0dc6..f38da800 100644 --- a/src/xmpp/connection.c +++ b/src/xmpp/connection.c @@ -107,7 +107,6 @@ _jabber_init(const int disable_tls) (GDestroyNotify)resource_destroy); xmpp_initialize(); } -void (*jabber_init)(const int) = _jabber_init; static jabber_conn_status_t _jabber_connect_with_account(const ProfAccount * const account) @@ -128,7 +127,6 @@ _jabber_connect_with_account(const ProfAccount * const account) return result; } -jabber_conn_status_t (*jabber_connect_with_account)(const ProfAccount * const) = _jabber_connect_with_account; static jabber_conn_status_t _jabber_connect_with_details(const char * const jid, @@ -161,8 +159,6 @@ _jabber_connect_with_details(const char * const jid, log_info("Connecting without account, JID: %s", saved_details.jid); return _jabber_connect(saved_details.jid, passwd, saved_details.altdomain); } -jabber_conn_status_t (*jabber_connect_with_details)(const char * const, - const char * const, const char * const) = _jabber_connect_with_details; static void _jabber_disconnect(void) @@ -193,14 +189,12 @@ _jabber_disconnect(void) FREE_SET_NULL(jabber_conn.presence_message); FREE_SET_NULL(jabber_conn.domain); } -void (*jabber_disconnect)(void) = _jabber_disconnect; static void _jabber_shutdown(void) { xmpp_shutdown(); } -void (*jabber_shutdown)(void) = _jabber_shutdown; static void _jabber_process_events(void) @@ -222,7 +216,6 @@ _jabber_process_events(void) } } -void (*jabber_process_events)(void) = _jabber_process_events; static void _jabber_set_autoping(const int seconds) @@ -237,21 +230,18 @@ _jabber_set_autoping(const int seconds) } } } -void (*jabber_set_autoping)(const int) = _jabber_set_autoping; static GList * _jabber_get_available_resources(void) { return g_hash_table_get_values(available_resources); } -GList * (*jabber_get_available_resources)(void) = _jabber_get_available_resources; static jabber_conn_status_t _jabber_get_connection_status(void) { return (jabber_conn.conn_status); } -jabber_conn_status_t (*jabber_get_connection_status)(void) = _jabber_get_connection_status; xmpp_conn_t * connection_get_conn(void) @@ -270,28 +260,24 @@ _jabber_get_fulljid(void) { return xmpp_conn_get_jid(jabber_conn.conn); } -const char * (*jabber_get_fulljid)(void) = _jabber_get_fulljid; static const char * _jabber_get_domain(void) { return jabber_conn.domain; } -const char * (*jabber_get_domain)(void) = _jabber_get_domain; static char * _jabber_get_presence_message(void) { return jabber_conn.presence_message; } -char * (*jabber_get_presence_message)(void) = _jabber_get_presence_message; static char * _jabber_get_account_name(void) { return saved_account.name; } -char * (*jabber_get_account_name)(void) = _jabber_get_account_name; void connection_set_presence_message(const char * const message) @@ -629,3 +615,20 @@ _xmpp_get_file_logger() return file_log; } +void +jabber_init_module(void) +{ + jabber_init = _jabber_init; + jabber_connect_with_account = _jabber_connect_with_account; + jabber_connect_with_details = _jabber_connect_with_details; + jabber_disconnect = _jabber_disconnect; + jabber_shutdown = _jabber_shutdown; + jabber_process_events = _jabber_process_events; + jabber_set_autoping = _jabber_set_autoping; + jabber_get_available_resources = _jabber_get_available_resources; + jabber_get_connection_status = _jabber_get_connection_status; + jabber_get_fulljid = _jabber_get_fulljid; + jabber_get_domain = _jabber_get_domain; + jabber_get_presence_message = _jabber_get_presence_message; + jabber_get_account_name = _jabber_get_account_name; +} diff --git a/src/xmpp/xmpp.h b/src/xmpp/xmpp.h index fe7abda8..c4dd9cf4 100644 --- a/src/xmpp/xmpp.h +++ b/src/xmpp/xmpp.h @@ -74,6 +74,8 @@ typedef struct disco_identity_t { char *category; } DiscoIdentity; +void jabber_init_module(void); + // connection functions void (*jabber_init)(const int disable_tls); jabber_conn_status_t (*jabber_connect_with_details)(const char * const jid, -- cgit 1.4.1-2-gfad0 From a6859354b453dad686f6ed570c28a4870733dd08 Mon Sep 17 00:00:00 2001 From: James Booth Date: Sun, 22 Dec 2013 23:54:22 +0000 Subject: Bind ui core functions in main.c --- src/main.c | 3 ++ src/ui/core.c | 154 ++++++++++++++++++++++++++++------------------------------ src/ui/ui.h | 2 + 3 files changed, 78 insertions(+), 81 deletions(-) (limited to 'src/ui/core.c') diff --git a/src/main.c b/src/main.c index d1a99556..2ca76de3 100644 --- a/src/main.c +++ b/src/main.c @@ -30,6 +30,7 @@ #include "profanity.h" #include "xmpp/xmpp.h" +#include "ui/ui.h" static gboolean disable_tls = FALSE; static gboolean version = FALSE; @@ -46,6 +47,8 @@ _init_modules(void) message_init_module(); presence_init_module(); roster_init_module(); + + ui_init_module(); } int diff --git a/src/ui/core.c b/src/ui/core.c index 241814bd..c5636d3a 100644 --- a/src/ui/core.c +++ b/src/ui/core.c @@ -95,7 +95,6 @@ _ui_init(void) ui_idle_time = g_timer_new(); wins_refresh_current(); } -void (*ui_init)(void) = _ui_init; static void _ui_refresh(void) @@ -105,7 +104,6 @@ _ui_refresh(void) status_bar_refresh(); inp_put_back(); } -void (*ui_refresh)(void) = _ui_refresh; static unsigned long _ui_get_idle_time(void) @@ -125,15 +123,12 @@ _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; -unsigned long (*ui_get_idle_time)(void) = _ui_get_idle_time; static void _ui_reset_idle_time(void) { g_timer_start(ui_idle_time); } -void (*ui_reset_idle_time)(void) = _ui_reset_idle_time; static void _ui_close(void) @@ -142,7 +137,6 @@ _ui_close(void) wins_destroy(); endwin(); } -void (*ui_close)(void) = _ui_close; static void _ui_resize(const int ch, const char * const input, const int size) @@ -154,7 +148,6 @@ _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; static void _ui_load_colours(void) @@ -165,7 +158,6 @@ _ui_load_colours(void) theme_init_colours(); } } -void (*ui_load_colours)(void) = _ui_load_colours; static gboolean _ui_win_exists(int index) @@ -173,14 +165,12 @@ _ui_win_exists(int index) ProfWin *window = wins_get_by_num(index); return (window != NULL); } -gboolean (*ui_win_exists)(int) = _ui_win_exists; static gboolean _ui_duck_exists(void) { return wins_duck_exists(); } -gboolean (*ui_duck_exists)(void) = _ui_duck_exists; static void _ui_contact_typing(const char * const barejid) @@ -219,7 +209,6 @@ _ui_contact_typing(const char * const barejid) notify_typing(display_usr); } } -void (*ui_contact_typing)(const char * const) = _ui_contact_typing; static GSList * _ui_get_recipients(void) @@ -227,7 +216,6 @@ _ui_get_recipients(void) GSList *recipients = wins_get_chat_recipients(); return recipients; } -GSList * (*ui_get_recipients)(void) = _ui_get_recipients; static void _ui_incoming_msg(const char * const from, const char * const message, @@ -305,8 +293,6 @@ _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; static void _ui_roster_add(const char * const barejid, const char * const name) @@ -317,42 +303,36 @@ _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; 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; 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; 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; 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; 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; static void _ui_handle_error_message(const char * const from, const char * const err_msg) @@ -369,8 +349,6 @@ _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; static void _ui_contact_online(const char * const barejid, const char * const resource, @@ -397,8 +375,6 @@ _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; static void _ui_contact_offline(const char * const from, const char * const show, @@ -427,8 +403,6 @@ _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; static void _ui_disconnected(void) @@ -438,7 +412,6 @@ _ui_disconnected(void) status_bar_clear_message(); status_bar_refresh(); } -void (*ui_disconnected)(void) = _ui_disconnected; static void _ui_handle_special_keys(const wint_t * const ch, const char * const inp, @@ -451,8 +424,6 @@ _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; static void _ui_close_connected_win(int index) @@ -475,7 +446,6 @@ _ui_close_connected_win(int index) } } } -void (*ui_close_connected_win)(int index) = _ui_close_connected_win; static int _ui_close_all_wins(void) @@ -503,7 +473,6 @@ _ui_close_all_wins(void) return count; } -int (*ui_close_all_wins)(void) = _ui_close_all_wins; static int _ui_close_read_wins(void) @@ -531,7 +500,6 @@ _ui_close_read_wins(void) return count; } -int (*ui_close_read_wins)(void) = _ui_close_read_wins; static void _ui_switch_win(const int i) @@ -566,7 +534,6 @@ _ui_switch_win(const int i) wins_refresh_current(); } } -void (*ui_switch_win)(const int) = _ui_switch_win; static void _ui_next_win(void) @@ -600,7 +567,6 @@ _ui_next_win(void) } wins_refresh_current(); } -void (*ui_next_win)(void) = _ui_next_win; static void _ui_previous_win(void) @@ -634,14 +600,12 @@ _ui_previous_win(void) } wins_refresh_current(); } -void (*ui_previous_win)(void) = _ui_previous_win; static void _ui_clear_current(void) { wins_clear_current(); } -void (*ui_clear_current)(void) = _ui_clear_current; static void _ui_close_current(void) @@ -653,7 +617,6 @@ _ui_close_current(void) status_bar_active(1); title_bar_title(); } -void (*ui_close_current)(void) = _ui_close_current; static void _ui_close_win(int index) @@ -665,7 +628,6 @@ _ui_close_win(int index) wins_refresh_current(); } -void (*ui_close_win)(int) = _ui_close_win; static void _ui_tidy_wins(void) @@ -678,7 +640,6 @@ _ui_tidy_wins(void) cons_show("No tidy needed."); } } -void (*ui_tidy_wins)(void) = _ui_tidy_wins; static void _ui_prune_wins(void) @@ -724,7 +685,6 @@ _ui_prune_wins(void) cons_show("No prune needed."); } } -void (*ui_prune_wins)(void) = _ui_prune_wins; static win_type_t _ui_current_win_type(void) @@ -732,14 +692,12 @@ _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; static int _ui_current_win_index(void) { return wins_get_current_num(); } -int (*ui_current_win_index)(void) = _ui_current_win_index; static win_type_t _ui_win_type(int index) @@ -747,7 +705,6 @@ _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; static char * _ui_recipient(int index) @@ -755,7 +712,6 @@ _ui_recipient(int index) ProfWin *window = wins_get_by_num(index); return window->from; } -char * (*ui_recipient)(int) = _ui_recipient; static char * _ui_current_recipient(void) @@ -763,7 +719,6 @@ _ui_current_recipient(void) ProfWin *current = wins_get_current(); return current->from; } -char* (*ui_current_recipient)(void) = _ui_current_recipient; static void _ui_current_print_line(const char * const msg, ...) @@ -775,7 +730,6 @@ _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; static void _ui_current_error_line(const char * const msg) @@ -784,7 +738,6 @@ _ui_current_error_line(const char * const msg) win_print_line(current, '-', COLOUR_ERROR, msg); win_refresh(current); } -void (*ui_current_error_line)(const char * const) = _ui_current_error_line; static void _ui_current_page_off(void) @@ -793,7 +746,6 @@ _ui_current_page_off(void) win_page_off(current); win_refresh(current); } -void (*ui_current_page_off)(void) = _ui_current_page_off; static void _ui_print_error_from_recipient(const char * const from, const char *err_msg) @@ -809,7 +761,6 @@ _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; static void _ui_print_system_msg_from_recipient(const char * const from, const char *message) @@ -845,8 +796,6 @@ _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; static void _ui_recipient_gone(const char * const barejid) @@ -870,7 +819,6 @@ _ui_recipient_gone(const char * const barejid) } } } -void (*ui_recipient_gone)(const char * const) = _ui_recipient_gone; static void _ui_new_chat_win(const char * const to) @@ -910,7 +858,6 @@ _ui_new_chat_win(const char * const to) ui_switch_win(num); } -void (*ui_new_chat_win)(const char * const) = _ui_new_chat_win; static void _ui_create_duck_win(void) @@ -920,7 +867,6 @@ _ui_create_duck_win(void) 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; static void _ui_open_duck_win(void) @@ -931,7 +877,6 @@ _ui_open_duck_win(void) ui_switch_win(num); } } -void (*ui_open_duck_win)(void) = _ui_open_duck_win; static void _ui_duck(const char * const query) @@ -948,7 +893,6 @@ _ui_duck(const char * const query) wprintw(window->win, "\n"); } } -void (*ui_duck)(const char * const) = _ui_duck; static void _ui_duck_result(const char * const result) @@ -982,7 +926,6 @@ _ui_duck_result(const char * const result) wprintw(window->win, "\n"); } } -void (*ui_duck_result)(const char * const) = _ui_duck_result; static void _ui_outgoing_msg(const char * const from, const char * const to, @@ -1035,8 +978,6 @@ _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; static void _ui_room_join(Jid *jid) @@ -1052,7 +993,6 @@ _ui_room_join(Jid *jid) num = wins_get_num(window); ui_switch_win(num); } -void (*ui_room_join)(Jid *) = _ui_room_join; static void _ui_room_roster(const char * const room, GList *roster, const char * const presence) @@ -1108,7 +1048,6 @@ _ui_room_roster(const char * const room, GList *roster, const char * const prese wins_refresh_current(); } } -void (*ui_room_roster)(const char * const, GList*, const char * const) = _ui_room_roster; static void _ui_room_member_offline(const char * const room, const char * const nick) @@ -1124,7 +1063,6 @@ _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; static void _ui_room_member_online(const char * const room, const char * const nick, @@ -1141,8 +1079,6 @@ _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; static void _ui_room_member_presence(const char * const room, const char * const nick, @@ -1158,8 +1094,6 @@ _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; static void _ui_room_member_nick_change(const char * const room, @@ -1176,8 +1110,6 @@ _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; static void _ui_room_nick_change(const char * const room, const char * const nick) @@ -1193,7 +1125,6 @@ _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; static void _ui_room_history(const char * const room_jid, const char * const nick, @@ -1220,8 +1151,6 @@ _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; static void _ui_room_message(const char * const room_jid, const char * const nick, @@ -1294,8 +1223,6 @@ _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; static void _ui_room_subject(const char * const room_jid, const char * const subject) @@ -1319,7 +1246,6 @@ _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; static void _ui_room_broadcast(const char * const room_jid, const char * const message) @@ -1343,7 +1269,6 @@ _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; static void _ui_status(void) @@ -1358,7 +1283,6 @@ _ui_status(void) win_print_line(current, '-', 0, "Error getting contact info."); } } -void (*ui_status)(void) = _ui_status; static void _ui_status_private(void) @@ -1375,7 +1299,6 @@ _ui_status_private(void) jid_destroy(jid); } -void (*ui_status_private)(void) = _ui_status_private; static void _ui_status_room(const char * const contact) @@ -1389,14 +1312,12 @@ _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; static gint _ui_unread(void) { return wins_get_total_unread(); } -gint (*ui_unread)(void) = _ui_unread; static int _ui_win_unread(int index) @@ -1408,7 +1329,6 @@ _ui_win_unread(int index) return 0; } } -int (*ui_win_unread)(int) = _ui_win_unread; static char * _ui_ask_password(void) @@ -1422,7 +1342,6 @@ _ui_ask_password(void) return passwd; } -char * (*ui_ask_password)(void) = _ui_ask_password; static void _ui_draw_win_title(void) @@ -1618,3 +1537,76 @@ _win_show_history(WINDOW *win, int win_index, const char * const contact) g_slist_free_full(history, free); } } + +void +ui_init_module(void) +{ + ui_init = _ui_init; + ui_refresh = _ui_refresh; + ui_get_idle_time = _ui_get_idle_time; + ui_reset_idle_time = _ui_reset_idle_time; + ui_close = _ui_close; + ui_resize = _ui_resize; + ui_load_colours = _ui_load_colours; + ui_win_exists = _ui_win_exists; + ui_duck_exists = _ui_duck_exists; + ui_contact_typing = _ui_contact_typing; + ui_get_recipients = _ui_get_recipients; + ui_incoming_msg = _ui_incoming_msg; + ui_roster_add = _ui_roster_add; + ui_roster_remove = _ui_roster_remove; + ui_contact_already_in_group = _ui_contact_already_in_group; + ui_contact_not_in_group = _ui_contact_not_in_group; + ui_group_added = _ui_group_added; + ui_group_removed = _ui_group_removed; + ui_handle_error_message = _ui_handle_error_message; + ui_contact_online = _ui_contact_online; + ui_contact_offline = _ui_contact_offline; + ui_disconnected = _ui_disconnected; + ui_handle_special_keys = _ui_handle_special_keys; + ui_close_connected_win = _ui_close_connected_win; + ui_close_all_wins = _ui_close_all_wins; + ui_close_read_wins = _ui_close_read_wins; + ui_switch_win = _ui_switch_win; + ui_next_win = _ui_next_win; + ui_previous_win = _ui_previous_win; + ui_clear_current = _ui_clear_current; + ui_close_current = _ui_close_current; + ui_close_win = _ui_close_win; + ui_tidy_wins = _ui_tidy_wins; + ui_prune_wins = _ui_prune_wins; + ui_current_win_type = _ui_current_win_type; + ui_current_win_index = _ui_current_win_index; + ui_win_type = _ui_win_type; + ui_recipient = _ui_recipient; + ui_current_recipient = _ui_current_recipient; + ui_current_print_line = _ui_current_print_line; + ui_current_error_line = _ui_current_error_line; + ui_current_page_off = _ui_current_page_off; + ui_print_error_from_recipient = _ui_print_error_from_recipient; + ui_print_system_msg_from_recipient = _ui_print_system_msg_from_recipient; + ui_recipient_gone = _ui_recipient_gone; + ui_new_chat_win = _ui_new_chat_win; + ui_create_duck_win = _ui_create_duck_win; + ui_open_duck_win = _ui_open_duck_win; + ui_duck = _ui_duck; + ui_duck_result = _ui_duck_result; + ui_outgoing_msg = _ui_outgoing_msg; + ui_room_join = _ui_room_join; + ui_room_roster = _ui_room_roster; + ui_room_member_offline = _ui_room_member_offline; + ui_room_member_online = _ui_room_member_online; + ui_room_member_presence = _ui_room_member_presence; + ui_room_member_nick_change = _ui_room_member_nick_change; + ui_room_nick_change = _ui_room_nick_change; + ui_room_history = _ui_room_history; + ui_room_message = _ui_room_message; + ui_room_subject = _ui_room_subject; + ui_room_broadcast = _ui_room_broadcast; + ui_status = _ui_status; + ui_status_private = _ui_status_private; + ui_status_room = _ui_status_room; + ui_unread = _ui_unread; + ui_win_unread = _ui_win_unread; + ui_ask_password = _ui_ask_password; +} diff --git a/src/ui/ui.h b/src/ui/ui.h index 482d8735..36bb1ff6 100644 --- a/src/ui/ui.h +++ b/src/ui/ui.h @@ -41,6 +41,8 @@ #define INP_WIN_MAX 1000 +void ui_init_module(void); + // ui startup and control void (*ui_init)(void); void (*ui_load_colours)(void); -- cgit 1.4.1-2-gfad0 From 4a706f7a801c4a4c18c30e27a6b31a468ef27b43 Mon Sep 17 00:00:00 2001 From: Jasper van Bourgognie Date: Fri, 27 Dec 2013 20:56:47 +0100 Subject: src/ui/core.c: Removed duplicate const keyword --- src/ui/core.c | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) (limited to 'src/ui/core.c') diff --git a/src/ui/core.c b/src/ui/core.c index c5636d3a..c06f025e 100644 --- a/src/ui/core.c +++ b/src/ui/core.c @@ -954,8 +954,8 @@ _ui_outgoing_msg(const char * const from, const char * const to, if (contact != NULL) { if (strcmp(p_contact_presence(contact), "offline") == 0) { - const char const *show = p_contact_presence(contact); - const char const *status = p_contact_status(contact); + const char *show = p_contact_presence(contact); + const char *status = p_contact_status(contact); win_show_status_string(window, to, show, status, NULL, "--", "offline"); } } @@ -1026,8 +1026,8 @@ _ui_room_roster(const char * const room, GList *roster, const char * const prese while (roster != NULL) { PContact member = roster->data; - const char const *nick = p_contact_barejid(member); - const char const *show = p_contact_presence(member); + const char *nick = p_contact_barejid(member); + const char *show = p_contact_presence(member); win_presence_colour_on(window, show); wprintw(window->win, "%s", nick); -- cgit 1.4.1-2-gfad0