mirror of
https://github.com/Mikaela/Limnoria.git
synced 2024-11-30 06:49:24 +01:00
in Later nick validation, use irc.isNick. now instead of forcing strictRfc to true, we are using the config.
This commit is contained in:
parent
e46948400d
commit
261a646451
@ -101,7 +101,7 @@ class Later(callbacks.Plugin):
|
||||
self.wildcards.append(nick)
|
||||
self._flushNotes()
|
||||
|
||||
def _validateNick(self, nick):
|
||||
def _validateNick(self, irc, nick):
|
||||
"""Validate nick according to the IRC RFC 2812 spec.
|
||||
|
||||
Reference: http://tools.ietf.org/rfcmarkup?doc=2812#section-2.3.1
|
||||
@ -113,8 +113,8 @@ class Later(callbacks.Plugin):
|
||||
If nick incorrigibly invalid, return False, otherwise,
|
||||
return (possibly trimmed) nick.
|
||||
"""
|
||||
if not ircutils.isNick(nick, strictRfc=True):
|
||||
if not ircutils.isNick(nick[:-1], strictRfc=True):
|
||||
if not irc.isNick(nick):
|
||||
if not irc.isNick(nick[:-1]):
|
||||
return False
|
||||
else:
|
||||
return nick[:-1]
|
||||
@ -131,7 +131,7 @@ class Later(callbacks.Plugin):
|
||||
if ircutils.strEqual(nick, irc.nick):
|
||||
irc.error(_('I can\'t send notes to myself.'))
|
||||
return
|
||||
validnick = self._validateNick(nick)
|
||||
validnick = self._validateNick(irc, nick)
|
||||
if validnick is False:
|
||||
irc.error('That is an invalid IRC nick. Please check your input.')
|
||||
return
|
||||
|
@ -44,10 +44,13 @@ class LaterTestCase(PluginTestCase):
|
||||
self.assertRegexp('later notes', 'foo')
|
||||
|
||||
def testNickValidation(self):
|
||||
origconf = conf.supybot.protocols.irc.strictRfc()
|
||||
conf.supybot.protocols.irc.strictRfc.setValue('True')
|
||||
self.assertError('later tell 1foo bar')
|
||||
self.assertError('later tell foo$moo zoob')
|
||||
self.assertNotError('later tell foo: baz')
|
||||
self.assertRegexp('later notes', 'foo\.')
|
||||
conf.supybot.protocols.irc.strictRfc.setValue(origconf)
|
||||
|
||||
# vim:set shiftwidth=4 softtabstop=4 expandtab textwidth=79:
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user