Mercurial > prosody-modules
comparison mod_muc_log_http/muc_log_http/mod_muc_log_http.lua @ 578:1a575bcbc843
mod_muc_log_http: Return a proper 404 Not Found page on missing pages instead of a traceback.
author | Waqas Hussain <waqas20@gmail.com> |
---|---|
date | Wed, 25 Jan 2012 04:20:08 +0500 |
parents | 20ef4a289d7d |
children | 513aa6fed9e9 |
comparison
equal
deleted
inserted
replaced
577:d26436bdfd5c | 578:1a575bcbc843 |
---|---|
84 end | 84 end |
85 return t; | 85 return t; |
86 end | 86 end |
87 | 87 |
88 function createDoc(body, title) | 88 function createDoc(body, title) |
89 assert(body, "<nil> HTTP response"); | 89 if not body then |
90 return { status = "404 Not Found", body = "<h1>Page Not Found</h1>Sorry, we couldn't find what you were looking for :(" }; | |
91 end | |
90 body = body:gsub("%%", "%%%%"); | 92 body = body:gsub("%%", "%%%%"); |
91 return html.doc:gsub("###BODY_STUFF###", body) | 93 return html.doc:gsub("###BODY_STUFF###", body) |
92 :gsub("<title>muc_log</title>", "<title>"..(title and htmlEscape(title) or "Chatroom logs").."</title>"); | 94 :gsub("<title>muc_log</title>", "<title>"..(title and htmlEscape(title) or "Chatroom logs").."</title>"); |
93 end | 95 end |
94 | 96 |