From 18b7def422e1347906304cdf0de0ba3601f7d411 Mon Sep 17 00:00:00 2001 From: James Booth Date: Sun, 6 Oct 2013 00:42:30 +0100 Subject: Refactor error handling to use win_type switch --- src/ui/core.c | 24 +++++++++++++++++------- 1 file changed, 17 insertions(+), 7 deletions(-) (limited to 'src') diff --git a/src/ui/core.c b/src/ui/core.c index 2cb133b6..93fc74a0 100644 --- a/src/ui/core.c +++ b/src/ui/core.c @@ -405,17 +405,27 @@ ui_group_removed(const char * const contact, const char * const group) void ui_handle_error_message(const char * const from, const char * const err_msg) { - win_type_t win_type = ui_current_win_type(); if (err_msg == NULL) { cons_show_error("Unknown error received from service."); - } else if (strcmp(err_msg, "conflict") == 0) { - if (win_type == WIN_MUC) { - ui_current_print_line("Nickname already in use."); - } else { + } else { + win_type_t win_type = ui_current_win_type(); + gboolean handled = FALSE; + + switch (win_type) + { + case WIN_MUC: + if (g_strcmp0(err_msg, "conflict") == 0) { + ui_current_print_line("Nickname already in use."); + handled = TRUE; + } + break; + default: + break; + } + + if (handled != TRUE) { cons_show_error("Error received from server: %s", err_msg); } - } else { - cons_show_error("Error received from server: %s", err_msg); } ui_print_error_from_recipient(from, err_msg); -- cgit 1.4.1-2-gfad0 0989f381722b503deb034e6c950'>blame commit diff stats
path: root/linux/404stream.mu
blob: 19bbb6e57dbc8da04fd809c905f0bf394a4c6c98 (plain) (tree)
1
2
3
4
5
6
7
8
9
10
11