Use bufName in addMessage, fix missing Client.isMyNick()

This commit is contained in:
Simon Ser 2021-06-03 13:29:32 +02:00
parent 283f8af4b1
commit 3b5b693403

View File

@ -486,14 +486,13 @@ export default class App extends Component {
var msgUnread = Unread.NONE; var msgUnread = Unread.NONE;
if ((msg.command == "PRIVMSG" || msg.command == "NOTICE") && !isRead) { if ((msg.command == "PRIVMSG" || msg.command == "NOTICE") && !isRead) {
var target = msg.params[0];
var text = msg.params[1]; var text = msg.params[1];
var kind; var kind;
if (msg.isHighlight) { if (msg.isHighlight) {
msgUnread = Unread.HIGHLIGHT; msgUnread = Unread.HIGHLIGHT;
kind = "highlight"; kind = "highlight";
} else if (target == client.nick) { } else if (client.isMyNick(bufName)) {
msgUnread = Unread.HIGHLIGHT; msgUnread = Unread.HIGHLIGHT;
kind = "private message"; kind = "private message";
} else { } else {
@ -502,8 +501,8 @@ export default class App extends Component {
if (msgUnread == Unread.HIGHLIGHT && window.Notification && Notification.permission === "granted" && !isDelivered && !irc.parseCTCP(msg)) { if (msgUnread == Unread.HIGHLIGHT && window.Notification && Notification.permission === "granted" && !isDelivered && !irc.parseCTCP(msg)) {
var title = "New " + kind + " from " + msg.prefix.name; var title = "New " + kind + " from " + msg.prefix.name;
if (this.isChannel(target)) { if (this.isChannel(bufName)) {
title += " in " + target; title += " in " + bufName;
} }
var notif = new Notification(title, { var notif = new Notification(title, {
body: stripANSI(text), body: stripANSI(text),
@ -511,7 +510,7 @@ export default class App extends Component {
}); });
notif.addEventListener("click", () => { notif.addEventListener("click", () => {
// TODO: scroll to message // TODO: scroll to message
this.switchBuffer({ server: serverID, name: target }); this.switchBuffer({ server: serverID, name: bufName });
}); });
} }
} }