My aim is to create a messaging filter for example finding certain recipients, subjects, email of a certain size etc and place them in folders according to the configuration of the user.

My problem is when using nsIMsgFolder and nsIMsgDBHdr, I am really lost on how to use these methods or how to add event listeners. could someone please provide me some examples on how to go about it?

thank you