mirror of
https://git.sr.ht/~emersion/gamja
synced 2024-11-25 00:58:08 -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) {
|
||||
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");
|
||||
}
|
||||
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)) {
|
||||
var title = "New " + kind + " from " + msg.prefix.name;
|
||||
if (this.isChannel(bufName)) {
|
||||
if (client.isChannel(bufName)) {
|
||||
title += " in " + bufName;
|
||||
}
|
||||
var notif = new Notification(title, {
|
||||
|
@ -517,7 +517,7 @@ export default class App extends Component {
|
|||
break;
|
||||
case "MODE":
|
||||
var target = msg.params[0];
|
||||
if (this.isChannel(target)) {
|
||||
if (client.isChannel(target)) {
|
||||
this.addMessage(serverID, target, msg);
|
||||
}
|
||||
this.handleMode(serverID, msg);
|
||||
|
@ -536,7 +536,7 @@ export default class App extends Component {
|
|||
var allowedPrefixes = client.isupport.get("STATUSMSG");
|
||||
if (allowedPrefixes) {
|
||||
var parts = irc.parseTargetPrefix(target, allowedPrefixes);
|
||||
if (this.isChannel(parts.name)) {
|
||||
if (client.isChannel(parts.name)) {
|
||||
target = parts.name;
|
||||
}
|
||||
}
|
||||
|
@ -728,11 +728,6 @@ export default class App extends Component {
|
|||
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) {
|
||||
client.fetchHistoryBetween(target, after, before, CHATHISTORY_MAX_SIZE).catch((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);
|
||||
|
||||
if (this.isChannel(target)) {
|
||||
if (client.isChannel(target)) {
|
||||
this.switchToChannel = target;
|
||||
client.send({ command: "JOIN", params: [target] });
|
||||
} else {
|
||||
|
|
Loading…
Reference in a new issue