Software /
code /
prosody
Comparison
util/pubsub.lua @ 9218:7e27dc4d100b
util.pubsub: Fire item-published/<node> to allow for easier handling of per-node items
author | Matthew Wild <mwild1@gmail.com> |
---|---|
date | Sun, 19 Aug 2018 23:37:19 +0100 |
parent | 9207:76d593b35958 |
child | 9220:c4f9469b203f |
comparison
equal
deleted
inserted
replaced
9217:7df29c5fbb9b | 9218:7e27dc4d100b |
---|---|
515 local ok = node_data:set(id, item); | 515 local ok = node_data:set(id, item); |
516 if not ok then | 516 if not ok then |
517 return nil, "internal-server-error"; | 517 return nil, "internal-server-error"; |
518 end | 518 end |
519 if type(ok) == "string" then id = ok; end | 519 if type(ok) == "string" then id = ok; end |
520 self.events.fire_event("item-published", { node = node, actor = actor, id = id, item = item }); | 520 local event_data = { node = node, actor = actor, id = id, item = item }; |
521 self.events.fire_event("item-published/"..node, event_data); | |
522 self.events.fire_event("item-published", event_data); | |
521 self.config.broadcaster("items", node, node_obj.subscribers, item, actor, node_obj, self); | 523 self.config.broadcaster("items", node, node_obj.subscribers, item, actor, node_obj, self); |
522 return true; | 524 return true; |
523 end | 525 end |
524 | 526 |
525 function service:retract(node, actor, id, retract) | 527 function service:retract(node, actor, id, retract) |