Software /
code /
prosody
Changeset
6464:737c81bd898e
Merge 0.9->0.10
author | Kim Alvefur <zash@zash.se> |
---|---|
date | Sun, 05 Oct 2014 15:37:21 +0200 |
parents | 6460:6d3187f24608 (current diff) 6463:460584257cc9 (diff) |
children | 6465:ab68bb837fe0 6468:3728c30da4e3 |
files | net/dns.lua plugins/mod_admin_adhoc.lua |
diffstat | 2 files changed, 11 insertions(+), 6 deletions(-) [+] |
line wrap: on
line diff
--- a/net/dns.lua Sun Oct 05 15:36:19 2014 +0200 +++ b/net/dns.lua Sun Oct 05 15:37:21 2014 +0200 @@ -135,17 +135,19 @@ local function prune(rrs, time, soft) -- - - - - - - - - - - - - - - prune time = time or socket.gettime(); - for i,rr in pairs(rrs) do + for i,rr in ipairs(rrs) do if rr.tod then -- rr.tod = rr.tod - 50 -- accelerated decripitude rr.ttl = math.floor(rr.tod - time); if rr.ttl <= 0 then + rrs[rr[rr.type:lower()]] = nil; table.remove(rrs, i); return prune(rrs, time, soft); -- Re-iterate end elseif soft == 'soft' then -- What is this? I forget! assert(rr.ttl == 0); - rrs[i] = nil; + rrs[rr[rr.type:lower()]] = nil; + table.remove(rrs, i); end end end @@ -188,7 +190,7 @@ local rrs_metatable = {}; -- - - - - - - - - - - - - - - - - - rrs_metatable function rrs_metatable.__tostring(rrs) local t = {}; - for i,rr in pairs(rrs) do + for i,rr in ipairs(rrs) do append(t, tostring(rr)..'\n'); end return table.concat(t); @@ -681,7 +683,10 @@ self.cache = self.cache or setmetatable({}, cache_metatable); local rrs = get(self.cache, qclass, type, qname) or set(self.cache, qclass, type, qname, setmetatable({}, rrs_metatable)); - append(rrs, rr); + if not rrs[rr[qtype:lower()]] then + rrs[rr[qtype:lower()]] = true; + append(rrs, rr); + end if type == 'MX' then self.unsorted[rrs] = true; end end
--- a/plugins/mod_admin_adhoc.lua Sun Oct 05 15:36:19 2014 +0200 +++ b/plugins/mod_admin_adhoc.lua Sun Oct 05 15:37:21 2014 +0200 @@ -119,7 +119,7 @@ instructions = "Fill out this form to delete a user."; { name = "FORM_TYPE", type = "hidden", value = "http://jabber.org/protocol/admin" }; - { name = "accountjids", type = "jid-multi", label = "The Jabber ID(s) to delete" }; + { name = "accountjids", type = "jid-multi", required = true, label = "The Jabber ID(s) to delete" }; }; local delete_user_command_handler = adhoc_simple(delete_user_layout, function(fields, err) @@ -163,7 +163,7 @@ instructions = "Fill out this form to end a user's session."; { name = "FORM_TYPE", type = "hidden", value = "http://jabber.org/protocol/admin" }; - { name = "accountjids", type = "jid-multi", label = "The Jabber ID(s) for which to end sessions" }; + { name = "accountjids", type = "jid-multi", label = "The Jabber ID(s) for which to end sessions", required = true }; }; local end_user_session_handler = adhoc_simple(end_user_session_layout, function(fields, err)