var user = function(){ this.name = null; this.TS = null; this.ident = null; this.host = null; this.account = null; this.umodes = {}; this.vhost = null; this.cloakedHost = null; this.ip = null; this.realname = null; this.uid = null; this.distance = null; this.uplink = null; this.secure = false; this.certfp = null; this.vident = null; this.metadata = {}; this.channels = []; this.events = {}; this.introduce = function(nick, distance, TS, ident, host, uid, account, umodes, vhost, cloakedHost, ip, realname, uplink){ // nick, distance, TS, ident, host, uid, account, umodes, vhost, cloakedHost, ip, realname, uplink this.name = nick; this.distance = distance; this.TS = TS; this.ident = ident; this.host = host; this.uid = uid; this.account = account; this.umodes = umodes; this.vhost = vhost; this.cloakedHost = cloakedHost; this.ip = ip; this.realname = realname; this.uplink = uplink; } this.setEvents = function(events){ this.events = events; } this.setSecure = function(secure){ this.secure = secure; } this.setFingerprint = function(certfp){ this.certfp = certfp; } this.changeVHost = function(host){ this.vhost = host; this.events.doEvent('userVHost', this); } this.changeVIdent = function(ident){ this.vident = ident; this.events.doEvent('userVIdent', this); } this.setRealname = function(realname){ this.realname = realname; this.events.doEvent('userRealname', this); } this.changeNick = function(nick){ this.name = nick; this.events.doEvent('userNick', this); } this.changeUmodes = function(umodes){ for(umode in umodes){ this.umodes[umode] = umodes[umode]; } this.events.doEvent('userUmode', this); } this.setMetadata = function(name, visibility, value){ if(value){ this.metadata[name] = { 'visibility': visibility, 'value': value }; } else { if(name in this.metadata){ delete this.metadata[name]; } } this.events.doEvent('userMetadata', this, name); } this.joinChannel = function(channel){ if(this.channels.indexOf(channel) < 0) this.channels.push(channel); } this.leaveChannel = function(channel){ for(var i=0; i