diff options
Diffstat (limited to 'src')
-rw-r--r-- | src/event/server_events.c | 16 | ||||
-rw-r--r-- | src/ui/privwin.c | 48 | ||||
-rw-r--r-- | src/ui/ui.h | 2 |
3 files changed, 65 insertions, 1 deletions
diff --git a/src/event/server_events.c b/src/event/server_events.c index e6738833..17754272 100644 --- a/src/event/server_events.c +++ b/src/event/server_events.c @@ -686,6 +686,14 @@ sv_ev_room_occupent_kicked(const char *const room, const char *const nick, const if (mucwin) { mucwin_occupant_kicked(mucwin, nick, actor, reason); } + + Jid *jidp = jid_create_from_bare_and_resource(room, nick); + ProfPrivateWin *privwin = wins_get_private(jidp->fulljid); + jid_destroy(jidp); + if (privwin != NULL) { + privwin_occupant_kicked(privwin, actor, reason); + } + occupantswin_occupants(room); rosterwin_roster(); } @@ -699,6 +707,14 @@ sv_ev_room_occupent_banned(const char *const room, const char *const nick, const if (mucwin) { mucwin_occupant_banned(mucwin, nick, actor, reason); } + + Jid *jidp = jid_create_from_bare_and_resource(room, nick); + ProfPrivateWin *privwin = wins_get_private(jidp->fulljid); + jid_destroy(jidp); + if (privwin != NULL) { + privwin_occupant_banned(privwin, actor, reason); + } + occupantswin_occupants(room); rosterwin_roster(); } diff --git a/src/ui/privwin.c b/src/ui/privwin.c index 4b8217e2..6a249091 100644 --- a/src/ui/privwin.c +++ b/src/ui/privwin.c @@ -126,11 +126,57 @@ privwin_occupant_offline(ProfPrivateWin *privwin) privwin->occupant_offline = TRUE; Jid *jidp = jid_create(privwin->fulljid); - win_vprint((ProfWin*)privwin, '-', 0, NULL, 0, THEME_OFFLINE, NULL, "-- %s has left the room.", jidp->resourcepart); + win_vprint((ProfWin*)privwin, '-', 0, NULL, 0, THEME_OFFLINE, NULL, "<- %s has left the room.", jidp->resourcepart); jid_destroy(jidp); } void +privwin_occupant_kicked(ProfPrivateWin *privwin, const char *const actor, const char *const reason) +{ + assert(privwin != NULL); + + privwin->occupant_offline = TRUE; + Jid *jidp = jid_create(privwin->fulljid); + GString *message = g_string_new(jidp->resourcepart); + jid_destroy(jidp); + g_string_append(message, " has been kicked from the room"); + if (actor) { + g_string_append(message, " by "); + g_string_append(message, actor); + } + if (reason) { + g_string_append(message, ", reason: "); + g_string_append(message, reason); + } + + win_vprint((ProfWin*)privwin, '!', 0, NULL, 0, THEME_OFFLINE, NULL, "<- %s", message->str); + g_string_free(message, TRUE); +} + +void +privwin_occupant_banned(ProfPrivateWin *privwin, const char *const actor, const char *const reason) +{ + assert(privwin != NULL); + + privwin->occupant_offline = TRUE; + Jid *jidp = jid_create(privwin->fulljid); + GString *message = g_string_new(jidp->resourcepart); + jid_destroy(jidp); + g_string_append(message, " has been banned from the room"); + if (actor) { + g_string_append(message, " by "); + g_string_append(message, actor); + } + if (reason) { + g_string_append(message, ", reason: "); + g_string_append(message, reason); + } + + win_vprint((ProfWin*)privwin, '!', 0, NULL, 0, THEME_OFFLINE, NULL, "<- %s", message->str); + g_string_free(message, TRUE); +} + +void privwin_occupant_online(ProfPrivateWin *privwin) { assert(privwin != NULL); diff --git a/src/ui/ui.h b/src/ui/ui.h index 028eaa25..91ee4d37 100644 --- a/src/ui/ui.h +++ b/src/ui/ui.h @@ -198,6 +198,8 @@ void privwin_message_occupant_offline(ProfPrivateWin *privwin); char* privwin_get_string(ProfPrivateWin *privwin); void privwin_occupant_offline(ProfPrivateWin *privwin); +void privwin_occupant_kicked(ProfPrivateWin *privwin, const char *const actor, const char *const reason); +void privwin_occupant_banned(ProfPrivateWin *privwin, const char *const actor, const char *const reason); void privwin_occupant_online(ProfPrivateWin *privwin); // MUC room config window |