Results 1 to 4 of 4

Thread: Mutators and Converters

  1. #1
    agnes is offline Active Member
    Join Date
    Mar 2008
    Posts
    40
    Rep Power
    7

    Default Mutators and Converters

    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
    Code:
        @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?
    Last edited by agnes; 12-02-2008 at 04:14 AM.

  2. #2
    dkarp is offline Zimbra Employee
    Join Date
    Aug 2005
    Posts
    1,433
    Rep Power
    11

    Default

    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?)
    Bugzilla - Wiki - Downloads - Before posting... Search!

  3. #3
    agnes is offline Active Member
    Join Date
    Mar 2008
    Posts
    40
    Rep Power
    7

    Default

    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 ?

  4. #4
    dkarp is offline Zimbra Employee
    Join Date
    Aug 2005
    Posts
    1,433
    Rep Power
    11

    Default

    I don't believe that's possible at present. Can you file an enhancement request in bugzilla?
    Bugzilla - Wiki - Downloads - Before posting... Search!

Thread Information

Users Browsing this Thread

There are currently 1 users browsing this thread. (0 members and 1 guests)

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •