diff options
Diffstat (limited to 'src/ui')
-rw-r--r-- | src/ui/core.c | 61 | ||||
-rw-r--r-- | src/ui/ui.h | 5 |
2 files changed, 66 insertions, 0 deletions
diff --git a/src/ui/core.c b/src/ui/core.c index a0712142..5269e96b 100644 --- a/src/ui/core.c +++ b/src/ui/core.c @@ -1894,6 +1894,44 @@ _ui_handle_room_affiliation_list(const char * const room, const char * const aff } static void +_ui_handle_room_role_list_error(const char * const room, const char * const role, const char * const error) +{ + ProfWin *window = wins_get_by_recipient(room); + if (window) { + win_save_vprint(window, '!', NULL, 0, COLOUR_ERROR, "", "Error retrieving %s list: %s", role, error); + } +} + +static void +_ui_handle_room_role_list(const char * const room, const char * const role, GSList *nicks) +{ + ProfWin *window = wins_get_by_recipient(room); + if (window) { + if (nicks) { + win_save_vprint(window, '!', NULL, 0, 0, "", "Role: %s", role); + GSList *curr_nick = nicks; + while (curr_nick) { + char *nick = curr_nick->data; + Occupant *occupant = muc_roster_item(room, nick); + if (occupant) { + if (occupant->jid) { + win_save_vprint(window, '!', NULL, 0, 0, "", " %s (%s)", nick, occupant->jid); + } else { + win_save_vprint(window, '!', NULL, 0, 0, "", " %s", nick); + } + } else { + win_save_vprint(window, '!', NULL, 0, 0, "", " %s", nick); + } + curr_nick = g_slist_next(curr_nick); + } + win_save_print(window, '!', NULL, 0, 0, "", ""); + } else { + win_save_vprint(window, '!', NULL, 0, 0, "", "No occupants found with role: %s", role); + } + } +} + +static void _ui_handle_room_affiliation_set_error(const char * const room, const char * const jid, const char * const affiliation, const char * const error) { @@ -1913,6 +1951,25 @@ _ui_handle_room_affiliation_set(const char * const room, const char * const jid, } static void +_ui_handle_room_role_set_error(const char * const room, const char * const nick, const char * const role, + const char * const error) +{ + ProfWin *window = wins_get_by_recipient(room); + if (window) { + win_save_vprint(window, '!', NULL, 0, COLOUR_ERROR, "", "Error setting %s role for %s: %s", role, nick, error); + } +} + +static void +_ui_handle_room_role_set(const char * const room, const char * const nick, const char * const role) +{ + ProfWin *window = wins_get_by_recipient(room); + if (window) { + win_save_vprint(window, '!', NULL, 0, 0, "", "Role for %s set: %s", nick, role); + } +} + +static void _ui_status(void) { char *recipient = ui_current_recipient(); @@ -2870,5 +2927,9 @@ ui_init_module(void) ui_room_kicked = _ui_room_kicked; ui_leave_room = _ui_leave_room; ui_room_member_kicked = _ui_room_member_kicked; + ui_handle_room_role_set_error = _ui_handle_room_role_set_error; + ui_handle_room_role_set = _ui_handle_room_role_set; + ui_handle_room_role_list_error = _ui_handle_room_role_list_error; + ui_handle_room_role_list = _ui_handle_room_role_list; } diff --git a/src/ui/ui.h b/src/ui/ui.h index dafcceac..f987bdbb 100644 --- a/src/ui/ui.h +++ b/src/ui/ui.h @@ -180,6 +180,11 @@ void (*ui_handle_room_affiliation_list)(const char * const room, const char * co void (*ui_handle_room_affiliation_set_error)(const char * const room, const char * const jid, const char * const affiliation, const char * const error); void (*ui_handle_room_affiliation_set)(const char * const room, const char * const jid, const char * const affiliation); +void (*ui_handle_room_role_set_error)(const char * const room, const char * const nick, const char * const role, + const char * const error); +void (*ui_handle_room_role_set)(const char * const room, const char * const nick, const char * const role); +void (*ui_handle_room_role_list_error)(const char * const room, const char * const role, const char * const error); +void (*ui_handle_room_role_list)(const char * const room, const char * const role, GSList *nicks); void (*ui_handle_room_kick_error)(const char * const room, const char * const nick, const char * const error); void (*ui_show_form)(ProfWin *window, const char * const room, DataForm *form); void (*ui_show_form_field)(ProfWin *window, DataForm *form, char *tag); |