Merge branch 'maint/0.83.4'

Signed-off-by: James Vega <jamessan@users.sourceforge.net>
This commit is contained in:
James Vega 2010-08-29 11:34:55 -04:00
commit 7d87d2f87a
2 changed files with 18 additions and 13 deletions

View File

@ -298,12 +298,10 @@ class Admin(callbacks.Plugin):
def add(self, irc, msg, args, hostmask, expires): def add(self, irc, msg, args, hostmask, expires):
"""<hostmask|nick> [<expires>] """<hostmask|nick> [<expires>]
Ignores <hostmask> or, if a nick is given, ignores whatever This will set a persistent ignore on <hostmask> or the hostmask
hostmask that nick is currently using. <expires> is a "seconds currently associated with <nick>. <expires> is an optional argument
from now" value that determines when the ignore will expire; if, specifying when (in "seconds from now") the ignore will expire; if
for instance, you wish for the ignore to expire in an hour, you it isn't given, the ignore will never automatically expire.
could give an <expires> of 3600. If no <expires> is given, the
ignore will never automatically expire.
""" """
ircdb.ignores.add(hostmask, expires) ircdb.ignores.add(hostmask, expires)
irc.replySuccess() irc.replySuccess()
@ -312,8 +310,8 @@ class Admin(callbacks.Plugin):
def remove(self, irc, msg, args, hostmask): def remove(self, irc, msg, args, hostmask):
"""<hostmask|nick> """<hostmask|nick>
Ignores <hostmask> or, if a nick is given, ignores whatever This will remove the persistent ignore on <hostmask> or the
hostmask that nick is currently using. hostmask currently associated with <nick>.
""" """
try: try:
ircdb.ignores.remove(hostmask) ircdb.ignores.remove(hostmask)
@ -325,7 +323,7 @@ class Admin(callbacks.Plugin):
def list(self, irc, msg, args): def list(self, irc, msg, args):
"""takes no arguments """takes no arguments
Returns the hostmasks currently being globally ignored. Lists the hostmasks that the bot is ignoring.
""" """
# XXX Add the expirations. # XXX Add the expirations.
if ircdb.ignores.hostmasks: if ircdb.ignores.hostmasks:

View File

@ -150,8 +150,8 @@ class User(callbacks.Plugin):
Changes your current user database name to the new name given. Changes your current user database name to the new name given.
<password> is only necessary if the user isn't recognized by hostmask. <password> is only necessary if the user isn't recognized by hostmask.
If you include the <password> parameter, this message must be sent This message must be sent to the bot privately (not on a channel) since
to the bot privately (not on a channel). it may contain a password.
""" """
try: try:
id = ircdb.users.getUserId(newname) id = ircdb.users.getUserId(newname)
@ -168,7 +168,7 @@ class User(callbacks.Plugin):
class set(callbacks.Commands): class set(callbacks.Commands):
def password(self, irc, msg, args, user, password, newpassword): def password(self, irc, msg, args, user, password, newpassword):
"""<name> <old password> <new password> """[<name>] <old password> <new password>
Sets the new password for the user specified by <name> to <new Sets the new password for the user specified by <name> to <new
password>. Obviously this message must be sent to the bot password>. Obviously this message must be sent to the bot
@ -180,6 +180,10 @@ class User(callbacks.Plugin):
u = ircdb.users.getUser(msg.prefix) u = ircdb.users.getUser(msg.prefix)
except KeyError: except KeyError:
u = None u = None
if user is None:
if u is None:
irc.errorNotRegistered(Raise=True)
user = u
if user.checkPassword(password) or \ if user.checkPassword(password) or \
(u and u._checkCapability('owner') and not u == user): (u and u._checkCapability('owner') and not u == user):
user.setPassword(newpassword) user.setPassword(newpassword)
@ -187,7 +191,8 @@ class User(callbacks.Plugin):
irc.replySuccess() irc.replySuccess()
else: else:
irc.error(conf.supybot.replies.incorrectAuthentication()) irc.error(conf.supybot.replies.incorrectAuthentication())
password = wrap(password, ['otherUser', 'something', 'something']) password = wrap(password, ['private', optional('otherUser'),
'something', 'something'])
def secure(self, irc, msg, args, user, password, value): def secure(self, irc, msg, args, user, password, value):
"""<password> [<True|False>] """<password> [<True|False>]
@ -322,6 +327,8 @@ class User(callbacks.Plugin):
ircdb.users.setUser(user) ircdb.users.setUser(user)
except ValueError, e: except ValueError, e:
irc.error(str(e), Raise=True) irc.error(str(e), Raise=True)
except ircdb.DuplicateHostmask:
irc.error('That hostmask is already registered.', Raise=True)
irc.replySuccess() irc.replySuccess()
add = wrap(add, ['private', first('otherUser', 'user'), add = wrap(add, ['private', first('otherUser', 'user'),
optional('something'), additional('something', '')]) optional('something'), additional('something', '')])