1
0
mirror of https://github.com/profanity-im/profanity.git synced 2024-11-03 19:37:16 -05:00

Changed error message when couldn't join room

This commit is contained in:
James Booth 2014-01-26 22:19:22 +00:00
parent 292ae567aa
commit 50f1a5ecc0
3 changed files with 20 additions and 9 deletions

View File

@ -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);
}
}

View File

@ -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);

View File

@ -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;