changeset 30:7b01c9b2b411

"nuke" command and implementation
author John@Yosemite-PC
date Sun, 11 Mar 2012 17:47:59 -0400
parents 731182d55b6c
children d27c28e5f964
files Core.lua Lists.lua
diffstat 2 files changed, 15 insertions(+), 0 deletions(-) [+]
line wrap: on
line diff
--- a/Core.lua	Sun Mar 11 17:47:26 2012 -0400
+++ b/Core.lua	Sun Mar 11 17:47:59 2012 -0400
@@ -85,6 +85,13 @@
         else
             bsk:Print(sformat("Deleting anything of type %s is not supported",param[2]))
         end
+    elseif param[1] == "nuke" then
+        if param[2] == nil or param[2] == "" then
+            bsk:PrintTable(param)
+            return
+        end
+        local person = FixPersonName(param[2])
+        bsk:NukePerson(person)
     elseif param[1] == "add" then
         if param[2] == nil or param[2] == "" then
             bsk:PrintTable(param)
--- a/Lists.lua	Sun Mar 11 17:47:26 2012 -0400
+++ b/Lists.lua	Sun Mar 11 17:47:59 2012 -0400
@@ -605,6 +605,14 @@
         end
     end
 end
+
+function bsk:NukePerson(name) -- delete from all lists and then from persons
+    local pid = personName2id[name]
+    for i,v in pairs(bsk.lists) do
+        bsk:RemovePersonFromList(name,v.name)
+    end
+    bsk:RemovePerson(name)
+end
 --}}}
 -- "Soft" actions- ie things that cause nonpermanent state {{{