Add Client.join, show join errors in popup
This commit is contained in:
parent
fc8aa30756
commit
05f7c6e9fe
3 changed files with 36 additions and 2 deletions
|
@ -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 = [];
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue