23 lines
775 B
GDScript
23 lines
775 B
GDScript
extends Node
|
|
class_name Stanza
|
|
|
|
const disco_info_queury := "<query xmlns='http://jabber.org/protocol/disco#info'/>"
|
|
const disco_items_queury := "<query xmlns='http://jabber.org/protocol/disco#items'/>"
|
|
|
|
static func yield_as_is():
|
|
return yield()
|
|
|
|
static func unwrap_query_result(iq: Xml.XmlElement) -> Sums.Result:
|
|
if iq == null or iq.name != "iq" or not "type" in iq.attributes:
|
|
return Sums.Result.make_error(ERR_INVALID_DATA)
|
|
|
|
# todo: Delegate strctured XMPP error.
|
|
if iq.attributes["type"] != "result":
|
|
return Sums.Result.make_error(ERR_INVALID_DATA)
|
|
|
|
for child in iq.children:
|
|
if child.is_element() and child.name == "query":
|
|
return Sums.Result.make_value(child)
|
|
|
|
return Sums.Result.make_error(ERR_INVALID_DATA)
|