Add an extra check and log message

This commit is contained in:
calzoneman 2013-09-07 15:44:57 -05:00
parent bca7199ec1
commit 4c34625d48
3 changed files with 15 additions and 0 deletions

View File

@ -1,3 +1,8 @@
Sat Sep 7 15:43 2013 CDT
* lib/channel.js, lib/user.js: Add an extra check for channel.users[i]
to write an error message (instead of kicking) when the same user that
is connecting is the one being kicked.
Fri Sep 6 16:29 2013 CDT Fri Sep 6 16:29 2013 CDT
* lib/config.js: Add an io-host option to allow binding socket.io to * lib/config.js: Add an io-host option to allow binding socket.io to
a different IP than the webserver a different IP than the webserver

View File

@ -757,6 +757,11 @@ Channel.prototype.userJoin = function(user) {
if(user.name != "") { if(user.name != "") {
for(var i = 0; i < this.users.length; i++) { for(var i = 0; i < this.users.length; i++) {
if(this.users[i].name.toLowerCase() == user.name.toLowerCase()) { if(this.users[i].name.toLowerCase() == user.name.toLowerCase()) {
if (this.users[i] == user) {
Logger.errlog.log("Wat: userJoin() called on user "+
"already in the channel");
break;
}
this.kick(this.users[i], "Duplicate login"); this.kick(this.users[i], "Duplicate login");
} }
} }

View File

@ -639,6 +639,11 @@ User.prototype.login = function(name, pw, session) {
if(self.channel != null) { if(self.channel != null) {
for(var i = 0; i < self.channel.users.length; i++) { for(var i = 0; i < self.channel.users.length; i++) {
if(self.channel.users[i].name.toLowerCase() == name.toLowerCase()) { if(self.channel.users[i].name.toLowerCase() == name.toLowerCase()) {
if (self.channel.users[i] == self) {
Logger.errlog.log("Wat: user.login() but user"+
"already logged in on channel");
break;
}
self.channel.kick(self.channel.users[i], "Duplicate login"); self.channel.kick(self.channel.users[i], "Duplicate login");
} }
} }