Add Client.join, show join errors in popup

This commit is contained in:
Simon Ser 2021-12-04 17:44:23 +01:00
parent fc8aa30756
commit 05f7c6e9fe
3 changed files with 36 additions and 2 deletions

View file

@ -789,6 +789,32 @@ export default class Client extends EventTarget {
});
}
join(channel) {
let msg = {
command: "JOIN",
params: [channel],
};
return this.roundtrip(msg, (msg) => {
switch (msg.command) {
case irc.ERR_NOSUCHCHANNEL:
case irc.ERR_TOOMANYCHANNELS:
case irc.ERR_BADCHANNELKEY:
case irc.ERR_BANNEDFROMCHAN:
case irc.ERR_CHANNELISFULL:
case irc.ERR_INVITEONLYCHAN:
if (this.cm(msg.params[1]) === this.cm(channel)) {
throw new IRCError(msg);
}
break;
case "JOIN":
if (this.isMyNick(msg.prefix.name) && this.cm(msg.params[0]) === this.cm(channel)) {
return true;
}
break;
}
});
}
fetchBatch(msg, batchType) {
let batchName = null;
let messages = [];