Code:
on *:connect:{
  if $me == no-nick {
    .join #channelA,#roomB,#channelC
  }
}
on *:invite:#:{
  .join $chan
  set $+(%,invite,$network) $addtok($($+(%,invite,$network),2),$chan,44)
}
on me:*:join:#:{
  if !$istok($($+(%,invite,$network),2),$chan,44) {
    .part $chan
  }
}

Note that the auto-join (first code) is not network specific, but the other two (which work with each other) are.