extends Node
var _connection
func _service_discovery():
var iq := yield() as Xml.XmlElement
var feature_promises := Array()
for item in iq.children[0].children:
feature_promises.push_back(_connection.promise_iq(item.attributes["jid"], "get",
"",
_connection.iq_as_is()))
while not _connection.are_promises_done(feature_promises):
yield()
for feature_promise in feature_promises:
if not feature_promise.is_ok:
push_error("Connection failed")
return
var feature := feature_promise.value as Xml.XmlElement
print(feature.as_string())
func _ready():
_connection = $Connections.establish_new_connection("poto.cafe", "veclavtalica", "-")
if _connection == null:
push_error("Connection failed")
return
if _connection.push_iq(_connection.domain, "get",
"",
_service_discovery()) != OK:
push_error("Connection failed")
return