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GKBTGHSIHJVB42ZXVMAC
DB2BCHT5GXNQ3JXQXWMDFNXIO7OVEQMVY34SHTAWSJS47N67YTIQC
42VXBMHQX5RDOVPY5LTQMJ3PGOEFGONBBHFWTSYIKHVMPN2IZQYAC
ZQE5UGGBKZRNI6ASUNOWVP4URLC7IHAWBO4RRACWLNS6OX2KQZVQC
ZMAZUHFHJOW2GSUH5SUDXRG4STQ6PQHWYGZIZHEJCN73PSNQOAAQC
LNGUDOUQK35O5IIUHSVJ5LW54JA7QNMNCJGQNYWPRDUSK6R4XCLQC
M5GXUK5HZE7HPLWQ33T73CXRJITOUJAO6T6F6QWTYYL7NLWFYA3AC
IAS75T3RE4KGP26ILCNZG5G52DZPV7XACR7PJUYVJACQUVH5J4HAC
VSXY63RCAE4WDARTVOW6YDD6VPMRBNASRD73R4UMZDAAQX7MAVTAC
F7UEAPOJLX43J32QD6JJ4YABOZLMQR2THHL6BGFTPSYZ35XQJSQAC
match irc_m {
irc.PrivMsg {
println(irc_m.one_line())
if irc_m.message.starts_with('!') {
room := if irc_m.channel == irc_m.network.nick {
irc_m.nick[1..].split('!')[0]
} else {
irc_m.channel
}
self.command(chat.System.irc, irc_m.network.hostname, room,
irc_m.message[1..])
} else {
// repeat in matrix
chat.say(self.out_chan, chat.System.matrix, 'room', irc_m.message)
}
}
irc.Connect {
self.sync_rooms()
}
}
self.irc_do(irc_m)
fn (mut self Main) irc_do(irc_m irc.Payload) {
match irc_m {
irc.PrivMsg {
println(irc_m.one_line())
if irc_m.message.starts_with('!') {
room := if irc_m.channel == irc_m.network.nick {
irc_m.nick[1..].split('!')[0]
} else {
irc_m.channel
}
self.command(chat.System.irc, irc_m.network.hostname, room, irc_m.message[1..])
} else {
// repeat in matrix
system, room := self.room_match(chat.System.irc, irc_m.channel)
chat.say(self.out_chan, system, room, irc_m.message)
}
}
irc.Connect {
self.sync_rooms()
}
}
}
mut msg := '$self.matrix.host is ${self.matrix.conn_state} in ${self.matrix.rooms.len} rooms. $self.irc.networks.len irc networks connected.'
mut msg := '$self.matrix.host is $self.matrix.conn_state in $self.matrix.rooms.len rooms. $self.irc.networks.len irc networks connected.'
pub fn (mut self Main) room_match(network chat.System, room_name string) (chat.System, string) {
other_system, other_room := match network {
.irc {
chat.System.matrix, room_name
}
.matrix {
chat.System.irc, room_name
}
}
return other_system, other_room
}