[CalendarServer-changes] [2665] CalendarServer/branches/users/sagen/xmpp/twistedcaldav

source_changes at macosforge.org source_changes at macosforge.org
Mon Jul 7 11:52:52 PDT 2008


Revision: 2665
          http://trac.macosforge.org/projects/calendarserver/changeset/2665
Author:   sagen at apple.com
Date:     2008-07-07 11:52:51 -0700 (Mon, 07 Jul 2008)
Log Message:
-----------
Use a more appropriate format for node name

Modified Paths:
--------------
    CalendarServer/branches/users/sagen/xmpp/twistedcaldav/notify.py
    CalendarServer/branches/users/sagen/xmpp/twistedcaldav/test/test_notify.py

Modified: CalendarServer/branches/users/sagen/xmpp/twistedcaldav/notify.py
===================================================================
--- CalendarServer/branches/users/sagen/xmpp/twistedcaldav/notify.py	2008-07-07 18:36:54 UTC (rev 2664)
+++ CalendarServer/branches/users/sagen/xmpp/twistedcaldav/notify.py	2008-07-07 18:52:51 UTC (rev 2665)
@@ -434,10 +434,13 @@
     def enqueue(self, uri):
         self.log_info("ENQUEUE %s" % (uri,))
         if self.xmlStream is not None:
+            # Convert uri to node
+            principal = uri.split('/')[3]
+            node = "/%s/com.apple.iCal" % (principal,)
             iq = IQ(self.xmlStream)
             child = iq.addElement('pubsub', defaultUri=self.pubsubNS)
             child = child.addElement('publish')
-            child['node'] = uri # TODO: use proper node
+            child['node'] = node
             iq.addCallback(self.response)
             iq.send(to=self.settings['ServiceAddress'])
 
@@ -446,7 +449,8 @@
             if testJid:
                 message = domish.Element(('jabber:client', 'message'))
                 message['to'] = testJid
-                message.addElement('body', None, uri)
+                message.addElement('body', None, "Calendar change: %s"
+                    % (principal,))
                 self.xmlStream.send(message)
 
     def response(self, iq):

Modified: CalendarServer/branches/users/sagen/xmpp/twistedcaldav/test/test_notify.py
===================================================================
--- CalendarServer/branches/users/sagen/xmpp/twistedcaldav/test/test_notify.py	2008-07-07 18:36:54 UTC (rev 2664)
+++ CalendarServer/branches/users/sagen/xmpp/twistedcaldav/test/test_notify.py	2008-07-07 18:52:51 UTC (rev 2665)
@@ -325,7 +325,7 @@
         settings = { 'ServiceAddress' : 'pubsub.example.com' }
         notifier = XMPPNotifier(settings, reactor=Clock())
         notifier.streamOpened(xmlStream)
-        notifier.enqueue("A")
+        notifier.enqueue("/principals/__uids__/test")
 
         iq = xmlStream.elements[0]
         self.assertEquals(iq.name, "iq")
@@ -337,13 +337,13 @@
         publish = list(pubsub.elements())[0]
         self.assertEquals(publish.name, "publish")
         self.assertEquals(publish.uri, 'http://jabber.org/protocol/pubsub')
-        self.assertEquals(publish['node'], "A")
+        self.assertEquals(publish['node'], "/test/com.apple.iCal")
 
     def test_sendWhileNotConnected(self):
         xmlStream = StubXmlStream()
         settings = { 'ServiceAddress' : 'pubsub.example.com' }
         notifier = XMPPNotifier(settings, Clock())
-        notifier.enqueue("A")
+        notifier.enqueue("/principals/__uids__/test")
         self.assertEquals(xmlStream.elements, [])
 
 
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://lists.macosforge.org/pipermail/calendarserver-changes/attachments/20080707/5b486355/attachment.html 


More information about the calendarserver-changes mailing list