Skip to content
Browse files

Merge pull request #1 from Hypnopompia/upstream

Fix for bot crashing on user quit.
  • Loading branch information...
2 parents b91c940 + bb8613a commit e354dcb5d9fe8d52f2e4d4131b054239e6570359 @ktiedt committed May 1, 2012
Showing with 6 additions and 6 deletions.
  1. +6 −6 user.js
View
12 user.js
@@ -101,12 +101,12 @@ User.prototype.part = function(/* string or Channel object */ channel) {
}
};
-User.prototype.quit = function() {
- var chan,
+User.prototype.quit = function(msg) {
+ var allchans = this.irc.channels,
+ chan,
idx;
-
- for(var i=0;i<this.channels.length;i++){
- chan = this.channels[i];
+ for(var chanName in allchans){
+ chan = allchans[chanName];
idx = chan.users.indexOf(this.nick);
if (idx != -1) {
chan.users.splice(idx, 1);
@@ -126,4 +126,4 @@ User.prototype.msg = function(target, msg) {
User.prototype.send = function(msg) {
this.irc.send(this.nick, msg);
-};
+};

0 comments on commit e354dcb

Please sign in to comment.
Something went wrong with that request. Please try again.