[CalendarServer-changes] [5989] CalendarServer/trunk/twistedcaldav/resource.py

source_changes at macosforge.org source_changes at macosforge.org
Thu Aug 5 14:18:24 PDT 2010


Revision: 5989
          http://trac.macosforge.org/projects/calendarserver/changeset/5989
Author:   sagen at apple.com
Date:     2010-08-05 14:18:23 -0700 (Thu, 05 Aug 2010)
Log Message:
-----------
Hook push properties up to calendar/addressbook homes

Modified Paths:
--------------
    CalendarServer/trunk/twistedcaldav/resource.py

Modified: CalendarServer/trunk/twistedcaldav/resource.py
===================================================================
--- CalendarServer/trunk/twistedcaldav/resource.py	2010-08-05 20:42:57 UTC (rev 5988)
+++ CalendarServer/trunk/twistedcaldav/resource.py	2010-08-05 21:18:23 UTC (rev 5989)
@@ -494,8 +494,6 @@
                     label = "collection" if isvirt else "default"
                     notifierID = dataObject.notifierID(label=label)
                     if notifierID is not None:
-                        print "XYZZY notifierID", notifierID
-
                         pubSubConfiguration = getPubSubConfiguration(config)
                         nodeName = getPubSubPath(notifierID, pubSubConfiguration)
                         propVal = customxml.PubSubXMPPPushKeyProperty(nodeName)
@@ -1401,9 +1399,6 @@
         except:
             return fail(Failure())
 
-        if hasattr(self, 'clientNotifier'):
-            self.clientNotifier.notify(op="update")
-
         return succeed(True)
 
     #
@@ -2294,79 +2289,59 @@
             qname = property.qname()
 
         if qname == (customxml.calendarserver_namespace, "push-transports"):
-            pubSubConfiguration = getPubSubConfiguration(config)
-            if (pubSubConfiguration['enabled'] and
-                getattr(self, "clientNotifier", None) is not None):
-                    id = self.clientNotifier.getID()
-                    nodeName = getPubSubPath(id, pubSubConfiguration)
-                    children = []
-                    if pubSubConfiguration['aps-bundle-id']:
-                        children.append(
-                            customxml.PubSubTransportProperty(
-                                customxml.PubSubSubscriptionProperty(
-                                    davxml.HRef(
-                                        pubSubConfiguration['subscription-url']
-                                    ),
+            notifierID = self._newStoreHome.notifierID()
+            if notifierID is not None:
+                pubSubConfiguration = getPubSubConfiguration(config)
+                children = []
+                if pubSubConfiguration['aps-bundle-id']:
+                    children.append(
+                        customxml.PubSubTransportProperty(
+                            customxml.PubSubSubscriptionProperty(
+                                davxml.HRef(
+                                    pubSubConfiguration['subscription-url']
                                 ),
-                                customxml.PubSubAPSBundleIDProperty(
-                                    pubSubConfiguration['aps-bundle-id']
-                                ),
-                                type="APSD",
-                            )
+                            ),
+                            customxml.PubSubAPSBundleIDProperty(
+                                pubSubConfiguration['aps-bundle-id']
+                            ),
+                            type="APSD",
                         )
-                    if pubSubConfiguration['xmpp-server']:
-                        children.append(
-                            customxml.PubSubTransportProperty(
-                                customxml.PubSubXMPPServerProperty(
-                                    pubSubConfiguration['xmpp-server']
-                                ),
-                                customxml.PubSubXMPPURIProperty(
-                                    getPubSubXMPPURI(id, pubSubConfiguration)
-                                ),
-                                type="XMPP",
-                            )
+                    )
+                if pubSubConfiguration['xmpp-server']:
+                    children.append(
+                        customxml.PubSubTransportProperty(
+                            customxml.PubSubXMPPServerProperty(
+                                pubSubConfiguration['xmpp-server']
+                            ),
+                            customxml.PubSubXMPPURIProperty(
+                                getPubSubXMPPURI(notifierID, pubSubConfiguration)
+                            ),
+                            type="XMPP",
                         )
+                    )
 
-                    propVal = customxml.PubSubPushTransportsProperty(*children)
-                    nodeCacher = getNodeCacher()
-                    d = nodeCacher.waitForNode(self.clientNotifier, nodeName)
-                    # In either case we're going to return the value
-                    d.addBoth(lambda ignored: propVal)
-                    return d
+                return succeed(customxml.PubSubPushTransportsProperty(*children))
 
 
             else:
                 return succeed(customxml.PubSubPushTransportsProperty())
 
         if qname == (customxml.calendarserver_namespace, "pushkey"):
-            pubSubConfiguration = getPubSubConfiguration(config)
-            if pubSubConfiguration['enabled']:
-                if getattr(self, "clientNotifier", None) is not None:
-                    id = self.clientNotifier.getID()
-                    nodeName = getPubSubPath(id, pubSubConfiguration)
-                    propVal = customxml.PubSubXMPPPushKeyProperty(nodeName)
-                    nodeCacher = getNodeCacher()
-                    d = nodeCacher.waitForNode(self.clientNotifier, nodeName)
-                    # In either case we're going to return the xmpp-uri value
-                    d.addBoth(lambda ignored: propVal)
-                    return d
+            notifierID = self._newStoreHome.notifierID()
+            if notifierID is not None:
+                pubSubConfiguration = getPubSubConfiguration(config)
+                nodeName = getPubSubPath(notifierID, pubSubConfiguration)
+                return succeed(customxml.PubSubXMPPPushKeyProperty(nodeName))
             else:
                 return succeed(customxml.PubSubXMPPPushKeyProperty())
 
 
         if qname == (customxml.calendarserver_namespace, "xmpp-uri"):
-            pubSubConfiguration = getPubSubConfiguration(config)
-            if pubSubConfiguration['enabled']:
-                if getattr(self, "clientNotifier", None) is not None:
-                    id = self.clientNotifier.getID()
-                    nodeName = getPubSubPath(id, pubSubConfiguration)
-                    propVal = customxml.PubSubXMPPURIProperty(
-                        getPubSubXMPPURI(id, pubSubConfiguration))
-                    nodeCacher = getNodeCacher()
-                    d = nodeCacher.waitForNode(self.clientNotifier, nodeName)
-                    # In either case we're going to return the xmpp-uri value
-                    d.addBoth(lambda ignored: propVal)
-                    return d
+            notifierID = self._newStoreHome.notifierID()
+            if notifierID is not None:
+                pubSubConfiguration = getPubSubConfiguration(config)
+                return succeed(customxml.PubSubXMPPURIProperty(
+                    getPubSubXMPPURI(notifierID, pubSubConfiguration)))
             else:
                 return succeed(customxml.PubSubXMPPURIProperty())
 
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.macosforge.org/pipermail/calendarserver-changes/attachments/20100805/bd5b22a5/attachment.html>


More information about the calendarserver-changes mailing list