diff idavoll/backend.py @ 174:79d451d186b1

Send out node deletion notifications.
author Ralph Meijer <ralphm@ik.nu>
date Wed, 09 Apr 2008 11:48:38 +0000
parents 9bfb00edd0cc
children 07114105885a
line wrap: on
line diff
--- a/idavoll/backend.py	Wed Apr 09 11:43:16 2008 +0000
+++ b/idavoll/backend.py	Wed Apr 09 11:48:38 2008 +0000
@@ -385,6 +385,7 @@
         self.pubSubFeatures = self._getPubSubFeatures()
 
         self.backend.register_notifier(self._notify)
+        self.backend.register_pre_delete(self._pre_delete)
 
     def _getPubSubFeatures(self):
         features = [
@@ -426,6 +427,13 @@
                                                                nodeIdentifier,
                                                                notifications))
 
+    def _pre_delete(self, nodeIdentifier):
+        d = self.backend.get_subscribers(nodeIdentifier)
+        d.addCallback(lambda subscribers: self.notifyDelete(self.serviceJID,
+                                                            nodeIdentifier,
+                                                            subscribers))
+        return d
+
     def _mapErrors(self, failure):
         e = failure.trap(*self._errorMap.keys())