diff --git a/src/UserCommands.py b/src/UserCommands.py index 6734f3dae..72ca4d22b 100755 --- a/src/UserCommands.py +++ b/src/UserCommands.py @@ -134,10 +134,10 @@ class UserCommands(callbacks.Privmsg): irc.error(msg, conf.replyIncorrectAuth) return - def delhostmask(self, irc, msg, args): + def removehostmask(self, irc, msg, args): """ [] - Deletes the hostmask from the record of the user specified + Removes the hostmask from the record of the user specified by . The may only be required if the user is not recognized by his hostmask. """ @@ -151,7 +151,11 @@ class UserCommands(callbacks.Privmsg): irc.error(msg, conf.replyNoUser) return if user.checkHostmask(msg.prefix) or user.checkPassword(password): - user.removeHostmask(hostmask) + try: + user.removeHostmask(hostmask) + except ValueError: + irc.error(msg, 'There was no such hostmask.') + return ircdb.users.setUser(id, user) irc.reply(msg, conf.replySuccess) else: diff --git a/src/ircdb.py b/src/ircdb.py index 74901d15d..19de146dd 100644 --- a/src/ircdb.py +++ b/src/ircdb.py @@ -223,7 +223,7 @@ class IrcUser(object): self.hostmasks.append(hostmask) def removeHostmask(self, hostmask): - self.hostmasks = [s for s in self.hostmasks if s != hostmask] + self.hostmasks.remove(hostmask) def hasHostmask(self, hostmask): return hostmask in self.hostmasks