"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("invite", function (data) {
        let chan = network.getChannel(data.channel);
        if (typeof chan === "undefined") {
            chan = network.getLobby();
        }
        const invitedYou = data.invited === irc.user.nick;
        const msg = new msg_1.default({
            type: msg_2.MessageType.INVITE,
            time: data.time,
            from: chan.getUser(data.nick),
            target: chan.getUser(data.invited),
            channel: data.channel,
            highlight: invitedYou,
            invitedYou: invitedYou,
        });
        chan.pushMessage(client, msg);
    });
});
