aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorMatthew Wild <mwild1@gmail.com>2010-06-01 20:10:17 +0100
committerMatthew Wild <mwild1@gmail.com>2010-06-01 20:10:17 +0100
commit7f29c6d34adea17abf505767cd0188442fd5b1bc (patch)
treee607d838fd73008d0764a1a9638d5d125d861d95
parent49d8e766146c0d9e097801661f28485552117da7 (diff)
downloadprosody-7f29c6d34adea17abf505767cd0188442fd5b1bc.tar.gz
prosody-7f29c6d34adea17abf505767cd0188442fd5b1bc.zip
mod_pep: Use is_contact_subscribed (which uses the new rostermanager fix to avoid unnecessary roster loads)
-rw-r--r--plugins/mod_pep.lua5
1 files changed, 2 insertions, 3 deletions
diff --git a/plugins/mod_pep.lua b/plugins/mod_pep.lua
index aa46d2d3..bc20fc77 100644
--- a/plugins/mod_pep.lua
+++ b/plugins/mod_pep.lua
@@ -16,7 +16,6 @@ local is_contact_subscribed = require "core.rostermanager".is_contact_subscribed
local pairs, ipairs = pairs, ipairs;
local next = next;
local type = type;
-local load_roster = require "core.rostermanager".load_roster;
local sha1 = require "util.hashes".sha1;
local base64 = require "util.encodings".base64.encode;
@@ -40,8 +39,8 @@ module:add_feature("http://jabber.org/protocol/pubsub#publish");
local function subscription_presence(user_bare, recipient)
local recipient_bare = jid_bare(recipient);
if (recipient_bare == user_bare) then return true end
- local item = load_roster(jid_split(user_bare))[recipient_bare];
- return item and (item.subscription == 'from' or item.subscription == 'both');
+ local username, host = jid_split(user_bare);
+ return is_contact_subscribed(username, host, recipient_bare);
end
local function publish(session, node, id, item)