From c1cd9755e4fa7a7a21a31db3e0c18afa9aa66dee Mon Sep 17 00:00:00 2001 From: reality Date: Thu, 27 Jun 2013 18:06:49 +0000 Subject: [PATCH] expose hostmask stuff in commands [Close #518] --- modules/nickserv/nickserv.js | 29 ++++++++++++++++++++++++++++- 1 file changed, 28 insertions(+), 1 deletion(-) diff --git a/modules/nickserv/nickserv.js b/modules/nickserv/nickserv.js index 6feafd9..8ca294b 100644 --- a/modules/nickserv/nickserv.js +++ b/modules/nickserv/nickserv.js @@ -24,6 +24,33 @@ var nickserv = function(dbot) { } }; + this.commands = { + '~auth': function(event) { + var user = event.params[1] || event.user; + this.api.auth(event.server, user, function(isAuthed) { + if(isAuthed) { + event.reply(dbot.t('authed', { 'nick': user })); + } else { + event.reply(dbot.t('not_authed', { 'nick': user })); + } + }); + }, + + '~hostmask': function(event) { + var user = event.params[1] || event.user; + this.api.getUserHost(event.server, user, function(host) { + if(host) { + event.reply(dbot.t('hostmask', { + 'nick': user, + 'host': host + })); + } else { + event.reply(dbot.t('no_hostmask', { 'nick': user })); + } + }); + } + }; + this.listener = function(event) { if(event.action == 'NOTICE') { var nickserv = dbot.config.servers[event.server].nickserv, @@ -33,7 +60,7 @@ var nickserv = function(dbot) { if(event.user == nickserv) { var info = event.params.match(statusRegex); if(info && _.has(this.authStack, event.server)) { - if(info[2] == acceptableState ) { + if(info[2] == acceptableState) { this.authStack[event.server][info[1]](true); } else { this.authStack[event.server][info[1]](false);