move chan enums

This commit is contained in:
Reto Brunner 2024-02-24 11:13:11 +01:00
parent b67e4699f5
commit 3f0ee6a961
22 changed files with 27 additions and 40 deletions

View file

@ -6,7 +6,7 @@ import crypto from "crypto";
import colors from "chalk"; import colors from "chalk";
import log from "./log"; import log from "./log";
import Chan, {ChanConfig, Channel, ChanType} from "./models/chan"; import Chan, {ChanConfig} from "./models/chan";
import Msg from "./models/msg"; import Msg from "./models/msg";
import Config from "./config"; import Config from "./config";
import {condensedTypes} from "../shared/irc"; import {condensedTypes} from "../shared/irc";
@ -21,6 +21,7 @@ import ClientManager from "./clientManager";
import {MessageStorage, SearchResponse} from "./plugins/messageStorage/types"; import {MessageStorage, SearchResponse} from "./plugins/messageStorage/types";
import {StorageCleaner} from "./storageCleaner"; import {StorageCleaner} from "./storageCleaner";
import {SearchQuery} from "../shared/types/storage"; import {SearchQuery} from "../shared/types/storage";
import {ChanType} from "../shared/types/chan";
type OrderItem = Chan["id"] | Network["uuid"]; type OrderItem = Chan["id"] | Network["uuid"];
type Order = OrderItem[]; type Order = OrderItem[];

View file

@ -8,25 +8,7 @@ import Client from "../client";
import Network from "./network"; import Network from "./network";
import Prefix from "./prefix"; import Prefix from "./prefix";
import {MessageType} from "../../shared/types/msg"; import {MessageType} from "../../shared/types/msg";
import {ChanType, SpecialChanType, ChanState} from "../../shared/types/chan";
export enum ChanType {
CHANNEL = "channel",
LOBBY = "lobby",
QUERY = "query",
SPECIAL = "special",
}
export enum SpecialChanType {
BANLIST = "list_bans",
INVITELIST = "list_invites",
CHANNELLIST = "list_channels",
IGNORELIST = "list_ignored",
}
export enum ChanState {
PARTED = 0,
JOINED = 1,
}
// eslint-disable-next-line no-use-before-define // eslint-disable-next-line no-use-before-define
export type FilteredChannel = Chan & { export type FilteredChannel = Chan & {

View file

@ -1,7 +1,7 @@
import _ from "lodash"; import _ from "lodash";
import {v4 as uuidv4} from "uuid"; import {v4 as uuidv4} from "uuid";
import IrcFramework, {Client as IRCClient} from "irc-framework"; import IrcFramework, {Client as IRCClient} from "irc-framework";
import Chan, {ChanConfig, Channel, ChanType} from "./chan"; import Chan, {ChanConfig, Channel} from "./chan";
import Msg from "./msg"; import Msg from "./msg";
import Prefix from "./prefix"; import Prefix from "./prefix";
import Helper, {Hostmask} from "../helper"; import Helper, {Hostmask} from "../helper";
@ -10,6 +10,7 @@ import STSPolicies from "../plugins/sts";
import ClientCertificate, {ClientCertificateType} from "../plugins/clientCertificate"; import ClientCertificate, {ClientCertificateType} from "../plugins/clientCertificate";
import Client from "../client"; import Client from "../client";
import {MessageType} from "../../shared/types/msg"; import {MessageType} from "../../shared/types/msg";
import {ChanType} from "../../shared/types/chan";
/** /**
* List of keys which should be sent to the client by default. * List of keys which should be sent to the client by default.

View file

@ -1,7 +1,7 @@
import {PluginInputHandler} from "./index"; import {PluginInputHandler} from "./index";
import Msg from "../../models/msg"; import Msg from "../../models/msg";
import {ChanType} from "../../models/chan";
import {MessageType} from "../../../shared/types/msg"; import {MessageType} from "../../../shared/types/msg";
import {ChanType} from "../../../shared/types/chan";
const commands = ["slap", "me"]; const commands = ["slap", "me"];

View file

@ -1,7 +1,7 @@
import {ChanType} from "../../models/chan";
import Msg from "../../models/msg"; import Msg from "../../models/msg";
import {PluginInputHandler} from "./index"; import {PluginInputHandler} from "./index";
import {MessageType} from "../../../shared/types/msg"; import {MessageType} from "../../../shared/types/msg";
import {ChanType} from "../../../shared/types/chan";
const commands = ["ban", "unban", "banlist", "kickban"]; const commands = ["ban", "unban", "banlist", "kickban"];

View file

@ -2,8 +2,8 @@ import Msg from "../../models/msg";
import Helper from "../../helper"; import Helper from "../../helper";
import {PluginInputHandler} from "./index"; import {PluginInputHandler} from "./index";
import {IgnoreListItem} from "../../models/network"; import {IgnoreListItem} from "../../models/network";
import {ChanType, SpecialChanType} from "../../models/chan";
import {MessageType} from "../../../shared/types/msg"; import {MessageType} from "../../../shared/types/msg";
import {ChanType, SpecialChanType} from "../../../shared/types/chan";
const commands = ["ignore", "unignore", "ignorelist"]; const commands = ["ignore", "unignore", "ignorelist"];

View file

@ -1,7 +1,7 @@
import {PluginInputHandler} from "./index"; import {PluginInputHandler} from "./index";
import Msg from "../../models/msg"; import Msg from "../../models/msg";
import {ChanType} from "../../models/chan";
import {MessageType} from "../../../shared/types/msg"; import {MessageType} from "../../../shared/types/msg";
import {ChanType} from "../../../shared/types/chan";
const commands = ["invite", "invitelist"]; const commands = ["invite", "invitelist"];

View file

@ -1,7 +1,7 @@
import {PluginInputHandler} from "./index"; import {PluginInputHandler} from "./index";
import Msg from "../../models/msg"; import Msg from "../../models/msg";
import {ChanType} from "../../models/chan";
import {MessageType} from "../../../shared/types/msg"; import {MessageType} from "../../../shared/types/msg";
import {ChanType} from "../../../shared/types/chan";
const commands = ["kick"]; const commands = ["kick"];

View file

@ -1,8 +1,8 @@
import {PluginInputHandler} from "./index"; import {PluginInputHandler} from "./index";
import Msg from "../../models/msg"; import Msg from "../../models/msg";
import {ChanType} from "../../models/chan";
import {MessageType} from "../../../shared/types/msg"; import {MessageType} from "../../../shared/types/msg";
import {ChanType} from "../../../shared/types/chan";
const commands = ["mode", "umode", "op", "deop", "hop", "dehop", "voice", "devoice"]; const commands = ["mode", "umode", "op", "deop", "hop", "dehop", "voice", "devoice"];

View file

@ -1,7 +1,8 @@
import {PluginInputHandler} from "./index"; import {PluginInputHandler} from "./index";
import Msg from "../../models/msg"; import Msg from "../../models/msg";
import Chan, {ChanType} from "../../models/chan"; import Chan from "../../models/chan";
import {MessageType} from "../../../shared/types/msg"; import {MessageType} from "../../../shared/types/msg";
import {ChanType} from "../../../shared/types/chan";
const commands = ["query", "msg", "say"]; const commands = ["query", "msg", "say"];

View file

@ -2,8 +2,8 @@ import {PluginInputHandler} from "./index";
import Msg from "../../models/msg"; import Msg from "../../models/msg";
import Config from "../../config"; import Config from "../../config";
import {ChanType, ChanState} from "../../models/chan";
import {MessageType} from "../../../shared/types/msg"; import {MessageType} from "../../../shared/types/msg";
import {ChanType, ChanState} from "../../../shared/types/chan";
const commands = ["close", "leave", "part"]; const commands = ["close", "leave", "part"];
const allowDisconnected = true; const allowDisconnected = true;

View file

@ -1,8 +1,8 @@
import {PluginInputHandler} from "./index"; import {PluginInputHandler} from "./index";
import Msg from "../../models/msg"; import Msg from "../../models/msg";
import {ChanType} from "../../models/chan";
import {MessageType} from "../../../shared/types/msg"; import {MessageType} from "../../../shared/types/msg";
import {ChanType} from "../../../shared/types/chan";
const commands = ["cycle", "rejoin"]; const commands = ["cycle", "rejoin"];

View file

@ -1,8 +1,8 @@
import {PluginInputHandler} from "./index"; import {PluginInputHandler} from "./index";
import Msg from "../../models/msg"; import Msg from "../../models/msg";
import {ChanType} from "../../models/chan";
import {MessageType} from "../../../shared/types/msg"; import {MessageType} from "../../../shared/types/msg";
import {ChanType} from "../../../shared/types/chan";
const commands = ["topic"]; const commands = ["topic"];

View file

@ -1,7 +1,7 @@
import {IrcEventHandler} from "../../client"; import {IrcEventHandler} from "../../client";
import {ChanType} from "../../models/chan";
import Msg from "../../models/msg"; import Msg from "../../models/msg";
import {MessageType} from "../../../shared/types/msg"; import {MessageType} from "../../../shared/types/msg";
import {ChanType} from "../../../shared/types/chan";
export default <IrcEventHandler>function (irc, network) { export default <IrcEventHandler>function (irc, network) {
const client = this; const client = this;

View file

@ -6,8 +6,8 @@ import log from "../../log";
import Msg from "../../models/msg"; import Msg from "../../models/msg";
import Helper from "../../helper"; import Helper from "../../helper";
import Config from "../../config"; import Config from "../../config";
import {ChanType, ChanState} from "../../models/chan";
import {MessageType} from "../../../shared/types/msg"; import {MessageType} from "../../../shared/types/msg";
import {ChanType, ChanState} from "../../../shared/types/chan";
export default <IrcEventHandler>function (irc, network) { export default <IrcEventHandler>function (irc, network) {
const client = this; const client = this;

View file

@ -1,8 +1,8 @@
import Msg from "../../models/msg"; import Msg from "../../models/msg";
import User from "../../models/user"; import User from "../../models/user";
import type {IrcEventHandler} from "../../client"; import type {IrcEventHandler} from "../../client";
import {ChanState} from "../../models/chan";
import {MessageType} from "../../../shared/types/msg"; import {MessageType} from "../../../shared/types/msg";
import {ChanState} from "../../../shared/types/chan";
export default <IrcEventHandler>function (irc, network) { export default <IrcEventHandler>function (irc, network) {
const client = this; const client = this;

View file

@ -1,9 +1,9 @@
import {IrcEventHandler} from "../../client"; import {IrcEventHandler} from "../../client";
import {ChanState} from "../../models/chan";
import Msg from "../../models/msg"; import Msg from "../../models/msg";
import User from "../../models/user"; import User from "../../models/user";
import {MessageType} from "../../../shared/types/msg"; import {MessageType} from "../../../shared/types/msg";
import {ChanState} from "../../../shared/types/chan";
export default <IrcEventHandler>function (irc, network) { export default <IrcEventHandler>function (irc, network) {
const client = this; const client = this;

View file

@ -1,6 +1,7 @@
import {IrcEventHandler} from "../../client"; import {IrcEventHandler} from "../../client";
import Chan, {ChanType, SpecialChanType} from "../../models/chan"; import Chan from "../../models/chan";
import {ChanType, SpecialChanType} from "../../../shared/types/chan";
export default <IrcEventHandler>function (irc, network) { export default <IrcEventHandler>function (irc, network) {
const client = this; const client = this;

View file

@ -3,9 +3,10 @@ import LinkPrefetch from "./link";
import {cleanIrcMessage} from "../../../shared/irc"; import {cleanIrcMessage} from "../../../shared/irc";
import Helper from "../../helper"; import Helper from "../../helper";
import {IrcEventHandler} from "../../client"; import {IrcEventHandler} from "../../client";
import Chan, {ChanType} from "../../models/chan"; import Chan from "../../models/chan";
import User from "../../models/user"; import User from "../../models/user";
import {MessageType} from "../../../shared/types/msg"; import {MessageType} from "../../../shared/types/msg";
import {ChanType} from "../../../shared/types/chan";
const nickRegExp = /(?:\x03[0-9]{1,2}(?:,[0-9]{1,2})?)?([\w[\]\\`^{|}-]+)/g; const nickRegExp = /(?:\x03[0-9]{1,2}(?:,[0-9]{1,2})?)?([\w[\]\\`^{|}-]+)/g;

View file

@ -1,8 +1,8 @@
import {IrcEventHandler} from "../../client"; import {IrcEventHandler} from "../../client";
import {SpecialChanType, ChanType} from "../../models/chan";
import Msg from "../../models/msg"; import Msg from "../../models/msg";
import {MessageType} from "../../../shared/types/msg"; import {MessageType} from "../../../shared/types/msg";
import {SpecialChanType, ChanType} from "../../../shared/types/chan";
export default <IrcEventHandler>function (irc, network) { export default <IrcEventHandler>function (irc, network) {
const client = this; const client = this;

View file

@ -1,8 +1,8 @@
import {IrcEventHandler} from "../../client"; import {IrcEventHandler} from "../../client";
import {ChanType} from "../../models/chan";
import Msg from "../../models/msg"; import Msg from "../../models/msg";
import {MessageType} from "../../../shared/types/msg"; import {MessageType} from "../../../shared/types/msg";
import {ChanType} from "../../../shared/types/chan";
export default <IrcEventHandler>function (irc, network) { export default <IrcEventHandler>function (irc, network) {
const client = this; const client = this;

View file

@ -24,7 +24,6 @@ themes.loadLocalThemes();
import packages from "./plugins/packages/index"; import packages from "./plugins/packages/index";
import {NetworkWithIrcFramework} from "./models/network"; import {NetworkWithIrcFramework} from "./models/network";
import {ChanType} from "./models/chan";
import Utils from "./command-line/utils"; import Utils from "./command-line/utils";
import type { import type {
ClientToServerEvents, ClientToServerEvents,
@ -32,6 +31,7 @@ import type {
InterServerEvents, InterServerEvents,
SocketData, SocketData,
} from "../shared/types/socket-events"; } from "../shared/types/socket-events";
import {ChanType} from "../shared/types/chan";
type ServerOptions = { type ServerOptions = {
dev: boolean; dev: boolean;