UNPKG

girc

Version:
95 lines (75 loc) 2.02 kB
"use strict"; var User = module.exports = function (nick, connection) { this.nick = nick; this.connection = connection; this.username = ''; this.realname = ''; this.hostname = ''; this.channels = {}; this.server = ''; this.serverInfo = ''; this.away = null; this.account = null; this.registered = false; this.secure = false; this.idle = 0; this.signon = new Date(); this.oper = false; }; User.prototype.toString = function () { return this.nick + '!' + this.username + '@' + this.hostname; }; User.prototype.getNick = function () { return this.nick; }; User.prototype.getUsername = function () { return this.username; }; User.prototype.getRealname = function () { return this.realname; }; User.prototype.getHostname = function () { return this.hostname; }; User.prototype.getChannels = function () { return this.channels; // {'#channel': ['~']} }; User.prototype.getServer = function () { return this.server; }; User.prototype.getServerInfo = function () { return this.serverInfo; }; User.prototype.getAway = function () { return this.away; }; User.prototype.getAccount = function () { return this.account; }; User.prototype.isRegistered = function () { return this.registered; }; User.prototype.isUsingSecureConnection = function () { return this.secure; }; User.prototype.getIdle = function () { return this.idle; }; User.prototype.getSignonTime = function () { return this.signon; }; User.prototype.isOper = function () { return this.oper; }; User.prototype.getConnection = function () { return this.connection; }; User.prototype.notice = function (msg) { this.connection.notice(this.getNick(), msg); }; User.prototype.say = function (msg) { this.connection.send(this.getNick(), msg); }; User.prototype.whois = function (fn) { this.connection.whois(this.getNick(), fn); };