diff options
author | rekado <rekado@elephly.net> | 2014-12-16 18:35:29 +0100 |
---|---|---|
committer | rekado <rekado@elephly.net> | 2014-12-16 18:35:29 +0100 |
commit | 131d26ffeca06e98b50191703baf7683f8b47e30 (patch) | |
tree | 84bc5437f2cf542eee4976122324a98bcd9c9e1f | |
parent | cb06d3d7fe9837e4e2708ba4e84fe9dd3f96660d (diff) |
rewrite stanza-find-property with sxpath
-rw-r--r-- | xmpp.scm | 14 |
1 files changed, 6 insertions, 8 deletions
@@ -124,14 +124,12 @@ handlers." (define (stanza-find-property property-name stanza) - "Return the given property of a stanza or #f if there is none." - (let ((properties (cadr stanza))) - (if (equal? '@ (car properties)) - (let ((res (find (lambda (prop) (eq? property-name (car prop))) - (cdr properties)))) - (if res - (cadr res) - #f))))) + "Return the value of a given stanza property or #f if there is +none." + (let ((property ((sxpath `(* @ ,property-name)) stanza))) + (if (null? property) + #f + (cadar property)))) ;; generate accessor functions for various stanza attributes (for-each |