From 6443949d3f9d588c34452919a6e645af05153374 Mon Sep 17 00:00:00 2001 From: Ted Trask Date: Sat, 28 Apr 2012 12:17:43 +0000 Subject: Updated for handle_form now passing self to get and set functions --- fetchmail-controller.lua | 2 +- fetchmail-model.lua | 14 +++++++------- 2 files changed, 8 insertions(+), 8 deletions(-) diff --git a/fetchmail-controller.lua b/fetchmail-controller.lua index c2168f7..fa58a21 100644 --- a/fetchmail-controller.lua +++ b/fetchmail-controller.lua @@ -27,7 +27,7 @@ function editentry(self) end function createentry(self) - return self.handle_form(self, self.model.readentry, self.model.createentry, self.clientdata, "Create", "Create Entry", "Entry Created") + return self.handle_form(self, function() return self.model.readentry() end, self.model.createentry, self.clientdata, "Create", "Create Entry", "Entry Created") end function deleteentry(self) diff --git a/fetchmail-model.lua b/fetchmail-model.lua index 16992d1..457452d 100644 --- a/fetchmail-model.lua +++ b/fetchmail-model.lua @@ -388,12 +388,12 @@ end -- ################################################################################ -- PUBLIC FUNCTIONS -function get_startstop(clientdata) +function get_startstop(self, clientdata) local actions = {"Run", "Test"} return cfe({ type="group", label="Management", value={}, option=actions }) end -function startstop_service(startstop, action) +function startstop_service(self, startstop, action) if action and (action:lower() == "run" or action:lower() == "test") then local cmd if action:lower() == "run" then @@ -419,9 +419,9 @@ function get_filedetails() return modelfunctions.getfiledetails(configfile) end -function update_filecontent(filedetails) +function update_filecontent(self, filedetails) -- FIXME - validation - local retval = modelfunctions.setfiledetails(filedetails, {configfile}) + local retval = modelfunctions.setfiledetails(self, filedetails, {configfile}) posix.chmod(configfile, "rw-------") posix.chown(configfile, posix.getpasswd("fetchmail", "uid") or 0) config = nil @@ -450,7 +450,7 @@ function getconfig() return cfe({ type="group", value={interval=interval, postmaster=postmaster, bounceerrors=bounceerrors}, label="Fetchmail Global Config" }) end -function updateconfig(conf) +function updateconfig(self, conf) local success, conf = validateconfig(conf) if success then @@ -573,7 +573,7 @@ function readentry(entryname, meth, remotemailbx, localdom) return cfe({ type="group", value={enabled=enabled, method=method, remotehost=remotehost, remotemailbox=remotemailbox, remotepassword=remotepassword, localhost=localhost, localmailbox=localmailbox, localdomain=localdomain, ssl=ssl, envelope=envelope}, label="Fetchmail Entry" }) end -function updateentry(entrystruct) +function updateentry(self, entrystruct) local success, entrystruct = validateentry(entrystruct) local entry = findentryline(entrystruct.value.remotehost.value, entrystruct.value.method.value, entrystruct.value.remotemailbox.value, entrystruct.value.localdomain.value) if not entry then @@ -590,7 +590,7 @@ function updateentry(entrystruct) return entrystruct end -function createentry(entrystruct) +function createentry(self, entrystruct) local success, entrystruct = validateentry(entrystruct) local entry = findentryline(entrystruct.value.remotehost.value, entrystruct.value.method.value, entrystruct.value.remotemailbox.value, entrystruct.value.localdomain.value) if entry then -- cgit v1.2.3