A Mail::Box::Thread::Manager object is usually created by a
Mail::Box::Manager. One manager can produce more than one of these
objects. One thread manager can combine messages from a set of folders,
which may be partially overlapping with other objects of the same type.
$obj-><B>foldersB>() Returns the folders as managed by this threader. $obj-><B>includeFolderB>(FOLDERS) Add one or more folders to the list of folders whose messages are organized in the threads maintained by this object. Duplicated inclusions will not cause any problems.
From the folders, the messages which have their header lines parsed (see Mail::Box about lazy extracting) will be immediately scanned. Messages of which the header is known only later will have to report this (see toBeThreaded()).
$obj-><B>removeFolderB>(FOLDERS) Remove one or more folders from the list of folders whose messages are organized in the threads maintained by this object.
$obj-><B>allB>() Returns all messages which start a thread. The list may contain dummy messages and messages which are scheduled for deletion.
To be able to return all threads, thread construction on each message is performed first, which may be slow for some folder-types because is will enforce parsing of message-bodies.
$obj-><B>knownB>() Returns the list of all messages which are known to be the start of a thread. Threads containing messages which where not read from their folder (like often happens MH-folder messages) are not yet known, and hence will not be returned.
The list may contain dummy messages, and messages which are scheduled for deletion. Threads are detected based on explicitly calling inThread() and thread() with a messages from the folder.
Be warned that, each time a messages header is read from the folder, the return of the method can change.
$obj-><B>sortedAllB>([PREPARE [COMPARE]]) Returns all() the threads by default, but sorted on timestamp. $obj-><B>sortedKnownB>([PREPARE [,COMPARE]]) Returns all known() threads, in sorted order. By default, the threads will be sorted on timestamp, But a different COMPARE method can be specified. $obj-><B>threadB>(MESSAGE) Returns the thread where this MESSAGE is the start of. However, there is a possibility that this message is a reply itself.
Usually, all messages which are in reply of this message are dated later than the specified one. All headers of messages later than this one are getting parsed first, for each folder in this threads-object.
$obj-><B>threadStartB>(MESSAGE) Based on a message, and facts from previously detected threads, try to build solid knowledge about the thread where this message is in.
$obj-><B>createDummyB>(MESSAGE-ID) Get a replacement message to be used in threads. Be warned that a dummy is not a member of any folder, so the program working with threads must test with Mail::Message::isDummy() before trying things only available to real messages. $obj-><B>inThreadB>(MESSAGE) Collect the thread-information of one message. The In-Reply-To and Reference header-fields are processed. If this method is called on a message whose header was not read yet (as usual for MH-folders, for instance) the reading of that header will be triggered here. $obj-><B>outThreadB>(MESSAGE) Remove the message from the thread-infrastructure. A message is replaced by a dummy. $obj-><B>toBeThreadedB>(FOLDER, MESSAGES) Include the specified messages in/from the threads managed by this object, if this folder is maintained by this thread-manager. $obj-><B>toBeUnthreadedB>(FOLDER, MESSAGES) Remove the specified messages in/from the threads managed by this object, if this folder is maintained by this thread-manager.
See documentation in the base class.
$obj-><B>AUTOLOADB>() See Error handling in Mail::Reporter $obj-><B>addReportB>(OBJECT) See Error handling in Mail::Reporter $obj-><B>defaultTraceB>([LEVEL]|[LOGLEVEL, TRACELEVEL]|[LEVEL, CALLBACK]) Mail::Box::Thread::Manager-><B>defaultTraceB>([LEVEL]|[LOGLEVEL, TRACELEVEL]|[LEVEL, CALLBACK]) See Error handling in Mail::Reporter $obj-><B>errorsB>() See Error handling in Mail::Reporter $obj-><B>logB>([LEVEL [,STRINGS]]) Mail::Box::Thread::Manager-><B>logB>([LEVEL [,STRINGS]]) See Error handling in Mail::Reporter $obj-><B>logPriorityB>(LEVEL) Mail::Box::Thread::Manager-><B>logPriorityB>(LEVEL) See Error handling in Mail::Reporter $obj-><B>logSettingsB>() See Error handling in Mail::Reporter $obj-><B>notImplementedB>() See Error handling in Mail::Reporter $obj-><B>reportB>([LEVEL]) See Error handling in Mail::Reporter $obj-><B>reportAllB>([LEVEL]) See Error handling in Mail::Reporter $obj-><B>traceB>([LEVEL]) See Error handling in Mail::Reporter $obj-><B>warningsB>() See Error handling in Mail::Reporter
See documentation in the base class.
$obj-><B>DESTROYB>() See Cleanup in Mail::Reporter
This module implements thread-detection on a folder. Messages created by the better mailers will include In-Reply-To and References lines, which are used to figure out how messages are related. If you prefer a better thread detection, they are implementable, but there may be a serious performance hit (depends on the type of folder used).
A Mail::Box::Thread::Manager object is created by the Mail::Box::Manager, using Mail::Box::Manager::threads(). Each object can monitor the thread-relations between messages in one or more folders. When more than one folder is specified, the messages are merged while reading the threads, although nothing changes in the folder-structure. Adding and removing folders which have to be maintained is permitted at any moment, although may be quite costly in performance.
An example of the maintained structure is shown below. The Mail::Box::Manager has two open folders, and a thread-builder which monitors them both. The combined folders have two threads, the second is two long (msg3 is a reply on msg2). Msg2 is in two folders at once.
manager | \ | `----------- threads | | | | thread thread---thread | | /| / | | // / +---- folder1 | // / | | / // / | `-----msg1 // / | `-----msg2-/ / | / / `-----folder2 / / | / / `-----msg2 / `-----msg3------
With all() you get the start-messages of each thread of this folder. When that message was not found in the folder (not saved or already removed), you get a message of the dummy-type. These thread descriptions are in perfect state: all messages of the folder are included somewhere, and each missing message of the threads (holes) are filled by dummies.
However, to be able to detect all threads it is required to have the headers of all messages, which is very slow for some types of folders, especially MH and IMAP folders.
For interactive mail-readers, it is preferred to detect threads only on messages which are in the viewport of the user. This may be sloppy in some situations, but everything is preferable over reading an MH mailbox with 10k e-mails to read only the see most recent messages.
In this object, we take special care not to cause unnecessary parsing (loading) of messages. Threads will only be detected on command, and by default only the message headers are used.
my $thread = $message->thread;
When the message was not put in a thread yet, it is done now. But, more work is done to return the best thread. Based on various parameters, which where specified when the folder was created, the method walks through the folder to fill the holes which are in this thread.
Walking from back to front (recently arrived messages are usually in the back of the folder), message after message are triggered to be included in their thread. At a certain moment, the whole thread of the requested method is found, a certain maximum number of messages was tried, but that didnt help (search window bound reached), or the messages within the folder are getting too old. Then the search to complete the thread will end, although more messages of them might have been in the folder: we dont scan the whole folder for performance reasons.
Finally, for each message where the head is known, for instance for all messages in mbox-folders, the correct thread is determined immediately. Also, all messages where the head get loaded later, are automatically included.
Error: Package $package does not implement $method. Fatal error: the specific package (or one of its superclasses) does not implement this method where it should. This message means that some other related classes do implement this method however the class at hand does not. Probably you should investigate this and probably inform the author of the package.
This module is part of Mail-Box distribution version 2.109, built on August 19, 2013. Website: http://perl.overmeer.net/mailbox/
Copyrights 2001-2013 by [Mark Overmeer]. For other contributors see ChangeLog.
This program is free software; you can redistribute it and/or modify it under the same terms as Perl itself. See http://www.perl.com/perl/misc/Artistic.html
|perl v5.20.3||MAIL::BOX::THREAD::MANAGER (3)||2013-08-19|