user.js 1.6 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778
  1. var user = function(){
  2. this.name = null;
  3. this.TS = null;
  4. this.ident = null;
  5. this.host = null;
  6. this.account = null;
  7. this.umodes = {};
  8. this.vhost = null;
  9. this.cloakedHost = null;
  10. this.ip = null;
  11. this.realname = null;
  12. this.uid = null;
  13. this.distance = null;
  14. this.uplink = null;
  15. this.secure = false;
  16. this.certfp = null;
  17. this.vident = null;
  18. this.metadata = {};
  19. 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
  20. this.name = nick;
  21. this.distance = distance;
  22. this.TS = TS;
  23. this.ident = ident;
  24. this.host = host;
  25. this.uid = uid;
  26. this.account = account;
  27. this.umodes = umodes;
  28. this.vhost = vhost;
  29. this.cloakedHost = cloakedHost;
  30. this.ip = ip;
  31. this.realname = realname;
  32. this.uplink = uplink;
  33. }
  34. this.setSecure = function(secure){
  35. this.secure = secure;
  36. }
  37. this.setFingerprint = function(certfp){
  38. this.certfp = certfp;
  39. }
  40. this.changeVHost = function(host){
  41. this.vhost = host;
  42. }
  43. this.changeVIdent = function(ident){
  44. this.vident = ident;
  45. }
  46. this.setRealname = function(realname){
  47. this.realname = realname;
  48. }
  49. this.changeNick = function(nick){
  50. this.name = nick;
  51. }
  52. this.changeUmodes = function(umodes){
  53. for(umode in umodes){
  54. this.umodes[umode] = umodes[umode];
  55. }
  56. }
  57. this.setMetadata = function(name, visibility, value){
  58. if(value){
  59. this.metadata[name] = { 'visibility': visibility, 'value': value };
  60. } else {
  61. if(name in this.metadata){
  62. delete this.metadata[name];
  63. }
  64. }
  65. }
  66. }
  67. module.exports = user;