From 301f1332728c427e3be7a6fa19148ec9d0012ef7 Mon Sep 17 00:00:00 2001 From: Simon Ser Date: Sat, 7 Sep 2024 12:36:13 +0200 Subject: [PATCH] lib/irc: move over STD_MEMBERSHIP_NAMES --- components/membership.js | 14 +++----------- lib/irc.js | 8 ++++++++ 2 files changed, 11 insertions(+), 11 deletions(-) diff --git a/components/membership.js b/components/membership.js index 36b3d73..f5ddde4 100644 --- a/components/membership.js +++ b/components/membership.js @@ -1,21 +1,13 @@ import { html, Component } from "../lib/index.js"; -// XXX: If we were feeling creative we could generate unique colors for -// each item in ISUPPORT CHANMODES. But I am not feeling creative. -const names = { - "~": "owner", - "&": "admin", - "@": "op", - "%": "halfop", - "+": "voice", -}; - export default function Membership(props) { if (!this.props.value) { return null; } - const name = names[this.props.value[0]] || ""; + // XXX: If we were feeling creative we could generate unique colors for + // each item in ISUPPORT CHANMODES. But I am not feeling creative. + const name = irc.STD_MEMBERSHIP_NAMES[this.props.value[0]] || ""; return html` ${this.props.value} diff --git a/lib/irc.js b/lib/irc.js index dafa99b..708a614 100644 --- a/lib/irc.js +++ b/lib/irc.js @@ -77,6 +77,14 @@ export const ERR_SASLALREADY = "907"; export const STD_MEMBERSHIPS = "~&@%+"; export const STD_CHANTYPES = "#&+!"; +export const STD_MEMBERSHIP_NAMES = { + "~": "owner", + "&": "admin", + "@": "operator", + "%": "halfop", + "+": "voice", +}; + const tagEscapeMap = { ";": "\\:", " ": "\\s",