Hi, if a user pm me with badword, How to get his/her host from his nick.

Its seems like if he/she on the channel then my script can get his/her host. If its from private message, i can't get his/she host.