Tidy ui_room_message

This commit is contained in:
James Booth
2015-05-10 01:44:34 +01:00
parent aaad3ff909
commit aeffca496c

View File

@@ -1748,7 +1748,9 @@ ui_room_message(const char * const roomjid, const char * const nick,
ProfMucWin *mucwin = wins_get_muc(roomjid); ProfMucWin *mucwin = wins_get_muc(roomjid);
if (mucwin == NULL) { if (mucwin == NULL) {
log_error("Room message received from %s, but no window open for %s", nick, roomjid); log_error("Room message received from %s, but no window open for %s", nick, roomjid);
} else { return;
}
ProfWin *window = (ProfWin*) mucwin; ProfWin *window = (ProfWin*) mucwin;
int num = wins_get_num(window); int num = wins_get_num(window);
char *my_nick = muc_nick(roomjid); char *my_nick = muc_nick(roomjid);
@@ -1772,11 +1774,9 @@ ui_room_message(const char * const roomjid, const char * const nick,
status_bar_new(num); status_bar_new(num);
cons_show_incoming_message(nick, num); cons_show_incoming_message(nick, num);
if (strcmp(nick, my_nick) != 0) { if (prefs_get_boolean(PREF_FLASH) && (strcmp(nick, my_nick) != 0)) {
if (prefs_get_boolean(PREF_FLASH)) {
flash(); flash();
} }
}
mucwin->unread++; mucwin->unread++;
} }
@@ -1786,7 +1786,11 @@ ui_room_message(const char * const roomjid, const char * const nick,
ui_index = 0; ui_index = 0;
} }
if (strcmp(nick, muc_nick(roomjid)) != 0) { // don't notify self messages
if (strcmp(nick, my_nick) == 0) {
return;
}
if (prefs_get_boolean(PREF_BEEP)) { if (prefs_get_boolean(PREF_BEEP)) {
beep(); beep();
} }
@@ -1819,8 +1823,6 @@ ui_room_message(const char * const roomjid, const char * const nick,
jid_destroy(jidp); jid_destroy(jidp);
} }
} }
}
}
} }
void void