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

View File

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