diff options
Diffstat (limited to 'src')
-rw-r--r-- | src/server_events.c | 2 | ||||
-rw-r--r-- | src/ui/core.c | 22 | ||||
-rw-r--r-- | src/xmpp/message.c | 5 |
3 files changed, 20 insertions, 9 deletions
diff --git a/src/server_events.c b/src/server_events.c index 6ca832d0..8400de8d 100644 --- a/src/server_events.c +++ b/src/server_events.c @@ -57,7 +57,7 @@ handle_recipient_not_found(const char *from) { log_info("Removing chat session for %s", from); ui_handle_recipient_not_found(from); - if (prefs_get_boolean(PREF_STATES)) { + if (prefs_get_boolean(PREF_STATES) && chat_session_exists(from)) { chat_session_set_recipient_supports(from, FALSE); } } diff --git a/src/ui/core.c b/src/ui/core.c index cad43e59..dd27aa1a 100644 --- a/src/ui/core.c +++ b/src/ui/core.c @@ -360,21 +360,31 @@ _ui_handle_recipient_not_found(const char * const from) ProfWin *win = wins_get_by_recipient(from); GString *msg = g_string_new(""); - // Message sent to chat room which hasn't been entered yet - if (win->type == WIN_MUC) { + // no window for intended recipient, show message in current and console + if (win == NULL) { + g_string_printf(msg, "Recipient %s not found at server.", from); + cons_show_error(msg->str); + win = wins_get_current(); + if (win->type != WIN_CONSOLE) { + win_print_line(win, '!', COLOUR_ERROR, msg->str); + } + + // intended recipient was invalid chat room + } else if (win->type == WIN_MUC) { g_string_printf(msg, "You have not joined %s.", from); + cons_show_error(msg->str); + win_print_line(win, '!', COLOUR_ERROR, msg->str); // unknown chat recipient } else { - if (prefs_get_boolean(PREF_STATES)) { + if (prefs_get_boolean(PREF_STATES) && chat_session_exists(from)) { chat_session_set_recipient_supports(from, FALSE); } g_string_printf(msg, "Recipient %s not found at server.", from); + cons_show_error(msg->str); + win_print_line(win, '!', COLOUR_ERROR, msg->str); } - cons_show_error(msg->str); - win_print_line(win, '!', COLOUR_ERROR, msg->str); - wins_refresh_current(); g_string_free(msg, TRUE); diff --git a/src/xmpp/message.c b/src/xmpp/message.c index bb5c58eb..d814d59d 100644 --- a/src/xmpp/message.c +++ b/src/xmpp/message.c @@ -211,8 +211,9 @@ _message_error_handler(xmpp_conn_t * const conn, xmpp_stanza_t * const stanza, // handle recipient not found if ((from != NULL) && ((type != NULL && (strcmp(type, "cancel") == 0)))) { - log_info("Recipient %s not found.", from); - handle_recipient_not_found(from); + char *cpy = strdup(from); + log_info("Recipient %s not found.", cpy); + handle_recipient_not_found(cpy); } return 1; |