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

mucwin_broadcast takes ProfMucWin

This commit is contained in:
James Booth 2015-11-02 00:36:25 +00:00
parent 5c53c94253
commit 2e81a4efa3
4 changed files with 23 additions and 23 deletions

View File

@ -136,7 +136,10 @@ void
sv_ev_room_broadcast(const char *const room_jid, const char *const message) sv_ev_room_broadcast(const char *const room_jid, const char *const message)
{ {
if (muc_roster_complete(room_jid)) { if (muc_roster_complete(room_jid)) {
mucwin_broadcast(room_jid, message); ProfMucWin *mucwin = wins_get_muc(room_jid);
if (mucwin) {
mucwin_broadcast(mucwin, message);
}
} else { } else {
muc_pending_broadcasts_add(room_jid, message); muc_pending_broadcasts_add(room_jid, message);
} }
@ -587,10 +590,10 @@ sv_ev_muc_self_online(const char *const room, const char *const nick, gboolean c
} }
GList *pending_broadcasts = muc_pending_broadcasts(room); GList *pending_broadcasts = muc_pending_broadcasts(room);
if (pending_broadcasts) { if (mucwin && pending_broadcasts) {
GList *curr = pending_broadcasts; GList *curr = pending_broadcasts;
while (curr) { while (curr) {
mucwin_broadcast(room, curr->data); mucwin_broadcast(mucwin, curr->data);
curr = g_list_next(curr); curr = g_list_next(curr);
} }
} }

View File

@ -506,25 +506,23 @@ mucwin_kick_error(ProfMucWin *mucwin, const char *const nick, const char *const
} }
void void
mucwin_broadcast(const char *const roomjid, const char *const message) mucwin_broadcast(ProfMucWin *mucwin, const char *const message)
{ {
ProfWin *window = (ProfWin*)wins_get_muc(roomjid); assert(mucwin != NULL);
if (window == NULL) {
log_error("Received room broadcast, but no window open for %s.", roomjid); ProfWin *window = (ProfWin*)mucwin;
int num = wins_get_num(window);
win_vprint(window, '!', 0, NULL, NO_EOL, THEME_ROOMINFO, "", "Room message: ");
win_vprint(window, '!', 0, NULL, NO_DATE, 0, "", "%s", message);
// currently in groupchat window
if (wins_is_current(window)) {
status_bar_active(num);
// not currently on groupchat window
} else { } else {
int num = wins_get_num(window); status_bar_new(num);
win_vprint(window, '!', 0, NULL, NO_EOL, THEME_ROOMINFO, "", "Room message: ");
win_vprint(window, '!', 0, NULL, NO_DATE, 0, "", "%s", message);
// currently in groupchat window
if (wins_is_current(window)) {
status_bar_active(num);
// not currently on groupchat window
} else {
status_bar_new(num);
}
} }
} }

View File

@ -186,7 +186,7 @@ void mucwin_occupant_kicked(ProfMucWin *mucwin, const char *const nick, const ch
const char *const reason); const char *const reason);
void mucwin_occupant_banned(ProfMucWin *mucwin, 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(ProfMucWin *mucwin, const char *const message);
void mucwin_occupant_offline(ProfMucWin *mucwin, const char *const nick); void mucwin_occupant_offline(ProfMucWin *mucwin, const char *const nick);
void mucwin_occupant_online(ProfMucWin *mucwin, const char *const nick, const char *const roles, void mucwin_occupant_online(ProfMucWin *mucwin, const char *const nick, const char *const roles,
const char *const affiliation, const char *const show, const char *const status); const char *const affiliation, const char *const show, const char *const status);

View File

@ -223,8 +223,7 @@ void ui_room_banned(const char * const roomjid, const char * const actor, const
void mucwin_occupant_banned(ProfMucWin *mucwin, 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(ProfMucWin *mucwin, const char * const message) {}
const char * const message) {}
void mucwin_occupant_offline(ProfMucWin *mucwin, const char * const nick) {} void mucwin_occupant_offline(ProfMucWin *mucwin, const char * const nick) {}
void mucwin_occupant_online(ProfMucWin *mucwin, const char * const nick, const char * const roles, void mucwin_occupant_online(ProfMucWin *mucwin, const char * const nick, const char * const roles,
const char * const affiliation, const char * const show, const char * const status) {} const char * const affiliation, const char * const show, const char * const status) {}