Subject to restrictions on the server/network, the following will do what you're asking for
on *:connect:{
.enable #channels
.list
}
#channels off
raw 321:*:{ halt }
raw 322:*:{
.join $2
haltdef
}
raw 323:*:{
.disable #channels
haltdef
}
#channels end