A Glasgow man who sent sexually explicit messages and images to someone he believed was a 14-year-old girl has avoided jail and been placed on the sex offenders register.