2023-08-26 15:16:36 +00:00
|
|
|
extends Node
|
|
|
|
|
2023-08-26 17:59:43 +00:00
|
|
|
var _connection
|
|
|
|
|
2023-08-26 15:16:36 +00:00
|
|
|
func _ready():
|
2023-09-25 07:57:50 +00:00
|
|
|
_connection = Connections.establish_new_connection("poto.cafe", "veclavtalica", "-")
|
2023-08-26 17:59:43 +00:00
|
|
|
if _connection == null:
|
|
|
|
push_error("Connection failed")
|
2023-08-26 20:52:21 +00:00
|
|
|
return
|
2023-08-26 17:59:43 +00:00
|
|
|
|
2023-09-02 13:51:00 +00:00
|
|
|
var service_request = load("res://scenes/PolyServiceBuilder.gd").new().request(_connection)
|
|
|
|
if not service_request.is_done:
|
|
|
|
yield(service_request, "done")
|
|
|
|
|
|
|
|
if not service_request.is_ok:
|
|
|
|
push_error("Service builder errored out: %s" % [service_request.value])
|
2023-08-26 20:52:21 +00:00
|
|
|
return
|
2023-09-02 13:51:00 +00:00
|
|
|
|
|
|
|
for service in service_request.value:
|
|
|
|
if service.muc == null: continue
|
|
|
|
|
|
|
|
var rooms_request = service.muc.request_rooms()
|
|
|
|
if not rooms_request.is_done:
|
|
|
|
yield(rooms_request, "done")
|
|
|
|
|
|
|
|
if not rooms_request.is_ok:
|
|
|
|
push_error("Room request errored out: %s" % [rooms_request.value])
|
|
|
|
return
|
|
|
|
|
|
|
|
for room in rooms_request.value:
|
|
|
|
var me = service.muc.join_room(room, "tochie-facade")
|
2023-09-02 14:15:15 +00:00
|
|
|
if not me.is_done:
|
|
|
|
yield(me, "done")
|
|
|
|
|
|
|
|
print("Chat joined")
|