plugin
authorJoerg Jaspert <joerg@debian.org>
Sat, 31 Jan 2009 22:35:42 +0000 (23:35 +0100)
committerJoerg Jaspert <joerg@debian.org>
Sat, 31 Jan 2009 22:35:42 +0000 (23:35 +0100)
allow multiple locks, seperated by comma
Signed-off-by: Joerg Jaspert <joerg@debian.org>
Dak/plugin.py

index 5048058..a7ce2c3 100644 (file)
@@ -200,17 +200,20 @@ class Dak(callbacks.Plugin):
         if self.locks.has_key("ALL"):
             irc.error("No, %s has an ALL lock" % (self.locks["ALL"]))
             return
-        if what == "ALL" and len(self.locks) > 0:
-            irc.error("Can't lock all, there are existing locks")
-            return
-        if self.locks.has_key(what):
-            if self.locks[what] == msg.nick:
-                irc.reply("Loser, you already locked %s" % (what) )
+
+        for key in what.split(","):
+            key = key.strip()
+            if key == "ALL" and len(self.locks) > 0:
+                irc.error("Can't lock all, there are existing locks")
+                return
+            if self.locks.has_key(key):
+                if self.locks[key] == msg.nick:
+                    irc.reply("Loser, you already locked %s" % (key) )
+                else:
+                    irc.reply("You suck, this is already locked by %s" % (self.locks[key]) )
             else:
-                irc.reply("You suck, this is already locked by %s" % (self.locks[what]) )
-        else:
-            self.locks[what]=msg.nick
-            irc.reply("locked %s" % (what) )
+                self.locks[key]=msg.nick
+                irc.reply("locked %s" % (key) )
     lock = wrap(lock, ['text'])
 
     def unlock(self, irc, msg, args, what):