Add output for when both role and affiliation changed at same time

This commit is contained in:
James Booth
2014-10-18 01:07:25 +01:00
parent 9134a65e97
commit 3790b16299
4 changed files with 20 additions and 3 deletions

View File

@@ -1,5 +1,6 @@
Show own role affilaition changes (including actor/reason) Show own role affilaition changes (including actor/reason)
Show occupants role and affiliation changes (including actor/reason) Show occupants role and affiliation changes (including actor/reason)
Add config option to not show role/affilation messages and changes
Check all commands from private conversations Check all commands from private conversations
Test all freetext args Test all freetext args
Make form editing commands less verbose Make form editing commands less verbose

View File

@@ -719,10 +719,16 @@ handle_muc_self_online(const char * const room, const char * const nick, gboolea
// check for change in role/affiliation // check for change in role/affiliation
} else { } else {
if (g_strcmp0(role, old_role) != 0) { // both changed
if ((g_strcmp0(role, old_role) != 0) && (g_strcmp0(affiliation, old_affiliation) != 0)) {
ui_room_role_and_affiliation_change(room, role, affiliation);
// role changed
} else if (g_strcmp0(role, old_role) != 0) {
ui_room_role_change(room, role); ui_room_role_change(room, role);
}
if (g_strcmp0(affiliation, old_affiliation) != 0) { // affiliation changed
} else if (g_strcmp0(affiliation, old_affiliation) != 0) {
ui_room_affiliation_change(room, affiliation); ui_room_affiliation_change(room, affiliation);
} }
} }

View File

@@ -1351,6 +1351,13 @@ _ui_room_affiliation_change(const char * const room, const char * const affiliat
win_save_vprint(window, '!', NULL, 0, COLOUR_ROOMINFO, "", "Your affiliation has been changed to: %s", affiliation); win_save_vprint(window, '!', NULL, 0, COLOUR_ROOMINFO, "", "Your affiliation has been changed to: %s", affiliation);
} }
static void
_ui_room_role_and_affiliation_change(const char * const room, const char * const role, const char * const affiliation)
{
ProfWin *window = wins_get_by_recipient(room);
win_save_vprint(window, '!', NULL, 0, COLOUR_ROOMINFO, "", "Your role and affiliation have been changed, role: %s, affiliation: %s", role, affiliation);
}
static void static void
_ui_handle_room_info_error(const char * const room, const char * const error) _ui_handle_room_info_error(const char * const room, const char * const error)
{ {
@@ -3076,5 +3083,6 @@ ui_init_module(void)
ui_room_role_change = _ui_room_role_change; ui_room_role_change = _ui_room_role_change;
ui_room_affiliation_change = _ui_room_affiliation_change; ui_room_affiliation_change = _ui_room_affiliation_change;
ui_switch_to_room = _ui_switch_to_room; ui_switch_to_room = _ui_switch_to_room;
ui_room_role_and_affiliation_change = _ui_room_role_and_affiliation_change;
} }

View File

@@ -133,6 +133,8 @@ void (*ui_room_join)(const char * const room, gboolean focus);
void (*ui_switch_to_room)(const char * const room); void (*ui_switch_to_room)(const char * const room);
void (*ui_room_role_change)(const char * const room, const char * const role); void (*ui_room_role_change)(const char * const room, const char * const role);
void (*ui_room_affiliation_change)(const char * const room, const char * const affiliation); void (*ui_room_affiliation_change)(const char * const room, const char * const affiliation);
void (*ui_room_role_and_affiliation_change)(const char * const room, const char * const role,
const char * const affiliation);
void (*ui_room_roster)(const char * const room, GList *roster, const char * const presence); 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, void (*ui_room_history)(const char * const room_jid, const char * const nick,
GTimeVal tv_stamp, const char * const message); GTimeVal tv_stamp, const char * const message);