Browse Source

Fixed duplicates in user list.

Nathaniel van Diepen 10 years ago
parent
commit
5855297ad9
1 changed files with 9 additions and 2 deletions
  1. 9 2
      app/OmnomIRC.js

+ 9 - 2
app/OmnomIRC.js

@@ -259,8 +259,7 @@ if(cluster.isMaster){
 							sockets[i].get('nick',function(e,nick){
 								if(e){
 									logger.error(e);
-									ret.push('');
-								}else{
+								}else if(!inArray(ret,nick)){
 									logger.debug(room+' '+nick);
 									ret.push(nick);
 								}
@@ -273,6 +272,14 @@ if(cluster.isMaster){
 					};
 				getNext();
 			},
+			inArray = function(arr,val){
+				for(var i in arr){
+					if(arr[i] == val){
+						return true;
+					}
+				}
+				return false;
+			},
 			sendUserList = function(room){
 				if(typeof room != 'undefined'){
 					runWithUserList(room,function(users){