# HG changeset patch # User Matthew Wild # Date 1257038667 0 # Node ID 1fc4e8dc66a644f40762bfd3c4201ca28165244b # Parent 3c7189e2684870b6ae99efbb3e2b73a6f2781899 mod_pastebin: Send Content-Type header to specify plain UTF-8 text diff -r 3c7189e26848 -r 1fc4e8dc66a6 mod_pastebin/mod_pastebin.lua --- a/mod_pastebin/mod_pastebin.lua Sun Nov 01 01:10:02 2009 +0000 +++ b/mod_pastebin/mod_pastebin.lua Sun Nov 01 01:24:27 2009 +0000 @@ -14,13 +14,14 @@ local expire_after = math.floor((config.get(module.host, "core", "pastebin_expire_after") or 24) * 3600); local pastes = {}; +local default_headers = { ["Content-Type"] = "text/plain; charset=utf-8" }; local xmlns_xhtmlim = "http://jabber.org/protocol/xhtml-im"; local xmlns_xhtml = "http://www.w3.org/1999/xhtml"; function pastebin_text(text) local uuid = uuid_new(); - pastes[uuid] = { text = text, time = os_time() }; + pastes[uuid] = { body = text, time = os_time(), headers = default_headers }; pastes[#pastes+1] = uuid; if not pastes[2] then -- No other pastes, give the timer a kick add_task(expire_after, expire_pastes); @@ -36,7 +37,7 @@ --module:log("debug", "Received request, replying: %s", pastes[pasteid].text); - return pastes[pasteid].text; + return pastes[pasteid]; end function check_message(data)