[CalendarServer-changes] [7032] CalendarServer/trunk/calendarserver/tools/notifications.py

source_changes at macosforge.org source_changes at macosforge.org
Thu Feb 17 08:40:38 PST 2011


Revision: 7032
          http://trac.macosforge.org/projects/calendarserver/changeset/7032
Author:   sagen at apple.com
Date:     2011-02-17 08:40:36 -0800 (Thu, 17 Feb 2011)
Log Message:
-----------
Examine push-transports DAV property rather than xmpp-server since new clients will be using push-transports.

Modified Paths:
--------------
    CalendarServer/trunk/calendarserver/tools/notifications.py

Modified: CalendarServer/trunk/calendarserver/tools/notifications.py
===================================================================
--- CalendarServer/trunk/calendarserver/tools/notifications.py	2011-02-17 03:04:46 UTC (rev 7031)
+++ CalendarServer/trunk/calendarserver/tools/notifications.py	2011-02-17 16:40:36 UTC (rev 7032)
@@ -469,8 +469,8 @@
                 <A:prop>
                     <A:displayname/>
                     <A:resourcetype/>
-                    <C:xmpp-server xmlns:C="http://calendarserver.org/ns/"/>
                     <C:pushkey xmlns:C="http://calendarserver.org/ns/"/>
+                    <C:push-transports xmlns:C="http://calendarserver.org/ns/"/>
                 </A:prop>
             </A:propfind>
         """
@@ -508,16 +508,22 @@
                                     if pushKey:
                                         key = pushKey
 
-                                xmppServer = prop.find("{http://calendarserver.org/ns/}xmpp-server")
-                                if xmppServer is not None:
-                                    xmppServer = xmppServer.text
-                                    if xmppServer:
-                                        if ":" in xmppServer:
-                                            host, port = xmppServer.split(":")
-                                            port = int(port)
-                                        else:
-                                            host = xmppServer
-                                            port = 5222
+                                pushTransports = prop.find("{http://calendarserver.org/ns/}push-transports")
+                                if pushTransports is not None:
+                                    if self.verbose:
+                                        print "push-transports:\n\n", ElementTree.tostring(pushTransports)
+                                    for transport in pushTransports.findall("{http://calendarserver.org/ns/}transport"):
+                                        if transport.attrib["type"] == "XMPP":
+                                            xmppServer = transport.find("{http://calendarserver.org/ns/}xmpp-server")
+                                            if xmppServer is not None:
+                                                xmppServer = xmppServer.text
+                                                if xmppServer:
+                                                    if ":" in xmppServer:
+                                                        host, port = xmppServer.split(":")
+                                                        port = int(port)
+                                                    else:
+                                                        host = xmppServer
+                                                        port = 5222
 
                     if key and not nodes.has_key(key):
                         nodes[key] = (href.text, name, kind)
@@ -531,6 +537,11 @@
             print "Unable to look up who %s is a proxy for" % (self.username,)
             raise
 
+        if host is None:
+            raise Exception("Unable to determine xmpp server name")
+        if port is None:
+            raise Exception("Unable to determine xmpp server port")
+
         returnValue( (host, port, nodes) )
 
 
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.macosforge.org/pipermail/calendarserver-changes/attachments/20110217/4014026a/attachment.html>


More information about the calendarserver-changes mailing list