mirror of
https://github.com/jwinterm/node-tip-bot.git
synced 2026-10-17 05:41:42 +02:00
bring back old nickserv-based auth checking
This commit is contained in:
+21
-3
@@ -76,9 +76,27 @@ var client = new irc.Client(settings.connection.host, settings.login.nickname, {
|
|||||||
|
|
||||||
// gets user's login status
|
// gets user's login status
|
||||||
irc.Client.prototype.isIdentified = function(nickname, callback) {
|
irc.Client.prototype.isIdentified = function(nickname, callback) {
|
||||||
this.whois(nickname, function(reply) {
|
// request login status
|
||||||
callback(!!reply.account);
|
this.say('NickServ', 'ACC ' + nickname);
|
||||||
});
|
|
||||||
|
// wait for response
|
||||||
|
var listener = function(from, to, message) {
|
||||||
|
// proceed only on NickServ's ACC response
|
||||||
|
var regexp = new RegExp('^(\\S+) ACC (\\d)');
|
||||||
|
if(from != undefined && from.toLowerCase() == 'nickserv' && regexp.test(message)) {
|
||||||
|
var match = message.match(regexp);
|
||||||
|
var user = match[1];
|
||||||
|
var level = match[2];
|
||||||
|
|
||||||
|
// if the right response, call the callback and remove this listener
|
||||||
|
if(user.toLowerCase() == nickname.toLowerCase()) {
|
||||||
|
callback(level == 3);
|
||||||
|
this.removeListener('notice', listener);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
this.addListener('notice', listener);
|
||||||
}
|
}
|
||||||
|
|
||||||
irc.Client.prototype.getNames = function(channel, callback) {
|
irc.Client.prototype.getNames = function(channel, callback) {
|
||||||
|
|||||||
Reference in New Issue
Block a user