aboutsummaryrefslogtreecommitdiffstats
path: root/plugins
diff options
context:
space:
mode:
Diffstat (limited to 'plugins')
-rw-r--r--plugins/mod_pep.lua15
1 files changed, 15 insertions, 0 deletions
diff --git a/plugins/mod_pep.lua b/plugins/mod_pep.lua
index df29afdc..a96bb1aa 100644
--- a/plugins/mod_pep.lua
+++ b/plugins/mod_pep.lua
@@ -9,6 +9,7 @@ local is_contact_subscribed = require "core.rostermanager".is_contact_subscribed
local cache = require "util.cache";
local set = require "util.set";
local storagemanager = require "core.storagemanager";
+local usermanager = require "core.usermanager";
local xmlns_pubsub = "http://jabber.org/protocol/pubsub";
local xmlns_pubsub_event = "http://jabber.org/protocol/pubsub#event";
@@ -174,6 +175,17 @@ local function get_subscriber_filter(username)
end
end
+local nobody_service = pubsub.new({
+ service = pubsub.new({
+ node_defaults = {
+ ["max_items"] = 1;
+ ["persist_items"] = false;
+ ["access_model"] = "presence";
+ ["send_last_published_item"] = "on_sub_and_presence";
+ };
+ });
+});
+
function get_pep_service(username)
module:log("debug", "get_pep_service(%q)", username);
local user_bare = jid_join(username, host);
@@ -181,6 +193,9 @@ function get_pep_service(username)
if service then
return service;
end
+ if not usermanager.user_exists(username, host) then
+ return nobody_service;
+ end
service = pubsub.new({
pep_username = username;
node_defaults = {