Fix #1692 when kicker is server

This commit is contained in:
Pavel Djundik 2017-11-08 23:10:17 +02:00
parent f8af23c64a
commit feb7d9d4bb
2 changed files with 7 additions and 2 deletions

View File

@ -2,6 +2,7 @@
var _ = require("lodash");
var Helper = require("../helper");
const User = require("./user");
const userLog = require("../userLog");
const storage = require("../plugins/storage");
@ -121,6 +122,10 @@ Chan.prototype.findUser = function(nick) {
return _.find(this.users, {nick: nick});
};
Chan.prototype.getUser = function(nick) {
return this.findUser(nick) || new User({nick: nick});
};
Chan.prototype.getMode = function(name) {
var user = this.findUser(name);
if (user) {

View File

@ -11,8 +11,8 @@ module.exports = function(irc, network) {
return;
}
const kicker = chan.findUser(data.nick);
const target = chan.findUser(data.kicked);
const kicker = chan.getUser(data.nick);
const target = chan.getUser(data.kicked);
if (data.kicked === irc.user.nick) {
chan.users = [];