mirror of
https://git.sr.ht/~emersion/gamja
synced 2024-11-15 03:35:10 -05:00
Add isChannel
This commit is contained in:
parent
f5106f1357
commit
df0981e8e0
2 changed files with 8 additions and 2 deletions
|
@ -261,6 +261,11 @@ export default class App extends Component {
|
|||
this.connect(connectParams);
|
||||
}
|
||||
|
||||
isChannel(name) {
|
||||
// TODO: use the ISUPPORT token if available
|
||||
return irc.STD_CHANNEL_TYPES.indexOf(name[0]) >= 0;
|
||||
}
|
||||
|
||||
executeCommand(s) {
|
||||
var parts = s.split(" ");
|
||||
var cmd = parts[0].toLowerCase().slice(1);
|
||||
|
@ -281,9 +286,8 @@ export default class App extends Component {
|
|||
this.client.send({ command: "JOIN", params: [channel] });
|
||||
break;
|
||||
case "part":
|
||||
// TODO: check whether the buffer is a channel with the ISUPPORT token
|
||||
// TODO: part reason
|
||||
if (!this.state.activeBuffer || this.state.activeBuffer == SERVER_BUFFER) {
|
||||
if (!this.state.activeBuffer || !this.isChannel(this.state.activeBuffer)) {
|
||||
console.error("Not in a channel");
|
||||
return;
|
||||
}
|
||||
|
|
|
@ -13,6 +13,8 @@ export const ERR_SASLTOOLONG = "905";
|
|||
export const ERR_SASLABORTED = "906";
|
||||
export const ERR_SASLALREADY = "907";
|
||||
|
||||
export const STD_CHANNEL_TYPES = "#&+!";
|
||||
|
||||
var tagsEscape = {
|
||||
";": "\\:",
|
||||
" ": "\\s",
|
||||
|
|
Loading…
Reference in a new issue