/*****************************************************************************/ /* draft.c As of v1.3.0 soyMAIL draft messages are stored in a VMS Mail folder, by default named "Draft Items", though configurable as a user option. These messages are [saved] into this folder by creating a sequential mail file which is then copied into the folder (see DraftSave()). Messages are [restore]d directly from the "Draft Items" folder by selecting the message item button (either open in current or in new window) reads the message, passes it to DraftRestore() to process the soyMAIL-specific draft data stored in it, then opens it in the compose window. See DraftPurge() for a description of what is required to maintain revisions of drafts in the Mail "Draft Items" folder. COPYRIGHT --------- Copyright (C) 2005-2023 Mark G.Daniel This program, comes with ABSOLUTELY NO WARRANTY. This is free software, and you are welcome to redistribute it under the conditions of the GNU GENERAL PUBLIC LICENSE, version 3, or any later version. VERSION HISTORY --------------- 04-OCT-2023 MGD DraftSave() subject MimeEncIsoString() 25-SEP-2015 MGD compose Confirm[x] and |ConfirmBeforeSend| 10-DEC-2013 MGD bugfix; DraftPurge() finalise with mail$mailfile_end() 12-NOV-2011 WK bugfix; force references into multiple lines in DraftSave() 01-NOV-2008 MGD DraftSave() and DraftRestore() in-reply-to and references 04-AUG-2007 MGD DraftSave() and DraftRestore() [charset] to propagate any compose message character set 12-FEB-2005 MGD initial */ /*****************************************************************************/ #ifdef SOYMAIL_VMS_V7 #undef _VMS_V6_SOURCE #define _VMS_V6_SOURCE #undef __VMS_VER #define __VMS_VER 70000000 #undef __CRTL_VER #define __CRTL_VER 70000000 #endif #pragma nomember_alignment /* standard C header files */ #include #include #include #include #include #include /* VMS related header files */ #include #include #include #include #include /* application header file */ #include #include #include #include #define FI_LI __FILE__, __LINE__ /* global storage */ /* prototypes */ int sys$fao (__unknown_params); /* external storage */ extern BOOL Debug, WatchEnabled; extern char CurrentVmsTimeString[], SoftwareVn[]; extern CONFIG_DATA SoyMailConfig; extern VMS_MAIL_USER VmsMailUser; extern VMS_ITEM_LIST3 CallMailNullItem; extern VMS_ITEM_LIST3 CallMailNoSignalItem[]; /*****************************************************************************/ /* Save a copy of the current composition (draft) into the "Draft Items" folder. This is done by writing the content to a temporary sequential mail file and then copying that into a mail folder. It gets a little complicated because each of these copies is entered as a separate message and for drafts we really only want/need to keep the latest copy. Can't use the message header to identify the same draft because the detail in that may change from edit-to-edit (subject or desination address(es) for example). The approach taken is to generate a hash of the header detail and use this to identify previous versions of the same draft. These are then purged as required (see DraftPurge() for further detail). Constrain the header strings used in the VMS format message to provide a maximum of 255 characters otherwise CallMailCopyFile() will barf. The saved draft message body contains soyMAIL-specific data in plain-text that are used to reconstruct the compose page it is saved from. As soyMAIL does not provide for 'reading' draft messages this is not an issue. The content should be (almost) obvious if another email agent is used and the data even used to manually reconstruct the draft content. Quoted printable encoding is used for the message text in case any one record exceeds the 255/2048 limits. This can commonly occur with