I try to give players 2 hours of offline before attacking. Of course, mistakes can happen. Also if I'm rushing to finish a level I might go as low as 1 hour. I think attacking below an hour is for sending messages or provoking a war. I don't mind being attacked if I'm marked away or offline, but if it's close I usually ask people about it, not to beg for stims but to make sure they are not trying to get a message through.
As for stims, I think everybody should have stims just for this matter. I keep a healthy stock of about 100k$ in stims at all times
I think a good solution would be to save the defender last action time in the attack logs for both the defender and the attacker. This way a defender cannot claim he was online if he really wasn't because both parties see it in the attack logs.
And if you don't see the attack log page maybe you should donate so you can.