tochie-facade/scenes/App.gd

36 lines
1.1 KiB
GDScript3
Raw Normal View History

2023-08-26 15:16:36 +00:00
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",
"<query xmlns='http://jabber.org/protocol/disco#items'/>",
_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())
2023-08-26 15:16:36 +00:00
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",
"<query xmlns='http://jabber.org/protocol/disco#items'/>",
_service_discovery()) != OK:
2023-08-26 15:16:36 +00:00
push_error("Connection failed")
return