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

mucwin_message takes ProfMucWin

This commit is contained in:
James Booth 2015-11-02 00:24:19 +00:00
parent e68784be43
commit 986741dea8
4 changed files with 11 additions and 14 deletions

View File

@ -165,7 +165,10 @@ void
sv_ev_room_message(const char *const room_jid, const char *const nick,
const char *const message)
{
mucwin_message(room_jid, nick, message);
ProfMucWin *mucwin = wins_get_muc(room_jid);
if (mucwin) {
mucwin_message(mucwin, nick, message);
}
if (prefs_get_boolean(PREF_GRLOG)) {
Jid *jid = jid_create(jabber_get_fulljid());

View File

@ -355,18 +355,13 @@ mucwin_history(ProfMucWin *mucwin, const char *const nick, GDateTime *timestamp,
}
void
mucwin_message(const char *const roomjid, const char *const nick,
const char *const message)
mucwin_message(ProfMucWin *mucwin, const char *const nick, const char *const message)
{
ProfMucWin *mucwin = wins_get_muc(roomjid);
if (mucwin == NULL) {
log_error("Room message received from %s, but no window open for %s", nick, roomjid);
return;
}
assert(mucwin != NULL);
ProfWin *window = (ProfWin*) mucwin;
ProfWin *window = (ProfWin*)mucwin;
int num = wins_get_num(window);
char *my_nick = muc_nick(roomjid);
char *my_nick = muc_nick(mucwin->roomjid);
if (g_strcmp0(nick, my_nick) != 0) {
if (g_strrstr(message, my_nick)) {
@ -427,7 +422,7 @@ mucwin_message(const char *const roomjid, const char *const nick,
if (notify) {
gboolean is_current = wins_is_current(window);
if ( !is_current || (is_current && prefs_get_boolean(PREF_NOTIFY_ROOM_CURRENT)) ) {
Jid *jidp = jid_create(roomjid);
Jid *jidp = jid_create(mucwin->roomjid);
if (prefs_get_boolean(PREF_NOTIFY_ROOM_TEXT)) {
notify_room_message(nick, jidp->localpart, ui_index, message);
} else {

View File

@ -174,7 +174,7 @@ void mucwin_occupant_role_and_affiliation_change(ProfMucWin *mucwin, const char
const char *const role, const char *const affiliation, const char *const actor, const char *const reason);
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(const char *const roomjid, const char *const nick, 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_requires_config(const char *const roomjid);
void mucwin_info(ProfMucWin *mucwin);

View File

@ -205,8 +205,7 @@ void mucwin_occupant_role_and_affiliation_change(ProfMucWin *mucwin, const char
const char * const affiliation, const char * const actor, const char * const reason) {}
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(const char * const roomjid, const char * const nick,
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_requires_config(const char * const roomjid) {}
void ui_room_destroy(const char * const roomjid) {}