Software / code / prosody
Comparison
plugins/mod_pubsub/mod_pubsub.lua @ 8808:40a7135eb6ac
mod_pubsub: Use moduleapi broadcast method
| author | Kim Alvefur <zash@zash.se> |
|---|---|
| date | Mon, 21 May 2018 01:25:10 +0200 |
| parent | 8695:09e7fd8b16cd |
| child | 8811:f2d35eee69c9 |
comparison
equal
deleted
inserted
replaced
| 8807:bf91de890107 | 8808:40a7135eb6ac |
|---|---|
| 50 end | 50 end |
| 51 local message = st.message({ from = module.host, type = "headline" }) | 51 local message = st.message({ from = module.host, type = "headline" }) |
| 52 :tag("event", { xmlns = xmlns_pubsub_event }) | 52 :tag("event", { xmlns = xmlns_pubsub_event }) |
| 53 :tag(kind, { node = node }) | 53 :tag(kind, { node = node }) |
| 54 :add_child(item); | 54 :add_child(item); |
| 55 for jid in pairs(jids) do | 55 module:broadcast(jids, message, pairs); |
| 56 module:log("debug", "Sending notification to %s", jid); | |
| 57 message.attr.to = jid; | |
| 58 module:send(message); | |
| 59 end | |
| 60 end | 56 end |
| 61 | 57 |
| 62 function is_item_stanza(item) | 58 function is_item_stanza(item) |
| 63 return st.is_stanza(item) and item.attr.xmlns == xmlns_pubsub and item.name == "item"; | 59 return st.is_stanza(item) and item.attr.xmlns == xmlns_pubsub and item.name == "item"; |
| 64 end | 60 end |