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QQKH4DAZP4HABHEVQI3AC
SEUEBLXEQOFJNM2KAA26Q6EX64IIMUCL44HIYWBKTWY34GENXRSQC
LJZEEQHTC6TPCTB4XMXWTKQMGT4X4FU7YQWAGAGF644ULSSRGZPAC
3CWGLJPBNZCCMZELC64VKGORTTDU5RY2ABF6DKRWS5FURPIG5PWQC
K7K3EWO4H75J63G3IREKSPGBVBF6LFZHD4WRKGQTWUYTYGHWQ22QC
P5UC3WC22YVZLV3A2PPZ54MZABW66GHGMH7RCVTK5HDTG6FWFZUQC
D745BHIMRZ4U6UASGNEPR6PAAWAGPMY5CH572UYVGAG6CH4FMURQC
pub fn (mut self Actor) room_alias(room_name string) ?string {
if room_name.starts_with('#') {
ret, code := self.call_get('directory/room/' + urllib.path_escape(room_name)) ?
struct RoomAliasResultRoom {
pub:
room_id string
}
struct RoomAliasResultNotFound {}
pub fn (mut self Actor) room_alias(room_alias string) ?&RoomAliasResult {
if room_alias.starts_with('#') {
ret, code := self.call_get('directory/room/' + urllib.path_escape(room_alias)) ?
if added_room_id := self.matrix.room_alias(room) {
match self.join_request_matrix(room, added_room_id) {
.saved {
msg = 'matrix room $room ($added_room_id) added'
go self.sync_rooms()
if alias_result := self.matrix.room_alias(room) {
match alias_result {
matrix.RoomAliasResultRoom {
match self.join_request_matrix(room, alias_result.room_id) {
.saved {
msg = 'matrix room $room ($alias_result.room_id) added'
go self.sync_rooms()
}
.already_joined {
msg = 'matrix room $room already added'
}
}
added_room_id := self.matrix.room_alias(room) or { room }
self.leave_request(chat.System.matrix, network, added_room_id)
msg = 'matrix room $room removed'
if alias_result := self.matrix.room_alias(room) {
match alias_result {
matrix.RoomAliasResultRoom {
self.leave_request(chat.System.matrix, network, alias_result.room_id)
msg = 'matrix room $room removed'
}
else {}
}
} else {
}
if room_id := self.matrix.room_alias(room.id) {
println('sync_rooms: joining $room_id')
_, code := self.matrix.join(room_id) or {
println('matrix.join fail $err')
continue
}
if code == 200 {
self.matrix.joined_rooms.add(room)
self.admin_say('matrix: room $room joined')
} else if code == 403 {
println('sync_rooms: not invited to $room.name')
if alias_result := self.matrix.room_alias(room.id) {
match alias_result {
matrix.RoomAliasResultRoom {
println('sync_rooms: joining $alias_result.room_id')
_, code := self.matrix.join(alias_result.room_id) or {
println('matrix.join fail $err')
continue
}
if code == 200 {
self.matrix.joined_rooms.add(room)
self.admin_say('matrix: room $room joined')
} else if code == 403 {
println('sync_rooms: not invited to $room.name')
}
}
matrix.RoomAliasResultNotFound {
println('sync_rooms: matrix room $room unknown/no alias')
}