diff options
author | James Booth <boothj5@gmail.com> | 2014-10-18 19:10:50 +0100 |
---|---|---|
committer | James Booth <boothj5@gmail.com> | 2014-10-18 19:10:50 +0100 |
commit | 77674beb7e8f82716f17e7d0dd60d989b54ed6d1 (patch) | |
tree | 3fd88f4a41fdfda56f8edcf94f1327d5b5266536 /src/ui | |
parent | 9792f3ddc9cb6b3c86e9915a30cfc98626ad00c3 (diff) | |
download | profani-tty-77674beb7e8f82716f17e7d0dd60d989b54ed6d1.tar.gz |
Show occupants role/affiliation changes
Diffstat (limited to 'src/ui')
-rw-r--r-- | src/ui/core.c | 49 | ||||
-rw-r--r-- | src/ui/ui.h | 6 |
2 files changed, 55 insertions, 0 deletions
diff --git a/src/ui/core.c b/src/ui/core.c index 2f8b3670..40157716 100644 --- a/src/ui/core.c +++ b/src/ui/core.c @@ -1382,6 +1382,52 @@ _ui_room_role_and_affiliation_change(const char * const room, const char * const win_save_print(window, '!', NULL, NO_DATE, COLOUR_ROOMINFO, "", ""); } + +static void +_ui_room_occupant_role_change(const char * const room, const char * const nick, const char * const role, + const char * const actor, const char * const reason) +{ + ProfWin *window = wins_get_by_recipient(room); + win_save_vprint(window, '!', NULL, NO_EOL, COLOUR_ROOMINFO, "", "%s's role has been changed to: %s", nick, role); + if (actor) { + win_save_vprint(window, '!', NULL, NO_DATE | NO_EOL, COLOUR_ROOMINFO, "", ", by: %s", actor); + } + if (reason) { + win_save_vprint(window, '!', NULL, NO_DATE | NO_EOL, COLOUR_ROOMINFO, "", ", reason: %s", reason); + } + win_save_print(window, '!', NULL, NO_DATE, COLOUR_ROOMINFO, "", ""); +} + +static void +_ui_room_occupant_affiliation_change(const char * const room, const char * const nick, const char * const affiliation, + const char * const actor, const char * const reason) +{ + ProfWin *window = wins_get_by_recipient(room); + win_save_vprint(window, '!', NULL, NO_EOL, COLOUR_ROOMINFO, "", "%s's affiliation has been changed to: %s", nick, affiliation); + if (actor) { + win_save_vprint(window, '!', NULL, NO_DATE | NO_EOL, COLOUR_ROOMINFO, "", ", by: %s", actor); + } + if (reason) { + win_save_vprint(window, '!', NULL, NO_DATE | NO_EOL, COLOUR_ROOMINFO, "", ", reason: %s", reason); + } + win_save_print(window, '!', NULL, NO_DATE, COLOUR_ROOMINFO, "", ""); +} + +static void +_ui_room_occupant_role_and_affiliation_change(const char * const room, const char * const nick, const char * const role, + const char * const affiliation, const char * const actor, const char * const reason) +{ + ProfWin *window = wins_get_by_recipient(room); + win_save_vprint(window, '!', NULL, NO_EOL, COLOUR_ROOMINFO, "", "%s's role and affiliation have been changed, role: %s, affiliation: %s", nick, role, affiliation); + if (actor) { + win_save_vprint(window, '!', NULL, NO_DATE | NO_EOL, COLOUR_ROOMINFO, "", ", by: %s", actor); + } + if (reason) { + win_save_vprint(window, '!', NULL, NO_DATE | NO_EOL, COLOUR_ROOMINFO, "", ", reason: %s", reason); + } + win_save_print(window, '!', NULL, NO_DATE, COLOUR_ROOMINFO, "", ""); +} + static void _ui_handle_room_info_error(const char * const room, const char * const error) { @@ -3108,5 +3154,8 @@ ui_init_module(void) ui_room_affiliation_change = _ui_room_affiliation_change; ui_switch_to_room = _ui_switch_to_room; ui_room_role_and_affiliation_change = _ui_room_role_and_affiliation_change; + ui_room_occupant_role_change = _ui_room_occupant_role_change; + ui_room_occupant_affiliation_change = _ui_room_occupant_affiliation_change; + ui_room_occupant_role_and_affiliation_change = _ui_room_occupant_role_and_affiliation_change; } diff --git a/src/ui/ui.h b/src/ui/ui.h index 044ea6e9..7c86e933 100644 --- a/src/ui/ui.h +++ b/src/ui/ui.h @@ -137,6 +137,12 @@ void (*ui_room_affiliation_change)(const char * const room, const char * const a const char * const reason); void (*ui_room_role_and_affiliation_change)(const char * const room, const char * const role, const char * const affiliation, const char * const actor, const char * const reason); +void (*ui_room_occupant_role_change)(const char * const room, const char * const nick, const char * const role, + const char * const actor, const char * const reason); +void (*ui_room_occupant_affiliation_change)(const char * const room, const char * const nick, const char * const affiliation, + const char * const actor, const char * const reason); +void (*ui_room_occupant_role_and_affiliation_change)(const char * const room, const char * const nick, const char * const role, + const char * const affiliation, const char * const actor, const char * const reason); 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); |