Services: Improve error on missing password or NickServ nick

This commit is contained in:
Valentin Lorentz 2023-11-18 22:02:36 +01:00
parent fffdd82571
commit 06c88581ec

View File

@ -124,9 +124,11 @@ class Services(callbacks.Plugin):
return
nickserv = self.registryValue('NickServ', network=irc.network)
password = self._getNickServPassword(nick, irc.network)
if not nickserv or not password:
s = 'Tried to identify without a NickServ or password set.'
self.log.warning(s)
if not nickserv:
self.log.warning('Tried to identify without a NickServ set.')
return
if not password:
self.log.warning('Tried to identify without a password set.')
return
assert ircutils.strEqual(irc.nick, nick), \
'Identifying with not normal nick.'
@ -150,16 +152,15 @@ class Services(callbacks.Plugin):
ghostDelay = self.registryValue('ghostDelay', network=irc.network)
if not ghostDelay:
return
if not nickserv or not password:
s = 'Tried to ghost without a NickServ or password set.'
self.log.warning(s)
if not nickserv:
self.log.warning('Tried to ghost without a NickServ set.')
return
if not password:
self.log.warning('Tried to ghost without a password set.')
return
if state.sentGhost and time.time() < (state.sentGhost + ghostDelay):
self.log.warning('Refusing to send GHOST more than once every '
'%s seconds.' % ghostDelay)
elif not password:
self.log.warning('Not ghosting: no password set.')
return
else:
self.log.info('Sending ghost (current nick: %s; ghosting: %s)',
irc.nick, nick)