mirror of
https://github.com/thelounge/thelounge.git
synced 2024-06-01 21:32:17 +02:00
27 lines
532 B
JavaScript
27 lines
532 B
JavaScript
var Msg = require("../../models/msg");
|
|
|
|
module.exports = function(irc, network) {
|
|
var client = this;
|
|
irc.on("invite", function(data) {
|
|
var target = data.to;
|
|
|
|
var chan = network.getChannel(data.channel);
|
|
if (typeof chan === "undefined") {
|
|
chan = network.channels[0];
|
|
}
|
|
|
|
var msg = new Msg({
|
|
type: Msg.Type.INVITE,
|
|
from: data.from,
|
|
target: target,
|
|
text: data.channel,
|
|
invitedYou: target === irc.user.nick
|
|
});
|
|
chan.messages.push(msg);
|
|
client.emit("msg", {
|
|
chan: chan.id,
|
|
msg: msg
|
|
});
|
|
});
|
|
};
|