From 8e4b72a862a3c7368825b2c39a20fafbda6138f3 Mon Sep 17 00:00:00 2001 From: Hugh Daschbach Date: Tue, 18 Jul 2023 23:25:58 -0700 Subject: [PATCH] Fix verification string computation. This is a fix for issue #37. XEP-0115 describes how the presence iq elements presents capabilities. In particular, capabilities are represented by a verification string which consists of a hash of features and form data fields that make up a capability list. See, https://xmpp.org/extensions/xep-0115.html#ver-proc The field list for a form consists of a "var" attribute with an associated element. It is not entirely clear from the XEP how an empty element should be treated. Unfortunately jabber.el throws a 'wrong-type-argument for empty . Here is an example form description sent from Psi+ that contains an empty "os_version" value: ```xml urn:xmpp:dataforms:softwareinfo Psi+ 1.5.1650 (2023-06-10, 526ed0b8) Debian GNU/Linux 11 (bullseye) ``` Looking at the psi-plus-snapshots source suggests that an empty value should be treated as an empty string. Experimentation verifies that this yields the same verification string that Psi+ sends with its disco#info response. --- lisp/jabber-disco.el | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/lisp/jabber-disco.el b/lisp/jabber-disco.el index 0b21f49..4ca37eb 100644 --- a/lisp/jabber-disco.el +++ b/lisp/jabber-disco.el @@ -305,7 +305,7 @@ obtained from `xml-parse-region'." ;; For each element, append the XML character ;; data, followed by the '<' character. (dolist (value values) - (insert value "<")))))))) + (insert (or value "") "<")))))))) ;; 8. Ensure that S is encoded according to the UTF-8 encoding ;; (RFC 3269 [18]).