mod_muc_limits: Update to work with both the new and the old MUC API
authorKim Alvefur <zash@zash.se>
Thu, 18 Jun 2015 19:15:55 +0200
changeset 1772 163967467308
parent 1771 ca48eea4785c
child 1773 f2705465cab4
mod_muc_limits: Update to work with both the new and the old MUC API
mod_muc_limits/mod_muc_limits.lua
--- a/mod_muc_limits/mod_muc_limits.lua	Mon Jun 08 15:29:33 2015 +0200
+++ b/mod_muc_limits/mod_muc_limits.lua	Thu Jun 18 19:15:55 2015 +0200
@@ -1,8 +1,8 @@
 
-local rooms = module:shared "muc/rooms";
+local mod_muc = module:depends"muc";
+local rooms = rawget(mod_muc, "rooms"); -- Old MUC API
 if not rooms then
-	module:log("error", "This module only works on MUC components!");
-	return;
+	rooms = module:shared"muc/rooms"; -- New MUC API
 end
 
 local jid_split, jid_bare = require "util.jid".split, require "util.jid".bare;