about summary refs log tree commit diff stats
path: root/src/ui
diff options
context:
space:
mode:
authorJames Booth <boothj5@gmail.com>2014-10-18 01:37:52 +0100
committerJames Booth <boothj5@gmail.com>2014-10-18 01:37:52 +0100
commit67755ca74d7d7ec53a1365eacfdca883f4c376f2 (patch)
tree65180fac8673e0730e9ed2593ebde13e8f5b1c79 /src/ui
parent3790b16299efb29843d4a221c41047d094616b5e (diff)
downloadprofani-tty-67755ca74d7d7ec53a1365eacfdca883f4c376f2.tar.gz
Added reason to role/affiliation changes
Diffstat (limited to 'src/ui')
-rw-r--r--src/ui/core.c36
-rw-r--r--src/ui/ui.h8
2 files changed, 35 insertions, 9 deletions
diff --git a/src/ui/core.c b/src/ui/core.c
index 5331e91f..2f8b3670 100644
--- a/src/ui/core.c
+++ b/src/ui/core.c
@@ -1338,24 +1338,48 @@ _ui_switch_to_room(const char * const room)
 }
 
 static void
-_ui_room_role_change(const char * const room, const char * const role)
+_ui_room_role_change(const char * const room, const char * const role, const char * const actor,
+    const char * const reason)
 {
     ProfWin *window = wins_get_by_recipient(room);
-    win_save_vprint(window, '!', NULL, 0, COLOUR_ROOMINFO, "", "Your role has been changed to: %s", role);
+    win_save_vprint(window, '!', NULL, NO_EOL, COLOUR_ROOMINFO, "", "Your role has been changed to: %s", 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_affiliation_change(const char * const room, const char * const affiliation)
+_ui_room_affiliation_change(const char * const room, const char * const affiliation, const char * const actor,
+    const char * const reason)
 {
     ProfWin *window = wins_get_by_recipient(room);
-    win_save_vprint(window, '!', NULL, 0, COLOUR_ROOMINFO, "", "Your affiliation has been changed to: %s", affiliation);
+    win_save_vprint(window, '!', NULL, NO_EOL, COLOUR_ROOMINFO, "", "Your affiliation has been changed to: %s", 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_role_and_affiliation_change(const char * const room, const char * const role, const char * const affiliation)
+_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)
 {
     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);
+    win_save_vprint(window, '!', NULL, NO_EOL, COLOUR_ROOMINFO, "", "Your role and affiliation have been changed, role: %s, affiliation: %s", 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
diff --git a/src/ui/ui.h b/src/ui/ui.h
index ed0f5764..044ea6e9 100644
--- a/src/ui/ui.h
+++ b/src/ui/ui.h
@@ -131,10 +131,12 @@ void (*ui_outgoing_msg)(const char * const from, const char * const to,
     const char * const message);
 void (*ui_room_join)(const char * const room, gboolean focus);
 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_affiliation_change)(const char * const room, const char * const affiliation);
+void (*ui_room_role_change)(const char * const room, const char * const role, const char * const actor,
+    const char * const reason);
+void (*ui_room_affiliation_change)(const char * const room, const char * const affiliation, const char * const actor,
+    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 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);