mirror of
https://codeberg.org/emersion/gamja.git
synced 2024-11-25 08:48:09 -05:00
Remove App.isChannel
Replace all remaining usage with Client.isChannel. Client will be able to use the ISUPPORT tokens to check if a name is a channel.
This commit is contained in:
parent
87588abf27
commit
db7aa337cb
2 changed files with 5 additions and 10 deletions
|
@ -11,7 +11,7 @@ function getActiveClient(app) {
|
||||||
|
|
||||||
function getActiveChannel(app) {
|
function getActiveChannel(app) {
|
||||||
var activeBuffer = app.state.buffers.get(app.state.activeBuffer);
|
var activeBuffer = app.state.buffers.get(app.state.activeBuffer);
|
||||||
if (!activeBuffer || !app.isChannel(activeBuffer.name)) {
|
if (!activeBuffer || activeBuffer.type !== BufferType.CHANNEL) {
|
||||||
throw new Error("Not in a channel");
|
throw new Error("Not in a channel");
|
||||||
}
|
}
|
||||||
return activeBuffer.name;
|
return activeBuffer.name;
|
||||||
|
|
|
@ -350,7 +350,7 @@ export default class App extends Component {
|
||||||
|
|
||||||
if (msgUnread == Unread.HIGHLIGHT && window.Notification && Notification.permission === "granted" && !isDelivered && !irc.parseCTCP(msg)) {
|
if (msgUnread == Unread.HIGHLIGHT && window.Notification && Notification.permission === "granted" && !isDelivered && !irc.parseCTCP(msg)) {
|
||||||
var title = "New " + kind + " from " + msg.prefix.name;
|
var title = "New " + kind + " from " + msg.prefix.name;
|
||||||
if (this.isChannel(bufName)) {
|
if (client.isChannel(bufName)) {
|
||||||
title += " in " + bufName;
|
title += " in " + bufName;
|
||||||
}
|
}
|
||||||
var notif = new Notification(title, {
|
var notif = new Notification(title, {
|
||||||
|
@ -517,7 +517,7 @@ export default class App extends Component {
|
||||||
break;
|
break;
|
||||||
case "MODE":
|
case "MODE":
|
||||||
var target = msg.params[0];
|
var target = msg.params[0];
|
||||||
if (this.isChannel(target)) {
|
if (client.isChannel(target)) {
|
||||||
this.addMessage(serverID, target, msg);
|
this.addMessage(serverID, target, msg);
|
||||||
}
|
}
|
||||||
this.handleMode(serverID, msg);
|
this.handleMode(serverID, msg);
|
||||||
|
@ -536,7 +536,7 @@ export default class App extends Component {
|
||||||
var allowedPrefixes = client.isupport.get("STATUSMSG");
|
var allowedPrefixes = client.isupport.get("STATUSMSG");
|
||||||
if (allowedPrefixes) {
|
if (allowedPrefixes) {
|
||||||
var parts = irc.parseTargetPrefix(target, allowedPrefixes);
|
var parts = irc.parseTargetPrefix(target, allowedPrefixes);
|
||||||
if (this.isChannel(parts.name)) {
|
if (client.isChannel(parts.name)) {
|
||||||
target = parts.name;
|
target = parts.name;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -728,11 +728,6 @@ export default class App extends Component {
|
||||||
this.open(nick);
|
this.open(nick);
|
||||||
}
|
}
|
||||||
|
|
||||||
isChannel(name) {
|
|
||||||
// TODO: use the ISUPPORT token if available
|
|
||||||
return irc.STD_CHANNEL_TYPES.indexOf(name[0]) >= 0;
|
|
||||||
}
|
|
||||||
|
|
||||||
fetchBacklog(client, target, after, before) {
|
fetchBacklog(client, target, after, before) {
|
||||||
client.fetchHistoryBetween(target, after, before, CHATHISTORY_MAX_SIZE).catch((err) => {
|
client.fetchHistoryBetween(target, after, before, CHATHISTORY_MAX_SIZE).catch((err) => {
|
||||||
this.setState({ error: "Failed to fetch history for '" + taregt + "': " + err });
|
this.setState({ error: "Failed to fetch history for '" + taregt + "': " + err });
|
||||||
|
@ -748,7 +743,7 @@ export default class App extends Component {
|
||||||
|
|
||||||
var client = this.clients.get(serverID);
|
var client = this.clients.get(serverID);
|
||||||
|
|
||||||
if (this.isChannel(target)) {
|
if (client.isChannel(target)) {
|
||||||
this.switchToChannel = target;
|
this.switchToChannel = target;
|
||||||
client.send({ command: "JOIN", params: [target] });
|
client.send({ command: "JOIN", params: [target] });
|
||||||
} else {
|
} else {
|
||||||
|
|
Loading…
Reference in a new issue