forked from CringeStudios/gamja
Add case-mapping support to irc.isHighlight
Closes: https://todo.sr.ht/~emersion/gamja/77
This commit is contained in:
parent
b9dc17db97
commit
403d7ec7f7
@ -322,7 +322,7 @@ export default class App extends Component {
|
|||||||
msg.key = messagesCount;
|
msg.key = messagesCount;
|
||||||
messagesCount++;
|
messagesCount++;
|
||||||
|
|
||||||
msg.isHighlight = irc.isHighlight(msg, client.nick);
|
msg.isHighlight = irc.isHighlight(msg, client.nick, client.cm);
|
||||||
|
|
||||||
if (!msg.tags) {
|
if (!msg.tags) {
|
||||||
msg.tags = {};
|
msg.tags = {};
|
||||||
|
10
lib/irc.js
10
lib/irc.js
@ -245,16 +245,18 @@ function isWordBoundary(ch) {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
export function isHighlight(msg, nick) {
|
export function isHighlight(msg, nick, cm) {
|
||||||
if (msg.command != "PRIVMSG" && msg.command != "NOTICE") {
|
if (msg.command != "PRIVMSG" && msg.command != "NOTICE") {
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
// TODO: case-mapping handling
|
|
||||||
if (msg.prefix && msg.prefix.name == nick) {
|
nick = cm(nick);
|
||||||
|
|
||||||
|
if (msg.prefix && cm(msg.prefix.name) == nick) {
|
||||||
return false; // Our own messages aren't highlights
|
return false; // Our own messages aren't highlights
|
||||||
}
|
}
|
||||||
|
|
||||||
var text = msg.params[1];
|
var text = cm(msg.params[1]);
|
||||||
while (true) {
|
while (true) {
|
||||||
var i = text.indexOf(nick);
|
var i = text.indexOf(nick);
|
||||||
if (i < 0) {
|
if (i < 0) {
|
||||||
|
Loading…
x
Reference in New Issue
Block a user