[CalendarServer-changes] [2673] CalendarServer/branches/users/sagen/xmpp/twistedcaldav
source_changes at macosforge.org
source_changes at macosforge.org
Thu Jul 10 10:39:07 PDT 2008
Revision: 2673
http://trac.macosforge.org/projects/calendarserver/changeset/2673
Author: sagen at apple.com
Date: 2008-07-10 10:39:06 -0700 (Thu, 10 Jul 2008)
Log Message:
-----------
Adds xmpp-uri element to pubsub node property on CalendarHomeFile.
Modified Paths:
--------------
CalendarServer/branches/users/sagen/xmpp/twistedcaldav/customxml.py
CalendarServer/branches/users/sagen/xmpp/twistedcaldav/notify.py
CalendarServer/branches/users/sagen/xmpp/twistedcaldav/static.py
Modified: CalendarServer/branches/users/sagen/xmpp/twistedcaldav/customxml.py
===================================================================
--- CalendarServer/branches/users/sagen/xmpp/twistedcaldav/customxml.py 2008-07-10 06:18:25 UTC (rev 2672)
+++ CalendarServer/branches/users/sagen/xmpp/twistedcaldav/customxml.py 2008-07-10 17:39:06 UTC (rev 2673)
@@ -267,6 +267,7 @@
allowed_children = {
(pubsubnode_namespace, "service"): (0, 1),
(pubsubnode_namespace, "nodeid"): (0, 1),
+ (calendarserver_namespace, "xmpp-uri"): (0, 1),
}
class PubSubNodeId (davxml.WebDAVTextElement):
@@ -283,9 +284,17 @@
namespace = pubsubnode_namespace
name = "service"
+class PubSubXMPPURI (davxml.WebDAVTextElement):
+ """
+ The XMPP URI for a particular pubsub node
+ """
+ namespace = calendarserver_namespace
+ name = "xmpp-uri"
+
+
##
# Extensions to davxml.ResourceType
##
Modified: CalendarServer/branches/users/sagen/xmpp/twistedcaldav/notify.py
===================================================================
--- CalendarServer/branches/users/sagen/xmpp/twistedcaldav/notify.py 2008-07-10 06:18:25 UTC (rev 2672)
+++ CalendarServer/branches/users/sagen/xmpp/twistedcaldav/notify.py 2008-07-10 17:39:06 UTC (rev 2673)
@@ -52,7 +52,7 @@
__all__ = '''
Coalescer getNotificationClient
-getPubSubConfiguration getPubSubPath
+getPubSubConfiguration getPubSubPath getPubSubXMPPURI
INotifier installNotificationClient
InternalNotificationFactory InternalNotificationProtocol
NotificationClient NotificationClientFactory NotificationClientLineProtocol
@@ -448,8 +448,7 @@
self.publishNode(nodeName)
def uriToNodeName(self, uri):
- principal = uri.split('/')[3]
- return getPubSubPath(principal, getPubSubConfiguration())
+ return getPubSubPath(uri, getPubSubConfiguration())
def publishNode(self, nodeName):
if self.xmlStream is not None:
@@ -665,10 +664,14 @@
return results
-def getPubSubPath(guid, pubSubConfiguration):
- return ("/Public/CalDAV/%s-%d/%s/" % (pubSubConfiguration['host'],
- pubSubConfiguration['port'], guid))
+def getPubSubPath(uri, pubSubConfiguration):
+ return ("/Public/CalDAV/%s/%d/%s/" % (pubSubConfiguration['host'],
+ pubSubConfiguration['port'], uri.strip("/")))
+def getPubSubXMPPURI(uri, pubSubConfiguration):
+ return "xmpp:%s?pubsub;node=%s" % (pubSubConfiguration['service'],
+ getPubSubPath(uri, pubSubConfiguration))
+
#
# Notification Server service config
#
Modified: CalendarServer/branches/users/sagen/xmpp/twistedcaldav/static.py
===================================================================
--- CalendarServer/branches/users/sagen/xmpp/twistedcaldav/static.py 2008-07-10 06:18:25 UTC (rev 2672)
+++ CalendarServer/branches/users/sagen/xmpp/twistedcaldav/static.py 2008-07-10 17:39:06 UTC (rev 2673)
@@ -72,7 +72,9 @@
from twistedcaldav.timezoneservice import TimezoneServiceResource
from twistedcaldav.cache import DisabledCacheNotifier, PropfindCacheMixin
+
from twistedcaldav.notify import getPubSubConfiguration, getPubSubPath
+from twistedcaldav.notify import getPubSubXMPPURI
log = Logger()
@@ -560,7 +562,6 @@
"""
cacheNotifierFactory = DisabledCacheNotifier
- # TODO: "node" should only be live if pubsub is enabled
liveProperties = CalDAVFile.liveProperties + (
(customxml.pubsubnode_namespace, "node"),
(customxml.pubsubnotify_namespace, "notify"),
@@ -620,8 +621,12 @@
if pubSubConfiguration['enabled']:
return succeed(customxml.PubSubNodeProperty(
customxml.PubSubService(pubSubConfiguration['service']),
- customxml.PubSubNodeId(getPubSubPath(self.record.guid,
+ customxml.PubSubNodeId(getPubSubPath(self.url(),
+ pubSubConfiguration)),
+ customxml.PubSubXMPPURI(getPubSubXMPPURI(self.url(),
pubSubConfiguration))))
+ else:
+ return succeed(customxml.PubSubNodeProperty())
elif qname == (customxml.pubsubnotify_namespace, "notify"):
pubSubConfiguration = getPubSubConfiguration()
@@ -630,6 +635,7 @@
return super(CalendarHomeFile, self).readProperty(property, request)
+
class ScheduleFile (AutoProvisioningFileMixIn, CalDAVFile):
def __init__(self, path, parent):
super(ScheduleFile, self).__init__(path, principalCollections=parent.principalCollections())
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://lists.macosforge.org/pipermail/calendarserver-changes/attachments/20080710/455fdfb2/attachment.html
More information about the calendarserver-changes
mailing list