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

mucwin_subject takes ProfMucWin

This commit is contained in:
James Booth 2015-11-02 00:29:35 +00:00
parent 0592c7f9e9
commit 23ada0d38b
4 changed files with 31 additions and 32 deletions

View File

@ -146,8 +146,9 @@ void
sv_ev_room_subject(const char *const room, const char *const nick, const char *const subject)
{
muc_set_subject(room, subject);
if (muc_roster_complete(room)) {
mucwin_subject(room, nick, subject);
ProfMucWin *mucwin = wins_get_muc(room);
if (mucwin && muc_roster_complete(room)) {
mucwin_subject(mucwin, nick, subject);
}
}
@ -581,8 +582,8 @@ sv_ev_muc_self_online(const char *const room, const char *const nick, gboolean c
}
char *subject = muc_subject(room);
if (subject) {
mucwin_subject(room, NULL, subject);
if (mucwin && subject) {
mucwin_subject(mucwin, NULL, subject);
}
GList *pending_broadcasts = muc_pending_broadcasts(room);

View File

@ -463,38 +463,36 @@ mucwin_requires_config(ProfMucWin *mucwin)
}
void
mucwin_subject(const char *const roomjid, const char *const nick, const char *const subject)
mucwin_subject(ProfMucWin *mucwin, const char *const nick, const char *const subject)
{
ProfWin *window = (ProfWin*)wins_get_muc(roomjid);
if (window == NULL) {
log_error("Received room subject, but no window open for %s.", roomjid);
assert(mucwin != NULL);
ProfWin *window = (ProfWin*)mucwin;
int num = wins_get_num(window);
if (subject) {
if (nick) {
win_vprint(window, '!', 0, NULL, NO_EOL, THEME_ROOMINFO, "", "*%s has set the room subject: ", nick);
win_vprint(window, '!', 0, NULL, NO_DATE, 0, "", "%s", subject);
} else {
win_vprint(window, '!', 0, NULL, NO_EOL, THEME_ROOMINFO, "", "Room subject: ");
win_vprint(window, '!', 0, NULL, NO_DATE, 0, "", "%s", subject);
}
} else {
int num = wins_get_num(window);
if (subject) {
if (nick) {
win_vprint(window, '!', 0, NULL, NO_EOL, THEME_ROOMINFO, "", "*%s has set the room subject: ", nick);
win_vprint(window, '!', 0, NULL, NO_DATE, 0, "", "%s", subject);
} else {
win_vprint(window, '!', 0, NULL, NO_EOL, THEME_ROOMINFO, "", "Room subject: ");
win_vprint(window, '!', 0, NULL, NO_DATE, 0, "", "%s", subject);
}
if (nick) {
win_vprint(window, '!', 0, NULL, 0, THEME_ROOMINFO, "", "*%s has cleared the room subject.", nick);
} else {
if (nick) {
win_vprint(window, '!', 0, NULL, 0, THEME_ROOMINFO, "", "*%s has cleared the room subject.", nick);
} else {
win_vprint(window, '!', 0, NULL, 0, THEME_ROOMINFO, "", "Room subject cleared");
}
win_vprint(window, '!', 0, NULL, 0, THEME_ROOMINFO, "", "Room subject cleared");
}
}
// currently in groupchat window
if (wins_is_current(window)) {
status_bar_active(num);
// currently in groupchat window
if (wins_is_current(window)) {
status_bar_active(num);
// not currently on groupchat window
} else {
status_bar_active(num);
}
// not currently on groupchat window
} else {
status_bar_active(num);
}
}

View File

@ -175,7 +175,7 @@ void mucwin_occupant_role_and_affiliation_change(ProfMucWin *mucwin, const char
void mucwin_roster(ProfMucWin *mucwin, GList *occupants, const char *const presence);
void mucwin_history(ProfMucWin *mucwin, const char *const nick, GDateTime *timestamp, const char *const message);
void mucwin_message(ProfMucWin *mucwin, const char *const nick, const char *const message);
void mucwin_subject(const char *const roomjid, const char *const nick, const char *const subject);
void mucwin_subject(ProfMucWin *mucwin, const char *const nick, const char *const subject);
void mucwin_requires_config(ProfMucWin *mucwin);
void mucwin_info(ProfMucWin *mucwin);
void mucwin_show_role_list(ProfMucWin *mucwin, muc_role_t role);

View File

@ -206,7 +206,7 @@ void mucwin_occupant_role_and_affiliation_change(ProfMucWin *mucwin, const char
void mucwin_roster(ProfMucWin *mucwin, GList *occupants, const char * const presence) {}
void mucwin_history(ProfMucWin *mucwin, const char * const nick, GDateTime *timestamp, const char * const message) {}
void mucwin_message(ProfMucWin *mucwin, const char * const nick, const char * const message) {}
void mucwin_subject(const char * const roomjid, const char * const nick, const char * const subject) {}
void mucwin_subject(ProfMucWin *mucwin, const char * const nick, const char * const subject) {}
void mucwin_requires_config(ProfMucWin *mucwin) {}
void ui_room_destroy(const char * const roomjid) {}
void mucwin_info(ProfMucWin *mucwin) {}