Add support for STATUSMSG

Closes: https://todo.sr.ht/~emersion/gamja/65
This commit is contained in:
Simon Ser 2021-06-03 13:31:43 +02:00
parent 3b5b693403
commit 6e20ad872e
2 changed files with 11 additions and 3 deletions

View file

@ -764,6 +764,15 @@ export default class App extends Component {
target = msg.prefix.name;
}
}
var allowedPrefixes = client.isupport.get("STATUSMSG");
if (allowedPrefixes) {
var parts = irc.parseTargetPrefix(target, allowedPrefixes);
if (this.isChannel(parts.name)) {
target = parts.name;
}
}
this.addMessage(serverID, target, msg);
break;
case "JOIN":

View file

@ -210,11 +210,10 @@ export function formatMessage(msg) {
}
/** Split a prefix and a name out of a target. */
export function parseTargetPrefix(s) {
// TODO: use the PREFIX token from RPL_ISUPPORT
export function parseTargetPrefix(s, allowedPrefixes = STD_MEMBERSHIPS) {
var i;
for (i = 0; i < s.length; i++) {
if (STD_MEMBERSHIPS.indexOf(s[i]) < 0) {
if (allowedPrefixes.indexOf(s[i]) < 0) {
break;
}
}