60 url = url:gsub("+", " ") |
60 url = url:gsub("+", " ") |
61 url = url:gsub("%%(%x%x)", function(h) return strchar(tonumber(h,16)) end) |
61 url = url:gsub("%%(%x%x)", function(h) return strchar(tonumber(h,16)) end) |
62 url = url:gsub("\r\n", "\n") |
62 url = url:gsub("\r\n", "\n") |
63 return url |
63 return url |
64 end |
64 end |
|
65 local function urlencode(s) |
|
66 return s and (s:gsub("[^a-zA-Z0-9.~_-]", function (c) return ("%%%02x"):format(c:byte()); end)); |
|
67 end |
65 |
68 |
66 local function generate_room_list(component) |
69 local function generate_room_list(component) |
67 local rooms = ""; |
70 local rooms = ""; |
68 local component_host = hosts[component]; |
71 local component_host = hosts[component]; |
69 if component_host and component_host.muc ~= nil then |
72 if component_host and component_host.muc ~= nil then |
70 for jid, room in pairs(component_host.muc.rooms) do |
73 for jid, room in pairs(component_host.muc.rooms) do |
71 local node = split_jid(jid); |
74 local node = split_jid(jid); |
72 if not room._data.hidden and room._data.logging and node then |
75 if not room._data.hidden and room._data.logging and node then |
73 rooms = rooms .. html.rooms.bit:gsub("###ROOM###", node):gsub("###COMPONENT###", component); |
76 rooms = rooms .. html.rooms.bit:gsub("###ROOM###", urlencode(node)):gsub("###COMPONENT###", component); |
74 end |
77 end |
75 end |
78 end |
76 return html.rooms.body:gsub("###ROOMS_STUFF###", rooms):gsub("###COMPONENT###", component), "Chatroom logs for "..component; |
79 return html.rooms.body:gsub("###ROOMS_STUFF###", rooms):gsub("###COMPONENT###", component), "Chatroom logs for "..component; |
77 end |
80 end |
78 end |
81 end |