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

mucwin_occupant_online takes ProfMucWin

This commit is contained in:
James Booth 2015-11-01 23:52:16 +00:00
parent 3a98bf315c
commit d505a92d1e
4 changed files with 17 additions and 18 deletions

View File

@ -646,8 +646,9 @@ sv_ev_muc_occupant_online(const char *const room, const char *const nick, const
// joined room // joined room
if (!occupant) { if (!occupant) {
char *muc_status_pref = prefs_get_string(PREF_STATUSES_MUC); char *muc_status_pref = prefs_get_string(PREF_STATUSES_MUC);
if (g_strcmp0(muc_status_pref, "none") != 0) { ProfMucWin *mucwin = wins_get_muc(room);
mucwin_occupant_online(room, nick, role, affiliation, show, status); if (mucwin && g_strcmp0(muc_status_pref, "none") != 0) {
mucwin_occupant_online(mucwin, nick, role, affiliation, show, status);
} }
prefs_free_string(muc_status_pref); prefs_free_string(muc_status_pref);
occupantswin_occupants(room); occupantswin_occupants(room);

View File

@ -285,24 +285,22 @@ mucwin_occupant_banned(ProfMucWin *mucwin, const char *const nick, const char *c
} }
void void
mucwin_occupant_online(const char *const roomjid, const char *const nick, const char *const role, mucwin_occupant_online(ProfMucWin *mucwin, const char *const nick, const char *const role,
const char *const affiliation, const char *const show, const char *const status) const char *const affiliation, const char *const show, const char *const status)
{ {
ProfWin *window = (ProfWin*)wins_get_muc(roomjid); assert(mucwin != NULL);
if (window == NULL) {
log_error("Received online presence for room participant %s, but no window open for %s.", nick, roomjid); ProfWin *window = (ProfWin*)mucwin;
} else { win_vprint(window, '!', 0, NULL, NO_EOL, THEME_ONLINE, "", "-> %s has joined the room", nick);
win_vprint(window, '!', 0, NULL, NO_EOL, THEME_ONLINE, "", "-> %s has joined the room", nick); if (prefs_get_boolean(PREF_MUC_PRIVILEGES)) {
if (prefs_get_boolean(PREF_MUC_PRIVILEGES)) { if (role) {
if (role) { win_vprint(window, '!', 0, NULL, NO_DATE | NO_EOL, THEME_ONLINE, "", ", role: %s", role);
win_vprint(window, '!', 0, NULL, NO_DATE | NO_EOL, THEME_ONLINE, "", ", role: %s", role); }
} if (affiliation) {
if (affiliation) { win_vprint(window, '!', 0, NULL, NO_DATE | NO_EOL, THEME_ONLINE, "", ", affiliation: %s", affiliation);
win_vprint(window, '!', 0, NULL, NO_DATE | NO_EOL, THEME_ONLINE, "", ", affiliation: %s", affiliation);
}
} }
win_print(window, '!', 0, NULL, NO_DATE, THEME_ROOMINFO, "", "");
} }
win_print(window, '!', 0, NULL, NO_DATE, THEME_ROOMINFO, "", "");
} }
void void

View File

@ -189,7 +189,7 @@ void mucwin_occupant_banned(ProfMucWin *mucwin, const char *const nick, const ch
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);
void mucwin_occupant_online(const char *const roomjid, 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);
void mucwin_occupant_nick_change(const char *const roomjid, const char *const old_nick, const char *const nick); void mucwin_occupant_nick_change(const char *const roomjid, const char *const old_nick, const char *const nick);
void mucwin_nick_change(const char *const roomjid, const char *const nick); void mucwin_nick_change(const char *const roomjid, const char *const nick);

View File

@ -228,7 +228,7 @@ void ui_leave_room(const char * const roomjid) {}
void mucwin_broadcast(const char * const roomjid, void mucwin_broadcast(const char * const roomjid,
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(const char * const roomjid, 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) {}
void mucwin_occupant_nick_change(const char * const roomjid, void mucwin_occupant_nick_change(const char * const roomjid,
const char * const old_nick, const char * const nick) {} const char * const old_nick, const char * const nick) {}