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

Moved room info output to ui module, added TODO for roles

This commit is contained in:
James Booth 2014-09-30 23:08:48 +01:00
parent 7ec0dd0b83
commit 76d2b9e9b5
4 changed files with 22 additions and 6 deletions

6
TODO_ROLES Normal file
View File

@ -0,0 +1,6 @@
Handle status codes
List members of different roles/affiliations
Changing subject
Moderator use cases
Admin use cases
Owner use cases

View File

@ -2078,12 +2078,7 @@ cmd_room(gchar **args, struct cmd_help_t help)
} }
if (g_strcmp0(args[0], "info") == 0) { if (g_strcmp0(args[0], "info") == 0) {
char *role = muc_role_str(room); ui_show_room_info(window, room);
char *affiliation = muc_affiliation_str(room);
win_save_print(window, '-', NULL, 0, 0, "", "");
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, "", "");
return TRUE; return TRUE;
} }

View File

@ -1886,6 +1886,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 static void
_ui_handle_form_field(ProfWin *window, char *tag, FormField *field) _ui_handle_form_field(ProfWin *window, char *tag, FormField *field)
{ {
@ -2513,4 +2526,5 @@ ui_init_module(void)
ui_show_form_field_help = _ui_show_form_field_help; ui_show_form_field_help = _ui_show_form_field_help;
ui_show_lines = _ui_show_lines; ui_show_lines = _ui_show_lines;
ui_handle_room_configuration_form_error = _ui_handle_room_configuration_form_error; ui_handle_room_configuration_form_error = _ui_handle_room_configuration_form_error;
ui_show_room_info = _ui_show_room_info;
} }

View File

@ -137,6 +137,7 @@ void (*ui_room_subject)(const char * const room_jid,
const char * const subject); const char * const subject);
void (*ui_room_requires_config)(const char * const room_jid); void (*ui_room_requires_config)(const char * const room_jid);
void (*ui_room_destroyed)(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, void (*ui_room_broadcast)(const char * const room_jid,
const char * const message); const char * const message);
void (*ui_room_member_offline)(const char * const room, const char * const nick); void (*ui_room_member_offline)(const char * const room, const char * const nick);