From 2d0671b6f62794db3e8a0a6823d9290206f228cc Mon Sep 17 00:00:00 2001 From: Jeremy Fincher Date: Sun, 14 Sep 2003 02:52:40 +0000 Subject: [PATCH] Changed delhostmask to removehostmask and fixed a bug. --- src/UserCommands.py | 10 +++++++--- src/ircdb.py | 2 +- 2 files changed, 8 insertions(+), 4 deletions(-) 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