diff options
-rw-r--r-- | plugins/mod_pubsub/pubsub.lib.lua | 7 | ||||
-rw-r--r-- | spec/scansion/pep_nickname.scs | 12 | ||||
-rw-r--r-- | spec/scansion/pep_publish_subscribe.scs | 6 | ||||
-rw-r--r-- | spec/scansion/pubsub_advanced.scs | 2 | ||||
-rw-r--r-- | spec/scansion/pubsub_basic.scs | 2 | ||||
-rw-r--r-- | spec/scansion/pubsub_multi_items.scs | 8 |
6 files changed, 20 insertions, 17 deletions
diff --git a/plugins/mod_pubsub/pubsub.lib.lua b/plugins/mod_pubsub/pubsub.lib.lua index e7fa715d..6214882f 100644 --- a/plugins/mod_pubsub/pubsub.lib.lua +++ b/plugins/mod_pubsub/pubsub.lib.lua @@ -607,6 +607,9 @@ function handlers.set_publish(origin, stanza, publish, service) item.attr.id = id; end end + if item then + item.attr.publisher = service.config.normalize_jid(stanza.attr.from); + end local ok, ret = service:publish(node, stanza.attr.from, id, item, required_config); local reply; if ok then @@ -795,8 +798,8 @@ function handlers.owner_set_affiliations(origin, stanza, affiliations, service) return true; end -local function create_encapsulating_item(id, payload) - local item = st.stanza("item", { id = id, xmlns = xmlns_pubsub }); +local function create_encapsulating_item(id, payload, publisher) + local item = st.stanza("item", { id = id, publisher = publisher, xmlns = xmlns_pubsub }); item:add_child(payload); return item; end diff --git a/spec/scansion/pep_nickname.scs b/spec/scansion/pep_nickname.scs index f958ec75..aaf53c87 100644 --- a/spec/scansion/pep_nickname.scs +++ b/spec/scansion/pep_nickname.scs @@ -1,7 +1,7 @@ # Publishing a nickname in PEP and receiving a notification [Client] Romeo - jid: romeo@localhost/nJi7BeTR + jid: romeo@localhost password: password ----- @@ -20,7 +20,7 @@ Romeo sends: </iq> Romeo receives: - <iq id="4" to="romeo@localhost/nJi7BeTR" type="result"> + <iq id="4" type="result"> <pubsub xmlns="http://jabber.org/protocol/pubsub"> <publish node="http://jabber.org/protocol/nick"> <item id="current"/> @@ -34,12 +34,12 @@ Romeo sends: </presence> Romeo receives: - <iq id="disco" to="romeo@localhost/nJi7BeTR" from="romeo@localhost" type="get"> + <iq id="disco" from="romeo@localhost" type="get"> <query xmlns="http://jabber.org/protocol/disco#info" node="http://code.matthewwild.co.uk/clix/#jC32N+FhQoLrZ7nNQtZK3aqR0Fk="/> </iq> Romeo receives: - <presence from="romeo@localhost/nJi7BeTR"> + <presence> <c xmlns="http://jabber.org/protocol/caps" hash="sha-1" node="http://code.matthewwild.co.uk/clix/" ver="jC32N+FhQoLrZ7nNQtZK3aqR0Fk="/> </presence> @@ -55,10 +55,10 @@ Romeo sends: </iq> Romeo receives: - <message type="headline" from="romeo@localhost" to="romeo@localhost/nJi7BeTR"> + <message type="headline" from="romeo@localhost"> <event xmlns="http://jabber.org/protocol/pubsub#event"> <items node="http://jabber.org/protocol/nick"> - <item id="current"> + <item id="current" publisher="${Romeo's JID}"> <nickname xmlns="http://jabber.org/protocol/nick"/> </item> </items> diff --git a/spec/scansion/pep_publish_subscribe.scs b/spec/scansion/pep_publish_subscribe.scs index e8080134..6d33ffeb 100644 --- a/spec/scansion/pep_publish_subscribe.scs +++ b/spec/scansion/pep_publish_subscribe.scs @@ -182,7 +182,7 @@ Juliet sends: <iq type='result' id='fixme'/> Juliet sends: - <iq type='set' id='7'><pubsub xmlns='http://jabber.org/protocol/pubsub'><publish node='http://jabber.org/protocol/tune'><item id='current'><tune xmlns='http://jabber.org/protocol/tune'><title>Beautiful Cedars</title><artist>The Spinners</artist><source>Not Quite Folk</source><track>4</track></tune></item></publish></pubsub></iq> + <iq type='set' id='7'><pubsub xmlns='http://jabber.org/protocol/pubsub'><publish node='http://jabber.org/protocol/tune'><item id='current' publisher="${Juliet's JID}"><tune xmlns='http://jabber.org/protocol/tune'><title>Beautiful Cedars</title><artist>The Spinners</artist><source>Not Quite Folk</source><track>4</track></tune></item></publish></pubsub></iq> Juliet receives: <iq type='result' id='7' ><pubsub xmlns='http://jabber.org/protocol/pubsub'><publish node='http://jabber.org/protocol/tune'><item id='current'/></publish></pubsub></iq> @@ -197,13 +197,13 @@ Juliet sends: <iq type='result' id='{scansion:any}'/> Romeo receives: - <message type='headline' from='pep-test-tqvqu_pv@localhost'><event xmlns='http://jabber.org/protocol/pubsub#event'><items node='http://jabber.org/protocol/tune'><item id='current'><tune xmlns='http://jabber.org/protocol/tune'><title>Beautiful Cedars</title><artist>The Spinners</artist><source>Not Quite Folk</source><track>4</track></tune></item></items></event></message> + <message type='headline' from='pep-test-tqvqu_pv@localhost'><event xmlns='http://jabber.org/protocol/pubsub#event'><items node='http://jabber.org/protocol/tune'><item id='current' publisher="${Juliet's JID}"><tune xmlns='http://jabber.org/protocol/tune'><title>Beautiful Cedars</title><artist>The Spinners</artist><source>Not Quite Folk</source><track>4</track></tune></item></items></event></message> Romeo sends: <iq type='result' id='disco' to='pep-test-tqvqu_pv@localhost'><query xmlns='http://jabber.org/protocol/disco#info' node='http://code.matthewwild.co.uk/verse/#IfQwbaaDB4LEP5tkGArEaB/3Y+s='><identity type='pc' name='Verse' category='client'/><feature var='http://jabber.org/protocol/tune+notify'/><feature var='http://jabber.org/protocol/disco#info'/><feature var='http://jabber.org/protocol/disco#items'/><feature var='http://jabber.org/protocol/caps'/><feature var='http://jabber.org/protocol/mood+notify'/></query></iq> Romeo receives: - <message type='headline' from='pep-test-tqvqu_pv@localhost'><event xmlns='http://jabber.org/protocol/pubsub#event'><items node='http://jabber.org/protocol/tune'><item id='current'><tune xmlns='http://jabber.org/protocol/tune'><title>Beautiful Cedars</title><artist>The Spinners</artist><source>Not Quite Folk</source><track>4</track></tune></item></items></event></message> + <message type='headline' from='pep-test-tqvqu_pv@localhost'><event xmlns='http://jabber.org/protocol/pubsub#event'><items node='http://jabber.org/protocol/tune'><item id='current' publisher="${Juliet's JID}"><tune xmlns='http://jabber.org/protocol/tune'><title>Beautiful Cedars</title><artist>The Spinners</artist><source>Not Quite Folk</source><track>4</track></tune></item></items></event></message> Juliet disconnects diff --git a/spec/scansion/pubsub_advanced.scs b/spec/scansion/pubsub_advanced.scs index 86410677..74ca5309 100644 --- a/spec/scansion/pubsub_advanced.scs +++ b/spec/scansion/pubsub_advanced.scs @@ -129,7 +129,7 @@ Juliet receives: <message type="headline" from="pubsub.localhost"> <event xmlns="http://jabber.org/protocol/pubsub#event"> <items node="princely_musings"> - <item id="current"> + <item id="current" publisher="${Romeo's JID}"> <entry xmlns="http://www.w3.org/2005/Atom"> <title>Soliloquy</title> <summary>Lorem ipsum dolor sit amet</summary> diff --git a/spec/scansion/pubsub_basic.scs b/spec/scansion/pubsub_basic.scs index 0adf6857..610a6612 100644 --- a/spec/scansion/pubsub_basic.scs +++ b/spec/scansion/pubsub_basic.scs @@ -67,7 +67,7 @@ Juliet receives: <message type="headline" from="pubsub.localhost"> <event xmlns="http://jabber.org/protocol/pubsub#event"> <items node="princely_musings"> - <item id="current"> + <item id="current" publisher="${Romeo's JID}"> <entry xmlns="http://www.w3.org/2005/Atom"> <title>Soliloquy</title> <summary>Lorem ipsum dolor sit amet</summary> diff --git a/spec/scansion/pubsub_multi_items.scs b/spec/scansion/pubsub_multi_items.scs index d76bc46c..247731f1 100644 --- a/spec/scansion/pubsub_multi_items.scs +++ b/spec/scansion/pubsub_multi_items.scs @@ -159,10 +159,10 @@ Alice receives: <iq xmlns:stream="http://etherx.jabber.org/streams" to="${Alice's full JID}" from="pubsub.localhost" type="result" id=":3nvB2E20p1iuM6lOPaP6"> <pubsub xmlns="http://jabber.org/protocol/pubsub"> <items node="e96caf12-264f-4e5a-988e-00ae191771b6"> - <item xmlns="http://jabber.org/protocol/pubsub" id="20e9eb9e-8acb-436e-a486-40e80400faf1"> + <item publisher="${Alice's JID}" xmlns="http://jabber.org/protocol/pubsub" id="20e9eb9e-8acb-436e-a486-40e80400faf1"> <foo xmlns="https://zombofant.net/xmlns/aioxmpp#test">foo</foo> </item> - <item xmlns="http://jabber.org/protocol/pubsub" id="4b94623d-1127-41c0-ac47-e283fd890557"> + <item publisher="${Alice's JID}" xmlns="http://jabber.org/protocol/pubsub" id="4b94623d-1127-41c0-ac47-e283fd890557"> <foo xmlns="https://zombofant.net/xmlns/aioxmpp#test">bar</foo> </item> </items> @@ -180,10 +180,10 @@ Alice receives: <iq xmlns:stream="http://etherx.jabber.org/streams" to="${Alice's full JID}" from="pubsub.localhost" type="result" id=":XQdyK54iyOKiJvUoX9t_"> <pubsub xmlns="http://jabber.org/protocol/pubsub"> <items node="e96caf12-264f-4e5a-988e-00ae191771b6"> - <item xmlns="http://jabber.org/protocol/pubsub" id="20e9eb9e-8acb-436e-a486-40e80400faf1"> + <item xmlns="http://jabber.org/protocol/pubsub" publisher="${Alice's JID}" id="20e9eb9e-8acb-436e-a486-40e80400faf1"> <foo xmlns="https://zombofant.net/xmlns/aioxmpp#test">foo</foo> </item> - <item xmlns="http://jabber.org/protocol/pubsub" id="4b94623d-1127-41c0-ac47-e283fd890557"> + <item xmlns="http://jabber.org/protocol/pubsub" publisher="${Alice's JID}" id="4b94623d-1127-41c0-ac47-e283fd890557"> <foo xmlns="https://zombofant.net/xmlns/aioxmpp#test">bar</foo> </item> </items> |