BUT, the two were strangers, in a topic-oriented setting, and she rebuffed his first attempt. That could have, and should have been the end of the story...
Put another way: if he had hugged her, she said "We just met..." and that was the end of it, we wouldn't be having the conversation at all.
Unfortunately, as you allude, there's not really a definitive way of solving this problem unless we build a way of giving passive signals constantly. Some sort of an indicator or smart phone app "Yes, I am willing to be hit on by you and you, but not you and you". There's a weird idea...