Hilchos Lashon Hara chapter 6, section 3
How can one know if one may listen to lashon hara? If a person wants to speak of someone and one understands he wants to denigrate him, once should immediately ask the speaker if the matter is relevant to oneself or if one will be able to rebuke the person spoken of. In such a case one may listen. Otherwise one may not.
Hilchos Lashon Hara chapter 6, section 4
Sometimes it is a mitzvah to hear lashon hara talk if one reckons one will be able to show the speaker or other people present that the story was not as reported or alleviate its severity in some other way. It is also a mitzvah to listen if one reckons that by listening one will be able to quiet the speaker's anger so that he does not repeat the story to others (who may believe it) and this will promulgate peace among Jews. Of course, one must never actually believe the lashon hara.