summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorTed Trask <ttrask01@yahoo.com>2013-10-18 19:47:04 +0000
committerTed Trask <ttrask01@yahoo.com>2013-10-18 19:47:04 +0000
commit08093f7a2d4cee3dac4834d7d24c81c52a4b7ae2 (patch)
tree0d63bd1cb28988a4bda0ccfc8aaf6b93e903c3c1
parentb08c9a69a29ff3500fc46fb6cdaddf1eda40c011 (diff)
downloadacf-amavisd-new-08093f7a2d4cee3dac4834d7d24c81c52a4b7ae2.tar.bz2
acf-amavisd-new-08093f7a2d4cee3dac4834d7d24c81c52a4b7ae2.tar.xz
Remove all calls to 'module' in preparation for move to Lua 5.2
Use mymodule parameter for module definition. This was also helpful in revealing places where the code relied on the global environment.
-rw-r--r--amavis-controller.lua12
-rw-r--r--amavis-model.lua14
2 files changed, 15 insertions, 11 deletions
diff --git a/amavis-controller.lua b/amavis-controller.lua
index 0648aac..d69fcc5 100644
--- a/amavis-controller.lua
+++ b/amavis-controller.lua
@@ -1,15 +1,17 @@
-module(..., package.seeall)
+local mymodule = {}
-default_action = "status"
+mymodule.default_action = "status"
-function status(self)
+function mymodule.status(self)
return self.model.getstatus()
end
-function startstop(self)
+function mymodule.startstop(self)
return self.handle_form(self, self.model.get_startstop, self.model.startstop_service, self.clientdata)
end
-function expert(self)
+function mymodule.expert(self)
return self.handle_form(self, self.model.get_filedetails, self.model.update_filedetails, self.clientdata, "Save", "Edit Amavis Config", "Configuration Set")
end
+
+return mymodule
diff --git a/amavis-model.lua b/amavis-model.lua
index f35ed9a..b73a7e2 100644
--- a/amavis-model.lua
+++ b/amavis-model.lua
@@ -1,4 +1,4 @@
-module(..., package.seeall)
+local mymodule = {}
-- Load libraries
modelfunctions = require("modelfunctions")
@@ -16,22 +16,24 @@ local path = "PATH=/usr/local/bin:/usr/bin:/bin:/usr/local/sbin:/usr/sbin:/sbin
-- ################################################################################
-- PUBLIC FUNCTIONS
-function get_startstop(self, clientdata)
+function mymodule.get_startstop(self, clientdata)
return modelfunctions.get_startstop(processname)
end
-function startstop_service(self, startstop, action)
+function mymodule.startstop_service(self, startstop, action)
return modelfunctions.startstop_service(startstop, action)
end
-function getstatus()
+function mymodule.getstatus()
return modelfunctions.getstatus(processname, packagename, "Amavis Status")
end
-function get_filedetails()
+function mymodule.get_filedetails()
return modelfunctions.getfiledetails(configfile)
end
-function update_filedetails(self, filedetails)
+function mymodule.update_filedetails(self, filedetails)
return modelfunctions.setfiledetails(self, filedetails, {configfile})
end
+
+return mymodule