Server-side MTM implementation

Example Code

Click on the following link to download the example:

Click: browse to view the example code.

The files reproduced here are the main files contained in the examples directory. Some extra files may be needed to run the examples, and these will be found in the appropriate examples directory.

The Server-side Text MTM simulates with the local file system the actions normally undertaken by a message transport protocol. A Text service entry maps a local file directory, from which message header information can be obtained (in a similar fashion to POP3), and from which messages can be get and put.

A file or folder in the mapped directory is regarded as a remote entry, and recorded by an entry in the message index. The name of the file to which a message corresponds is stored in the index Description field, and the full folder path in the index Details field. No message store is associated with these remote entries.

Under a local folder, for example, the Inbox, each message has a message store that contains a rich text stream representing the body text.

Messages can be deleted, moved, or copied. When a local message to transferred to a Text service, the Server-side MTM constructs a new file, obtaining its name and location from the index fields. When the transfer is from the service to a local folder, the Server-side MTM creates a rich text stream and reads the file text into it.

The Text server DLL currently supports one MTM-specific operation, KTXTMTMRefresh , which refreshes the folder tree below a service entry.

Move, copy, and delete implementation

Move, copy, and delete operations all operate on a collection of message entries, often involving creating new index entries, and deleting existing ones. This common functionality is provided by the class CTxtCopyMoveBase .

A CTxtCopyMoveBase instance is provided with an object to perform the specific operation required. The classes CTxtCopyToLocalOp , CTxtCopyFromLocalOp , CTxtCopyWithinServiceOp , CTxtMoveToLocalOp , CTxtMoveFromLocalOp , CTxtMoveWithinServiceOp and CTxtDeleteOp each define the functionality for a specific operation.

Each of these classes is derived from CTxtActiveOper . The move operation classes are derived from their copy counterparts, and add the extra deletion after copying.

Service refresh implementation

The contents of folders under the file system can be changed at any time outside of the application, by the user or some other application. In order for these changes to be visible in the messaging application, the Server-side MTM provides a refresh capability.

The refresh capability is provided by the refresher class CTxtRefreshMBox . It ensures that the current entries accurately reflect the state of the corresponding file folder, adding or removing entries under the service as required.