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; |