|
diff --git a/plugins/mod_pubsub/mod_pubsub.lua b/plugins/mod_pubsub/mod_pubsub.lua |
|
index 40c28d2..fc0c420 100644 |
|
--- a/plugins/mod_pubsub/mod_pubsub.lua |
|
+++ b/plugins/mod_pubsub/mod_pubsub.lua |
|
@@ -153,78 +153,89 @@ end |
|
function module.load() |
|
if module.reloading then return; end |
|
|
|
+ |
|
+ local capabilities = { |
|
+ none = { |
|
+ create = false; |
|
+ publish = false; |
|
+ retract = false; |
|
+ get_nodes = true; |
|
+ |
|
+ subscribe = true; |
|
+ unsubscribe = true; |
|
+ get_subscription = true; |
|
+ get_subscriptions = true; |
|
+ get_items = true; |
|
+ |
|
+ subscribe_other = false; |
|
+ unsubscribe_other = false; |
|
+ get_subscription_other = false; |
|
+ get_subscriptions_other = false; |
|
+ |
|
+ be_subscribed = true; |
|
+ be_unsubscribed = true; |
|
+ |
|
+ set_affiliation = false; |
|
+ }; |
|
+ publisher = { |
|
+ create = false; |
|
+ publish = true; |
|
+ retract = true; |
|
+ get_nodes = true; |
|
+ |
|
+ subscribe = true; |
|
+ unsubscribe = true; |
|
+ get_subscription = true; |
|
+ get_subscriptions = true; |
|
+ get_items = true; |
|
+ |
|
+ subscribe_other = false; |
|
+ unsubscribe_other = false; |
|
+ get_subscription_other = false; |
|
+ get_subscriptions_other = false; |
|
+ |
|
+ be_subscribed = true; |
|
+ be_unsubscribed = true; |
|
+ |
|
+ set_affiliation = false; |
|
+ }; |
|
+ owner = { |
|
+ create = true; |
|
+ publish = true; |
|
+ retract = true; |
|
+ delete = true; |
|
+ get_nodes = true; |
|
+ |
|
+ subscribe = true; |
|
+ unsubscribe = true; |
|
+ get_subscription = true; |
|
+ get_subscriptions = true; |
|
+ get_items = true; |
|
+ |
|
+ subscribe_other = true; |
|
+ unsubscribe_other = true; |
|
+ get_subscription_other = true; |
|
+ get_subscriptions_other = true; |
|
+ |
|
+ be_subscribed = true; |
|
+ be_unsubscribed = true; |
|
+ |
|
+ set_affiliation = true; |
|
+ }; |
|
+ }; |
|
+ |
|
+ local default_capabilities = module:get_option("pubsub_capabilities"); |
|
+ |
|
+ if type(default_capabilities) == "table" then |
|
+ for aff, caps in pairs(default_capabilities) do |
|
+ for name, cap in pairs(caps) do |
|
+ capabilities[aff][name] = cap; |
|
+ end |
|
+ end |
|
+ end |
|
+ |
|
set_service(pubsub.new({ |
|
- capabilities = { |
|
- none = { |
|
- create = false; |
|
- publish = false; |
|
- retract = false; |
|
- get_nodes = true; |
|
- |
|
- subscribe = true; |
|
- unsubscribe = true; |
|
- get_subscription = true; |
|
- get_subscriptions = true; |
|
- get_items = true; |
|
- |
|
- subscribe_other = false; |
|
- unsubscribe_other = false; |
|
- get_subscription_other = false; |
|
- get_subscriptions_other = false; |
|
- |
|
- be_subscribed = true; |
|
- be_unsubscribed = true; |
|
- |
|
- set_affiliation = false; |
|
- }; |
|
- publisher = { |
|
- create = false; |
|
- publish = true; |
|
- retract = true; |
|
- get_nodes = true; |
|
- |
|
- subscribe = true; |
|
- unsubscribe = true; |
|
- get_subscription = true; |
|
- get_subscriptions = true; |
|
- get_items = true; |
|
- |
|
- subscribe_other = false; |
|
- unsubscribe_other = false; |
|
- get_subscription_other = false; |
|
- get_subscriptions_other = false; |
|
- |
|
- be_subscribed = true; |
|
- be_unsubscribed = true; |
|
- |
|
- set_affiliation = false; |
|
- }; |
|
- owner = { |
|
- create = true; |
|
- publish = true; |
|
- retract = true; |
|
- delete = true; |
|
- get_nodes = true; |
|
- configure = true; |
|
- |
|
- subscribe = true; |
|
- unsubscribe = true; |
|
- get_subscription = true; |
|
- get_subscriptions = true; |
|
- get_items = true; |
|
- |
|
- |
|
- subscribe_other = true; |
|
- unsubscribe_other = true; |
|
- get_subscription_other = true; |
|
- get_subscriptions_other = true; |
|
- |
|
- be_subscribed = true; |
|
- be_unsubscribed = true; |
|
- |
|
- set_affiliation = true; |
|
- }; |
|
- }; |
|
+ capabilities = capabilities; |
|
|
|
autocreate_on_publish = autocreate_on_publish; |
|
autocreate_on_subscribe = autocreate_on_subscribe; |
|
diff --git a/plugins/muc/muc.lib.lua b/plugins/muc/muc.lib.lua |
|
index 60b12ac..f731211 100644 |
|
--- a/plugins/muc/muc.lib.lua |
|
+++ b/plugins/muc/muc.lib.lua |
|
@@ -265,6 +265,17 @@ function room_mt:publicise_occupant_status(occupant, base_x, nick, actor, reason |
|
|
|
-- Presences for occupant itself |
|
self_x:tag("status", {code = "110";}):up(); |
|
+ local has201 = false; |
|
+ self_x:maptags(function(tag) |
|
+ if tag.name == "status" and tag.attr.code == "201" then |
|
+ has201 = true; |
|
+ return nil; |
|
+ end |
|
+ return tag; |
|
+ end) |
|
+ if has201 then |
|
+ self_x:tag("status", {code = "201";}):up(); |
|
+ end |
|
if occupant.role == nil then |
|
-- They get an unavailable |
|
self:route_to_occupant(occupant, self_p); |