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name: cols[1]
}
}
pub fn rooms_subtract(rooms_a []&Room, rooms_b []&Room) []&Room {
mut missing := []&Room{}
for room in rooms_a {
if rooms_contains(rooms_b, room) {
} else {
missing << room
}
}
return missing
}
pub fn rooms_contains(rooms []&Room, looking Room) bool {
for room in rooms {
if room.id == looking.id {
println('FOUND')
return true
}
// self.room_state(rooms[0])
self.room_messages(self.rooms[0])
self.room_say(self.rooms[0], 'irc bridge started. homeserver $self.host')
self.conn_state = ConnState.connected
if self.rooms.len > 0 {
// self.room_state(rooms[0])
self.room_messages(self.rooms[0])
self.room_say(self.rooms[0], 'irc bridge started. homeserver $self.host')
}
pub fn (mut self Actor) joined_rooms() ?[]Room {
resp := self.call_get('joined_rooms') or { return []Room{} }
return resp['joined_rooms'].arr().map(Room{ id: it.str() })
pub fn (mut self Actor) joined_rooms() ?[]&Room {
resp := self.call_get('joined_rooms') or { return []&Room{} }
return resp['joined_rooms'].arr().map(&Room{ id: it.str() })
println('sync_rooms: db_rooms $db_rooms')
j_rooms := self.matrix.joined_rooms() or {panic('joined_rooms fail') }
println('sync_rooms: joined_rooms $j_rooms')
for row in self.db.select_all('matrix_rooms') {
println(row)
if room_id := self.matrix.room_alias(row[1]) {
if room := self.matrix.find_room(room_id) {
println('sync_rooms: $room.id/$room.name is already known')
} else {
println('sync_rooms: joining $room_id ')
self.matrix.join(room_id)
}
println('sync_rooms: matrix db_rooms $db_rooms')
j_rooms := self.matrix.joined_rooms() or { panic('joined_rooms fail') }
println('sync_rooms: matrix joined_rooms $j_rooms')
needs_to_join := matrix.rooms_subtract(db_rooms, j_rooms)
println('sync_rooms: matrix needs_to_join $needs_to_join')
for room in needs_to_join {
println(room)
if room_id := self.matrix.room_alias(room.name) {
println('sync_rooms: joining $room_id')
self.matrix.join(room_id)