(* *) (* WPMFORMS.H *) (* Definitions and constants for the Pegasus Mail for Windows *) (* Extensions Manager interface. *) (* *) (* Copyright (c) 1994-96, David Harris, all rights reserved. *) (* Ported to Pascal by Martin Ireland, May 13, 1996 *) (* Updated for V2.54 February 1997 by Martin Ireland *) (* Annotated for Delphi V2/delph1 V1/BPW V7 by *) (* Martin Ireland, October 1997 *) (* Updated November 1999 by Martin Ireland (Dialog constants) *) (* Updated February 2000 by Martin Ireland (WM_SET_FIELD) *) (* *) (* Contents: *) (* SECTION 1: Messages the Extension Manager can send to an extension *) (* SECTION 2: Messages for composing and sending e-mail *) (* SECTION 3: Simple TCP/IP interface routines *) (* SECTION 4: Calls available only to READER extensions *) (* SECTION 5: Logging messages *) (* SECTION 6: Addressbook interface *) (* SECTION 7: File system, message store and informational services *) (* SECTION 8: Miscellaneous services *) (* *) (* To go to a particular section in this file, use your text editor's *) (* "search" function to do a case-sensitive search for SECTION X, where *) (* "X" is the number in the list above. *) (* Next available offset - *) (* - For WM_FM_* = 11 (29 Aug '95) *) (* - For WM_F_* = 83 (4 Mar '96) *) (* - For WM_F_* = 84 (3 Nov 96) *) (* Flag constants: *) const WPM_STARTUP = 1; (* Extension wants to be loaded at startup *) WPM_NOLIST = 2; (* Do not show extension in Form Manager list *) WPM_HIDDEN = 4; (* Do not display extension's parent window *) WPM_LOGGING = 8; (* Extension wants to receive logging events *) WPM_ONEONLY = 16; (* Disallow multiple simultaneous instances *) WPM_FIRSTRUN = 32; (* Autoload extension on first-ever WinPMail run *) WPM_USES_TCP = 64; (* Extension requires TCP/IP services to run *) WPM_UNKNOWN = 128; (* Unannounced *) WPM_CAN_ENCRYPT = 256; (* Module can encrypt messages *) WPM_CAN_DECRYPT = 512; (* Module can decrypt messages *) WPM_CAN_SIGN = 1024; (* Module can add digital signatures to messages *) WPM_CAN_VALIDATE = 2048; (* Module can verify digital signatures *) WPM_HAS_INTERFACE = 4096; (* Module has a key management user interface *) WPM_NEEDS_BURSTING = 8192; (* Module requires one message per recipient *) WPM_PROHIBIT = $9999; (* refuse an action (in WM_LOGEVENT) *) (* Valid Form Types type = ENCRYPTOR type = COMPOSER type = READER *) (* Control IDs: Control IDs are internal tags used to tie a button to a given internal function. The following control IDs are recognized: Buttons: 801 Start a new mail message 802 Open or re-scan the new mail folder 803 Work with mail folders 804 Work with address books 805 Work with distribution lists 806 Get a list of local users on the system 807 Edit filters applied when the new mail folder is opened 808 Open noticeboards 820 Cut 821 Copy 822 Paste 823 Print the current window 824 Set a font for the current window 825 Save to disk 826 Read from disk 827 Get mail via the built-in POP3 transport 828 Send mail via the built-in SMTP transport 829 Get mail then send mail 835 Perform a selective download via the built-in POP3 transport 836 Start a new circulation message. Comboboxes: 840 List of currently-defined identities on the system *) (* Bitmap IDs: A number of bitmaps are built-in to Pegasus Mail and can be accessed in buttons via special bitmap IDs. The following IDs are available: note that the text describing each button is simple description - the control ID is what decides what function is actually associated with a button. 1801 Start a new mail message 1802 Open or re-scan the new mail folder 1803 Work with mail folders 1804 Work with address books 1805 Work with distribution lists 1806 Get a list of local users on the system 1807 Edit filters applied when the new mail folder is opened 1808 Open noticeboards 1820 Cut 1821 Copy 1822 Paste 1823 Print the current window 1824 Set a font for the current window 1825 Save to disk 1826 Read from disk 1827 Get mail via the built-in POP3 transport 1828 Send mail via the built-in SMTP transport 1829 Get mail then send mail 1830 Connect/go online 1831 Disconnect/go offline 1835 Perform a selective download via the built-in POP3 transport 1836 Start a new circulation message. Appendix A: Menu codes for Pegasus Mail The following predefined values should be used to decode WM_FM_COMMAND messages: you should avoid using any of these values in any menu you create. ------------------------------------------------------------------------ WinPMail Mnemonic ID Menu function (Which Menu) ------------------------------------------------------------------------ *) const IDM_HELP = 10; (* "Context-sensitive help" (HELP) *) IDM_USING_HELP = 11; (* "Using Help" (HELP) *) IDM_HELPINDEX = 12; (* "Help index" (HELP) *) IDM_RMACRO = 75; (* "Open glossary manager" (EDIT/GLOSSARY) *) IDM_PMACRO = 76; (* "Expand glossary entry" (EDIT/GLOSSARY) *) IDM_NEWMESSAGE = 101; (* "Start new message" (FILE) *) IDM_READNEW = 102; (* "Open new mail folder" (FILE) *) IDM_OPENFOLDER = 103; (* "Folders..." (FILE) *) IDM_IMPORT = 104; (* "Import into message" (MESSAGE) *) IDM_SAVESESSION = 105; (* "Save message as draft" (MESSAGE) *) IDM_RESTORESESSION = 106; (* "Open saved message" (FILE) *) IDM_PRINT = 107; (* "Print" (FILE) *) IDM_PRINTSETUP = 109; (* "Printer setup" (FILE) *) IDM_FILTERS = 110; (* "New mail filtering rules" (FILE) *) IDM_EXIT = 111; (* "Exit" (FILE) *) IDM_PREF_GENERAL = 121; (* "General settings" (FILE/PREFS) *) IDM_PREF_SMF = 122; (* "NetWare MHS settings" (FILE/PREFS) *) IDM_PREF_SIGS = 123; (* "Signatures..." (FILE/PREFS) *) IDM_PREF_HOMEBOX = 124; (* "Home mailbox location" (FILE/PREFS) *) IDM_PREF_EXT = 125; (* "Extended features" (FILE/PREFS) *) IDM_UNDO = 131; (* "Undo" (EDIT) *) IDM_CUT = 132; (* "Cut" (EDIT) *) IDM_COPY = 133; (* "Copy" (EDIT) *) IDM_PASTE = 134; (* "Paste" (EDIT) *) IDM_CLEAR = 135; (* "Clear" (EDIT) *) IDM_SELECTALL = 136; (* "Select all" (EDIT) *) IDM_SPELLING = 137; (* "Check spelling" (EDIT) *) IDM_SERVER = 138; (* "File servers..." (FILE) *) IDM_LOCALUSERS = 141; (* "Lookup local users" (ADDRESSES) *) IDM_ADDRESSBOOKS = 142; (* "Address books" (ADDRESSES) *) IDM_MAILINGLISTS = 143; (* "Distribution lists..." (ADDRESSES) *) IDM_SORTBYKEY = 144; (* "Sort by key" (ADDRESSBOOK) *) IDM_SORTBYNAME = 145; (* "Sort by name" (ADDRESSBOOK) *) IDM_FIND = 146; (* "Find text", (MESSAGE/FOLDER/READER/ADDRBK) *) IDM_FINDAGAIN = 147; (* "Find again", (MESSAGE/FOLDER/READER/ADDRBK) *) IDM_PASTENAMES = 148; (* "Paste names" (ADDRESSBOOK) *) IDM_PASTEADDRESSES = 149; (* "Paste addresses" (ADDRESSBOOK) *) IDM_SAVESIZE = 150; (* "Save window size" (Various) *) IDM_OTHEROPTIONS = 151; (* "Special message view" (MESSAGE) *) IDM_SHOWHEADERS = 153; (* "Show all headers" (READER) *) IDM_EXTRACT = 154; (* "Save messages to disk" (FOLDER/READER) *) IDM_ATTACH = 155; (* "Switch to attachments view" (MESSAGE) *) IDM_MARKUNREAD = 156; (* "Mark message as unread" (FOLDER and NB) *) IDM_ALIASING = 157; (* "Resolve aliases" (ADDRESSBOOK) *) IDM_BPPREF = 158; (* "Button panel preferences" (FILE/PREFS) *) IDM_UUDECODE = 160; (* "UUdecode message" (FOLDER/READER /SPECIAL) *) IDM_UNBINHEX = 161; (* "Un-BinHex message" (FOLDER/READER /SPECIAL) *) IDM_LOCALSIG = 162; (* "Signature for local mail" (FILE/PREFS) *) IDM_INETSIG = 163; (* "Signature for Internet mail" (FILE/PREFS) *) IDM_MHSSIG = 164; (* "Signature for MHS mail" (FILE/PREFS) *) IDM_DELEXPIRED = 165; (* "Delete expired messages" (FOLDER/SPECIAL) *) IDM_EDMAIL = 167; (* "Switch to message editor view" (MESSAGE) *) IDM_QUICKLOOKUP = 168; (* "Quick lookup" (ADDRESSES) *) IDM_WORDWRAP = 169; (* "Wrap long lines" (READER) *) IDM_DELLINE = 170; (* "Delete line" (MESSAGE) *) IDM_REFORMAT = 171; (* "Reformat paragraph" (MESSAGE) *) IDM_INDENT = 172; (* "Indent text" (MESSAGE) *) IDM_REPLACE = 173; (* "Search and replace" (MESSAGE) *) IDM_DELWORD = 174; (* "Delete word right" (MESSAGE) *) IDM_APREFS = 175; (* "Advanced settings" (FILE/PREFS) *) IDM_ENLARGE = 176; (* "Enlarge window" (WINDOW) *) IDM_ABK_EXPORT = 177; (* "Export addressbook" (ADDRESSBOOK) *) IDM_ABK_IMPORT = 178; (* "Import addressbook" (ADDRESSBOOK) *) IDM_NOTICEBOARDS = 179; (* "Noticeboards" (FILE) *) IDM_ANN_EDIT = 180; (* "Add/edit annotation" (FOLDER) *) IDM_SRT_DATE = 270; (* "Sort by date" (FOLDER) *) IDM_SRT_REVDATE = 271; (* "Sort by reverse date" (FOLDER) *) IDM_SRT_SUBJECT = 272; (* "Sort by subject" (FOLDER) *) IDM_SRT_FROM = 273; (* "Sort by sender's name" (FOLDER) *) IDM_SRT_SUBJECT2 = 274; (* "Sort by subject/reverse date" (FOLDER) *) IDM_SRT_COLOUR = 275; (* "Sort by colour" (FOLDER) *) IDM_FORMS = 185; (* "Open Forms Manager" (FILE) *) IDM_ANN_DELETE = 186; (* "Delete annotation" (FOLDER) *) IDM_REVIEWMAIL = 187; (* "Review Queued Mail" (FILE) *) IDM_TODISK = 230; (* "Save to disk" (Various) *) IDM_FROMDISK = 231; (* "Read from disk" (Various) *) IDM_EXTRACTFILE = 240; (* "MHS directory service" (ADDRESSES) *) IDM_LOGGED_IN = 241; (* "Logged-in users" (ADDRESSES) *) IDM_ADD_USER = 242; (* "Add sender to list" (READER/SPECIAL) *) IDM_REMOVE_USER = 243; (* "Remove sender from list" (READER/SPECIAL) *) IDM_FONT = 299; (* "Font" (Various) *) IDM_TILE = 500; (* "Tile" (WINDOW) *) IDM_CASCADE = 501; (* "Cascade" (WINDOW) *) IDM_ARRANGEICONS = 502; (* "Arrange Icons" (WINDOW) *) IDM_BUTTONPANEL = 503; (* "Button panel" (WINDOW) *) IDM_NETCONFIG = 210; (* "Network Configuration" (FILE) *) IDM_GETMAIL = 211; (* "Check host for new mail" (FILE) *) IDM_SENDMAIL = 212; (* "Send all queued mail" (FILE) *) IDM_GETANDSEND = 189; (* "Check and send mail" (FILE) *) IDM_MSGCOLOUR = 260; (* "Set colour" (FOLDER) *) IDM_UADMIN = 322; (* "Manage users..." (ADDRESSES) *) IDM_ONLINE = 321; (* "Leave offline mode" (FILE) *) IDM_OFFLINE = 320; (* "Enter offline mode" (FILE) *) IDM_QF_6 = 316; (* "Quick folder 6" (FILE/FOLDERS) *) IDM_QF_5 = 315; (* "Quick folder 5" (FILE/FOLDERS) *) IDM_QF_4 = 314; (* "Quick folder 4" (FILE/FOLDERS) *) IDM_QF_3 = 313; (* "Quick folder 3" (FILE/FOLDERS) *) IDM_QF_2 = 312; (* "Quick folder 2" (FILE/FOLDERS) *) IDM_QF_1 = 311; (* "Quick folder 1" (FILE/FOLDERS) *) IDM_QF_DEFINE = 197; (* "Define quick folders" (FILE/FOLDERS) *) IDM_EDIT_FLAGS = 199; (* "Edit message flags" (FOLDER) *) IDM_SRT_NEWTOTOP = 198; (* "Sort unread before read" (FOLDER) *) IDM_DLM_EXPORT = 196; (* "Export to text file" (LISTS) *) IDM_DLM_DUPLICATE = 194; (* "Duplicate list" (LISTS) *) IDM_DLM_EDIT = 193; (* "Edit list" (LISTS) *) IDM_DLM_DELETE = 192; (* "Delete list" (LISTS) *) IDM_DLM_ADD = 191; (* "Add new list" (LISTS) *) IDM_PREF_VIEW = 190; (* "Attachment viewers" (FILE) *) IDM_FULLSCREEN = 188; (* "E *) (* Form dialogs and callbacks: a form DLL can export a function *) (* which WinPMail's form manager will call with Windows messages *) (* destined for the form's dialog or window (such as menu selections *) (* and so forth). The function takes the following form: *) (* Original "C" Definition typedef long FAR PASCAL ( *FORM_CALLBACK) (HWND hWnd, UINT wMsg, WPARAM wParam, LPARAM lParam); PASCAL 16 Bit function FORM_CALLBACK(Hwindow: hWnd; wMsg: word; wParam: word; lParam: longint): longint; export; DELPHI 32 Bit function FORM_CALLBACK(Hwindow: hWnd; wMsg: integer; wParam: integer; lParam: longint): longint; export; stdcall; *) (* The return from a form callback is passed back through the *) (* Windows call chain if non-zero, otherwise the default window *) (* proc is called. *) (* Minimum interface: the minimum interface a form DLL must provide *) (* is a routine called "FORMINIT" which is exported by name. "FORMINIT" *) (* has the following prototype: *) (* "C" Definition typedef WORD FAR PASCAL ( *FN_FORMINIT) (WORD version, int variant, HWND hParent, char *data, HWND *hDialog, char *callback_name); PASCAL 16 Bit VERSION: function FORMINIT (version: word; variant: integer; hParent: hwnd; data: pchar; var hDialog: hwnd; callback_name: pchar): word; export; DELPHI 32 Bit VERSION: function FORMINIT (version: word; variant: integer; hParent: hwnd; data: pchar; var hDialog: hwnd; callback_name: pchar): word; export; stdcall; *) (* "version" is passed in with the version of the WinPMail forms *) (* manager which is running. *) (* "variant" indicates what type of form is required - the following *) (* values are currently defined: *) (* 0: Create a form for composing a message *) (* 1: Create a form for reading a message *) (* "hParent" contains the handle of the WinPMail MDI child window *) (* which is to contain the form. *) (* "data" contains any string defined as being required for the *) (* form in the menu interface. *) (* "hDialog" should be filled in with the window handle of the *) (* modeless dialog created within the MDI child window. If the *) (* value returned is NULL, then the MDI child window will be *) (* hidden and will never actually interact directly with the *) (* user, but the extension will still receive messages from the *) (* Form Manager and can still send messages to its parent for *) (* access to API functions. *) (* "callback_name" (optional) should be filled in with the name of the *) (* function in the DLL of the exported function to which messages *) (* should be sent or NULL if there is none. If NULL, messages are *) (* sent to the dialog returned in "hDialog". You will use an *) (* indirect callback of this kind when your extension does not *) (* create a dialog within the enclosing parent window. *) (* Example Delphi FORMINIT var r: Trect; begin pegparent := hparent; Pegparent is global variable defined as pegparent: Handle; (or Thandle) callback_name := nil; application.createform(tform1,form1); hdialog := application.mainform.handle; GetClientRect(hDialog, r); MoveWindow(hDialog, 0, 0, r.right, r.bottom, FALSE); forminit := 1; end; (* *) (* When FORMINIT is called, the DLL should create the dialog within *) (* the MDI parent window and set it to the correct size. On return *) (* WinPMail will resize the parent window to enclose the dialog *) (* correctly. The DLL should NOT make the dialog visible - WinPMail *) (* will do that as required. *) (* *) (* +--------------------------------------------------------------------+ *) (* | SECTION 1: | *) (* | Messages the Extension Manager can send to an extension: | *) (* +--------------------------------------------------------------------+ *) (* *) (*$ifdef testingonly *) const WM_USER = 1000; type (* These type defines are only to allow syntax compilation of Wpmforms.inc by itself *) (* Normal program will have USES library WINDOWS or equivalent before the include for Wpmforms.inc, so WM_USER will be defined *) hmenu = integer; hwnd = integer; dword = longint; thandle = integer; (*$endif *) const WM_FM_FORMBASE = (WM_USER + 1800); (* WM_USER Defined in wintypes *) WM_FM_INIT = (WM_FM_FORMBASE + 1); (* Sent by the manager after the MDI parent window has been created *) (* and FORMINIT has been called, but before any positioning has been *) (* done. At the time this message arrives, the window will not be *) (* visible on the screen. An extension may send any extension manager *) (* message while processing this message and at any time afterwards. *) WM_FM_SIZE = (WM_FM_FORMBASE + 2); (* Sent by the manager when the enclosing MDI window is resized. *) (* The parameters from the WM_SIZE message passed by windows are *) (* sent through unaltered. If an extension contains a dialog, it *) (* should resize the dialog to the MDI parent window size in *) (* response to this message. *) WM_FM_GETMINMAXINFO = (WM_FM_FORMBASE + 3); (* Sent by the manager when Windows asks it for the limits on a *) (* window resize operation. See the Windows documentation for *) (* WM_GETMINMAXINFO for more details (the manager passes the *) (* parameters through unmodified). *) WM_FM_WHEREYAWANNIT = (WM_FM_FORMBASE + 4); (* Sent by the forms manager after creating the form dialog but before *) (* displaying the MDI child window; asks where the form would like its *) (* window placed on the screen. lParam points to a POINT structure; *) (* if 1 is returned, the position it contains will be used. The position *) (* should be expressed in units from the top left corner of WinPMail's *) (* main client area. If 0 is returned, WinPMail will stagger the window *) (* like any other of its own windows. If 2 is returned, WinPMail will *) (* centre the window in the client area. *) WM_FM_INITFOCUS = (WM_FM_FORMBASE + 5); (* Sent by the manager at the end of Window creation, after the *) (* window has been made visible. The dialog should set focus to *) (* whichever control it wishes. *) WM_FM_RESTOREFOCUS = (WM_FM_FORMBASE + 6); (* Sent by the manager any time the window should restore its *) (* focus to the last active control. This curiosity is needed *) (* because of a glitch in the way Windows handles focus for *) (* dialogs embedded in MDI children. Dialogs should record the *) (* last active control by trapping EN_SETFOCUS messages from *) (* the controls they contain. *) WM_FM_COMMAND = (WM_FM_FORMBASE + 7); (* The Manager generates a WM_FM_COMMAND message any time it *) (* receives a WM_COMMAND message which it cannot itself handle. *) (* In almost all cases, this will occur with menu selections *) (* from the main WinPMail menu. The format of this command is *) (* exactly the same as a WM_COMMAND message. *) (* *) (* The predefined IDM.* values above should be used to decode *) (* WM_FM_COMMAND messages: *) WM_FM_DROPMESSAGE = (WM_FM_FORMBASE + 10); (* Sent by the Extensions Manager when it is advised that a message *) (* has been dropped somewhere on the extension's window. lParam *) (* contains a pointer to the point in the window where the drop occurred. *) (* Once an extension receives this message, it may use any of the messages *) (* in section 4 (Reader Extension Messages) to access the message which has *) (* been dropped onto it, but only up to the point at which it returns *) (* control to the Extension Manager. *) (* *) (* +--------------------------------------------------------------------+ *) (* | SECTION 2: | *) (* | Messages a form can send to the Forms Manager to access | *) (* | internal Pegasus Mail messaging services: | *) (* +--------------------------------------------------------------------+ *) (* *) WM_F_FORMBASE = (WM_USER + 2000); WM_F_QUICKADDRESS = (WM_F_FORMBASE + 1); (* Open the Recent address list and allow the user to select *) (* addresses from it. Any addresses selected are pasted into the *) (* EDIT control specified in wParam. *) (* ** PARAMETERS: wParam = Active edit control; lParam = unused *) (* ** RETURNS: Nothing *) WM_F_NEWMESSAGE = (WM_F_FORMBASE + 2); (* Create a new message ready to be filled out. NOTE: this does not *) (* mean "open a new mail composition window", it merely means "I am *) (* about to generate a message for you to send - get ready", and *) (* causes the Extension Manager to create internal data structures. *) (* Note that this function will also "reset" the message structure *) (* associated with an extension window if a message has already been *) (* started or sent, clearing all addresses, custom headers and other *) (* defined fields. *) (* ** PARAMETERS: None *) (* ** RETURNS: 1 on success, 0 on failure (out of memory) *) (* ** WARNING: You MUST send this message before attempting to *) (* fill out any fields in a message. *) WM_F_TO = (WM_F_FORMBASE + 3); (* Set the "To" field of the message *) (* ** PARAMETERS: wParam = unused; lParam = address to set *) (* ** RETURNS: Nothing *) WM_F_CC = (WM_F_FORMBASE + 4); (* Set the "Cc" field of the message *) (* ** PARAMETERS: wParam = unused; lParam = address to set *) (* ** RETURNS: Nothing *) WM_F_BCC = (WM_F_FORMBASE + 5); (* Set the "BCc" field of the message *) (* ** PARAMETERS: wParam = unused; lParam = address to set *) (* ** RETURNS: Nothing *) WM_F_SUBJECT = (WM_F_FORMBASE + 6); (* Set the "Subject" field of the message *) (* ** PARAMETERS: wParam = unused; lParam = text to set *) (* ** RETURNS: Nothing *) WM_F_COPYSELF = (WM_F_FORMBASE + 7); (* Set the message's Copy-to-self flag *) (* ** PARAMETERS: wParam = 1 or 0; lParam = unused *) (* ** RETURNS: Nothing *) WM_F_CONFIRMREADING = (WM_F_FORMBASE + 8); (* Set the message's Confirm-reading flag *) (* ** PARAMETERS: wParam = 1 or 0; lParam = unused *) (* ** RETURNS: Nothing *) WM_F_CONFIRMDELIVERY = (WM_F_FORMBASE + 9); (* Set the message's Confirm-delivery flag *) (* ** PARAMETERS: wParam = 1 or 0; lParam = unused *) (* ** RETURNS: Nothing *) WM_F_URGENT = (WM_F_FORMBASE + 10); (* Set the message's Urgent flag *) (* ** PARAMETERS: wParam = 1 or 0; lParam = unused *) (* ** RETURNS: Nothing *) WM_F_MIME = (WM_F_FORMBASE + 11); (* Set the message's Use-MIME flag *) (* ** PARAMETERS: wParam = 1 (use MIME) or 0 (Don't); lParam = unused *) (* ** RETURNS: Nothing *) WM_F_8BITDATA = (WM_F_FORMBASE + 62); (* Set/unset the flag which controls whether or not a message *) (* can be sent via Internet transports using raw 8-bit data. *) (* ** PARAMETERS: wParam = 1 (allow 8 bits) or 0 (don't); lParam = unused *) (* ** RETURNS: Nothing *) (* Note: 8-bit data is officially illegal in Internet mail - you are *) (* <> urged not to use this option unless you have no other *) (* choice and understand very clearly what you are doing. The author *) (* accepts no responsibility whatsoever for abuse of this feature and *) (* reserves the right to remove or disable it in future releases of *) (* the program if it is indiscriminately or carelessly used. *) WM_F_REPLYTO = (WM_F_FORMBASE + 12); (* Set the "Reply-to" field of the message *) (* ** PARAMETERS: wParam = unused; lParam = address to set *) (* ** RETURNS: Nothing *) WM_F_ATTACH = (WM_F_FORMBASE + 13); (* Add an attachment to the message: *) (* ** PARAMETERS: wParam = unused; *) (* lParam points to a record of the following type: *) type attachment = record file_to_attach: array[0..143] of char; attachment_type: array[0..31] of char; encoding: char; end; (* "encoding" can be: *) (* 0: Best guess - WinPMail chooses the most appropriate encoding *) (* 1: No encoding (use with EXTREME care) *) (* 2: ASCII text *) (* 3: UUencoding *) (* 4: BinHex *) (* 5: MIME encoding (BASE64) *) (* You are <> encouraged to set "encoding" to 0 unless you *) (* are VERY sure of what you are doing. *) (* ** RETURNS: Nothing *) const WM_F_ENCRYPTIONKEY = (WM_F_FORMBASE + 14); (* Set the encryption key for the message; if 0-length, the message *) (* is not encrypted. *) (* ** PARAMETERS: wParam = unused; lParam points to encryption key *) (* ** RETURNS: Nothing *) WM_F_NOSIG = (WM_F_FORMBASE + 15); (* Set the message's No-signature flag; wParam = 1 or 0 *) (* ** PARAMETERS: wParam = 1 (no signature) or 0; lParam = unused *) (* ** RETURNS: Nothing *) (* ** Note the reversed sense of the wParam parameter. *) WM_F_MESSAGEFILE = (WM_F_FORMBASE + 16); (* Indicate the full path to a file containing the text Pegasus Mail *) (* should use as the body of the mail message. *) (* ** PARAMETERS: wParam = unused; lParam = pointer to path (C string) *) (* ** RETURNS: Nothing *) (* ** Note: this message and WM_F_MESSAGETEXT are mutually exclusive. *) (* ** Note 2: the variable pointed to by lParam should be persistent - *) (* that is, its value should remain valid until the message is sent. *) (* Pegasus Mail stores the pointer, not a copy of the data, so if you *) (* allocate the path on the stack the return from the function where *) (* it is declared, it will be trashed. In general, either allocate *) (* memory for it explicitly or declare it static. If you allocate *) (* memory for it, remember to release it, since WinPMail will not. *) WM_F_MESSAGETEXT = (WM_F_FORMBASE + 17); (* Set the text of the mail message body to a block contained in memory. *) (* Lines should end in LF characters only. lParam points to the text, *) (* which must be nul-terminated. *) (* ** PARAMETERS: wParam = unused; lParam = pointer to textual data. *) (* ** RETURNS: Nothing *) (* ** Note: this message and WM_F_MESSAGEFILE are mutually exclusive. *) (* ** Note 2: you can get text from an edit control formatted in the *) (* proper way for this message using the WM_F_GETTEXT message. *) WM_F_EXPIRATION = (WM_F_FORMBASE + 18); (* Set the expiration date of the message *) (* ** PARAMETERS: wParam = unused; lParam = pointer to a 7-byte *) (* date format record described under WM_F_GETDATETIME below. *) (* ** RETURNS: Nothing *) WM_F_SETDEFAULTS = (WM_F_FORMBASE + 19); (* Initialize a message created using the WM_F_NEWMESSAGE menu to *) (* the values stored in the user's preferences file. You should send *) (* this message after sending WM_F_NEWMESSAGE but before sending any *) (* other messagefield-related message. *) (* ** PARAMETERS: wParam = unused; lParam = unused *) (* ** RETURNS: Nothing *) WM_F_SETHEADER = (WM_F_FORMBASE + 61); (* Set a custom header in the outgoing message. lParam points to *) (* the header data, and wParam is either 0 if the header is suitable *) (* for use in RFC822 messages or 1 if the header is intended for use *) (* in MHS messages. This routine cannot be used to alter the following *) (* headers in the message: "From:", "To:", "Reply-to:", "Cc:", "Bcc:", *) (* "Subject:", "Date:", "X-To:", "Copies-to:", "Organization:", *) (* "Priority:", "Importance:", or "Sender:" - attempting to do so will *) (* return an error code. Any other legally formatted header may be *) (* added, though; the header may contain LFs to indicate line breaks *) (* (note, do NOT add the CR) but must follow proper line folding rules *) (* for the destination transport. The header need not end with a newline *) (* character but may do so (WinPMail will add it if necessary). *) (* ** PARAMETERS: wParam = 0 (RFC822) or 1 (MHS); lParam = header. *) (* ** RETURNS: 1=Success, 0=illegal header, -1 = out of memory. *) (* ** WARNING: This message is extremely specialised and should not *) (* be needed in the vast majority of cases. You should *) (* only use this message if you have expert knowledge *) (* of the message transport for with the header you are *) (* adding is intended. *) WM_F_SENDMESSAGE = (WM_F_FORMBASE + 20); (* Send a message created using the interface defined in the *) (* preceding messages. It is legal to call this message repeatedly *) (* for the same message definition - so, if you wanted to send the *) (* same message to 20 different users, you could set it up the way *) (* you want it then call WM_F_TO after each WM_F_SENDMESSAGE call *) (* to change the recipient. *) (* ** PARAMETERS: wParam = unused; lParam = unused *) (* ** RETURNS: 0 on failure, 1 on success. *) (* *) (* +--------------------------------------------------------------------+ *) (* | SECTION 3: | *) (* | Simple TCP/IP interface routines | *) (* +--------------------------------------------------------------------+ *) (* *) (* The extensions manager provides a simplified TCP/IP interface to *) (* extensions, suitable for simple question-and-answer style protocols *) (* such as POP3, SMTP, Finger, LDAP or PH. The TCP/IP connection is *) (* fully buffered and quite robust, but offers nothing fancy. An *) (* extension can have up to five TCP/IP connections open at any time. *) (* If you need more than this interface offers (UDP support, for *) (* instance), you should load WINSOCK.DLL using your own instance *) (* handle and access its services directly. *) (* *) (* Note: WinPMail's socket handling is fully non-blocking so you can *) (* open multiple sockets simultaneously without contention problems. *) (* The exception to this is name resolution calls, which may block, *) (* and which may therefore cause transient failures. This will be *) (* addressed in future, but for now the easiest way to avoid this *) (* as a problem is to use numeric IP addresses instead of names *) (* wherever possible. *) WM_F_TCPOPEN = (WM_F_FORMBASE + 29); (* Open a TCP/IP connection *) (* ** PARAMETERS: wParam = host port; lParam = pointer to host *) (* address in either domain name or dotted-IP format. *) (* ** RETURNS: -1 on failure *) WM_F_TCPGETS = (WM_F_FORMBASE + 34); (* Get a line of data from an open TCP/IP port. The terminating LF or *) (* CR/LF is not removed from the returned data. *) (* ** PARAMETERS: wParam = length of buffer; lParam = pointer to buffer *) (* ** RETURNS: > 0 = OK; 0 = timeout; < 0; TCP/IP error *) WM_F_TCPPUTS = (WM_F_FORMBASE + 35); (* Write a line of data to an open TCP/IP port; does not add CRLF. The *) (* data is presumed to be a nul-terminated C string. *) (* ** PARAMETERS: wParam = unused; lParam = pointer to data to write *) (* ** RETURNS: > 0 = OK; 0 = timeout; < 0; TCP/IP error *) WM_F_TCPCLOSE = (WM_F_FORMBASE + 36); (* Close an open TCP/IP connection *) (* ** PARAMETERS: wParam = unused; lParam = unused *) (* ** RETURNS: -1 on failure *) WM_F_TCPPRESENT = (WM_F_FORMBASE + 37); (* Determine whether TCP/IP services are available and configured *) (* ** PARAMETERS: wParam = unused; lParam = unused *) (* ** RETURNS: 1 = OK to use TCP/IP services; 0 = no TCP/IP services *) WM_F_TCPMYNAME = (WM_F_FORMBASE + 38); (* Return the domain name of the current machine. If no domain name *) (* can be determined, return the machine's IP address in dotted format. *) (* ** PARAMETERS: wParam = length of buffer; lParam = pointer to buffer *) (* ** RETURNS: Nothing *) WM_F_TCPSETSOCKET = (WM_F_FORMBASE + 49); (* Set the socket which will be used in subsequent TCP/IP calls. *) (* The default socket is 0, so if you only ever have a single *) (* connection open at any time you will never need to use this *) (* message. Each extension (or instance of an extension) can have up *) (* to five connections open simultaneously and can select the one you *) (* are interested in using this message *) (* ** PARAMETERS: wParam = desired socket (0..4); lParam = unused *) (* ** RETURNS: Nothing *) WM_F_TCPPOP3 = (WM_F_FORMBASE + 52); (* Initiate a regular POP3 connection and download mail to the *) (* local machine. If wParam is 0, a progress dialog will be put *) (* up during the transaction. If lParam is 0 (NULL) then the *) (* standard host configuration provided by the user will be used *) (* for host and username information; alternatively, lParam can *) (* point to a copy of the following structure: *) (*$ifndef PROFILE_INCLUDED *) MAXHOST = 80; type popdef = record pop3host: array[0..MAXHOST-1] of char; (* POP3 server address *) smtphost: array[0..MAXHOST-1] of char; (* SMTP server address *) username: array[0..47] of char; (* POP3 account name *) password: array[0..47] of char; (* POP3 account password *) mask: array[0..63] of char; (* Path and filespec to find SMTP files *) mailbox: array[0..77] of char; (* Where to place incoming POP3 messages *) smtp_port: word; threshhold: longint; (* Largest message to download, in bytes *) delete_mail: word; (* If NZ, delete successfully downloaded mail *) wflags: longint; from_field: array[0..MAXHOST-1] of char; (* Contents of the message's "from" field *) timeout: word; (* TCP/IP timeout (seconds) *) memory_file: array[0..13] of char; (* State info file when leaving mail on server *) pop3port: word; (* Destination port on POP3 server *) end; (* The "wflags" field is a bitmap which can have the following values: *) const POP_LEAVE_ON_SERVER = 1; (* Download only unread mail *) (*$endif *) (* *) (* ** PARAMETERS: wParam = 0/NZ;dialog/none; lParam = NULL/see above *) (* ** RETURNS: None *) WM_F_TCPOP3VERIFY = (WM_F_FORMBASE + 55); (* Initiate a regular POP3 connection but ONLY check that the *) (* user and password information supplied is valid. No actual *) (* mail transaction is performed. A dialog is never put up for *) (* this routine, although messages may appear on the statusline. *) (* If wParam is non-zero, the POP3 code will establish a con- *) (* nection to the POP3 server, will authenticate the user, and *) (* will then return control in the open state. If you use this *) (* feature, it is up to you to issue proper POP3 commands to *) (* manage the session and close it down gracefully. *) (* If lParam is 0 (NULL) then the standard host configuration *) (* provided by the user will be used for host and username *) (* information; alternatively, lParam can point to a copy of *) (* the POPDEF structure shown above. *) (* ** PARAMETERS: wParam = unused; lParam = NULL/see above *) (* ** RETURNS: 1 if the information is valid, 0 if not. *) (* ** Note: it is not possible to determine in any meaningful way *) (* which of the username or password was incorrect if verification *) (* fails, because most POP3 servers accept any username for security *) (* reasons. *) WM_F_TCPOP3COUNT = (WM_F_FORMBASE + 56); (* Initiate a regular POP3 connection but ONLY count the number *) (* of messages waiting on the account. No actual mail download is *) (* performed and a dialog is never put up although messages may *) (* appear on the statusline. If lParam is 0 (NULL) then the *) (* standard host configuration provided by the user will be used *) (* for host and username information; alternatively, lParam can *) (* point to a copy of the POPDEF structure shown above. *) (* ** PARAMETERS: wParam = unused; lParam = NULL/see above *) (* ** RETURNS: -1 on error, message count otherwise *) WM_F_TCPSMTP = (WM_F_FORMBASE + 53); (* Initiate a regular SMTP connection using the built-in client. *) (* If wParam is 0, a progress dialog will be put up during the *) (* transaction. As with WM_F_TCPPOP3, you can pass a POPDEF *) (* structure pointer in lParam to specify an alternative host. *) (* ** PARAMETERS: wParam = 0/NZ;dialog/none; lParam = NULL/see above *) (* ** RETURNS: None *) (* ** Note: for security reasons, WinPMail will only send mail using *) (* the SMTP protocol if it can verify your POP3 information by *) (* connecting to the specified POP3 server; no verification, no send. *) WM_F_TCPREAD = (WM_F_FORMBASE + 59); (* Read raw data from a TCP/IP port. lParam points to a buffer where *) (* the data should be written: if wParam is non-zero, then it is *) (* whichever is the lesser of the size of the buffer, or the maximum *) (* number of bytes to read. If wParam is zero, then the buffer must *) (* be 1024 bytes long and the routine will wait until any data appears *) (* on the port then return it, up to 1024 bytes in length. This latter *) (* application is useful when dealing with protocols where you don't *) (* necessarily know how much data you are going to receive in advance. *) (* ** PARAMETERS: wParam = 0, or bufsize/maxdata; lParam = buffer address *) (* ** RETURNS: The actual number of bytes read; < 0 indicates an *) (* error; 0 indicates either socket closed or timeout. *) WM_F_TCPWRITE = (WM_F_FORMBASE + 60); (* Write raw data to a TCP/IP port. lParam points to the data to write, *) (* and wParam points to the length of the data. The data is written *) (* without any modification. This routine never blocks, and enters an *) (* internal message processing loop while waiting for the data to clear. *) (* ** PARAMETERS: wParam = length of data; lParam = pointer to data *) (* ** RETURNS: -1 on hard error; 0 on timeout; >0 on success (the *) (* number of bytes actually written). *) WM_F_TCPTIMEOUT = (WM_F_FORMBASE + 67); (* Get or set the WinPMail global TCP/IP timeout value. If wParam is *) (* 0, lParam is ignored, and the current timeout is returned by the *) (* message (expressed as a number of seconds). If wParam is non-zero, *) (* lParam is presumed to contain a new value (expressed in seconds) *) (* which will be applied to subsequently-opened sockets. To set the *) (* timeout for a socket, you should make this call immediately before *) (* opening the connection, and should reset the original value once *) (* the socket has been successfully opened. Note that you cannot *) (* change the timeout value for a socket once it has been opened - *) (* it inherits the global value in force at that moment and retains *) (* it until closed. *) (* ** PARAMETERS: wParam = 0 to get, 1 to set; lParam = new seconds value *) (* ** RETURNS: The old value in seconds of the global timeout value. *) WM_F_TCPSET = (WM_F_FORMBASE + 70); (* WinPMail v2.11 and later only *) (* Set the master POPDEF record maintained by Pegasus Mail (see above *) (* for the POPDEF data structure). Pegasus Mail uses this record to *) (* initiate SMTP and POP3 transactions for the user, and presents the *) (* values from this record when the "Network configuration" dialog is *) (* opened. If wParam is non-zero, then the structure you pass will be *) (* marked as "dirty" which will force WinPMail to save it immediately, *) (* replacing the user's existing TCP/IP preferences in PMAIL.INI. You *) (* should exercise caution using this message - it's really provided *) (* only for extensions that create default settings for users. The *) (* POPDEF you supply is copied by WinPMail - you do not have to keep *) (* it allocated after calling this function. *) (* *) (* SETTING TRANSPORT OPTIONS: many of the settings to do with the way *) (* WinPMail loads and interacts with WINSOCK.DLL are held in a separate *) (* field within the user's preferences. You can access this field, which *) (* is a single unsigned char, using the W_PRO_POPOPTS index to the *) (* WM_GETPREF and WM_SETPREF messages. The character is a bitmap having *) (* the following possible values: *) (* *) (*$ifndef WINPMAIL *) POP_OPEN_NEW = 1; (* Check when opening new mail folder *) POP_IMMEDIATE_SEND = 2; (* Send at once (don't queue) *) POP_PREFER = 4; (* Prefer over Mercury for Internet mail *) POP_COUNT_ONLY = 8; (* Message count only on idle polls *) POP_MINIMIZED_CHECKS = 16; (* Allow checks when minimized *) POP_ALWAYS_USE = 32; (* Use for all outgoing mail *) POP_DEMAND_LOAD = 64; (* Load WINSOCK.DLL on demand *) SMTP_IDLE_SEND = 128; (* Send queue during idle polls *) (*$endif *) (* *) (* ** SEE ALSO: WM_F_GETPREF and WM_F_SETPREF using W_PRO_POPOPTS index *) (* ** PARAMETERS: wParam = 0/1 (see above); lParam = pointer to POPDEF *) (* ** RETURNS: 0 on failure, 1 on success. *) WM_F_TCPGET = (WM_F_FORMBASE + 71); (* WinPMail v2.11 and later only *) (* Get the master POPDEF record maintained by Pegasus Mail (see above *) (* for the POPDEF data structure). Pegasus Mail uses this record to *) (* initiate SMTP and POP3 transactions for the user, and presents the *) (* values from this record when the "Network configuration" dialog is *) (* opened. See above under WM_F_TCPSET for more information on other *) (* aspects of controlling this configuration information. *) (* ** SEE ALSO: WM_F_GETPREF and WM_F_SETPREF using W_PRO_POPOPTS index *) (* ** PARAMETERS: wParam = unused; lParam = pointer to POPDEF *) (* ** RETURNS: 0 on failure, 1 on success. *) WM_F_TCPINIT = (WM_F_FORMBASE + 76); (* Extension Manager 1.03 (WinPMail v2.25) and later only *) (* Indicate to WinPMail that you are starting a transaction or series *) (* of transactions, or if wParam is zero, that you have finished all *) (* the transactions you intend to make. This message is provided for *) (* efficiency reasons, because many SLIP and PPP WINSOCK.DLLs will *) (* open a connection when loaded and close it when unloaded. Calling *) (* this tells WinPMail to load WINSOCK.DLL if it's not already loaded, *) (* which will usually initiate a call. When you've finished, calling *) (* this with wParam set to 0 tells WinPMail that it's safe to unload *) (* WINSOCK.DLL. The gain in doing this is that you can conduct several *) (* different transactions (for example, POP3 connections) using a *) (* single phone call. If you use WM_F_TCPOPEN and only want to make the *) (* one connection, you do not have to call this function. If you want *) (* to use any of the WM_F_TCPOP3... or WM_F_SMTP... messages, you must *) (* use this message before calling them. *) (* ** PARAMETERS: wParam = 1/0, init/finish. lParam = unused. *) (* ** RETURNS: 1 if TCP/IP services are available, 0 if not. *) (* ** VERSION: Requires version 1.03 or later of the Extension Manager *) WM_F_SETSTATE = (WM_F_FORMBASE + 77); (* ** Extension Manager 1.03 (WinPMail v2.25) and later only ** *) (* Set or get the state of the WinPMail "Offline mode" flag. If wParam *) (* is 0, the offline mode is returned, 1 for offline, 0 for online mode. *) (* If wParam is 1, the offline mode flag is set to the value contained *) (* in lParam (again, 1 = offline, 0 = online). *) (* ** PARAMETERS: see description *) (* ** RETURNS: see description *) (* ** VERSION: Requires version 1.03 or later of the Extension Manager *) (* *) (* +--------------------------------------------------------------------+ *) (* | SECTION 4: | *) (* | Calls available only to READER extensions | *) (* +--------------------------------------------------------------------+ *) (* *) WM_F_OPENMESSAGE = (WM_F_FORMBASE + 42); (* A reader extension can call this to open the original message *) (* passed to it at startup, or in response to a WM_FM_DROPPED message *) (* to access the dropped message. If wParam is 0 (the default) any *) (* normal transformations and decodings will be done on the message *) (* data before it is passed to the extension. If you want to open a *) (* message as a raw stream without any transformations, pass 1 in *) (* wParam. *) (* ** PARAMETERS: wParam = processed/raw; lParam = unused *) (* ** RETURNS: 1 if successfully opened; 0 on failure. *) WM_F_READLINE = (WM_F_FORMBASE + 43); (* Read a line from the original message. The message must have been *) (* opened successfully by calling WM_F_OPENMESSAGE before calling this *) (* routine. *) (* ** PARAMETERS: wParam = maximum length to read; lParam = pointer to buffer *) (* ** RETURNS: 1 if data was read, 0 on failure (usually EOF). *) WM_F_CLOSEMESSAGE = (WM_F_FORMBASE + 44); (* Close a message file opened with WM_F_OPENMESSAGE. You MUST call *) (* this function when you have finished accessing the message. *) (* ** PARAMETERS: wParam = unused; lParam = unused. *) (* ** RETURNS: Nothing. *) WM_F_GETFLAGS = (WM_F_FORMBASE + 45); (* Get the flag longword for the message. The message does NOT have to *) (* be open in order for this call to succeed. *) (* ** PARAMETERS: wParam = unused; lParam = unused. *) (* ** RETURNS: Flag longword (32 bits) *) WM_F_SETFLAGS = (WM_F_FORMBASE + 46); (* Set the flag longword for the message. The message does NOT have *) (* to be open in order for this call to succeed. Note; this function *) (* is only provided to allow you to alter the "has been read", "replied", *) (* "forwarded" and "is annotated" flags. Changing or setting any other *) (* bit in the flag longword may have unexpected consequences and should *) (* only be done if you're absolutely sure of what you're doing. *) (* ** PARAMETERS: wParam = unused; lParam = Flag longword. *) (* ** RETURNS: Nothing *) (* The flag longword is a 32-bit bitmap which can consist of the *) (* following values: *) (*$ifndef WINPMAIL *) FILE_MAILED = 1; (* Message has local-style PMF attachments *) UUENCODED = 2; (* " " " uuencoded attachments *) FILE_ATTACHED = $800003; (* Use this as an attachment mask. *) ENCRYPTED = 4; (* Message is encrypted. *) EXPIRED = 16; (* Message is past its expiry date *) HAS_BEEN_READ = 128; (* The reader has opened the message *) CONFIRMATION = 8192; (* Sender wants confirmation of reading *) COPYSELF = $20000; (* Message is a copy to self *) DELETED = $40000; (* Message has been deleted. *) MIME = $80000; (* Message is a MIME transmission *) REPLIED = $100000; (* Message has been replied to. *) FORWARDED = $200000; (* Message has been forwarded. *) URGENT = $400000; (* Message is urgent/high priority. *) BINHEX = $800000; (* Message contains BinHex-encoded data *) IS_MHS = $1000000; (* Message originates from MHS *) IS_SMTP = $2000000; (* Message originates from SMTP *) IS_ANNOTATED = $4000000; (* The message has an annotation *) ENCLOSURE = $8000000; (* The message has enclosures *) (*$endif *) WM_F_ATTACHMENTINFO = (WM_F_FORMBASE + 47); (* Get details about an attachment from a message. wParam should *) (* indicate the index to the attachment for which data is required *) (* (numbering from 0 as the first attachment) or -1 if you only want *) (* it to return a count of the number of attachments. lParam should *) (* point to an ATTACHMENT structure as defined in the WM_F_ATTACH *) (* message. You should generally only call this routine if the flag *) (* longword for the message indicates that attachments are present, *) (* although this routine does a much more thorough examination of the *) (* message for enclosures than the standard message parser and may *) (* pick up some which it misses. *) (* ** PARAMETERS: wParam = index or -1; lParam = pointer to ATTACHMENT *) (* ** RETURNS: Number of attachments to message, or -1 on error *) (* ** Note: This call cannot be used to handle components of *) (* multipart MIME messages, since they are not necessarily *) (* attachments. Pegasus Mail's own multipart browser is *) (* capable of loading reader extensions for individual *) (* components, but if you want to write your own multipart *) (* browser to replace the built-in browser, you will have *) (* handle the MIME sub-parsing yourself. *) WM_F_EXTRACTATTACHMENT = (WM_F_FORMBASE + 48); (* Extract an attachment from a message into a specified file. wParam *) (* should indicate the index to the attachment required. lParam should *) (* point to a filename string; if lParam is NULL or if the first char *) (* in the filename string is an ASCII NUL (0), then WinPMail will *) (* prompt the user for a filename, and if lParam is non-NULL, will *) (* return it in lParam (allocate at least 128 characters). All decoding *) (* of the message is performed automatically, including MIME translations. *) (* ** PARAMETERS: wParam = index to attachment; lParam = see above *) (* ** RETURNS: 1 on success, < 1 on failure *) WM_F_NEXTMESSAGE = (WM_F_FORMBASE + 68); (* Open the next message in the folder from which the current message *) (* was loaded. If successful, this message will result in the current *) (* window being closed normally. *) (* ** PARAMETERS: wParam = unused; lParam = unused *) (* ** RETURNS: HWND of new message on success; 0 on failure *) WM_F_PREVMESSAGE = (WM_F_FORMBASE + 69); (* Open the message before the current message in the folder from which *) (* the current message was loaded. If successful, this message will *) (* result in the current window being closed normally. *) (* ** PARAMETERS: wParam = unused; lParam = unused *) (* ** RETURNS: HWND of new message on success; 0 on failure *) (* *) (* +--------------------------------------------------------------------+ *) (* | SECTION 5: | *) (* | Logging messages | *) (* +--------------------------------------------------------------------+ *) (* *) (* Extensions can indicate an interest in logging events by setting the *) (* WPM_LOGGING bit in the flags field of their form fact file. An extension *) (* that has set the logging bit will receive messages from WinPMail about *) (* a number of events which can occur in a user session, including mail *) (* being sent, files being created and deleted, and so on. *) (* *) (* Logging extensions can also prevent certain events from happening by *) (* returning WPM_PROHIBIT instead of 0; note that if an extension prohibits *) (* an action, it is up to the extension to indicate an error message or *) (* warning explaining to the user why it has done so (if appropriate) - *) (* WinPMail will not do so. *) (* *) (* There are no limitations on what a logging extension can do, although *) (* in almost every case they will set the WPM_STARTUP bit to load at *) (* runtime. Logging extensions may generate mail messages at any time. *) (* *) WM_FM_SENDMAIL = (WM_FM_FORMBASE + 8); (* WinPMail generates this message when the user sends a mail message, *) (* before any actual processing is done on the message itself. When a *) (* logging extension receives this message, it can call *) (* WM_F_GETMESSAGEFIELD as shown below to retrieve message fields *) (* until the time it returns. A logging extension can prohibit sending a *) (* message by returning WPM_PROHIBIT when it receives this message. *) WM_FM_LOGEVENT = (WM_FM_FORMBASE + 9); (* WinPMail generates this message to cover a variety of system *) (* events. In most cases, returning WPM_PROHIBIT will prevent the *) (* action from occurring. *) (* ** PARAMETERS: wParam = event type; lParam = string descriptor *) (* wParam can have the following values: *) (* wParam lParam Prohibit? *) WLOG_OPEN_FILE = 1; (* Filename of entry to be opened Y *) WLOG_DEL_FILE = 2; (* " " " " " be deleted Y *) WLOG_NEW_FILE = 3; (* Unused Y *) WLOG_REN_FILE = 4; (* Old filename of entry to be renamed Y *) WLOG_OPEN_FOLDER = 5; (* Path to folder to be opened Y *) WLOG_DEL_FOLDER = 6; (* " " " " " be deleted Y *) WLOG_NEW_FOLDER = 7; (* Unused Y *) WLOG_REN_FOLDER = 8; (* Old filename of folder to be renamed Y *) WLOG_EDIT_FILE = 9; (* Filename of dlist to be edited Y *) WLOG_ACTIVATE = 10; (* 1=activating, 0=minimizing Y *) (* WLOG_NEWMESSAGE is sent before the window is actually *) (* created and displayed; WLOG_NEWMESSAGE1 is sent after the *) (* window has been completely created. *) WLOG_NEWMESSAGE = 11; (* Unused Y *) WLOG_NEWMESSAGE2 = 12; (* HWND of new message N *) (* WLOG_ENTERPREFS is called before entering any of the preferences *) (* dialogs in WinPMail, using one of the following values in lParam *) type wlog = ( WPREF_GENERAL, WPREF_ADVANCED, WPREF_SMF, WPREF_HOMEBOX, WPREF_EXTENDED, WPREF_SIGS, WPREF_BPANEL, WPREF_NETCONFIG ); const WLOG_ENTERPREFS = 13; (* Code from list above Y *) (* WLOG_GETMAIL is sent prior to downloading mail via POP3 *) WLOG_GETMAIL = 14; (* Unused Y *) (* WLOG_SMTPSEND is sent before opening an outgoing SMTP connection *) WLOG_SMTPSEND = 15; (* Unused Y *) (* WLOG_NEWEXTENSION is sent before an extension is loaded *) WLOG_NEWEXTENSION = 16; (* Path to extension file Y *) WLOG_ERROR = 17; (* Integer - ID of error message Y *) WLOG_WARNING = 18; (* Integer - ID of warning message Y *) (* WLOG_LOADEXTENSION is sent AFTER an extension has been loaded *) WLOG_LOADEXTENSION = 19; (* HWND - window containing new form N *) WLOG_OPENNEWMAIL = 20; (* Unused *) WLOG_PARSENEW = 21; (* Path to new message file Y *) (* *) (* Detecting when menus are loaded: WLOG_LOADMENU is generated when an *) (* MDI window in WinPMail loads a menu. The completed menu is passed to *) (* the extension in an LMENU structure, and while the extension cannot *) (* suppress the loading of the menu, it can modify the menu. Note that *) (* each menu is a complete copy of the entire menu system, including *) (* File, Edit, Addresses, and Window submenus as well as the specific *) (* menu for the subwindow itself. *) (* *) type LMENU = record menu: hMenu; (* Changed from 'hmenu' to avoid confusion (MSI) *) menu_id: word; end; (* "menu_id" can have the following values: *) (* *) (*$ifndef WINPMAIL *) enummenu = ( FILLER0, (* value 0 unused *) MN_FRAME, (* Pegasus Mail's frame (main window) menu *) MN_EDMAIL, (* Message editor menu ("Message") *) MN_READER, (* Message reader menu ("Reader") *) MN_BROWSE, (* Folder browser menu ("Folder") *) MN_DLIST, (* DList editor menu (no specific menu entry) *) MN_ADDRBOOK, (* Addressbook menu ("Addressbook") *) MN_FOLMAN, (* Floating Folder Manager menu ("Folders") *) MN_FORMS, (* Extensions Manager menu (no specific entry) *) MN_NB, (* Noticeboards menu. *) MN_DLM (* Distribution List Manager menu ("Lists") *) ); (*$endif *) (* *) const WLOG_LOADMENU = 22; (* Pointer to LMENU structure (above) N *) WLOG_SENDERROR = 23; (* Locus of delivery failure N *) WLOG_APPLYRULE = 24; (* Pointer to RULE_EVENT structure Y *) (* Indicates that a new mail filtering rule has been triggered *) (* for application to a message. lParam points to the following *) (* structure: *) type RULE_EVENT = record action: integer; param: pchar; imessage: pointer; fol_id: word; end; const WLOG_NEWDIALOG = 25; (* Pointer to CREATION_EVENT struct N *) (* ** Note: Requires Extension Manager v1.02 or later *) (* Detecting when dialogs are created: WinPMail sends WLOG_NEWDIALOG *) (* messages to logging extensions when particular dialog windows are *) (* created, but before they are displayed. You cannot prohibit the *) (* creation of a dialog, but there is nothing to stop you from *) (* superclassing it (in fact, this is the expected use of this *) (* logging message). lParam points to the following structure: *) type CREATION_EVENT = record hDialog: hwnd; (* The dialog's window handle *) selector: word; (* Type of dialog - see NDLG_* values below *) data: pointer; (* Window-specific data *) end; (* "selector" can have the following values: *) const (* value 0 not used *) NDLG_MESSAGE_EDITOR = 1; (* Message editor "editor" dialog *) NDLG_MESSAGE_ATTACH = 2; (* Message editor "attach" dialog *) NDLG_MESSAGE_SPECIAL = 3; (* Message editor "special" dialog *) NDLG_ENCRYPT = 4; (* "Encrypt message" dialog (modal) *) NDLG_NORMAL_READER =5; (* Standard message reader dialog *) NDLG_MMP_READER = 6; (* MIME Multipart reader dialog *) NDLG_MMD_READER = 7; (* MIME Multipart digest dialog *) NDLG_NB_READER = 8; (* A noticeboard reader dialog *) NDLG_BINARY_READER = 9; (* Binary data reader dialog *) NDLG_FOLDER = 10; (* Standard folder window, data=filename *) NDLG_FOLMAN = 11; (* Folder Manager window *) NDLG_ADDRESSBOOK = 12; (* Addressbook window, data=filename *) NDLG_LOCALUSERS = 13; (* Local user list *) NDLG_LOGGEDUSERS = 14; (* Logged-in user list *) NDLG_NETCONFIG = 15; (* Network Configuration dialog *) NDLG_GPREFS = 16; (* General preferences *) NDLG_APREFS = 17; (* Advanced settings *) NDLG_HOMEBOX = 18; (* Home mailbox location preference *) NDLG_VIEWER = 19; (* Attachment viewer preferences *) NDLG_EPREFS = 20; (* Extended features dialog *) NDLG_MPREFS = 21; (* MHS preferences *) NDLG_NETCONFIG2 = 22; (* Advanced WinSock settings (v2.25 and later) *) NDLG_MMC_READER = 23; (* Combined Multipart message reader *) (* *) WLOG_SAVEFILE = 26; (* Pointer to filename Y *) (* ** Note: Requires Extension Manager v1.02 or later *) (* Sent whenever Pegasus Mail saves a file to disk, except when *) (* saving plain textual data. This message usually only occurs *) (* when WinPMail saves an attachment to disk and is intended to *) (* allow the invocation of virus-scanning modules and so on. Returning *) (* WPM_PROHIBIT to this message has a slightly different meaning from *) (* other places in the program - it means that you have deleted the *) (* file for some reason. You must ONLY return WPM_PROHIBIT if you have *) (* actually deleted the file. *) (* ** TECHNICAL NOTE: Because of the doubly-indirect way BinHex *) (* encoding is handled within WinPMail, you may occasionally get *) (* this message twice for the same file. Accordingly, you should *) (* always check for the existence of the file before doing anything *) (* else with it. If the file does NOT exist, you should return *) (* WPM_PROHIBIT, as if you had deleted it. *) WLOG_DELETEMESSAGE = 27; (* Pointer to FOLDATA structure *) (* ** Note: Requires Extension Manager v1.06 or later *) (* Sent when WinPMail is about to delete a message. "lParam" points to *) (* a FOLDATA structure (see below). Note that the fields of a FOLDATA *) (* structure are strictly read-only - you must not alter them. The *) (* "foldername" member contains the full path to the folder containing *) (* the message, or a zero-length string if the message is in the new *) (* mail folder. Returning WPM_PROHIBIT to this message will prevent the *) (* message from being deleted. *) type foldata = record from: pchar; subject: pchar; date: pchar; flags: longint; mtime: longint; fsize: longint; foldername: pchar; unique_id: pchar; matches: word; weight: word; end; const WLOG_NEWPOP3MESSAGE = 28; (* pointer to NPOPDATA structure *) (* ** Note: Requires Extension Manager v1.06 or later *) (* Sent by WinPMail's POP3 client the moment it has completed the *) (* download of a message. "lParam" contains a pointer to the *) (* following structure: *) type ppopdef = ^popdef; npopdata = record fname: pchar; (* Full path to file containing new message *) p: ppopdef; (* POPDEF structure in use for connection *) end; (* *) (* Note that the connection is still in progress at the point this *) (* message is sent, so you should return as quickly as possible *) (* if you process it. This message cannot be prohibited, but it is *) (* permissible (albeit irregular) to delete the file. *) const WM_F_GETMESSAGEFIELD = (WM_F_FORMBASE + 50); (* Retrieve a field from a message. This message can only be sent *) (* after a logging extension receives a WM_FM_SENDMAIL message but *) (* before it returns from processing it. *) (* ** PARAMETERS: wParam = field of interest *) (* ** RETURNS: pointer to data in every case. *) (* *) (* wParam can be set to the following values: *) (* wParam value: type pointer to *) WMSG_TO = 1; (* string raw to: data *) WMSG_SUBJECT = 2; (* string subject: field *) WMSG_CC = 3; (* string cc: field *) WMSG_BCC = 4; (* string bcc: field *) WMSG_REPLYTO = 5; (* string reply-to: field *) WMSG_DATA = 6; (* string message, NULL if file. *) WMSG_FILE = 7; (* string filename, NULL if data *) WMSG_ENCRYPT = 8; (* char NZ if encrypted, Z if not *) WMSG_COPYSELF = 9; (* char NZ if copying to self *) WMSG_READING = 10; (* char NZ if reading confirm required *) WMSG_DELIVERY = 11; (* char NZ if delivery confirm required *) WMSG_URGENT = 12; (* char NZ if urgent *) WMSG_NOSIG = 13; (* char NZ if no signature to be attached *) WMSG_EXPIRES = 14; (* byte [7] expiration, NetWare date format *) WMSG_KEY = 15; (* string encryption key *) (* *) (* Note that the returned value is ALWAYS a pointer, which allows a *) (* logging extension to change message field values before they are *) (* sent. Extensions are discouraged from modifying fields casually - *) (* fields should only be changed when you are sure of what you are *) (* doing. *) const (* New Feb 97 *) WLOG_WINSOCK_LOADING = 29; (* 1 if loading, 0 unloading Y ** Note: Requires Extension Manager v1.07 or later WinPMail sends this message with "lParam" set to 1 immediately before it loads WINSOCK.DLL or WSOCK32.DLL, and with "lParam" set to 0 immediately after it has unloaded WINSOCK.DLL. WinPMail does not load WINSOCK.DLL unnecessarily - it keeps its own internal instance counter for each access to the DLL and only loads it the first time. The intention of this message is to allow dialer applications to be called before and after a TCP/IP connection. *) (* *) (* +--------------------------------------------------------------------+ *) (* | SECTION 6: | *) (* | Addressbook API (Extension Manager 1.04 and later) | *) (* +--------------------------------------------------------------------+ *) (* *) (* This API gives extensions the ability to manipulate WinPMail address *) (* books directly without being aware of the underlying data structures *) (* used to store them. Extensions using this API do not need to concern *) (* themselves with things like sorting, or whether or not the book is *) (* currently open. *) (* *) (* ABKAPI_* flags are used to select specific address book fields *) (* when reading or writing entries. The lengths shown are indications *) (* only - it is safe to assume that a field will not be shorter than *) (* these lengths, but it may be longer. *) type enumabkapi = ( ABKAPI_FLAGS, (* Flag word - seldom used: 16-bit integer *) ABKAPI_NAME, (* Name/alias field: 36 characters *) ABKAPI_DEPT, (* Department field: 40 characters *) ABKAPI_INDEX, (* Index, or "Key" field: 12 characters *) ABKAPI_PHYS_ADDRESS, (* Street address: 60 characters *) ABKAPI_POST_ADDRESS, (* Postal address: 60 characters *) ABKAPI_PHONE, (* Phone number: 24 characters *) ABKAPI_FAX, (* Fax number: 24 characters *) ABKAPI_DETAILS, (* Details (notes) field: 80 characters *) ABKAPI_ADDRESS, (* E-mail address: 100 characters *) ABKAPI_USER_FIELD, (* For third-party use. 32-bit integer *) ABKAPI_IMAGE_FILE (* Filename only (no extension) for image: 9 chars *) ); const WM_F_ABK_START_ENTRY = (WM_F_FORMBASE + 78); (* Tells the Extension Manager that you want to create a new entry *) (* in an addressbook. This results in a blank template being allocated, *) (* which you subsequently fill out with WM_F_ABK_SET_FIELD messages, *) (* then write to an address book using the WM_F_ABK_SET_ENTRY message. *) (* It is explicitly legal to call this function once, then to create *) (* more than one addressbook entry using it before deallocating it. *) (* ** PARAMETERS: unused *) (* ** RETURNS: 0 on failure, non-zero on success, *) (* ** VERSION: Requires version 1.04 or later of the Extension Manager *) WM_F_ABK_SET_FIELD = (WM_F_FORMBASE + 79); (* Sets the value of any field in an addressbook entry allocated using *) (* the WM_F_ABK_START_ENTRY message. wParam contains a selector from the *) (* ABKAPI_* table above, and lParam contains the data to write into the *) (* field. For string types, lParam should be a "char *" value, while for *) (* scalar types, lParam should be the value itself. *) (* ** PARAMETERS: wParam = selector (see above), lParam = data or *data *) (* ** RETURNS: Nothing *) (* ** VERSION: Requires version 1.04 or later of the Extension Manager *) WM_F_ABK_SET_ENTRY = (WM_F_FORMBASE + 80); (* Writes an addressbook entry defined using the WM_F_ABK_START_ENTRY and *) (* WM_F_ABK_SET_FIELD messages to an addressbook. lParam contains a pointer *) (* to the full filename of addressbook to which the entry should be added *) (* (you can use the WM_F_SELECTOR message to prompt the user to select an *) (* addressbook). The "name" and "key" fields MUST be completed or this *) (* routine will refuse to write the entry. All other fields may be blank *) (* (including the e-mail address field - you should probably initiate your *) (* own check for this). *) (* ** PARAMETERS: wParam = unused; lParam = full addressbook filename *) (* ** RETURNS: 1 for success; *) (* -1 WM_F_START_ENTRY has not been called *) (* -2 specified addressbook file does not exist *) (* -3 "name" field does not contain a value *) (* -4 "key" field does not contain a value *) (* ** VERSION: Requires version 1.04 or later of the Extension Manager *) WM_F_ABK_END_ENTRY = (WM_F_FORMBASE + 81); (* Deallocates the internal data structures allocated when the *) (* WM_F_ABK_START_ENTRY message was sent. You must send this message *) (* when you have finished adding entries to addressbooks. *) (* ** PARAMETERS: wParam = unused; lParam = unused *) (* ** RETURNS: Nothing *) (* ** VERSION: Requires version 1.04 or later of the Extension Manager *) (* *) (* +--------------------------------------------------------------------+ *) (* | SECTION 7: | *) (* | File system, message store and informational services | *) (* +--------------------------------------------------------------------+ *) (* *) (* Extensions can access the user's message store and also have access *) (* to a great deal of the internal system information WinPMail maintains. *) (* *) WM_F_GETVERSION = (WM_F_FORMBASE + 75); (* Get the version number of the running copy of WinPMail. The version *) (* number is returned as an integer with the Major version number in the *) (* high byte and the minor version number in the low byte. *) (* ** PARAMETERS: wParam = reserved, must be 0; lParam = reserved, must be 0 *) (* ** RETURNS: Version number. *) (* ** VERSION: Requires version 1.02 or later of the Extension Manager *) WM_F_GETNEWMAILBOX = (WM_F_FORMBASE + 21); (* Get the full path to the user's new mail folder. *) (* lParam points to a buffer into which the path should be copied, *) (* and wParam is the maximum length of the string to copy, including *) (* the terminating nul. You should allocate at least 128 characters. *) (* The string returned is a full path normalized to "\" separators *) (* and does not have a trailing "\" character. *) (* ** Note: do NOT assume that this is a DOS path: it may just as *) (* well be supplied in UNC or NetWare formats depending on the system. *) (* ** PARAMETERS: wParam = max length; lParam = pointer to buffer *) (* ** RETURNS: Nothing *) WM_F_GETHOMEBOX = (WM_F_FORMBASE + 22); (* Get the full path to the user's home mailbox directory. *) (* lParam points to a buffer into which the path should be copied, *) (* and wParam is the maximum length of the string to copy, including *) (* the terminating nul. You should allocate at least 128 characters. *) (* The string returned is a full path normalized to "\" separators *) (* and does not have a trailing "\" character. *) (* ** PARAMETERS: wParam = max length; lParam = pointer to buffer *) (* ** RETURNS: Nothing *) (* ** Note: do NOT assume that this is a DOS path: it may just as *) (* well be supplied in UNC or NetWare formats depending on the system. *) WM_F_GETTEMPDIR = (WM_F_FORMBASE + 23); (* Get the full path to the recommended temporary files directory. *) (* lParam points to a buffer into which the path should be copied, *) (* and wParam is the maximum length of the string to copy, including *) (* the terminating nul. You should allocate at least 128 characters. *) (* The string returned is a full path normalized to "\" separators *) (* and does not have a trailing "\" character. *) (* ** PARAMETERS: wParam = max length; lParam = pointer to buffer *) (* ** RETURNS: Nothing *) WM_F_GETBASEDIR = (WM_F_FORMBASE + 65); (* Get the full path to the directory from which WINPMAIL.EXE was *) (* run. lParam points to a buffer into which the path should be *) (* copied and wParam is the maximum length of the string to copy, *) (* including the terminating nul. You should allocate at least 128 *) (* characters. The string returned is a full path in DOS format *) (* and does not have a trailing "\" character. *) WM_F_BROWSEFILE = (WM_F_FORMBASE + 72); (* Open the Pegasus Mail "Enter filename" browser and allow the user *) (* to select a file. lParam should point to a buffer 128 characters *) (* long, where the resulting filename will be written. If wParam is *) (* zero, WinPMail will issue a warning if the user attempts to *) (* select a file that already exists. On entry, lParam can contain *) (* a path and a wildcard specification, both of which will be used *) (* by the browser - so for example, passing in "C:\WINWORD\*.DOC" *) (* will commence browsing in C:\WINWORD and will default to the *) (* document filter "*.DOC". *) (* ** PARAMETERS: wParam = 0 if new file; lParam = pointer to char [128] *) (* ** RETURNS: Non-zero if a file was successfully selected. *) (* ** VERSION: Requires version 1.02 or later of the Extension Manager *) WM_F_TEMPFILE = (WM_F_FORMBASE + 24); (* Get the fully-qualified path name of a temporary file that *) (* is guaranteed not to exist and to be writable. wParam contains *) (* the maximum length allocated for the filename including the *) (* terminating Nul, while lParam points to the location where the *) (* filename should be written. *) (* ** PARAMETERS: wParam = max length; lParam = pointer to buffer *) (* ** RETURNS: Nothing *) WM_F_NEWMAIL = (WM_F_FORMBASE + 28); (* Get the number of new mail messages currently in the user's *) (* new mail box. If wParam is 0, WinPMail returns the value from the *) (* last periodic scan it made; if wParam is non-zero, WinPMail is *) (* forced to rescan the new mail box immediately - depending on *) (* the number of messages already in the new mail box, this may *) (* result in a considerable impact on system performance. Returns *) (* the number of messages. *) (* ** PARAMETERS: wParam = (see above); lParam = unused *) (* ** RETURNS: Total number of new messages in mailbox *) WM_F_SELECTOR = (WM_F_FORMBASE + 39); (* Prompt the user to select a WinPMail file. The standard WinPMail *) (* selector dialog is opened and control is not returned until the *) (* user either selects an item or cancels the dialog. *) (* ** PARAMETERS: *) (* wParam can have the following values: *) (* 0 - select a folder *) (* 1 - select an address book *) (* 2 - select a distribution list *) (* 3 - select a message draft *) (* lParam = points to a char buffer at least 128 characters long *) (* - the buffer is filled with the full path name to the selected *) (* file. For address books, the .PMR file is returned. For *) (* folders, the .PMM file is returned. *) (* ** RETURNS: 1 if the user selected an item, 0 for no selection. *) WM_F_OPENFILE = (WM_F_FORMBASE + 66); (* Open one of the standard Pegasus Mail file types. lParam must point *) (* to the full path to the file (as returned by WM_F_SELECTOR), and *) (* wParam must be set to: *) (* 0 - File is a mail folder *) (* 1 - File is an address book *) (* 2 - File is a distribution list *) (* 3 - File is a message draft *) (* 4 - File is a message queued for delivery *) (* 255 - No file - simply start a new message *) (* Note that for Folders you must pass the path to the folder's PMM *) (* file, and for Addressbooks to the book's .PMR file. The extensions *) (* for the various types of files are: *) (* Folders - .PMM *) (* Addressbooks - .PMR *) (* Distribution lists - .PML *) (* Message drafts - .PMO *) (* Queued mail - .PMW *) (* ** PARAMETERS: wParam (see above); lParam = file to open. *) (* ** RETURNS: hWnd of newly-opened MDI window, NULL on failure. *) WM_F_GETPREF = (WM_F_FORMBASE + 40); WM_F_SETPREF = (WM_F_FORMBASE + 41); (* Preferences services. Get or set the value of an entry in the *) (* user's preferences (PMAIL.INI) file. Examine the file WPMPREFS.H *) (* for documentation on the possible values you can pass in these *) (* calls. *) (* ** PARAMETERS: *) (* - WM_F_SETPREF: wParam = item to set; lParam = value *) (* - WM_F_GETPREF: wParam = item to get; lParam = buffer pointer *) (* ** RETURNS: *) (* - WM_F_SETPREF: Nothing *) (* - WM_F_GETPREF: Value (for scalar types). *) WM_F_GETUSERNAME = (WM_F_FORMBASE + 58); (* Get the name of the user at the current workstation. wParam can *) (* have the following values: *) (* 0: return the basic username (login name under NetWare) *) (* 1: return the user's name as a full Internet address *) (* 2: return the user's name as an MHS address *) (* lParam should point to a buffer at least 256 characters in length. *) (* ** PARAMETERS: wParam = (see above); lParam = pointer to buffer *) (* ** RETURNS: 1 on success; 0 if the address form is unavailable. *) (* *) (* +--------------------------------------------------------------------+ *) (* | Section 8: | *) (* | Miscellaneous services | *) (* +--------------------------------------------------------------------+ *) (* *) WM_F_GETDATETIME = (WM_F_FORMBASE + 25); (* Return the current date and time in NetWare format - ie, an *) (* array of seven bytes arranged as follows: *) (* *) (* Byte 0 - Year modulus 100 (if less than 80 assume 20xx) *) (* Byte 1 - Month - 1 (ie, January == 0) No !! *** This is actual month number now *) (* Byte 2 - Day (1 .. 31) *) (* Byte 3 - Hour (0 - 24) *) (* Byte 4 - Minute (0 - 59) *) (* Byte 5 - Second (0 - 60) *) (* Byte 6 - Day of week (Sunday == 0) *) (* *) (* The function returns a correctly-formatted value whether or not *) (* you are actually attached to a NetWare system, and deals correctly *) (* with shell problems under Windows Standard mode which can result *) (* in NetWare returning garbage times. Where possible, this function *) (* gets the time from the file server instead of from the local *) (* workstation. *) (* ** PARAMETERS: wParam = unused; lParam = pointer to 7-byte buffer area *) (* ** RETURNS: Nothing *) WM_F_GETRFC822DATETIME = (WM_F_FORMBASE + 26); (* Return a date and time string in legal RFC822 format. You can *) (* either set lParam to point to a 7-byte structure as described in *) (* WM_F_GETDATETIME above, or else you can set lParam to 0 to get *) (* a legal RFC822 representation of the current time. The return *) (* from this message is a pointer to a static buffer in memory *) (* containing the formatted string. You must NEVER directly alter *) (* this buffer or you may crash WinPMail. The buffer is overwritten *) (* on each call, and may be overwritten indirectly by other internal *) (* WinPMail routines, so if you do not intend to use this string *) (* immediately, you would be well advised to copy it to a local buffer. *) (* ** PARAMETERS: wParam = unused; lParam = (optional) 7-byte date structure *) (* ** RETURNS: Read-only far pointer to character array containing date. *) WM_F_PARSEADDRESS = (WM_F_FORMBASE + 27); (* Reduce an e-mail address to its minimum form, by removing any *) (* Ctext or Qtext components - so, the address *) (* "David Harris" (Pegasus Mail Author) *) (* would be reduced to *) (* david@pmail.gen.nz *) (* lParam should point to the raw address, which is overwritten with *) (* the reduced form. The returned value is guaranteed never to be *) (* longer than the value passed in. *) (* ** PARAMETERS: wParam = unused; lParam = raw address data *) (* ** RETURNS: -1 on invalid address (unbalanced '()' or '<>' pairs) *) (* ** Note: this function works equally well for both RFC822 and *) (* MHS addresses, but you should be aware that comments in '()' pairs *) (* are sometimes significant to some MHS gateways. *) WM_F_GETCQTEXT = (WM_F_FORMBASE + 82); (* Given an e-mail address in a buffer pointed to by lParam, attempt *) (* to extract the first comment or quoted field from the address - so, *) (* given the address "David Harris" , this function *) (* will return the string David Harris. Note that quotes and brackets *) (* are removed. The first comment or quoted string found in the address *) (* is returned and is written back over the top of the address you pass *) (* in, so make sure you use a copy of the address. *) (* ** PARAMETERS: wParam = unused; lParam = address to parse *) (* ** RETURNS: -1 on invalid address (unbalanced '()' or '<>' pairs) *) (* ** VERSION: Requires version 1.04 or later of the Extension Manager *) WM_F_MALLOC = (WM_F_FORMBASE + 30); (* Allocate memory in WinPMail's heap. This call is specialised and *) (* is generally not needed. wParam contains the number of bytes to *) (* allocate; the return value is NULL on failure, or a pointer on *) (* success. Note that memory obtained this way must ONLY be freed *) (* using the WM_F_FREE message. *) (* ** PARAMETERS: wParam = bytes to allocate; lParam = unused *) (* ** RETURNS: Pointer, or NULL on failure *) WM_F_FREE = (WM_F_FORMBASE + 31); (* Free a block of memory obtained using WM_F_MALLOC *) (* ** PARAMETERS: wParam = unused; lParam = pointer returned by WM_F_MALLOC *) (* ** RETURNS: Nothing *) WM_F_GETTEXT = (WM_F_FORMBASE + 32); (* A handy function to retrieve the text from a standard Windows *) (* edit control in a format ready to be dumped to a file or passed *) (* to WinPMail for delivery; pass the ID of the control in the *) (* current dialog in wParam and WinPMail will return the text from *) (* that control, properly formatted, with all carriage returns *) (* stripped (ie, as a C string). The pointer returned is allocated *) (* using the WM_F_MALLOC message and must be freed using WM_F_FREE. *) (* ** PARAMETERS: wParam = edit control ID; lParam = unused *) (* ** RETURNS: Pointer to formatted textual data or NULL on failure *) WM_F_SETDIALOG = (WM_F_FORMBASE + 33); (* Change the active dialog in the window. This function is needed *) (* if your DLL can produce more than one dialog in the MDI child *) (* window and can change between them (presumably in response to *) (* user input, much like the WinPMail message editor dialog). When *) (* the dialog active in the window changes and the window is in the *) (* foreground, you should call this function to ensure that WinPMail *) (* directs messages to the correct dialog. Pass the address of the *) (* new dialog in lParam. *) (* ** PARAMETERS: wParam = unused; lParam = HWND of new dialog *) (* ** RETURNS: Nothing *) WM_F_SETSTATUS = (WM_F_FORMBASE + 51); (* Set text on the statusline. Four text areas can be set on the *) (* statusline: *) (* 0: The basic text area at the left-hand end of the bar *) (* 1: The text in the username/server panel of the bar *) (* 2: The text in the newmail panel of the bar *) (* 3: A double-size text area overlaid over 0 and 1 *) (* You can also reset the statusbar by setting wParam to 0 and *) (* passing a pointer to a NULL string *) (* ** PARAMETERS: wParam = panel to set; lParam = text to set *) (* ** RETURNS: Nothing. *) WM_F_PASTEDATA = (WM_F_FORMBASE + 54); (* Paste an arbitrary string of data into the last active control *) (* (which will almost always be one of the addressing Edit fields). *) (* Using this call allows you to duplicate the behaviour of the *) (* WinPMail local user list or address books when the user clicks *) (* the "paste" button. If wParam is non-zero, WinPMail will add a *) (* newline (CRLF) to the data if the target control is capable of *) (* supporting multiple lines; this is a handy way of allowing the *) (* user to paste your data either into single address fields or into *) (* distribution lists without you having to be worried about the *) (* distinction. If wParam is zero, the data will be pasted as-is. *) (* ** PARAMETERS: wParam = see above; lParam = (char * ) text to paste *) (* ** RETURNS: 0 if no pasting was possible, 1 on success. *) WM_F_GETWINDOW = (WM_F_FORMBASE + 57); (* Get a core WinPMail window. This function allows you to obtain *) (* the HWND for either the WinPMail Frame window (the main application *) (* window itself) or the MDI Client window maintained inside it. This *) (* function is extremely specialised and is really only useful if you *) (* are brave enough to want to enumerate the program's child windows *) (* (possibly to send them all messages or to find all windows of a *) (* particular type). You should avoid using this message if you can, *) (* since it may impair the portability of your extension. WinPMail's *) (* author offers no guarantee that windows will retain the same class *) (* names or other information throughout the life of the program. *) (* wParam can have the following values for this call: *) (* 0 - return the WinPMail main frame window *) (* 1 - return the WinPMail MDI client window *) (* 2 - return the currently active MDI child window *) (* 3 - return the dialog contained in the currently active MDI window *) (* 4 - return the toolbar window (note - ONLY if currently a toolbar) *) (* ** PARAMETERS: wParam = see above; lParam = unused. *) (* ** RETURNS: The HWND for the specified window. *) WM_F_GETMENU = (WM_F_FORMBASE + 63); (* Get a core WinPMail menu. This function lets you retrieve any *) (* of the menu handles associated with each type of WinPMail MDI *) (* window. wParam should contain one of the MN_* selector values *) (* defined for the WLOG_LOADMENU logging event (above). The return *) (* value is the menu handle for that window, which may be NULL if *) (* no instance of that type of window has been opened yet. *) (* ** PARAMETERS: wParam = MN_* selector value; lParam = unused *) (* ** RETURNS: menu handle (may be NULL) *) WM_F_LOADEXTENSION = (WM_F_FORMBASE + 64); (* Load and execute a new extension. lParam must point to an instance *) (* of the following parameter block: *) type FORM_PARAM = record dll_path: array[0..127] of char; variant: integer; commandline: array[0..127] of char; title: array[0..63] of char; flags: integer; end; (* *) (* "dll_name" is the fully-qualified path to the DLL containing the *) (* extension's executable code. It may contain valid command *) (* substitutions (such as ~a for the Pegasus Mail base directory). *) (* "variant" is 0 for a Composer extension, or 1 for a Reader extension. *) (* Note that until advised in future, only Composer extensions can *) (* be loaded with this call. *) (* "commandline" is whatever parameters should be passed to the extension *) (* at startup. *) (* "title" is the title of the new extension's enclosing MDI window *) (* "flags" is a bitmap comprised of the following values: *) (* WPM_HIDDEN 4 Hide the parent MDI window on loading *) (* WPM_LOGGING 8 Extension wants to receive logging events *) (* WPM_ONEONLY 16 Only allow one running instance at any time *) (* *) (* ** PARAMETERS: wParam = unused; lParam = pointer to FORM_PARAM *) (* ** RETURNS: HWND of new extension's MDI window or NULL on failure *) const WM_F_ADDBUTTON = (WM_F_FORMBASE + 73); (* Add a button to the Pegasus Mail button panel. wParam is unused, and *) (* lParam contains a pointer to the following structure: *) type BUTTONDEF = record bitmap_file: array[0..127] of char; title_text: array[0..63] of char; owner_window: hwnd; (*$ifdef VER90 *) (* Delphi V2 What is Delphi V3 known as? *) wMsg: integer; wParam: integer; lParam: longint; (*$endif *) (*$ifdef VER80 *) (* Delphi V1 *) wMsg: word; wParam: word; lParam: longint; (*$endif *) (*$ifdef VER70 *) (* BPW V7 *) wMsg: word; wParam: word; lParam: longint; (*$endif *) end; (* "bitmap_file" contains the path to the Windows .BMP file to load and *) (* use as the button's face. The bitmap should be 16 colours or more *) (* and must be 22(h) x 20(v) pixels in size. *) (* "title_text" contains the "fly-by" help that is presented on the status *) (* line when the button is right-clicked. *) (* "owner_window" is the HWND of the Window to which "wMsg" should be sent *) (* when the button is triggered. *) (* "wMsg", "wParam" and "lParam" are the remaining parameters of the *) (* message sent to "owner_window" when the button is triggered. They *) (* may can contain whatever values are appropriate. *) (* Note that it is possible to use this function to create buttons on the *) (* toolbar that trigger standard internal functions. To do this, use the *) (* WM_F_GETWINDOW message to retrieve the handle of WinPMail's Frame *) (* window then register a button that generates a WM_COMMAND message to *) (* that window containing the proper ID and command values to trigger the *) (* function. *) (* The return from this message is 0 if unsuccessful (usually means there *) (* are too many buttons already defined), or a "button handle" > 0 if *) (* successful. The "button handle" may be passed via the WM_F_REMOVEBUTTON *) (* message to remove the button. *) (* ** PARAMETERS: wParam = unused; lParam = pointer to BUTTONDEF *) (* ** RETURNS: handle to button (see above) *) (* ** VERSION: Requires version 1.02 or later of the Extension Manager *) const WM_F_REMOVEBUTTON = (WM_F_FORMBASE + 74); (* Remove a button added using WM_F_ADDBUTTON. wParam contains the button *) (* handle returned by that message. The bitmap created for the button is *) (* automatically destroyed. Note that it is explicitly legal for an *) (* Extension to add a button then terminate without removing it - this is *) (* the standard way of defining a button for a standard built-in feature. *) (* ** PARAMETERS: wParam = button handle; lParam = unused *) (* ** RETURNS: None *) (* ** VERSION: Requires version 1.02 or later of the Extension Manager *) (* *) const WM_SET_FIELD = (WM_USER + 128); (* Allows the setting of individual fields in the message editor *) (* ** PARAMETERS: wParam = selector; lParam = Pointer to string value (pchar) *) (* ** RETURNS: None *) (* Example: hEditWnd:= Sendmessage(hParent, WM_F_OPENFILE, 255,0); SendMessage (hEditorWnd, WM_SET_FIELD, selector, data); *) (* The "selector" (wParam) field indicates what item you want to set in the message editor. The "data" (lParam) field supplies the content to which to set it. The following selectors are available: 0: Set the "to" field; "data" is a pchar, the address to add 1: Set the "subject" field; "data" is a pchar, the subject to add 2: Set the "cc" field; "data" is a pchar, the address to add 3: Set the message data. See below 4: Set the "copy-self" field; "data" is 1 or 0 for "on" or "off" 5: Set the "confirm delivery" field; "data" is 1 or 0 for "on" or "off" 6: Set the "confirm reading" field; "data" is 1 or 0 for "on" or "off" 7: Set the "urgent" field; "data" is 1 or 0 for "on" or "off" 8: Set the "encrypt" field. See below. 9: Set the "Use MIME" field; "data" is 1 or 0 for "on" or "off" 10: Set the "bcc" field; "data" is a pchar, the address to add 11: Set the message signature; "data" is 0 - 9 (signature to add) 12: Set the message data without reformatting. See below 13: Make the message volatile; "data" is 1 or 0 for "on" or "off" 14: Set the message identity; "data" is a pchar, identity name to set 15: Used internally only 16: Set the "reply-to" field; "data" is a pchar, the address to set 17: Add a custom header; "data" is fully-formed header to add 18: Import a raw text file into the editor; "data" is a pchar, filename 19: Set the "rich text" field; "data" is 1 or 0 for "on" or "off" 100: Set the editor's focus to the "To" field. 101: Set the editor's focus to the "Subject" field 102: Set the editor's focus to the "Cc" field 103: Set the editor's focus to the message body. 3 and 12: Set the message data; you need to pass a pchar pointer to the data you want to insert into the message editor. The string must be nul terminated, and lines must end with CRLF. You may dispose of the value when the message returns control to you - I do not store it or use it later. If you pass 3 as the selector, the data will be reformatted as it is inserted. If you pass 12, it will not be reformatted. 8: Setting an encryptor; you need to pass a string formatted in a particular way: ,, "encryptor_flags" is an integer bitmap, where the bits have the following meanings: 1: Encrypt the message 2: Unused - do not set this bit 4: Digitally sign the message (if supported) *) type TCryptEx = Record (*$ifdef VER80 *) (* Delphi V1 *) StructLen: longint; Crypt_Version: longint; Flags: longint; (*$else *) StructLen: DWord; Crypt_Version: DWord; Flags: DWord; (*$endif *) Form_Data: PChar; SourceFile: PChar; DestFile: PChar; Recipient: PChar; Key: PChar; HeaderText: PChar; Global_Data: THandle; Reserved: Pointer; end; (* Flag constants: *) const CIFF_TEXTFILE = 1; CIFF_ENCRYPT_AS_WELL = 2; CIFF_USING_MIME = 4; CIFF_SIGN_FILE = 8; (* *) (* To send a request for communication to WinPMail from outside WinPMail *) WM_INTERFACE = (WM_USER + 17480); (* This is obsolete with 32 bit programming *) (* use DDE interface instead *)