fade6a8d2e
This documents what we actually want and allows us to shift the logic to the network
29 lines
662 B
TypeScript
29 lines
662 B
TypeScript
import {IrcEventHandler} from "../../client";
|
|
|
|
import Msg, {MessageType} from "../../models/msg";
|
|
|
|
export default <IrcEventHandler>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({
|
|
type: 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);
|
|
});
|
|
};
|