1
0
mirror of https://github.com/profanity-im/profanity.git synced 2024-11-03 19:37:16 -05:00

mucwin_occupant_banned takes ProfMucWin

This commit is contained in:
James Booth 2015-11-01 23:49:45 +00:00
parent cc498110e2
commit 3a98bf315c
4 changed files with 21 additions and 20 deletions

View File

@ -510,7 +510,10 @@ sv_ev_room_occupent_banned(const char *const room, const char *const nick, const
const char *const reason) const char *const reason)
{ {
muc_roster_remove(room, nick); muc_roster_remove(room, nick);
mucwin_occupant_banned(room, nick, actor, reason); ProfMucWin *mucwin = wins_get_muc(room);
if (mucwin) {
mucwin_occupant_banned(mucwin, nick, actor, reason);
}
occupantswin_occupants(room); occupantswin_occupants(room);
} }

View File

@ -263,13 +263,12 @@ mucwin_occupant_kicked(ProfMucWin *mucwin, const char *const nick, const char *c
} }
void void
mucwin_occupant_banned(const char *const roomjid, const char *const nick, const char *const actor, mucwin_occupant_banned(ProfMucWin *mucwin, const char *const nick, const char *const actor,
const char *const reason) const char *const reason)
{ {
ProfWin *window = (ProfWin*)wins_get_muc(roomjid); assert(mucwin != NULL);
if (window == NULL) {
log_error("Received ban for room participant %s, but no window open for %s.", nick, roomjid); ProfWin *window = (ProfWin*)mucwin;
} else {
GString *message = g_string_new(nick); GString *message = g_string_new(nick);
g_string_append(message, " has been banned from the room"); g_string_append(message, " has been banned from the room");
if (actor) { if (actor) {
@ -284,7 +283,6 @@ mucwin_occupant_banned(const char *const roomjid, const char *const nick, const
win_vprint(window, '!', 0, NULL, 0, THEME_OFFLINE, "", "<- %s", message->str); win_vprint(window, '!', 0, NULL, 0, THEME_OFFLINE, "", "<- %s", message->str);
g_string_free(message, TRUE); g_string_free(message, TRUE);
} }
}
void void
mucwin_occupant_online(const char *const roomjid, const char *const nick, const char *const role, mucwin_occupant_online(const char *const roomjid, const char *const nick, const char *const role,

View File

@ -185,7 +185,7 @@ void mucwin_room_info_error(ProfMucWin *mucwin, const char *const error);
void mucwin_room_disco_info(ProfMucWin *mucwin, GSList *identities, GSList *features); void mucwin_room_disco_info(ProfMucWin *mucwin, GSList *identities, GSList *features);
void mucwin_occupant_kicked(ProfMucWin *mucwin, const char *const nick, const char *const actor, void mucwin_occupant_kicked(ProfMucWin *mucwin, const char *const nick, const char *const actor,
const char *const reason); const char *const reason);
void mucwin_occupant_banned(const char *const roomjid, const char *const nick, const char *const actor, void mucwin_occupant_banned(ProfMucWin *mucwin, const char *const nick, const char *const actor,
const char *const reason); const char *const reason);
void mucwin_broadcast(const char *const roomjid, const char *const message); void mucwin_broadcast(const char *const roomjid, const char *const message);
void mucwin_occupant_offline(ProfMucWin *mucwin, const char *const nick); void mucwin_occupant_offline(ProfMucWin *mucwin, const char *const nick);

View File

@ -222,7 +222,7 @@ void ui_room_kicked(const char * const roomjid, const char * const actor, const
void mucwin_occupant_kicked(ProfMucWin *mucwin, const char * const nick, const char * const actor, void mucwin_occupant_kicked(ProfMucWin *mucwin, const char * const nick, const char * const actor,
const char * const reason) {} const char * const reason) {}
void ui_room_banned(const char * const roomjid, const char * const actor, const char * const reason) {} void ui_room_banned(const char * const roomjid, const char * const actor, const char * const reason) {}
void mucwin_occupant_banned(const char * const roomjid, const char * const nick, const char * const actor, void mucwin_occupant_banned(ProfMucWin *mucwin, const char * const nick, const char * const actor,
const char * const reason) {} const char * const reason) {}
void ui_leave_room(const char * const roomjid) {} void ui_leave_room(const char * const roomjid) {}
void mucwin_broadcast(const char * const roomjid, void mucwin_broadcast(const char * const roomjid,