2014-06-29 19:41:02 +00:00
|
|
|
var _ = require("lodash");
|
2014-06-30 01:20:54 +00:00
|
|
|
var Msg = require("../../models/msg");
|
2014-06-29 19:41:02 +00:00
|
|
|
|
|
|
|
module.exports = function(irc, network) {
|
|
|
|
var client = this;
|
|
|
|
irc.on("mode", function(data) {
|
|
|
|
var chan = _.findWhere(network.channels, {name: data.target});
|
|
|
|
if (typeof chan !== "undefined") {
|
|
|
|
setTimeout(function() {
|
|
|
|
irc.write("NAMES " + data.target);
|
|
|
|
}, 200);
|
|
|
|
var nick = data.nick;
|
|
|
|
if (nick.indexOf(".") !== -1) {
|
|
|
|
nick = data.target;
|
|
|
|
}
|
|
|
|
var msg = new Msg({
|
|
|
|
type: Msg.Type.MODE,
|
|
|
|
from: nick,
|
|
|
|
text: data.mode + " " + data.client,
|
|
|
|
});
|
|
|
|
chan.messages.push(msg);
|
|
|
|
client.emit("msg", {
|
|
|
|
chan: chan.id,
|
|
|
|
msg: msg,
|
|
|
|
});
|
|
|
|
}
|
|
|
|
});
|
2014-06-26 23:05:47 +00:00
|
|
|
};
|