You shouldn't run it from a quit message because that can be falsified by any user. Run it from your server notices instead.

Code:
ON *:SNOTICE:*: {
  if (Outbound connection to isin $4-) && (dropped isin $8) {
    connect irc.leafserver.com 7000 irc.hubserver.com
  }
}
1. You need to alter the ON SNOTICE to match how the notices on your IRCd are phrased.
2. You need to use your server hostnames and the correct connection port in the connect command.