UNPKG

twiedenbein-thelounge

Version:

The self-hosted Web IRC client

43 lines (42 loc) 1.46 kB
"use strict"; var __importDefault = (this && this.__importDefault) || function (mod) { return (mod && mod.__esModule) ? mod : { "default": mod }; }; Object.defineProperty(exports, "__esModule", { value: true }); const msg_1 = __importDefault(require("../../models/msg")); const msg_2 = require("../../../shared/types/msg"); exports.default = (function (irc, network) { const client = this; irc.on("topic", function (data) { const chan = network.getChannel(data.channel); if (typeof chan === "undefined") { return; } const msg = new msg_1.default({ time: data.time, type: msg_2.MessageType.TOPIC, from: data.nick && chan.getUser(data.nick), text: data.topic, self: data.nick === irc.user.nick, }); chan.pushMessage(client, msg); chan.topic = data.topic; client.emit("topic", { chan: chan.id, topic: chan.topic, }); }); irc.on("topicsetby", function (data) { const chan = network.getChannel(data.channel); if (typeof chan === "undefined") { return; } const msg = new msg_1.default({ type: msg_2.MessageType.TOPIC_SET_BY, from: chan.getUser(data.nick), when: new Date(data.when * 1000), self: data.nick === irc.user.nick, }); chan.pushMessage(client, msg); }); });