Add support for draft/read-marker

References: https://github.com/ircv3/ircv3-specifications/pull/489
This commit is contained in:
Simon Ser 2022-06-27 16:08:15 +02:00
parent 839e46360e
commit 1428ec4d49
2 changed files with 34 additions and 10 deletions

View file

@ -1015,4 +1015,32 @@ export default class Client extends EventTarget {
return { message: msg.params[2] };
});
}
supportsReadMarker() {
return this.caps.enabled.has("draft/read-marker") || this.caps.enabled.has("soju.im/read");
}
_markReadCmd() {
if (this.caps.enabled.has("draft/read-marker")) {
return "MARKREAD";
} else if (this.caps.enabled.has("soju.im/read")) {
return "READ";
} else {
return null;
}
}
fetchReadMarker(target) {
this.send({
command: this._markReadCmd(),
params: [target],
});
}
setReadMarker(target, t) {
this.send({
command: this._markReadCmd(),
params: [target, "timestamp="+t],
});
}
}