Inherits EventHandler
Stores message objects in the database.
This class takes a list of Message objects and performs the database operations necessary to inject them into their respective mailboxes. Injection commences only when execute() is called.
Creates a new Injector to inject messages into the database on behalf of the owner, which is notified when the injection is completed.
Ensures that a is present in the database after injection.
Adds annotations rows for the message m in mailbox mb to the query q, and returns the number of annotations (may be 0).
Adds b to the list of bodyparts if it's not there already.
Notes that message must be injected, and spooled for delivery to the specified recipients from the given sender, and delivered later if later is non-null.
Adds flags rows for the message m in mailbox mb to the query q, and returns the number of flags (which may be 0).
Add each field from the header h (belonging to the given part of the message with id mid) to one of the queries qh, qa, or qd, depending on their type.
Notes that messages must be injected into the database.
Adds a mailbox_messages row for the message m in mailbox mb to the query q.
Like convertInReplyTo(), except that it looks at other messages being injected rather than messages already in the database.
This is a no-op when messages are inserted using SMTP or LMTP, but can matter for aoximport.
Adds a single part_numbers row for the given part number, belonging to the message with id mid and the bodypart b (which may be 0) to the query q.
Returns the database ID of a, or 0 if this injector hasn't added a to the database.
Inserts this/these message/s into the MessageCache. If the transaction fails, the cache has to be cleared.
Creates a proper References field for any messages which have In-Reply-To but not References. This covers some versions of Outlook, but not all.
Creates a proper References field for any messages sent by Outlook*, ie. having Thread-Index instead of References.
This function creates any unknown names found by findDependencies(). It creates up to four subtransactions and advances to the next state, trusting Transaction to queue the work appropriately.
This private function looks through the list of messages, notes what mailboxes are needed, and creates any that do not exist or are currently deleted.
Returns true if this injector has finished its work, and false if it hasn't started or is currently working.
Returns an error message if injection failed, or an empty string if it succeeded or hasn't failed yet.
Returns true if this injection failed, and false if it has succeeded or is in progress.
This private function looks through the list of messages given to this Injector, to make sure that they are all valid, and to collect lists of any unknown header field names, flags, annotation names, or addresses.
In the common case there will be few, if any, entries to insert into the *_names tables, so we build lists of them without worrying about memory use. The list of addresses may be large, but we can't avoid building that list anyway.
This private helper makes a master list of messages to be inserted, based on what addDelivery() and addInjection() have done.
Inserts all unique bodyparts in the messages into the bodyparts table, and updates the in-memory objects with the newly-created bodyparts.ids.
This private function inserts one row per remote recipient into the deliveries table.
Injects messages into the correct tables.
Inserts rows into the thread_indexes table, so that convertThreadIndex() will have fodder next time it runs.
Inserts rows into the thread_rows table and records to which thread_rows row each Injectee belong.
Returns a sensible internaldate for m. If Message::internalDate() is not null, it is used, otherwise this function tries to obtain a date heuristically.
Logs a little information about the messages to be injected, and a little more for the special case of a single message being injected into a single mailbox.
This private function advances the injector to the next state.
This function inserts rows into the messages table for each Message in d->messages, and updates the objects with the newly-created ids. It expects to be called repeatedly until it returns true, which it does only when the work is done, or an error occurs.
Returns a new Query to select num nextval()s as "id" from the named sequence.
This private function is responsible for fetching a uid and modseq value for each message in each mailbox and incrementing uidnext and nextmodseq appropriately.
Instructs this Injector to use a subtransaction of t for all its database work.
Does nothing if the injector already has a transaction.
Adds previously unknown addresses from newAddresses to d->addresses.
This web page based on source code belonging to The Archiveopteryx Developers. All rights reserved.