I don’t know who’s right

So me and my boyfriend used to work in the same place before. A guy there liked me and wanted to get w me. One day he rubbed my leg and my boyfriend now (who wasn’t my boyfriend then) saw what happened. Anyways that is all that happened. Now me and my boyfriend start talking so I went and talk to the guy because they were friends and the guy basically talked so much shit about my boyfriend. Which I told my boyfriend right away and my boyfriend was not OK with it and ever since I did not speak to that guy I only say hi because he says hi and that’s it. Yesterday was my first day back from maternity leave. The guy waved at me from far And was trying to but in a conversation that I was having with a different person. But I kept ignoring him and going back to the person I was talking to. I got home yesterday and I felt it was important to tell my boyfriend. And he is really upset he’s not even talking to me. He says I’m too friendly. Now I feel I did right by telling him. And I feel it was OK for me to say hi back if he said hi and that was it even though he did try talking to me I kept the conversation going with the other person and that was all.