diff options
author | Mika Havela <mika.havela@gmail.com> | 2008-02-22 15:11:01 +0000 |
---|---|---|
committer | Mika Havela <mika.havela@gmail.com> | 2008-02-22 15:11:01 +0000 |
commit | 800060937ee9a859baa2157e4912a1e064ee6ca2 (patch) | |
tree | 3f1f34151a2d020cc7f04f1392c91400d8746ccb /tinydns-model.lua | |
parent | 9c87ef46027f223be76d19ba0339f37c35ce23a5 (diff) | |
download | acf-tinydns-800060937ee9a859baa2157e4912a1e064ee6ca2.tar.bz2 acf-tinydns-800060937ee9a859baa2157e4912a1e064ee6ca2.tar.xz |
Made some progress
git-svn-id: svn://svn.alpinelinux.org/acf/tinydns/trunk@765 ab2d0c66-481e-0410-8bed-d214d4d58bed
Diffstat (limited to 'tinydns-model.lua')
-rw-r--r-- | tinydns-model.lua | 58 |
1 files changed, 54 insertions, 4 deletions
diff --git a/tinydns-model.lua b/tinydns-model.lua index 4d08a57..a466f6b 100644 --- a/tinydns-model.lua +++ b/tinydns-model.lua @@ -122,7 +122,7 @@ local function searchforconfigfiles() end -- Debug option (adds the sampleconfig content) - table.insert(configfiles, "/usr/share/acf/app/tinydns/sampleconfig.conf") +-- table.insert(configfiles, "/usr/share/acf/app/tinydns/sampleconfig.conf") end searchforconfigfiles() @@ -149,7 +149,15 @@ local function recursedomains(t,array,maxn,currnum) currnum = currnum - 1 -- FIXME: The current level should hold information on previous level too! if not (currnum == 0) then + +-- if (array) and (type(array[t[currnum]]) == "table") then +-- local k,v = pairs(array[t[currnum]]) do +-- end +-- end + if not (array[t[currnum]]) then +-- if not (array[(table.concat(t,"."))]) then +-- array[t[currnum]] = {} array[t[currnum]] = {} end recursedomains(t,array[t[currnum]],maxn,currnum) @@ -273,11 +281,53 @@ function getconfig() if (filecontent_table[1] == "&") then local descr=check_signs("prefix") domain = format.string_to_table(filecontent_table[2], "%.") + + if (domain[#domain] ~= "arpa") then + -- We rebuild the table and add previous level-information to the current level + for i = table.maxn(domain),2,-1 do + domain[i-1] = domain[i-1] .. "." .. domain[i] + end + + -- This is the main information on each object domaindetails = cfe ({ - name=filecontent_table[2], - label=descr[filecontent_table[1]], - value=filecontent_table[2], + name=filecontent_table[4], + label=filecontent_table[4], }) + -- Add details to the previous object + table.insert(domaindetails, cfe ({ + name=type, + label="Type:", + value=descr[filecontent_table[1]], + })) + table.insert(domaindetails, cfe ({ + name=domain, + label="Domain:", + value=filecontent_table[2], + })) + table.insert(domaindetails, cfe ({ + name=ip, + label="IP address:", + value=filecontent_table[3], + })) + table.insert(domaindetails, cfe ({ + name=ns, + label="Name server:", + value=filecontent_table[4], + })) + table.insert(domaindetails, cfe ({ + name=ttl, + label="TimeToLive:", + value=filecontent_table[5], + })) + + + table.insert(domaindetails, cfe ({ + name=debug, + label="Debug:", + value=table.concat(filecontent_table,":"), + })) + end + end local value = filecontent_table[2] |