about summary refs log tree commit diff stats
path: root/src/ui
diff options
context:
space:
mode:
authorJames Booth <boothj5@gmail.com>2014-09-30 23:08:48 +0100
committerJames Booth <boothj5@gmail.com>2014-09-30 23:08:48 +0100
commit76d2b9e9b5c1c7fa4dd6fdaa3072365eafa84473 (patch)
tree3b670c863570a2d3dabb0627d5664d3664d70edb /src/ui
parent7ec0dd0b83957c16c0c6f7ff7be4aa323076fba5 (diff)
downloadprofani-tty-76d2b9e9b5c1c7fa4dd6fdaa3072365eafa84473.tar.gz
Moved room info output to ui module, added TODO for roles
Diffstat (limited to 'src/ui')
-rw-r--r--src/ui/core.c14
-rw-r--r--src/ui/ui.h1
2 files changed, 15 insertions, 0 deletions
diff --git a/src/ui/core.c b/src/ui/core.c
index 500e435b..7c6d24cb 100644
--- a/src/ui/core.c
+++ b/src/ui/core.c
@@ -1887,6 +1887,19 @@ _ui_draw_term_title(void)
 }
 
 static void
+_ui_show_room_info(ProfWin *window, const char * const room)
+{
+    char *role = muc_role_str(room);
+    char *affiliation = muc_affiliation_str(room);
+
+    win_save_print(window, '-', NULL, 0, 0, "", "");
+    win_save_vprint(window, '!', NULL, 0, 0, "", "Room: %s", room);
+    win_save_vprint(window, '!', NULL, 0, 0, "", "  Affiliation: %s", affiliation);
+    win_save_vprint(window, '!', NULL, 0, 0, "", "  Role: %s", role);
+    win_save_print(window, '-', NULL, 0, 0, "", "");
+}
+
+static void
 _ui_handle_form_field(ProfWin *window, char *tag, FormField *field)
 {
     win_save_vprint(window, '-', NULL, NO_EOL, COLOUR_AWAY, "", "[%s] ", tag);
@@ -2513,4 +2526,5 @@ ui_init_module(void)
     ui_show_form_field_help = _ui_show_form_field_help;
     ui_show_lines = _ui_show_lines;
     ui_handle_room_configuration_form_error = _ui_handle_room_configuration_form_error;
+    ui_show_room_info = _ui_show_room_info;
 }
diff --git a/src/ui/ui.h b/src/ui/ui.h
index d71a78c1..85649c0e 100644
--- a/src/ui/ui.h
+++ b/src/ui/ui.h
@@ -137,6 +137,7 @@ void (*ui_room_subject)(const char * const room_jid,
     const char * const subject);
 void (*ui_room_requires_config)(const char * const room_jid);
 void (*ui_room_destroyed)(const char * const room_jid);
+void (*ui_show_room_info)(ProfWin *window, const char * const room);
 void (*ui_room_broadcast)(const char * const room_jid,
     const char * const message);
 void (*ui_room_member_offline)(const char * const room, const char * const nick);