Mercurial > prosody-hg
comparison plugins/mod_pubsub/mod_pubsub.lua @ 14117:354427afb638
mod_pubsub: Provide iteminfo method to enable retract-own-items functionality
| author | Matthew Wild <mwild1@gmail.com> |
|---|---|
| date | Tue, 31 Mar 2026 14:15:00 +0100 |
| parents | cc916272c30f |
| children | 221f3378e7f4 |
comparison
equal
deleted
inserted
replaced
| 14116:c8458864dcea | 14117:354427afb638 |
|---|---|
| 139 | 139 |
| 140 function is_item_stanza(item) | 140 function is_item_stanza(item) |
| 141 return st.is_stanza(item) and item.attr.xmlns == xmlns_pubsub and item.name == "item" and #item.tags == 1; | 141 return st.is_stanza(item) and item.attr.xmlns == xmlns_pubsub and item.name == "item" and #item.tags == 1; |
| 142 end | 142 end |
| 143 | 143 |
| 144 function get_item_metadata(item) | |
| 145 return { | |
| 146 publisher = item.attr.publisher; | |
| 147 }; | |
| 148 end | |
| 149 | |
| 144 -- Compose a textual representation of Atom payloads | 150 -- Compose a textual representation of Atom payloads |
| 145 local summary_templates = module:get_option("pubsub_summary_templates", { | 151 local summary_templates = module:get_option("pubsub_summary_templates", { |
| 146 ["http://www.w3.org/2005/Atom"] = "{@pubsub:title|and{*{@pubsub:title}*\n\n}}{summary|or{{author/name|and{{author/name} posted }}{title}}}"; | 152 ["http://www.w3.org/2005/Atom"] = "{@pubsub:title|and{*{@pubsub:title}*\n\n}}{summary|or{{author/name|and{{author/name} posted }}{title}}}"; |
| 147 }) | 153 }) |
| 148 | 154 |
| 229 | 235 |
| 230 service.config.nodestore = node_store; | 236 service.config.nodestore = node_store; |
| 231 service.config.itemstore = create_simple_itemstore; | 237 service.config.itemstore = create_simple_itemstore; |
| 232 service.config.broadcaster = simple_broadcast; | 238 service.config.broadcaster = simple_broadcast; |
| 233 service.config.itemcheck = is_item_stanza; | 239 service.config.itemcheck = is_item_stanza; |
| 240 service.config.iteminfo = get_item_metadata; | |
| 234 service.config.check_node_config = check_node_config; | 241 service.config.check_node_config = check_node_config; |
| 235 service.config.get_affiliation = get_affiliation; | 242 service.config.get_affiliation = get_affiliation; |
| 236 | 243 |
| 237 module.environment.service = service; | 244 module.environment.service = service; |
| 238 add_disco_features_from_service(service); | 245 add_disco_features_from_service(service); |
| 260 max_items = max_max_items; | 267 max_items = max_max_items; |
| 261 nodestore = node_store; | 268 nodestore = node_store; |
| 262 itemstore = create_simple_itemstore; | 269 itemstore = create_simple_itemstore; |
| 263 broadcaster = simple_broadcast; | 270 broadcaster = simple_broadcast; |
| 264 itemcheck = is_item_stanza; | 271 itemcheck = is_item_stanza; |
| 272 iteminfo = get_item_metadata; | |
| 265 check_node_config = check_node_config; | 273 check_node_config = check_node_config; |
| 266 metadata_subset = { | 274 metadata_subset = { |
| 267 "title"; | 275 "title"; |
| 268 "description"; | 276 "description"; |
| 269 "payload_type"; | 277 "payload_type"; |
