Diff

plugins/mod_compression.lua @ 4480:187ce118aea6

mod_compression: Use get_option_number
author Kim Alvefur <zash@zash.se>
date Thu, 19 Jan 2012 16:38:04 +0100
parent 3540:bc139431830b
child 4481:408c2f688e4e
line wrap: on
line diff
--- a/plugins/mod_compression.lua	Wed Jan 18 15:08:05 2012 +0000
+++ b/plugins/mod_compression.lua	Thu Jan 19 16:38:04 2012 +0100
@@ -16,12 +16,8 @@
 local compression_stream_feature = st.stanza("compression", {xmlns=xmlns_compression_feature}):tag("method"):text("zlib"):up();
 local add_filter = require "util.filters".add_filter;
 
-local compression_level = module:get_option("compression_level");
--- if not defined assume admin wants best compression
-if compression_level == nil then compression_level = 9 end;
+local compression_level = module:get_option_number("compression_level", 9);
 
-
-compression_level = tonumber(compression_level);
 if not compression_level or compression_level < 1 or compression_level > 9 then
 	module:log("warn", "Invalid compression level in config: %s", tostring(compression_level));
 	module:log("warn", "Module loading aborted. Compression won't be available.");