Mercurial > prosody-hg
comparison plugins/mod_pep.lua @ 2384:7bec10f26082
mod_pep: Handle service discovery queries for bare account JIDs (thanks darkrain).
| author | Waqas Hussain <waqas20@gmail.com> |
|---|---|
| date | Mon, 21 Dec 2009 06:26:37 +0500 |
| parents | 5839f303addf |
| children | 470004f8f4ed |
comparison
equal
deleted
inserted
replaced
| 2383:29a30884aadd | 2384:7bec10f26082 |
|---|---|
| 275 -- send messages to recipient | 275 -- send messages to recipient |
| 276 publish_all(user, contact, session); | 276 publish_all(user, contact, session); |
| 277 end | 277 end |
| 278 end | 278 end |
| 279 end); | 279 end); |
| 280 | |
| 281 module:hook("account-disco-info", function(event) | |
| 282 local stanza = event.stanza; | |
| 283 stanza:tag('identity', {category='pubsub', type='pep'}):up(); | |
| 284 stanza:tag('feature', {var='http://jabber.org/protocol/pubsub#publish'}):up(); | |
| 285 end); | |
| 286 | |
| 287 module:hook("account-disco-items", function(event) | |
| 288 local session, stanza = event.session, event.stanza; | |
| 289 local bare = session.username..'@'..session.host; | |
| 290 local user_data = data[bare]; | |
| 291 | |
| 292 if user_data then | |
| 293 for node, _ in pairs(user_data) do | |
| 294 stanza:tag('item', {jid=bare, node=node}):up(); | |
| 295 end | |
| 296 end | |
| 297 end); |
