about summary refs log tree commit diff stats
path: root/src/ui
diff options
context:
space:
mode:
authorJames Booth <boothj5@gmail.com>2014-04-21 00:37:04 +0100
committerJames Booth <boothj5@gmail.com>2014-04-21 00:37:04 +0100
commit2c15aba92a8288e41bea6e12933a14ffe390e1f4 (patch)
tree6e0efc0358f712a2e991259a0fbf2bf0c941cb61 /src/ui
parent9a55d8ad193e79c38d59c9448330132f1c874bca (diff)
downloadprofani-tty-2c15aba92a8288e41bea6e12933a14ffe390e1f4.tar.gz
Chat room windows now created only after successful join
Diffstat (limited to 'src/ui')
-rw-r--r--src/ui/core.c12
-rw-r--r--src/ui/ui.h3
2 files changed, 12 insertions, 3 deletions
diff --git a/src/ui/core.c b/src/ui/core.c
index a84d5856..8f385cf2 100644
--- a/src/ui/core.c
+++ b/src/ui/core.c
@@ -1272,7 +1272,7 @@ _ui_outgoing_msg(const char * const from, const char * const to,
 }
 
 static void
-_ui_room_join(char *room, gboolean focus)
+_ui_room_join(const char * const room, gboolean focus)
 {
     ProfWin *window = wins_get_by_recipient(room);
     int num = 0;
@@ -1289,7 +1289,8 @@ _ui_room_join(char *room, gboolean focus)
     } else {
         status_bar_active(num);
         ProfWin *console = wins_get_console();
-        win_vprint_line(console, '!', COLOUR_ONLINE, "-> Autojoined %s (%d).", room, num);
+        char *nick = muc_get_room_nick(room);
+        win_vprint_line(console, '!', COLOUR_TYPING, "-> Autojoined %s as %s (%d).", room, nick, num);
         win_update_virtual(console);
     }
 }
@@ -1350,6 +1351,12 @@ _ui_room_roster(const char * const room, GList *roster, const char * const prese
 }
 
 static void
+_ui_handle_room_join_error(const char * const room, const char * const err)
+{
+    cons_show_error("Error joining room %s, reason: %s", room, err);
+}
+
+static void
 _ui_room_member_offline(const char * const room, const char * const nick)
 {
     ProfWin *window = wins_get_by_recipient(room);
@@ -1979,4 +1986,5 @@ ui_init_module(void)
     ui_handle_stanza = _ui_handle_stanza;
     ui_create_xmlconsole_win = _ui_create_xmlconsole_win;
     ui_xmlconsole_exists = _ui_xmlconsole_exists;
+    ui_handle_room_join_error = _ui_handle_room_join_error;
 }
diff --git a/src/ui/ui.h b/src/ui/ui.h
index a93cc3d0..14f7137c 100644
--- a/src/ui/ui.h
+++ b/src/ui/ui.h
@@ -102,7 +102,7 @@ void (*ui_disconnected)(void);
 void (*ui_recipient_gone)(const char * const barejid);
 void (*ui_outgoing_msg)(const char * const from, const char * const to,
     const char * const message);
-void (*ui_room_join)(char *room, gboolean focus);
+void (*ui_room_join)(const char * const room, gboolean focus);
 void (*ui_room_roster)(const char * const room, GList *roster, const char * const presence);
 void (*ui_room_history)(const char * const room_jid, const char * const nick,
     GTimeVal tv_stamp, const char * const message);
@@ -132,6 +132,7 @@ void (*ui_handle_recipient_not_found)(const char * const recipient, const char *
 void (*ui_handle_recipient_error)(const char * const recipient, const char * const err_msg);
 void (*ui_handle_error)(const char * const err_msg);
 void (*ui_clear_win_title)(void);
+void (*ui_handle_room_join_error)(const char * const room, const char * const err);
 
 // contact status functions
 void (*ui_status_room)(const char * const contact);