ON *:CONNECT:.timerANTIIDLE 1 60 raw -q ping $server
This above code would only execute once. If you also want to have it support your being on multiple networks at the same time:
ON *:CONNECT:.timerANTIIDLE. [ $+ [ $network ] ] 0 60 raw -q ping $server