mirror of
https://github.com/Mikaela/Limnoria.git
synced 2025-01-30 22:24:20 +01:00
Fixed NickServ module.
This commit is contained in:
parent
0863a95919
commit
2db2f64696
@ -47,29 +47,27 @@ import privmsgs
|
|||||||
import ircutils
|
import ircutils
|
||||||
import callbacks
|
import callbacks
|
||||||
|
|
||||||
class NickServ(callbacks.Privmsg):
|
class NickServ(privmsgs.CapabilityCheckingPrivmsg):
|
||||||
|
capability = 'owner'
|
||||||
def __init__(self):
|
def __init__(self):
|
||||||
callbacks.Privmsg.__init__(self)
|
callbacks.Privmsg.__init__(self)
|
||||||
self.started = False
|
self.nickserv = ''
|
||||||
|
|
||||||
def startnickserv(self, irc, msg, args):
|
def startnickserv(self, irc, msg, args):
|
||||||
"<bot's nick> <password> <NickServ's nick (defaults to NickServ)>"
|
"<bot's nick> <password> <NickServ's nick (defaults to NickServ)>"
|
||||||
if ircutils.isChannel(msg.args[0]):
|
if ircutils.isChannel(msg.args[0]):
|
||||||
irc.error(msg, conf.replyRequiresPrivacy)
|
irc.error(msg, conf.replyRequiresPrivacy)
|
||||||
return
|
return
|
||||||
if ircdb.checkCapability(msg.prefix, 'owner'):
|
|
||||||
(self.nick, self.password, nickserv) = privmsgs.getArgs(args,
|
(self.nick, self.password, nickserv) = privmsgs.getArgs(args,
|
||||||
needed=2,
|
needed=2,
|
||||||
optional=1)
|
optional=1)
|
||||||
self.nickserv = nickserv or 'NickServ'
|
self.nickserv = nickserv or 'NickServ'
|
||||||
self._ghosted = re.compile('%s.*killed' % self.nick)
|
self._ghosted = re.compile('%s.*killed' % self.nick)
|
||||||
irc.reply(msg, conf.replySuccess)
|
irc.reply(msg, conf.replySuccess)
|
||||||
else:
|
|
||||||
irc.error(msg, conf.replyNoCapability % 'owner')
|
|
||||||
|
|
||||||
_owned = re.compile('nick.*(?:(?<!not)(?:registered|protected|owned))')
|
_owned = re.compile('nick.*(?:(?<!not)(?:registered|protected|owned))')
|
||||||
def doNotice(self, irc, msg):
|
def doNotice(self, irc, msg):
|
||||||
if self.started:
|
if self.nickserv:
|
||||||
if msg.nick == self.nickserv:
|
if msg.nick == self.nickserv:
|
||||||
if self._owned.search(msg.args[1]):
|
if self._owned.search(msg.args[1]):
|
||||||
# NickServ told us the nick is registered.
|
# NickServ told us the nick is registered.
|
||||||
@ -79,8 +77,9 @@ class NickServ(callbacks.Privmsg):
|
|||||||
# NickServ told us the nick has been ghost-killed.
|
# NickServ told us the nick has been ghost-killed.
|
||||||
irc.queueMsg(ircmsgs.nick(self.nick))
|
irc.queueMsg(ircmsgs.nick(self.nick))
|
||||||
|
|
||||||
def do376(self, irc, msg):
|
def __call__(self, irc, msg):
|
||||||
if self.started:
|
callbacks.Privmsg.__call__(self, irc, msg)
|
||||||
|
if self.nickserv:
|
||||||
if irc.nick != self.nick:
|
if irc.nick != self.nick:
|
||||||
ghost = 'GHOST %s %s' % (self.nick, self.password)
|
ghost = 'GHOST %s %s' % (self.nick, self.password)
|
||||||
irc.queueMsg(ircmsgs.privmsg(self.nickserv, ghost))
|
irc.queueMsg(ircmsgs.privmsg(self.nickserv, ghost))
|
||||||
|
Loading…
Reference in New Issue
Block a user