]> code.delx.au - gnu-emacs-elpa/commitdiff
packages/excorporate: Change server version lookup
authorThomas Fitzsimmons <fitzsim@fitzsim.org>
Wed, 2 Mar 2016 04:56:13 +0000 (23:56 -0500)
committerThomas Fitzsimmons <fitzsim@fitzsim.org>
Wed, 16 Mar 2016 13:03:08 +0000 (09:03 -0400)
* packages/excorporate/excorporate.el (exco--get-server-version):
Change version lookup algorithm.

packages/excorporate/excorporate.el

index c32f7980e6de125aafe9f3ba935a69426d458308..8168dd38b97950e77116e68c1ac29f17f0b2a250 100644 (file)
@@ -497,18 +497,27 @@ the FSM should transition to on success."
 
 (defun exco--get-server-version (wsdl)
   "Extract server version from WSDL."
-  (catch 'found
-    (dolist (attribute
-            (soap-xs-type-attributes
-             (soap-xs-element-type
-              (soap-wsdl-get
-               '("http://schemas.microsoft.com/exchange/services/2006/types"
-                 . "RequestServerVersion")
-               wsdl 'soap-xs-element-p))))
-      (when (equal (soap-xs-attribute-name attribute) "Version")
-       (throw 'found (soap-xs-attribute-default attribute))))
-    (warn "Excorporate: Failed to determine server version")
-    nil))
+  (let ((warning-message "Excorporate: Failed to determine server version")
+       (namespace "http://schemas.microsoft.com/exchange/services/2006/types")
+       (name "RequestServerVersion")
+       (found-version nil))
+    (unwind-protect
+       (setq found-version
+             (catch 'found
+               (dolist (attribute
+                        (soap-xs-type-attributes
+                         (soap-xs-element-type (soap-wsdl-get
+                                                `(,namespace . ,name)
+                                                wsdl 'soap-xs-element-p))))
+                 (when (equal (soap-xs-attribute-name attribute) "Version")
+                   (throw 'found (car (soap-xs-simple-type-enumeration
+                                       (soap-xs-attribute-type attribute))))))
+               (warn warning-message)
+               nil))
+      (if found-version
+         found-version
+       (warn warning-message)
+       nil))))
 
 (define-enter-state exco--fsm :retrieving-data
   (_fsm state-data)