Add Client.join, show join errors in popup
This commit is contained in:
@@ -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 = [];
|
||||
|
||||
@@ -34,6 +34,8 @@ export const RPL_MOTDSTART = "375";
|
||||
export const RPL_ENDOFMOTD = "376";
|
||||
export const ERR_UNKNOWNERROR = "400";
|
||||
export const ERR_NOSUCHNICK = "401";
|
||||
export const ERR_NOSUCHCHANNEL = "403";
|
||||
export const ERR_TOOMANYCHANNELS = "405";
|
||||
export const ERR_UNKNOWNCOMMAND = "421";
|
||||
export const ERR_NOMOTD = "422";
|
||||
export const ERR_ERRONEUSNICKNAME = "432";
|
||||
@@ -43,6 +45,10 @@ export const ERR_NEEDMOREPARAMS = "461";
|
||||
export const ERR_NOPERMFORHOST = "463";
|
||||
export const ERR_PASSWDMISMATCH = "464";
|
||||
export const ERR_YOUREBANNEDCREEP = "465";
|
||||
export const ERR_CHANNELISFULL = "471";
|
||||
export const ERR_INVITEONLYCHAN = "473";
|
||||
export const ERR_BANNEDFROMCHAN = "474";
|
||||
export const ERR_BADCHANNELKEY = "475";
|
||||
// RFC 2812
|
||||
export const ERR_UNAVAILRESOURCE = "437";
|
||||
// Other
|
||||
|
||||
Reference in New Issue
Block a user