Commit 938c8119 authored by Ted Trask's avatar Ted Trask

Modified format library. parse_configfile2, update_configfile2, get_section,...

Modified format library.  parse_configfile2, update_configfile2, get_section, and set_section became parse_ini_file, update_ini_file, get_ini_section, and set_ini_section.  Updated all code that used these functions.

git-svn-id: svn://svn.alpinelinux.org/acf/fetchmail/trunk@1539 ab2d0c66-481e-0410-8bed-d214d4d58bed
parent 38e9a058
......@@ -325,7 +325,7 @@ function update_filecontent(filedetails)
end
function getconfig()
local interval = cfe({ value=60, label="Polling Interval", descr="Interval in seconds" })
local interval = cfe({ value="60", label="Polling Interval", descr="Interval in seconds" })
local postmaster = cfe({ label="Postmaster", descr="If defined, undeliverable mail is sent to this account, otherwise it is discarded" })
local bounceerrors = cfe({ type="boolean", value=true, label="Bounce Errors", descr="Bounce errors back to the sender or send them to the postmaster" })
......@@ -338,9 +338,9 @@ function getconfig()
end
end
local confd = format.parse_configfile2(fs.read_file(confdfile), "", "polling_period")
local confd = format.parse_ini_file(fs.read_file(confdfile), "", "polling_period")
if confd then
interval.value = confd
interval.value = string.sub(confd, 2, -2)
end
return cfe({ type="group", value={interval=interval, postmaster=postmaster, bounceerrors=bounceerrors}, label="Fetchmail Global Config" })
......@@ -376,7 +376,7 @@ function updateconfig(conf)
posix.chmod(configfile, "rwx--x---")
config = nil
fs.write_file(confdfile, format.update_configfile2(fs.read_file(confdfile) or "", "", "polling_period", '"'..conf.value.interval.value..'"'))
fs.write_file(confdfile, format.update_ini_file(fs.read_file(confdfile) or "", "", "polling_period", '"'..conf.value.interval.value..'"'))
else
conf.errtxt = "Failed to set configuration"
end
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment