Software /
code /
prosody
Comparison
plugins/mod_pep.lua @ 8330:8d5c2eef1654
mod_pep: Advertise pubsub features that I believe to be implented
author | Kim Alvefur <zash@zash.se> |
---|---|
date | Tue, 17 Oct 2017 05:22:43 +0200 |
parent | 8329:83bab3c84671 |
child | 8728:41c959c5c84b |
comparison
equal
deleted
inserted
replaced
8329:83bab3c84671 | 8330:8d5c2eef1654 |
---|---|
15 local next = next; | 15 local next = next; |
16 local type = type; | 16 local type = type; |
17 local calculate_hash = require "util.caps".calculate_hash; | 17 local calculate_hash = require "util.caps".calculate_hash; |
18 local core_post_stanza = prosody.core_post_stanza; | 18 local core_post_stanza = prosody.core_post_stanza; |
19 local bare_sessions = prosody.bare_sessions; | 19 local bare_sessions = prosody.bare_sessions; |
20 | |
21 local xmlns_pubsub = "http://jabber.org/protocol/pubsub"; | |
20 | 22 |
21 -- Used as canonical 'empty table' | 23 -- Used as canonical 'empty table' |
22 local NULL = {}; | 24 local NULL = {}; |
23 -- data[user_bare_jid][node] = item_stanza | 25 -- data[user_bare_jid][node] = item_stanza |
24 local data = {}; | 26 local data = {}; |
279 end); | 281 end); |
280 | 282 |
281 module:hook("account-disco-info", function(event) | 283 module:hook("account-disco-info", function(event) |
282 local reply = event.reply; | 284 local reply = event.reply; |
283 reply:tag('identity', {category='pubsub', type='pep'}):up(); | 285 reply:tag('identity', {category='pubsub', type='pep'}):up(); |
284 reply:tag('feature', {var='http://jabber.org/protocol/pubsub#publish'}):up(); | 286 reply:tag('feature', {var=xmlns_pubsub}):up(); |
287 local features = { | |
288 "access-presence", | |
289 "auto-create", | |
290 "auto-subscribe", | |
291 "filtered-notifications", | |
292 "item-ids", | |
293 "last-published", | |
294 "presence-notifications", | |
295 "presence-subscribe", | |
296 "publish", | |
297 "retract-items", | |
298 "retrieve-items", | |
299 }; | |
300 for _, feature in ipairs(features) do | |
301 reply:tag('feature', {var=xmlns_pubsub.."#"..feature}):up(); | |
302 end | |
285 end); | 303 end); |
286 | 304 |
287 module:hook("account-disco-items", function(event) | 305 module:hook("account-disco-items", function(event) |
288 local reply = event.reply; | 306 local reply = event.reply; |
289 local bare = reply.attr.to; | 307 local bare = reply.attr.to; |