Made name and hostmask optional in addhostmask.

This commit is contained in:
Jeremy Fincher 2004-08-03 07:39:05 +00:00
parent bbd401533f
commit 2bd7a31c27

View File

@ -191,17 +191,23 @@ class User(callbacks.Privmsg):
irc.replySuccess() irc.replySuccess()
def addhostmask(self, irc, msg, args): def addhostmask(self, irc, msg, args):
"""<name> <hostmask> [<password>] """[<name>] [<hostmask>] [<password>]
Adds the hostmask <hostmask> to the user specified by <name>. The Adds the hostmask <hostmask> to the user specified by <name>. The
<password> may only be required if the user is not recognized by <password> may only be required if the user is not recognized by
hostmask. If you include the <password> parameter, this message must hostmask. If you include the <password> parameter, this message must
be sent to the bot privately (not on a channel). <password> is also be sent to the bot privately (not on a channel). <password> is also
not required if an owner user is giving the command on behalf of some not required if an owner user is giving the command on behalf of some
other user. other user. If <hostmask> is not given, it defaults to your current
hostmask. If <name> is not given, it defaults to your currently
identified name.
""" """
(name, hostmask, password) = privmsgs.getArgs(args, 2, 1) (name, hostmask, password) = privmsgs.getArgs(args, 0, 3)
self._checkNotChannel(irc, msg, password) self._checkNotChannel(irc, msg, password)
if not hostmask:
hostmask = msg.prefix
if not name:
name = msg.prefix
if not ircutils.isUserHostmask(hostmask): if not ircutils.isUserHostmask(hostmask):
irc.error('That\'s not a valid hostmask. Make sure your hostmask ' irc.error('That\'s not a valid hostmask. Make sure your hostmask '
'includes a nick, then an exclamation point (!), then ' 'includes a nick, then an exclamation point (!), then '