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