Mutators and Converters

Have a great idea for extending Zimbra? Share ideas, ask questions, contribute, and get feedback.
agnes
Posts: 39
Joined: Fri Sep 12, 2014 11:23 pm

Mutators and Converters

Postby agnes » Tue Dec 02, 2008 3:45 am

I have some questions about the MimeVisitor class.
I have an extension where I register my converter and my mutator class.
I want the mutator to take actions when I send a message only and not when a new message comes.

The same with a converter. I want my converter's functions to be invoked only when I read a message and not when a new message is added to a mailbox.
My question is how can I check in my function if a message is being send or received ? And what can I do to not invoke a conversion while the new message is comming? Is it possible at all ?
Here is an example of a converter

    @Override

protected boolean visitMessage(MimeMessage mm, VisitPhase visitKind) throws MessagingException {

if (visitKind != VisitPhase.VISIT_BEGIN) {

return false;

}

if (.....) { // here i want to check if it's an old message to start my conversion

if (mCallback != null && mCallback.onModification() == false) {

return false;

}
// do some modifications on the message .....
mm.saveChanges();

return true;

}

return false;

}



Can I access some info about user account (account ID ...) in that function?


dkarp
Elite member
Elite member
Posts: 1410
Joined: Fri Sep 12, 2014 9:52 pm

Mutators and Converters

Postby dkarp » Tue Dec 02, 2008 8:20 am

Mutators operate both on send and receive, with no exceptions. Can you find a way to detect received messages and skip them? (Maybe look for a "Received" header?)
agnes
Posts: 39
Joined: Fri Sep 12, 2014 11:23 pm

Mutators and Converters

Postby agnes » Tue Dec 02, 2008 9:02 am

Thank you. I will detect new messages like you said.
While we are parsing a message is there any simple way to find out to which mailbox the message belongs?

I need to get some user's properties in my converter. How can I do that ?
dkarp
Elite member
Elite member
Posts: 1410
Joined: Fri Sep 12, 2014 9:52 pm

Mutators and Converters

Postby dkarp » Tue Dec 02, 2008 10:00 am

I don't believe that's possible at present. Can you file an enhancement request in bugzilla?

Return to “Developers”

Who is online

Users browsing this forum: No registered users and 4 guests