# HG changeset patch # User Matthew Wild # Date 1679051521 0 # Node ID b2198cd64c5a592d630d762e8ba8b4a4cf9ae81f # Parent 864c9dc27c606da1b7d61857e99ae38d6cc83f2e disco: Add support for extended disco forms diff -r 864c9dc27c60 -r b2198cd64c5a plugins/disco.lua --- a/plugins/disco.lua Fri Mar 17 11:07:02 2023 +0000 +++ b/plugins/disco.lua Fri Mar 17 11:12:01 2023 +0000 @@ -203,7 +203,7 @@ return callback(nil, result:get_error()); end - local identities, features = {}, {}; + local identities, features, extended = {}, {}, {}; for tag in result:get_child("query", xmlns_disco_info):childtags() do if tag.name == "identity" then @@ -213,6 +213,13 @@ end end + for tag in result:get_child("query", xmlns_disco_info):childtags("x", "jabber:x:data") do + local form_type_field = tag:get_child_with_attr("field", nil, "var", "FORM_TYPE"); + local form_type = form_type_field and form_type_field:get_child_text("value"); + if form_type then + extended[form_type] = tag; + end + end if not self.disco.cache[jid] then self.disco.cache[jid] = { nodes = {} }; @@ -224,9 +231,11 @@ end self.disco.cache[jid].nodes[node].identities = identities; self.disco.cache[jid].nodes[node].features = features; + self.disco.cache[jid].nodes[node].extended = extended; else self.disco.cache[jid].identities = identities; self.disco.cache[jid].features = features; + self.disco.cache[jid].extended = extended; end return callback(self.disco.cache[jid]); end);