Pharmacology

Dapsone is used for treatment of bacterial and fungal infections as well as for immunomodulatory actions. What is mechanism of dapsone for these indication?