Mercurial > prosody-hg
comparison plugins/mod_pep.lua @ 5627:0439d1349dc1
mod_disco: Emit events for disco requests, which contain a node, on user accounts
| author | Florian Zeitz <florob@babelmonkeys.de> |
|---|---|
| date | Fri, 17 May 2013 18:35:50 +0200 |
| parents | 3eaf4fc58902 |
| children | 624b874059bf |
comparison
equal
deleted
inserted
replaced
| 5626:8416d4619d80 | 5627:0439d1349dc1 |
|---|---|
| 260 end | 260 end |
| 261 end | 261 end |
| 262 end); | 262 end); |
| 263 | 263 |
| 264 module:hook("account-disco-info", function(event) | 264 module:hook("account-disco-info", function(event) |
| 265 local stanza = event.stanza; | 265 local reply = event.reply; |
| 266 stanza:tag('identity', {category='pubsub', type='pep'}):up(); | 266 reply:tag('identity', {category='pubsub', type='pep'}):up(); |
| 267 stanza:tag('feature', {var='http://jabber.org/protocol/pubsub#publish'}):up(); | 267 reply:tag('feature', {var='http://jabber.org/protocol/pubsub#publish'}):up(); |
| 268 end); | 268 end); |
| 269 | 269 |
| 270 module:hook("account-disco-items", function(event) | 270 module:hook("account-disco-items", function(event) |
| 271 local stanza = event.stanza; | 271 local reply = event.reply; |
| 272 local bare = stanza.attr.to; | 272 local bare = reply.attr.to; |
| 273 local user_data = data[bare]; | 273 local user_data = data[bare]; |
| 274 | 274 |
| 275 if user_data then | 275 if user_data then |
| 276 for node, _ in pairs(user_data) do | 276 for node, _ in pairs(user_data) do |
| 277 stanza:tag('item', {jid=bare, node=node}):up(); -- TODO we need to handle queries to these nodes | 277 reply:tag('item', {jid=bare, node=node}):up(); -- TODO we need to handle queries to these nodes |
| 278 end | 278 end |
| 279 end | 279 end |
| 280 end); | 280 end); |
