about summary refs log tree commit diff stats
path: root/src/ui/core.c
diff options
context:
space:
mode:
authorJames Booth <boothj5@gmail.com>2014-01-26 22:19:22 +0000
committerJames Booth <boothj5@gmail.com>2014-01-26 22:19:22 +0000
commit50f1a5ecc0686cf22fc2c9d5766a4954a24fe5d5 (patch)
tree72134954d761ce8d69f4d2ff5fde248cfff4914a /src/ui/core.c
parent292ae567aa0766dba4975c02379ec0e4a4ac3ecd (diff)
downloadprofani-tty-50f1a5ecc0686cf22fc2c9d5766a4954a24fe5d5.tar.gz
Changed error message when couldn't join room
Diffstat (limited to 'src/ui/core.c')
-rw-r--r--src/ui/core.c22
1 files changed, 16 insertions, 6 deletions
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);