Software / code / prosody
Comparison
plugins/mod_pubsub.lua @ 4225:f8dc8b9e0bdd
mod_pubsub: Remove checks for whether the JID being (un)subscribed is the actor's own - it's possible to (un)subscribe another JID if you have the (un)subscribe_other capability, which is already checked in util.pubsub (thanks Andrew)
| author | Matthew Wild <mwild1@gmail.com> |
|---|---|
| date | Fri, 18 Mar 2011 10:32:55 +0000 |
| parent | 4120:d62a2861f1f9 |
| child | 4246:d0767040236f |
comparison
equal
deleted
inserted
replaced
| 4223:9fb6e8ec15ed | 4225:f8dc8b9e0bdd |
|---|---|
| 106 return origin.send(reply); | 106 return origin.send(reply); |
| 107 end | 107 end |
| 108 | 108 |
| 109 function handlers.set_subscribe(origin, stanza, subscribe) | 109 function handlers.set_subscribe(origin, stanza, subscribe) |
| 110 local node, jid = subscribe.attr.node, subscribe.attr.jid; | 110 local node, jid = subscribe.attr.node, subscribe.attr.jid; |
| 111 if jid_bare(jid) ~= jid_bare(stanza.attr.from) then | |
| 112 return origin.send(pubsub_error_reply(stanza, "invalid-jid")); | |
| 113 end | |
| 114 local ok, ret = service:add_subscription(node, stanza.attr.from, jid); | 111 local ok, ret = service:add_subscription(node, stanza.attr.from, jid); |
| 115 local reply; | 112 local reply; |
| 116 if ok then | 113 if ok then |
| 117 reply = st.reply(stanza) | 114 reply = st.reply(stanza) |
| 118 :tag("pubsub", { xmlns = xmlns_pubsub }) | 115 :tag("pubsub", { xmlns = xmlns_pubsub }) |
| 127 return origin.send(reply); | 124 return origin.send(reply); |
| 128 end | 125 end |
| 129 | 126 |
| 130 function handlers.set_unsubscribe(origin, stanza, unsubscribe) | 127 function handlers.set_unsubscribe(origin, stanza, unsubscribe) |
| 131 local node, jid = unsubscribe.attr.node, unsubscribe.attr.jid; | 128 local node, jid = unsubscribe.attr.node, unsubscribe.attr.jid; |
| 132 if jid_bare(jid) ~= jid_bare(stanza.attr.from) then | |
| 133 return origin.send(pubsub_error_reply(stanza, "invalid-jid")); | |
| 134 end | |
| 135 local ok, ret = service:remove_subscription(node, stanza.attr.from, jid); | 129 local ok, ret = service:remove_subscription(node, stanza.attr.from, jid); |
| 136 local reply; | 130 local reply; |
| 137 if ok then | 131 if ok then |
| 138 reply = st.reply(stanza); | 132 reply = st.reply(stanza); |
| 139 else | 133 else |