diff options
author | Matthew Wild <mwild1@gmail.com> | 2015-05-06 19:02:07 +0100 |
---|---|---|
committer | Matthew Wild <mwild1@gmail.com> | 2015-05-06 19:02:07 +0100 |
commit | e5323b0c7fac6ae251228473407591139dcd0e58 (patch) | |
tree | b9d8e305a1276966526ca7b704039a8ba20ce1bc /core | |
parent | 343f4f8c29f7c8856f7237c7a3cd16785ee6b86b (diff) | |
download | prosody-e5323b0c7fac6ae251228473407591139dcd0e58.tar.gz prosody-e5323b0c7fac6ae251228473407591139dcd0e58.zip |
moduleapi: Minor variable renaming to avoid clashes with the 'type' function
Diffstat (limited to 'core')
-rw-r--r-- | core/moduleapi.lua | 28 |
1 files changed, 14 insertions, 14 deletions
diff --git a/core/moduleapi.lua b/core/moduleapi.lua index c7fadc27..fbb131ec 100644 --- a/core/moduleapi.lua +++ b/core/moduleapi.lua @@ -63,8 +63,8 @@ end function api:add_feature(xmlns) self:add_item("feature", xmlns); end -function api:add_identity(category, type, name) - self:add_item("identity", {category = category, type = type, name = name}); +function api:add_identity(category, identity_type, name) + self:add_item("identity", {category = category, type = identity_type, name = name}); end function api:add_extension(data) self:add_item("extension", data); @@ -75,9 +75,9 @@ function api:has_feature(xmlns) end return false; end -function api:has_identity(category, type, name) +function api:has_identity(category, identity_type, name) for _, id in ipairs(self:get_host_items("identity")) do - if id.category == category and id.type == type and id.name == name then + if id.category == category and id.type == identity_type and id.name == name then return true; end end @@ -329,11 +329,11 @@ function api:get_host_items(key) return result; end -function api:handle_items(type, added_cb, removed_cb, existing) - self:hook("item-added/"..type, added_cb); - self:hook("item-removed/"..type, removed_cb); +function api:handle_items(item_type, added_cb, removed_cb, existing) + self:hook("item-added/"..item_type, added_cb); + self:hook("item-removed/"..item_type, removed_cb); if existing ~= false then - for _, item in ipairs(self:get_host_items(type)) do + for _, item in ipairs(self:get_host_items(item_type)) do added_cb({ item = item }); end end @@ -389,19 +389,19 @@ function api:load_resource(path, mode) return io.open(path, mode); end -function api:open_store(name, type) - return require"core.storagemanager".open(self.host, name or self.name, type); +function api:open_store(name, store_type) + return require"core.storagemanager".open(self.host, name or self.name, store_type); end -function api:measure(name, type) - return measure(type, "/"..self.host.."/mod_"..self.name.."/"..name); +function api:measure(name, stat_type) + return measure(stat_type, "/"..self.host.."/mod_"..self.name.."/"..name); end function api:measure_object_event(events_object, event_name, stat_name) local m = self:measure(stat_name or event_name, "duration"); - local function handler(handlers, event_name, event_data) + local function handler(handlers, _event_name, _event_data) local finished = m(); - local ret = handlers(event_name, event_data); + local ret = handlers(_event_name, _event_data); finished(); return ret; end |