var channel = function(){ this.name = null; this.TS = null; this.topic = null; this.modes = {}; // indexed by mode name this.statusModes = {}; // indexed by UID this.listModes = {}; // indexed by mode name this.users = []; this.setTS = function(TS){ this.TS = TS; }; this.changeModes = function(modes){ for(var mode in modes){ if(mode == 'status'){ for(var i=0; i= 0; j--){ if(this.listModes[listMode.name][j] == listMode.value){ this.listModes[listMode.name].splice(j, 1); } } } } } else { this.modes[mode] = modes[mode]; } } }; this.joinUser = function(user){ if(this.users.indexOf(user) >= 0) return; this.users.push(user); this.statusModes[user.uid] = {}; }; this.removeUser = function(user){ if(user.uid in this.statusModes){ delete this.statusModes[user.uid]; // remove status modes for this user } for(var i=0; i