mirror of
https://github.com/Mikaela/Limnoria.git
synced 2024-11-07 19:49:23 +01:00
Added returns after irc.errors.
This commit is contained in:
parent
b9153e5ad0
commit
3188810d21
@ -56,10 +56,13 @@ class UserCommands(callbacks.Privmsg):
|
|||||||
self._checkNotChannel(irc, msg, password)
|
self._checkNotChannel(irc, msg, password)
|
||||||
if ircutils.isChannel(msg.args[0]):
|
if ircutils.isChannel(msg.args[0]):
|
||||||
irc.error(msg, conf.replyRequiresPrivacy)
|
irc.error(msg, conf.replyRequiresPrivacy)
|
||||||
|
return
|
||||||
if ircdb.users.hasUser(name):
|
if ircdb.users.hasUser(name):
|
||||||
irc.error(msg, 'That name is already registered.')
|
irc.error(msg, 'That name is already registered.')
|
||||||
|
return
|
||||||
if ircutils.isUserHostmask(name):
|
if ircutils.isUserHostmask(name):
|
||||||
irc.error(msg, 'Hostmasks aren\'t valid usernames.')
|
irc.error(msg, 'Hostmasks aren\'t valid usernames.')
|
||||||
|
return
|
||||||
user = ircdb.IrcUser()
|
user = ircdb.IrcUser()
|
||||||
user.setPassword(password)
|
user.setPassword(password)
|
||||||
user.addHostmask(msg.prefix)
|
user.addHostmask(msg.prefix)
|
||||||
@ -79,14 +82,17 @@ class UserCommands(callbacks.Privmsg):
|
|||||||
if len(s) < 10:
|
if len(s) < 10:
|
||||||
s = 'Hostmask must be more than 10 non-wildcard characters.'
|
s = 'Hostmask must be more than 10 non-wildcard characters.'
|
||||||
irc.error(msg, s)
|
irc.error(msg, s)
|
||||||
|
return
|
||||||
try:
|
try:
|
||||||
user = ircdb.users.getUser(name)
|
user = ircdb.users.getUser(name)
|
||||||
except KeyError:
|
except KeyError:
|
||||||
irc.error(msg, conf.replyNoUser)
|
irc.error(msg, conf.replyNoUser)
|
||||||
|
return
|
||||||
try:
|
try:
|
||||||
name = ircdb.users.getUserName(hostmask)
|
name = ircdb.users.getUserName(hostmask)
|
||||||
s = 'That hostmask is already registered to %s.' % name
|
s = 'That hostmask is already registered to %s.' % name
|
||||||
irc.error(msg, s)
|
irc.error(msg, s)
|
||||||
|
return
|
||||||
except KeyError:
|
except KeyError:
|
||||||
pass
|
pass
|
||||||
if user.checkHostmask(msg.prefix) or user.checkPassword(password):
|
if user.checkHostmask(msg.prefix) or user.checkPassword(password):
|
||||||
@ -95,6 +101,7 @@ class UserCommands(callbacks.Privmsg):
|
|||||||
irc.reply(msg, conf.replySuccess)
|
irc.reply(msg, conf.replySuccess)
|
||||||
else:
|
else:
|
||||||
irc.error(msg, conf.replyIncorrectAuth)
|
irc.error(msg, conf.replyIncorrectAuth)
|
||||||
|
return
|
||||||
|
|
||||||
def delhostmask(self, irc, msg, args):
|
def delhostmask(self, irc, msg, args):
|
||||||
"""<name> <hostmask> [<password>]
|
"""<name> <hostmask> [<password>]
|
||||||
@ -109,12 +116,14 @@ class UserCommands(callbacks.Privmsg):
|
|||||||
user = ircdb.users.getUser(name)
|
user = ircdb.users.getUser(name)
|
||||||
except KeyError:
|
except KeyError:
|
||||||
irc.error(msg, conf.replyNoUser)
|
irc.error(msg, conf.replyNoUser)
|
||||||
|
return
|
||||||
if user.checkHostmask(msg.prefix) or user.checkPassword(password):
|
if user.checkHostmask(msg.prefix) or user.checkPassword(password):
|
||||||
user.removeHostmask(hostmask)
|
user.removeHostmask(hostmask)
|
||||||
ircdb.users.setUser(name, user)
|
ircdb.users.setUser(name, user)
|
||||||
irc.reply(msg, conf.replySuccess)
|
irc.reply(msg, conf.replySuccess)
|
||||||
else:
|
else:
|
||||||
irc.error(msg, conf.replyIncorrectAuth)
|
irc.error(msg, conf.replyIncorrectAuth)
|
||||||
|
return
|
||||||
|
|
||||||
def setpassword(self, irc, msg, args):
|
def setpassword(self, irc, msg, args):
|
||||||
"""<name> <old password> <new password>
|
"""<name> <old password> <new password>
|
||||||
@ -128,6 +137,7 @@ class UserCommands(callbacks.Privmsg):
|
|||||||
user = ircdb.users.getUser(name)
|
user = ircdb.users.getUser(name)
|
||||||
except KeyError:
|
except KeyError:
|
||||||
irc.error(msg, conf.replyNoUser)
|
irc.error(msg, conf.replyNoUser)
|
||||||
|
return
|
||||||
if user.checkPassword(oldpassword):
|
if user.checkPassword(oldpassword):
|
||||||
user.setPassword(newpassword)
|
user.setPassword(newpassword)
|
||||||
ircdb.users.setUser(name, user)
|
ircdb.users.setUser(name, user)
|
||||||
@ -147,6 +157,7 @@ class UserCommands(callbacks.Privmsg):
|
|||||||
hostmask = irc.state.nickToHostmask(hostmask)
|
hostmask = irc.state.nickToHostmask(hostmask)
|
||||||
except KeyError:
|
except KeyError:
|
||||||
irc.error(msg, conf.replyNoUser)
|
irc.error(msg, conf.replyNoUser)
|
||||||
|
return
|
||||||
try:
|
try:
|
||||||
name = ircdb.users.getUserName(hostmask)
|
name = ircdb.users.getUserName(hostmask)
|
||||||
irc.reply(msg, name)
|
irc.reply(msg, name)
|
||||||
|
Loading…
Reference in New Issue
Block a user