Mercurial > prosody-hg
comparison plugins/mod_pep.lua @ 1402:34723bbd5acb
mod_pep: Broadcast from the user's bare JID, not full JID
| author | Waqas Hussain <waqas20@gmail.com> |
|---|---|
| date | Wed, 24 Jun 2009 19:40:12 +0500 |
| parents | a3ce55c1e43a |
| children | 12abd2da8885 |
comparison
equal
deleted
inserted
replaced
| 1401:a3ce55c1e43a | 1402:34723bbd5acb |
|---|---|
| 15 module:add_identity("pubsub", "pep"); | 15 module:add_identity("pubsub", "pep"); |
| 16 module:add_feature("http://jabber.org/protocol/pubsub#publish"); | 16 module:add_feature("http://jabber.org/protocol/pubsub#publish"); |
| 17 | 17 |
| 18 local function publish(session, node, item) | 18 local function publish(session, node, item) |
| 19 local disable = #item.tags ~= 1 or #item.tags[1].tags == 0; | 19 local disable = #item.tags ~= 1 or #item.tags[1].tags == 0; |
| 20 local stanza = st.message({from=session.full_jid, type='headline'}) | 20 local bare = session.username..'@'..session.host; |
| 21 local stanza = st.message({from=bare, type='headline'}) | |
| 21 :tag('event', {xmlns='http://jabber.org/protocol/pubsub#event'}) | 22 :tag('event', {xmlns='http://jabber.org/protocol/pubsub#event'}) |
| 22 :tag('items', {node=node}) | 23 :tag('items', {node=node}) |
| 23 :add_child(item) | 24 :add_child(item) |
| 24 :up() | 25 :up() |
| 25 :up(); | 26 :up(); |
| 26 | 27 |
| 27 local bare = session.username..'@'..session.host; | |
| 28 -- store for the future | 28 -- store for the future |
| 29 local user_data = data[bare]; | 29 local user_data = data[bare]; |
| 30 if disable then | 30 if disable then |
| 31 if user_data then user_data[node] = nil; end | 31 if user_data then user_data[node] = nil; end |
| 32 if not next(user_data) then data[bare] = nil; end | 32 if not next(user_data) then data[bare] = nil; end |
