Software /
code /
prosody
Comparison
util/pubsub.lua @ 3672:b24db47995ac
mod_pubsub, util.pubsub: Support node creation
author | Florian Zeitz <florob@babelmonkeys.de> |
---|---|
date | Wed, 01 Dec 2010 23:38:47 +0100 |
parent | 3641:3603aeb325de |
child | 3698:77171fd1dc3c |
comparison
equal
deleted
inserted
replaced
3671:b7d5fe8eb829 | 3672:b24db47995ac |
---|---|
26 if node_obj then | 26 if node_obj then |
27 return node_obj.subscribers[jid]; | 27 return node_obj.subscribers[jid]; |
28 end | 28 end |
29 end | 29 end |
30 | 30 |
31 function service:create(node, actor) | |
32 if not self.nodes[node] then | |
33 self.nodes[node] = { name = node, subscribers = {}, config = {}, data = {} }; | |
34 return true; | |
35 end | |
36 return false, "conflict"; | |
37 end | |
38 | |
31 function service:publish(node, actor, id, item) | 39 function service:publish(node, actor, id, item) |
32 local node_obj = self.nodes[node]; | 40 local node_obj = self.nodes[node]; |
33 if not node_obj then | 41 if not node_obj then |
34 node_obj = { name = node, subscribers = {}, config = {}, data = {} }; | 42 node_obj = { name = node, subscribers = {}, config = {}, data = {} }; |
35 self.nodes[node] = node_obj; | 43 self.nodes[node] = node_obj; |