commit
b2625aebae
@ -32,7 +32,7 @@
|
||||
"commander": "2.9.0",
|
||||
"event-stream": "3.3.2",
|
||||
"express": "4.13.4",
|
||||
"lodash": "~2.4.1",
|
||||
"lodash": "4.5.0",
|
||||
"mkdirp": "0.5.1",
|
||||
"moment": "2.11.2",
|
||||
"read": "1.0.7",
|
||||
|
@ -110,7 +110,7 @@ ClientManager.prototype.removeUser = function(name) {
|
||||
ClientManager.prototype.autoload = function(/* sockets */) {
|
||||
var self = this;
|
||||
setInterval(function() {
|
||||
var loaded = _.pluck(
|
||||
var loaded = _.map(
|
||||
self.clients,
|
||||
"name"
|
||||
);
|
||||
@ -135,4 +135,3 @@ ClientManager.prototype.autoload = function(/* sockets */) {
|
||||
});
|
||||
}, 1000);
|
||||
};
|
||||
|
||||
|
@ -46,8 +46,8 @@ Network.prototype.export = function() {
|
||||
"commands"
|
||||
]);
|
||||
network.nick = (this.irc || {}).me;
|
||||
network.join = _.pluck(
|
||||
_.where(this.channels, {type: "channel"}),
|
||||
network.join = _.map(
|
||||
_.filter(this.channels, {type: "channel"}),
|
||||
"name"
|
||||
).join(",");
|
||||
return network;
|
||||
|
@ -10,7 +10,7 @@ module.exports = function(network, chan, cmd, args) {
|
||||
var irc = network.irc;
|
||||
irc.notice(args[0], message);
|
||||
|
||||
var targetChan = _.findWhere(network.channels, {name: args[0]});
|
||||
var targetChan = _.find(network.channels, {name: args[0]});
|
||||
if (typeof targetChan === "undefined") {
|
||||
message = "{to " + args[0] + "} " + message;
|
||||
targetChan = chan;
|
||||
|
@ -5,7 +5,7 @@ module.exports = function(irc, network) {
|
||||
var client = this;
|
||||
irc.on("kick", function(data) {
|
||||
var from = data.nick;
|
||||
var chan = _.findWhere(network.channels, {name: data.channel});
|
||||
var chan = _.find(network.channels, {name: data.channel});
|
||||
var mode = chan.getMode(from);
|
||||
|
||||
if (typeof chan === "undefined") {
|
||||
@ -15,7 +15,7 @@ module.exports = function(irc, network) {
|
||||
if (data.client === irc.me) {
|
||||
chan.users = [];
|
||||
} else {
|
||||
chan.users = _.without(chan.users, _.findWhere(chan.users, {name: data.client}));
|
||||
chan.users = _.without(chan.users, _.find(chan.users, {name: data.client}));
|
||||
}
|
||||
|
||||
client.emit("users", {
|
||||
|
@ -29,7 +29,7 @@ module.exports = function(irc, network) {
|
||||
}
|
||||
|
||||
var self = data.to.toLowerCase() === irc.me.toLowerCase();
|
||||
var chan = _.findWhere(network.channels, {name: self ? data.from : data.to});
|
||||
var chan = _.find(network.channels, {name: self ? data.from : data.to});
|
||||
if (typeof chan === "undefined") {
|
||||
return;
|
||||
}
|
||||
|
@ -15,7 +15,7 @@ module.exports = function(irc, network) {
|
||||
target = data.from;
|
||||
}
|
||||
|
||||
var chan = _.findWhere(network.channels, {name: target});
|
||||
var chan = _.find(network.channels, {name: target});
|
||||
if (typeof chan === "undefined") {
|
||||
chan = new Chan({
|
||||
type: Chan.Type.QUERY,
|
||||
|
@ -4,7 +4,7 @@ var Msg = require("../../models/msg");
|
||||
module.exports = function(irc, network) {
|
||||
var client = this;
|
||||
irc.on("mode", function(data) {
|
||||
var chan = _.findWhere(network.channels, {name: data.target});
|
||||
var chan = _.find(network.channels, {name: data.target});
|
||||
if (typeof chan !== "undefined") {
|
||||
setTimeout(function() {
|
||||
irc.write("NAMES " + data.target);
|
||||
|
@ -4,7 +4,7 @@ var User = require("../../models/user");
|
||||
module.exports = function(irc, network) {
|
||||
var client = this;
|
||||
irc.on("names", function(data) {
|
||||
var chan = _.findWhere(network.channels, {name: data.channel});
|
||||
var chan = _.find(network.channels, {name: data.channel});
|
||||
if (typeof chan === "undefined") {
|
||||
return;
|
||||
}
|
||||
|
@ -24,7 +24,7 @@ module.exports = function(irc, network) {
|
||||
});
|
||||
}
|
||||
network.channels.forEach(function(chan) {
|
||||
var user = _.findWhere(chan.users, {name: data.nick});
|
||||
var user = _.find(chan.users, {name: data.nick});
|
||||
if (typeof user === "undefined") {
|
||||
return;
|
||||
}
|
||||
|
@ -9,7 +9,7 @@ module.exports = function(irc, network) {
|
||||
target = data.from;
|
||||
}
|
||||
|
||||
var chan = _.findWhere(network.channels, {name: target});
|
||||
var chan = _.find(network.channels, {name: target});
|
||||
if (typeof chan === "undefined") {
|
||||
chan = network.channels[0];
|
||||
}
|
||||
|
@ -4,7 +4,7 @@ var Msg = require("../../models/msg");
|
||||
module.exports = function(irc, network) {
|
||||
var client = this;
|
||||
irc.on("part", function(data) {
|
||||
var chan = _.findWhere(network.channels, {name: data.channels[0]});
|
||||
var chan = _.find(network.channels, {name: data.channels[0]});
|
||||
if (typeof chan === "undefined") {
|
||||
return;
|
||||
}
|
||||
@ -16,7 +16,7 @@ module.exports = function(irc, network) {
|
||||
chan: chan.id
|
||||
});
|
||||
} else {
|
||||
var user = _.findWhere(chan.users, {name: from});
|
||||
var user = _.find(chan.users, {name: from});
|
||||
chan.users = _.without(chan.users, user);
|
||||
client.emit("users", {
|
||||
chan: chan.id
|
||||
|
@ -6,7 +6,7 @@ module.exports = function(irc, network) {
|
||||
irc.on("quit", function(data) {
|
||||
network.channels.forEach(function(chan) {
|
||||
var from = data.nick;
|
||||
var user = _.findWhere(chan.users, {name: from});
|
||||
var user = _.find(chan.users, {name: from});
|
||||
if (typeof user === "undefined") {
|
||||
return;
|
||||
}
|
||||
|
@ -4,7 +4,7 @@ var Msg = require("../../models/msg");
|
||||
module.exports = function(irc, network) {
|
||||
var client = this;
|
||||
irc.on("topic", function(data) {
|
||||
var chan = _.findWhere(network.channels, {name: data.channel});
|
||||
var chan = _.find(network.channels, {name: data.channel});
|
||||
if (typeof chan === "undefined") {
|
||||
return;
|
||||
}
|
||||
|
@ -8,7 +8,7 @@ module.exports = function(irc, network) {
|
||||
if (data === null) {
|
||||
return;
|
||||
}
|
||||
var chan = _.findWhere(network.channels, {name: data.nickname});
|
||||
var chan = _.find(network.channels, {name: data.nickname});
|
||||
if (typeof chan === "undefined") {
|
||||
chan = new Chan({
|
||||
type: Chan.Type.QUERY,
|
||||
|
@ -77,12 +77,10 @@ function index(req, res, next) {
|
||||
require("../package.json"),
|
||||
config
|
||||
);
|
||||
var template = _.template(file);
|
||||
res.setHeader("Content-Type", "text/html");
|
||||
res.writeHead(200);
|
||||
res.end(_.template(
|
||||
file,
|
||||
data
|
||||
));
|
||||
res.end(template(data));
|
||||
});
|
||||
}
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user