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):
"""<hostmask|nick> [<expires>]
Ignores <hostmask> or, if a nick is given, ignores whatever
hostmask that nick is currently using. <expires> is a "seconds
from now" value that determines when the ignore will expire; if,
for instance, you wish for the ignore to expire in an hour, you
could give an <expires> of 3600. If no <expires> is given, the
ignore will never automatically expire.
This will set a persistent ignore on <hostmask> or the hostmask
currently associated with <nick>. <expires> is an optional argument
specifying when (in "seconds from now") the ignore will expire; if
it isn't given, the ignore will never automatically expire.
"""
ircdb.ignores.add(hostmask, expires)
irc.replySuccess()
@ -312,8 +310,8 @@ class Admin(callbacks.Plugin):
def remove(self, irc, msg, args, hostmask):
"""<hostmask|nick>
Ignores <hostmask> or, if a nick is given, ignores whatever
hostmask that nick is currently using.
This will remove the persistent ignore on <hostmask> or the
hostmask currently associated with <nick>.
"""
try:
ircdb.ignores.remove(hostmask)
@ -325,7 +323,7 @@ class Admin(callbacks.Plugin):
def list(self, irc, msg, args):
"""takes no arguments
Returns the hostmasks currently being globally ignored.
Lists the hostmasks that the bot is ignoring.
"""
# XXX Add the expirations.
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.
<password> is only necessary if the user isn't recognized by hostmask.
If you include the <password> parameter, this message must be sent
to the bot privately (not on a channel).
This message must be sent to the bot privately (not on a channel) since
it may contain a password.
"""
try:
id = ircdb.users.getUserId(newname)
@ -168,7 +168,7 @@ class User(callbacks.Plugin):
class set(callbacks.Commands):
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
password>. Obviously this message must be sent to the bot
@ -180,6 +180,10 @@ class User(callbacks.Plugin):
u = ircdb.users.getUser(msg.prefix)
except KeyError:
u = None
if user is None:
if u is None:
irc.errorNotRegistered(Raise=True)
user = u
if user.checkPassword(password) or \
(u and u._checkCapability('owner') and not u == user):
user.setPassword(newpassword)
@ -187,7 +191,8 @@ class User(callbacks.Plugin):
irc.replySuccess()
else:
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):
"""<password> [<True|False>]
@ -322,6 +327,8 @@ class User(callbacks.Plugin):
ircdb.users.setUser(user)
except ValueError, e:
irc.error(str(e), Raise=True)
except ircdb.DuplicateHostmask:
irc.error('That hostmask is already registered.', Raise=True)
irc.replySuccess()
add = wrap(add, ['private', first('otherUser', 'user'),
optional('something'), additional('something', '')])