about summary refs log tree commit diff stats
diff options
context:
space:
mode:
authorJames Booth <boothj5@gmail.com>2015-11-01 23:14:27 +0000
committerJames Booth <boothj5@gmail.com>2015-11-01 23:14:27 +0000
commit799c064dffea4a076382af752f3f167dc8c0c167 (patch)
treee93d4a945c1e51bfd80bbc3b5cbcb830a99deb3b
parent288c1a9d6e560f0d07909c8d68b3113bbb60b4f4 (diff)
downloadprofani-tty-799c064dffea4a076382af752f3f167dc8c0c167.tar.gz
mucwin_occupant_affiliation_change takes ProfMucWin
-rw-r--r--src/event/server_events.c5
-rw-r--r--src/ui/mucwin.c6
-rw-r--r--src/ui/ui.h2
-rw-r--r--tests/unittests/ui/stub_ui.c2
4 files changed, 10 insertions, 5 deletions
diff --git a/src/event/server_events.c b/src/event/server_events.c
index 6254d725..0d044704 100644
--- a/src/event/server_events.c
+++ b/src/event/server_events.c
@@ -671,7 +671,10 @@ sv_ev_muc_occupant_online(const char *const room, const char *const nick, const
 
             // affiliation changed
             } else if (g_strcmp0(affiliation, old_affiliation) != 0) {
-                mucwin_occupant_affiliation_change(room, nick, affiliation, actor, reason);
+                ProfMucWin *mucwin = wins_get_muc(room);
+                if (mucwin) {
+                    mucwin_occupant_affiliation_change(mucwin, nick, affiliation, actor, reason);
+                }
             }
         }
         occupantswin_occupants(room);
diff --git a/src/ui/mucwin.c b/src/ui/mucwin.c
index 692d884a..9abf86d6 100644
--- a/src/ui/mucwin.c
+++ b/src/ui/mucwin.c
@@ -109,10 +109,12 @@ mucwin_occupant_role_change(ProfMucWin *mucwin, const char *const nick, const ch
 }
 
 void
-mucwin_occupant_affiliation_change(const char *const roomjid, const char *const nick, const char *const affiliation,
+mucwin_occupant_affiliation_change(ProfMucWin *mucwin, const char *const nick, const char *const affiliation,
     const char *const actor, const char *const reason)
 {
-    ProfWin *window = (ProfWin*)wins_get_muc(roomjid);
+    assert(mucwin != NULL);
+
+    ProfWin *window = (ProfWin*)mucwin;
     win_vprint(window, '!', 0, NULL, NO_EOL, THEME_ROOMINFO, "", "%s's affiliation has been changed to: %s", nick, affiliation);
     if (actor) {
         win_vprint(window, '!', 0, NULL, NO_DATE | NO_EOL, THEME_ROOMINFO, "", ", by: %s", actor);
diff --git a/src/ui/ui.h b/src/ui/ui.h
index 5409fa8f..263b4d91 100644
--- a/src/ui/ui.h
+++ b/src/ui/ui.h
@@ -168,7 +168,7 @@ void mucwin_role_and_affiliation_change(ProfMucWin *mucwin, const char *const ro
     const char *const affiliation, const char *const actor, const char *const reason);
 void mucwin_occupant_role_change(ProfMucWin *mucwin, const char *const nick, const char *const role,
     const char *const actor, const char *const reason);
-void mucwin_occupant_affiliation_change(const char *const roomjid, const char *const nick,
+void mucwin_occupant_affiliation_change(ProfMucWin *mucwin, const char *const nick,
     const char *const affiliation, const char *const actor, const char *const reason);
 void mucwin_occupant_role_and_affiliation_change(const char *const roomjid, const char *const nick,
     const char *const role, const char *const affiliation, const char *const actor, const char *const reason);
diff --git a/tests/unittests/ui/stub_ui.c b/tests/unittests/ui/stub_ui.c
index 907d765a..43d90980 100644
--- a/tests/unittests/ui/stub_ui.c
+++ b/tests/unittests/ui/stub_ui.c
@@ -199,7 +199,7 @@ void mucwin_role_and_affiliation_change(ProfMucWin *mucwin, const char * const r
     const char * const affiliation, const char * const actor, const char * const reason) {}
 void mucwin_occupant_role_change(ProfMucWin *mucwin, const char * const nick, const char * const role,
     const char * const actor, const char * const reason) {}
-void mucwin_occupant_affiliation_change(const char * const roomjid, const char * const nick, const char * const affiliation,
+void mucwin_occupant_affiliation_change(ProfMucWin *mucwin, const char * const nick, const char * const affiliation,
     const char * const actor, const char * const reason) {}
 void mucwin_occupant_role_and_affiliation_change(const char * const roomjid, const char * const nick, const char * const role,
     const char * const affiliation, const char * const actor, const char * const reason) {}