mirror of
https://git.sr.ht/~emersion/gamja
synced 2024-11-14 19:25:26 -05:00
lib/irc: make isHighlight operate on messages
Makes it easier to re-use elsewhere.
This commit is contained in:
parent
11660e4409
commit
917b348992
2 changed files with 10 additions and 2 deletions
|
@ -291,7 +291,7 @@ export default class App extends Component {
|
|||
var text = msg.params[1];
|
||||
|
||||
var kind;
|
||||
if (msg.prefix.name != this.client.nick && irc.isHighlight(text, this.client.nick)) {
|
||||
if (irc.isHighlight(msg, this.client.nick)) {
|
||||
msgUnread = Unread.HIGHLIGHT;
|
||||
kind = "highlight";
|
||||
} else if (target == this.client.nick) {
|
||||
|
|
10
lib/irc.js
10
lib/irc.js
|
@ -219,7 +219,15 @@ function isWordBoundary(ch) {
|
|||
}
|
||||
}
|
||||
|
||||
export function isHighlight(text, nick) {
|
||||
export function isHighlight(msg, nick) {
|
||||
if (msg.command != "PRIVMSG" && msg.command != "NOTICE") {
|
||||
return false;
|
||||
}
|
||||
if (msg.prefix.name == nick) {
|
||||
return false; // Our own messages aren't highlights
|
||||
}
|
||||
|
||||
var text = msg.params[1];
|
||||
while (true) {
|
||||
var i = text.indexOf(nick);
|
||||
if (i < 0) {
|
||||
|
|
Loading…
Reference in a new issue