Mercurial > wow > breuesk
changeset 20:3fedb912c088
Rename a list
author | John@Yosemite-PC |
---|---|
date | Fri, 09 Mar 2012 23:18:20 -0500 |
parents | cdca1f2ae605 |
children | ffcea2f51663 |
files | Core.lua Lists.lua |
diffstat | 2 files changed, 27 insertions(+), 1 deletions(-) [+] |
line wrap: on
line diff
--- a/Core.lua Fri Mar 09 23:02:25 2012 -0500 +++ b/Core.lua Fri Mar 09 23:18:20 2012 -0500 @@ -136,6 +136,12 @@ return end bsk:TrimLists(param[2]) + elseif param[1] == "rename" then + if param[2] == nil or param[2] == "" or param[3] == nil or param[3] == "" then + bsk:printtable(param) + return + end + bsk:RenameList(param[2],param[3]) elseif param[1] == "selfdestruct" then bsk:SelfDestruct() end
--- a/Lists.lua Fri Mar 09 23:02:25 2012 -0500 +++ b/Lists.lua Fri Mar 09 23:18:20 2012 -0500 @@ -13,7 +13,6 @@ -- TODO: organize working state data a little more carefully - hard to keep -- track of all the arrays that are floating out there -- TODO: delete list --- TODO: rename list -- TODO: remove player from list -- TODO: (meta) remove player from all lists -- TODO: remove person (actually kinda tricky without casuality problems) @@ -222,6 +221,8 @@ function bsk:ProcessChange(change) if change.action == "AddPerson" then bsk:DoAddPerson(change) + elseif change.action == "RenameList" then + bsk:DoRenameList(change) elseif change.action == "CreateList" then bsk:DoCreateList(change) elseif change.action == "AddToListEnd" then @@ -452,6 +453,25 @@ end end +function bsk:DoRenameList(change) + bsk.lists[change.arg.listIndex].name = change.arg.name + bsk.lists[change.arg.listIndex].time = change.time + return true +end + +function bsk:RenameList(listName,newListName) + -- require admin + local listIndex = bsk:GetListIndex(listName) + local change = {action="RenameList",arg={listIndex=listIndex,name=newListName}} + bsk:StartChange(change) + if bsk:DoRenameList(change) then + bsk:CommitChange(change) + end +end + +--}}} +-- Higher order actions (ie calls other standard actions){{{ + function bsk:TrimLists(time) if not bsk:CheckListCausality() then self:Print("Unable to trim changelist due to violated causality") @@ -486,8 +506,6 @@ bsk:CreateWorkingStateFromChanges(bsk.db.profile.changes) end ---}}} --- Higher order actions (ie calls other standard actions){{{ function bsk:AddMissingPersons() bsk:PopulateRaidList() local t = {}