diff options
author | Tobias Markmann <tm@ayena.de> | 2009-08-13 11:56:22 +0200 |
---|---|---|
committer | Tobias Markmann <tm@ayena.de> | 2009-08-13 11:56:22 +0200 |
commit | 07f9296e47efa855976bfff40b99b9bddf9edb86 (patch) | |
tree | f245142bcb522b5ff072de765ba589659a058019 /plugins/mod_compression.lua | |
parent | cbf4a37b6f8e58b2bf054475fe829f00f93b8530 (diff) | |
download | prosody-07f9296e47efa855976bfff40b99b9bddf9edb86.tar.gz prosody-07f9296e47efa855976bfff40b99b9bddf9edb86.zip |
Add config option handling.
Diffstat (limited to 'plugins/mod_compression.lua')
-rw-r--r-- | plugins/mod_compression.lua | 11 |
1 files changed, 11 insertions, 0 deletions
diff --git a/plugins/mod_compression.lua b/plugins/mod_compression.lua index 8c32b14d..660d9052 100644 --- a/plugins/mod_compression.lua +++ b/plugins/mod_compression.lua @@ -13,6 +13,17 @@ local xmlns_compression_feature = "http://jabber.org/features/compress" local xmlns_compression_protocol = "http://jabber.org/protocol/compress" local compression_stream_feature = st.stanza("compression", {xmlns=xmlns_compression_feature}):tag("method"):text("zlib"):up(); +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; + +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."); + return; +end module:add_event_hook("stream-features", function (session, features) |