// Lotus Notes Command Line Mail Client NOTES_MAIL by Gottfried Rudorfer // // THIS CODE AND INFORMATION IS PROVIDED "AS IS" WITHOUT WARRANTY OF // ANY KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING BUT NOT LIMITED TO // THE IMPLIED WARRANTIES OF MERCHANTABILITY AND/OR FITNESS FOR A // PARTICULAR PURPOSE. // // Copyright 2002 Gottfried Rudorfer. All Rights Reserved. // // MODULE: Notes_Mail.h // // PURPOSE: Include file for Notes_Mail.cpp // // COMMENTS: // // AUTHOR: Gottfried Rudorfer // http://godefroy.sdf-eu.org/notes_mail/ // //==================================================================================== #ifndef NOTES_MAIL_H #define NOTES_MAIL_H #include #include #include //#include #include #include #include #include extern "C" { #include #include #include #include #include #include #include #include #include #include #include #include #include } #include "service.h" #include "ReadParse.h" #include "web.h" #include "Event.h" using namespace std; #define _X86_ #define NT // Notes C++ API headers #include "lncppapi.h" // Forward declarations. const char ESC = '\001'; const int PrefixLength = 33; // The length of the date and time prefix. const char PrefixDelim = '-'; // Prefix delimiter const unsigned long chksum = 697647898; // Checksum for copyright checks typedef map StringStringMap; const string NotOkChars = "\\/:*?\"<>|\n\001"; // List of characters to ignore const unsigned int ServiceSleepTime = 30000; // wait 30 seconds in service const unsigned int CountSleepsIn = 6; // wait 30 * 6 seconds for reread of mail const unsigned int CountSleepsDel = 120; // 120 * 30s = 1 h const unsigned int max_mail_days = 32; // max number of days for mail class Notes_Mail { public: string MailAddr; string MailSubject; string MailBody; string ProgName; string InstPath; string MailBox; string ReceivedBox; string InBox; string SentBox; string OutBox; string ErrBox; string AttachmentBox; StringStringMap Attachments; StringStringMap Attributes; int Ahd; int ProgramStatus; int useStdin; int InstallService; int RemoveService; int RunAsService; int DirectMail; unsigned int MaxBodyBytes; struct _timeb timeStrIn, timeStrOpen; string FilePrefix; string MailFileName; LNNotesSession *Session; LNDatabase *MailDB; string progressStr; BOOL MailDBOpened, SessionInitialized, GetMailDatabase; int lockFDin, mailFDin; FILE *mailSTin; int lockFDout, mailFDout; FILE *mailSTout; Notes_Mail(); void PrintArguments(const char *error); void CheckMailDirs(); string MyGetenv(char *envname); void logevt(const char *str, WORD type); void ProcessArguments (int argc, char *argv[]); void GetAHD(); void GetInstPath(); void MkMailDir(string &dir); int PrintWithoutEsc(string Text, FILE *fileS); int GetFileName(string &dir, string &NewFile); int Queue(string &dir); void AttachmentsOut(FILE *MailStream); void AttributesOut(FILE *MailStream); void SplitPathName(string &FullName, string &Path, string &Name); int SendMail(string File); int ReceiveMail(); long ToNumber(const char* chptr, unsigned int length=0); void ReduceName(string &fullName, string &reducedName); void NotifyError(string Part, string ErrorText, string Severity, int Exit); int CloseMailDB(); int OpenMailDB(); void ChkSum(); int GetSumRes(); void CleanVars(); int CleanDir(const string &mailbox); void Help(); void LGL(); private: int checkSumOk; }; void NotesWeb(Notes_Mail& aMail); string StringModuleVersion(); #endif // NOTES_MAIL_H