Software /
code /
prosody
Comparison
util/pubsub.lua @ 5675:e29ece65e3b0
util.pubsub: Check whether node exists, when deleting
author | Florian Zeitz <florob@babelmonkeys.de> |
---|---|
date | Wed, 12 Jun 2013 16:53:51 +0200 |
parent | 5628:ba5c2f6b799e |
child | 5776:bd0ff8ae98a8 |
comparison
equal
deleted
inserted
replaced
5673:9ca4d1ada906 | 5675:e29ece65e3b0 |
---|---|
231 if not self:may(node, actor, "delete") then | 231 if not self:may(node, actor, "delete") then |
232 return false, "forbidden"; | 232 return false, "forbidden"; |
233 end | 233 end |
234 -- | 234 -- |
235 local node_obj = self.nodes[node]; | 235 local node_obj = self.nodes[node]; |
236 if not node_obj then | |
237 return false, "item-not-found"; | |
238 end | |
236 self.nodes[node] = nil; | 239 self.nodes[node] = nil; |
237 self.config.broadcaster("delete", node, node_obj.subscribers); | 240 self.config.broadcaster("delete", node, node_obj.subscribers); |
238 return true; | 241 return true; |
239 end | 242 end |
240 | 243 |