3
0
mirror of https://github.com/reality/dbot.git synced 2025-01-11 20:42:37 +01:00

mite b cool

This commit is contained in:
reality 2013-10-20 16:16:21 +00:00
parent d0ac927b92
commit c611487f42
2 changed files with 17 additions and 9 deletions

View File

@ -11,7 +11,7 @@ var nickserv = function(dbot) {
if(!_.has(this.authStack, server)) this.authStack[server] = {}; if(!_.has(this.authStack, server)) this.authStack[server] = {};
this.authStack[server][nick] = callback; this.authStack[server][nick] = callback;
dbot.say(server, nickserv, infoCommand + ' ' + nick); dbot.say(server, nickserv, infoCommand + ' ' + nick + ' *');
}, },
'getUserHost': function(server, nick, callback) { 'getUserHost': function(server, nick, callback) {
@ -34,9 +34,16 @@ var nickserv = function(dbot) {
this.commands = { this.commands = {
'~auth': function(event) { '~auth': function(event) {
var user = event.params[1] || event.user; var user = event.params[1] || event.user;
this.api.auth(event.server, user, function(isAuthed) { this.api.auth(event.server, user, function(isAuthed, account) {
if(isAuthed) { if(isAuthed) {
event.reply(dbot.t('authed', { 'nick': user })); if(user == account) {
event.reply(dbot.t('authed', { 'nick': user }));
} else {
event.reply(dbot.t('authed_as', {
'nick': user,
'account': account
}));
}
} else { } else {
event.reply(dbot.t('not_authed', { 'nick': user })); event.reply(dbot.t('not_authed', { 'nick': user }));
} }
@ -67,10 +74,10 @@ var nickserv = function(dbot) {
if(event.user == nickserv) { if(event.user == nickserv) {
var info = event.params.match(statusRegex); var info = event.params.match(statusRegex);
if(info && _.has(this.authStack, event.server)) { if(info && _.has(this.authStack, event.server)) {
if(info[2] == acceptableState) { if(info[3] == acceptableState) {
this.authStack[event.server][info[1]](true); this.authStack[event.server][info[1]](true, info[2]);
} else { } else {
this.authStack[event.server][info[1]](false); this.authStack[event.server][info[2]](false, info[2]);
} }
} }
} }
@ -88,8 +95,6 @@ var nickserv = function(dbot) {
nick = params[1], nick = params[1],
host = params[3]; host = params[3];
console.log(params);
if(_.has(this.userStack, event.server) && _.has(this.userStack[event.server], nick)) { if(_.has(this.userStack, event.server) && _.has(this.userStack[event.server], nick)) {
var callback = this.userStack[event.server][nick]; var callback = this.userStack[event.server][nick];
delete this.userStack[event.server][nick]; delete this.userStack[event.server][nick];

View File

@ -2,7 +2,10 @@
"authed": { "authed": {
"en": "{nick} is authed with nickserv.", "en": "{nick} is authed with nickserv.",
"fr": "{nick} est authentifié avec nickserv.", "fr": "{nick} est authentifié avec nickserv.",
"it": "{nick} è autenticato con nickserv." "it": "{nick} è autenticato con nickserv."
},
"authed_as": {
"en": "{nick} is authed as {account} with nickserv.",
}, },
"not_authed": { "not_authed": {
"en": "{nick} is not authed with nickserv.", "en": "{nick} is not authed with nickserv.",