diff --git a/src/client.js b/src/client.js index 805c8a1..95a050b 100644 --- a/src/client.js +++ b/src/client.js @@ -45,6 +45,7 @@ var inputs = [ "part", "quit", "raw", + "services", "topic", "whois" ]; diff --git a/src/plugins/inputs/msg.js b/src/plugins/inputs/msg.js index b502b46..7757be9 100644 --- a/src/plugins/inputs/msg.js +++ b/src/plugins/inputs/msg.js @@ -1,5 +1,4 @@ var _ = require("lodash"); -var Msg = require("../../models/msg"); module.exports = function(network, chan, cmd, args) { if (cmd != "say" && cmd != "msg") { @@ -19,14 +18,14 @@ module.exports = function(network, chan, cmd, args) { } else { target = chan.name; } - var text = args.join(" "); - irc.send(target, text); + var msg = args.join(" "); + irc.send(target, msg); var channel = _.find(network.channels, {name: target}); if (typeof channel !== "undefined") { irc.emit("message", { from: irc.me, to: channel.name, - message: text + message: msg }); } }; diff --git a/src/plugins/inputs/services.js b/src/plugins/inputs/services.js new file mode 100644 index 0000000..515fd3e --- /dev/null +++ b/src/plugins/inputs/services.js @@ -0,0 +1,26 @@ +var _ = require("lodash"); + +module.exports = function(network, chan, cmd, args) { + if (cmd != "ns" && cmd != "cs" && cmd != "hs") { + return; + } + var target = ({ + "ns": "nickserv", + "cs": "chanserv", + "hs": "hostserv", + })[cmd]; + if (!target || args.length === 0 || args[0] === "") { + return; + } + var irc = network.irc; + var msg = args.join(" "); + irc.send(target, msg); + var channel = _.find(network.channels, {name: target}); + if (typeof channel !== "undefined") { + irc.emit("message", { + from: irc.me, + to: channel.name, + message: msg + }); + } +};