User: Make arguments handling of '@user hostmask remove' similar to '@user hostmask add' 's. Closes GH-101.

This commit is contained in:
Valentin Lorentz 2013-08-10 16:01:25 +02:00
parent 744681d259
commit 269f22a84b

View File

@ -364,15 +364,22 @@ class User(callbacks.Plugin):
@internationalizeDocstring @internationalizeDocstring
def remove(self, irc, msg, args, user, hostmask, password): def remove(self, irc, msg, args, user, hostmask, password):
"""<name> <hostmask> [<password>] """[<name>] [<hostmask>] [<password>]
Removes the hostmask <hostmask> from the record of the user Removes the hostmask <hostmask> from the record of the user
specified by <name>. If the hostmask given is 'all' then all specified by <name>. If the hostmask given is 'all' then all
hostmasks will be removed. The <password> may only be required if hostmasks will be removed. The <password> may only be required if
the user is not recognized by their hostmask. This message must be the user is not recognized by their hostmask. This message must be
sent to the bot privately (not on a channel) since it may contain a sent to the bot privately (not on a channel) since it may contain a
password. password. If <hostmask> is
not given, it defaults to your current hostmask. If <name> is not
given, it defaults to your currently identified name. This message
must be sent to the bot privately (not on a channel) since it may
contain a password.
""" """
if not hostmask:
hostmask = msg.prefix
if not user.checkPassword(password) and \ if not user.checkPassword(password) and \
not user.checkHostmask(msg.prefix): not user.checkHostmask(msg.prefix):
u = ircdb.users.getUser(msg.prefix) u = ircdb.users.getUser(msg.prefix)
@ -391,8 +398,8 @@ class User(callbacks.Plugin):
return return
ircdb.users.setUser(user) ircdb.users.setUser(user)
irc.replySuccess(s) irc.replySuccess(s)
remove = wrap(remove, ['private', 'otherUser', 'something', remove = wrap(remove, ['private', first('otherUser', 'user'),
additional('something', '')]) optional('something'), additional('something', '')])
class gpg(callbacks.Commands): class gpg(callbacks.Commands):
def __init__(self, *args): def __init__(self, *args):