2016-02-12 11:24:13 +00:00
|
|
|
var Msg = require("../../models/msg");
|
|
|
|
|
|
|
|
module.exports = function(irc, network) {
|
|
|
|
var client = this;
|
|
|
|
irc.on("invite", function(data) {
|
|
|
|
var target = data.to;
|
|
|
|
|
2016-03-20 14:28:47 +00:00
|
|
|
var chan = network.getChannel(data.channel);
|
2016-02-12 11:24:13 +00:00
|
|
|
if (typeof chan === "undefined") {
|
|
|
|
chan = network.channels[0];
|
|
|
|
}
|
|
|
|
|
|
|
|
var msg = new Msg({
|
|
|
|
type: Msg.Type.INVITE,
|
|
|
|
from: data.from,
|
|
|
|
target: target,
|
2016-02-28 08:21:19 +00:00
|
|
|
text: data.channel,
|
2016-03-07 21:09:42 +00:00
|
|
|
invitedYou: target === irc.user.nick
|
2016-02-12 11:24:13 +00:00
|
|
|
});
|
|
|
|
chan.messages.push(msg);
|
|
|
|
client.emit("msg", {
|
|
|
|
chan: chan.id,
|
|
|
|
msg: msg
|
|
|
|
});
|
|
|
|
});
|
|
|
|
};
|