extract cleanIrcMessage from client to shared

This commit is contained in:
Reto Brunner 2023-01-29 17:04:41 +01:00
parent a8149c0f1a
commit 9d34955836
3 changed files with 7 additions and 2 deletions

View File

@ -1,6 +1,6 @@
import Msg, {MessageType} from "../../models/msg"; import Msg, {MessageType} from "../../models/msg";
import LinkPrefetch from "./link"; import LinkPrefetch from "./link";
import cleanIrcMessage from "../../../client/js/helpers/ircmessageparser/cleanIrcMessage"; 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, {ChanType} from "../../models/chan";

View File

@ -2,7 +2,6 @@
"extends": "../tsconfig.base.json" /* Path to base configuration file to inherit from. Requires TypeScript version 2.1 or later. */, "extends": "../tsconfig.base.json" /* Path to base configuration file to inherit from. Requires TypeScript version 2.1 or later. */,
"include": [ "include": [
"**/*", "**/*",
"../client/js/helpers/ircmessageparser/*.ts",
"../shared/" "../shared/"
] /* Specifies a list of glob patterns that match files to be included in compilation. If no 'files' or 'include' property is present in a tsconfig.json, the compiler defaults to including all files in the containing directory and subdirectories except those specified by 'exclude'. Requires TypeScript version 2.0 or later. */, ] /* Specifies a list of glob patterns that match files to be included in compilation. If no 'files' or 'include' property is present in a tsconfig.json, the compiler defaults to including all files in the containing directory and subdirectories except those specified by 'exclude'. Requires TypeScript version 2.0 or later. */,
"files": [ "files": [

6
shared/irc.ts Normal file
View File

@ -0,0 +1,6 @@
const matchFormatting =
/\x02|\x1D|\x1F|\x16|\x0F|\x11|\x1E|\x03(?:[0-9]{1,2}(?:,[0-9]{1,2})?)?|\x04(?:[0-9a-f]{6}(?:,[0-9a-f]{6})?)?/gi;
export function cleanIrcMessage(message: string) {
return message.replace(matchFormatting, "").trim();
}