Child custody, visitation rights

Hi all i have been married for 5 plus years. things have not been good between me and my husband and we have not led a life like any other married couple. he has been extremely rude,indifferent and has always suppressed me. his parents also have looked down on me because i am coming from a simple family and i did not give them dowry. 3 years after my son was born i found out that my husband was having affairs with many women. i have taken photos of those messages. i came away to my home without telling him anything. after explaining everything to my parents i confronted him over phone. he admitted that he was having fun but he also said that i should not take it seriously. now he has filed a case for custody and for visitation rights. the court proceedings are going on . till now he has been coming to visit my son every 2 months. am i on the right track. i am scared that he will be a bad influence ot my son. and all this while he has not spent time withmy son. now why does he want to do that. and everytime he comes down he would brings toys and splurge lot of money on my son. so my son is happy because he is like a santa claus. i do feel insecure but i also dont have any financial support from him. its been 2 years since i am here in chennai and till date he has not given a single penny. how do i deal with this? can i file for a divorce now?