diff options
author | James Booth <boothj5@gmail.com> | 2014-01-30 22:20:57 +0000 |
---|---|---|
committer | James Booth <boothj5@gmail.com> | 2014-01-30 22:20:57 +0000 |
commit | 12666b41e671b3daa98f66afc3127b3c718cde18 (patch) | |
tree | 0bbe10fd92eaf05559eb7e338e4695a5b500bafe /src/ui | |
parent | 2cd24a484a4259e744bdea6613eaa373cdd457ed (diff) | |
download | profani-tty-12666b41e671b3daa98f66afc3127b3c718cde18.tar.gz |
Refactored handle_presence_error, removed no longer used functions
Diffstat (limited to 'src/ui')
-rw-r--r-- | src/ui/core.c | 34 | ||||
-rw-r--r-- | src/ui/ui.h | 2 | ||||
-rw-r--r-- | src/ui/window.c | 41 | ||||
-rw-r--r-- | src/ui/window.h | 3 |
4 files changed, 1 insertions, 79 deletions
diff --git a/src/ui/core.c b/src/ui/core.c index cdac6e8f..80f3c6ac 100644 --- a/src/ui/core.c +++ b/src/ui/core.c @@ -339,22 +339,6 @@ _ui_group_removed(const char * const contact, const char * const group) } 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."); - } else { - ProfWin *current = wins_get_current(); - gboolean handled = win_handle_error_message(current, from, err_msg); - if (handled != TRUE) { - cons_show_error("Error received from server: %s", err_msg); - } - } - - ui_print_error_from_recipient(from, err_msg); -} - -static void _ui_handle_recipient_not_found(const char * const recipient, const char * const err_msg) { ProfWin *win = wins_get_by_recipient(recipient); @@ -390,6 +374,7 @@ _ui_handle_recipient_not_found(const char * const recipient, const char * const static void _ui_handle_recipient_error(const char * const recipient, const char * const err_msg) { + cons_debug("RECIPIENT = %s", recipient); ProfWin *win = wins_get_by_recipient(recipient); GString *msg = g_string_new(""); g_string_printf(msg, "Error from %s: %s", recipient, err_msg); @@ -870,21 +855,6 @@ _ui_current_page_off(void) } static void -_ui_print_error_from_recipient(const char * const from, const char *err_msg) -{ - if (from == NULL || err_msg == NULL) - return; - - ProfWin *window = wins_get_by_recipient(from); - if (window != NULL) { - win_vprint_line(window, '-', COLOUR_ERROR, "%s", err_msg); - if (wins_is_current(window)) { - wins_refresh_current(); - } - } -} - -static void _ui_print_system_msg_from_recipient(const char * const from, const char *message) { int num = 0; @@ -1727,7 +1697,6 @@ ui_init_module(void) 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_disconnected = _ui_disconnected; ui_handle_special_keys = _ui_handle_special_keys; ui_close_connected_win = _ui_close_connected_win; @@ -1750,7 +1719,6 @@ ui_init_module(void) ui_current_print_formatted_line = _ui_current_print_formatted_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; diff --git a/src/ui/ui.h b/src/ui/ui.h index 9d7ba282..c30bbb12 100644 --- a/src/ui/ui.h +++ b/src/ui/ui.h @@ -68,9 +68,7 @@ void (*ui_untrust)(const char * const recipient); unsigned long (*ui_get_idle_time)(void); void (*ui_reset_idle_time)(void); void (*ui_new_chat_win)(const char * const to); -void (*ui_print_error_from_recipient)(const char * const from, const char *err_msg); void (*ui_print_system_msg_from_recipient)(const char * const from, const char *message); -void (*ui_handle_error_message)(const char * const from, const char * const err_msg); gint (*ui_unread)(void); void (*ui_close_connected_win)(int index); int (*ui_close_all_wins)(void); diff --git a/src/ui/window.c b/src/ui/window.c index a74479d8..2e2fbf6a 100644 --- a/src/ui/window.c +++ b/src/ui/window.c @@ -38,9 +38,6 @@ static void _win_chat_print_incoming_message(ProfWin *window, GTimeVal *tv_stamp, const char * const from, const char * const message); -static gboolean -_muc_handle_error_message(ProfWin *window, const char * const from, - const char * const err_msg); ProfWin* win_create(const char * const title, int cols, win_type_t type) @@ -314,44 +311,6 @@ win_print_incoming_message(ProfWin *window, GTimeVal *tv_stamp, } } -gboolean -win_handle_error_message(ProfWin *window, const char * const from, - const char * const err_msg) -{ - gboolean handled = FALSE; - switch (window->type) - { - case WIN_CHAT: - case WIN_PRIVATE: - case WIN_DUCK: - case WIN_CONSOLE: - handled = FALSE; - break; - case WIN_MUC: - handled = _muc_handle_error_message(window, from, err_msg); - break; - default: - assert(FALSE); - break; - } - - return handled; -} - -static gboolean -_muc_handle_error_message(ProfWin *window, const char * const from, - const char * const err_msg) -{ - gboolean handled = FALSE; - if (g_strcmp0(err_msg, "conflict") == 0) { - win_print_line(window, '-', 0, "Nickname already in use."); - win_refresh(window); - handled = TRUE; - } - - return handled; -} - static void _win_chat_print_incoming_message(ProfWin *window, GTimeVal *tv_stamp, const char * const from, const char * const message) diff --git a/src/ui/window.h b/src/ui/window.h index 752787dc..eb92f5e4 100644 --- a/src/ui/window.h +++ b/src/ui/window.h @@ -74,8 +74,5 @@ void win_show_status_string(ProfWin *window, const char * const from, const char * const default_show); void win_print_incoming_message(ProfWin *window, GTimeVal *tv_stamp, const char * const from, const char * const message); -gboolean -win_handle_error_message(ProfWin *window, const char * const from, - const char * const err_msg); #endif |