home *** CD-ROM | disk | FTP | other *** search
/ Visual Basic Controls / Visual Basic Controls.iso / vbcontrol / ahmmailc / _setup.1 / AHMTIEMails.hpp < prev    next >
Encoding:
C/C++ Source or Header  |  1998-12-01  |  14.7 KB  |  364 lines

  1. // Borland C++ Builder
  2. // Copyright (c) 1995, 1998 by Borland International
  3. // All rights reserved
  4.  
  5. // (DO NOT EDIT: machine generated header) 'AHMTIEmails.pas' rev: 3.00
  6.  
  7. #ifndef AHMTIEmailsHPP
  8. #define AHMTIEmailsHPP
  9. #include <ScktComp.hpp>
  10. #include <AHMMails.hpp>
  11. #include <Classes.hpp>
  12. #include <Windows.hpp>
  13. #include <SysUtils.hpp>
  14. #include <SysInit.hpp>
  15. #include <System.hpp>
  16.  
  17. //-- user supplied -----------------------------------------------------------
  18.  
  19. namespace Ahmtiemails
  20. {
  21. //-- type declarations -------------------------------------------------------
  22. typedef Shortint TAHMPStep;
  23.  
  24. enum TAHMMailSessionState { Authorization, Transaction };
  25.  
  26. typedef void __fastcall (__closure *TAHMOnError)(System::TObject* Sender, int Error, System::AnsiString 
  27.     VMessage);
  28.  
  29. typedef void __fastcall (__closure *TAHMOnRead)(System::TObject* Sender, int BytesRead);
  30.  
  31. typedef void __fastcall (__closure *TAHMOnCodingStart)(System::TObject* Sender, System::AnsiString FileName
  32.     , int BytesCount);
  33.  
  34. typedef void __fastcall (__closure *TAHMOnCodingProgress)(System::TObject* Sender, Word Percent);
  35.  
  36. typedef void __fastcall (__closure *TAHMSendingProgress)(System::TObject* Sender, Word Percent);
  37.  
  38. typedef void __fastcall (__closure *TAHMOnDelete)(System::TObject* Sender, Word Index);
  39.  
  40. typedef void __fastcall (__closure *TAHMBeforeRetrieve)(System::TObject* sender, Word Index);
  41.  
  42. class DELPHICLASS TAHMAttachment;
  43. class DELPHICLASS TAHMMessage;
  44. class DELPHICLASS TAHMMailHost;
  45. class DELPHICLASS TAHMMessages;
  46. class PASCALIMPLEMENTATION TAHMMessages : public Classes::TCollection 
  47. {
  48.     typedef Classes::TCollection inherited;
  49.     
  50. private:
  51.     TAHMMailHost* FAHMMailHost;
  52.     TAHMMessage* __fastcall GetAHMMessage(int Index);
  53.     void __fastcall SetAHMMessage(int Index, TAHMMessage* Value);
  54.     
  55. protected:
  56.     DYNAMIC Classes::TPersistent* __fastcall GetOwner(void);
  57.     
  58. public:
  59.     __property TAHMMailHost* Owner = {read=FAHMMailHost};
  60.     __fastcall TAHMMessages(TAHMMailHost* AOwner);
  61.     HIDESBASE TAHMMessage* __fastcall Add(void);
  62.     bool __fastcall Delete(int Index);
  63.     __property TAHMMessage* Items[int Index] = {read=GetAHMMessage, write=SetAHMMessage/*, default*/};
  64. public:
  65.         
  66.     /* TCollection.Destroy */ __fastcall virtual ~TAHMMessages(void) { }
  67.     
  68. };
  69.  
  70. class PASCALIMPLEMENTATION TAHMMailHost : public Ahmmails::TAHMMailsComponent 
  71. {
  72.     typedef Ahmmails::TAHMMailsComponent inherited;
  73.     
  74. private:
  75.     Scktcomp::TWinSocketStream* FSocketStream;
  76.     Scktcomp::TClientSocket* FSocket;
  77.     System::AnsiString FHost;
  78.     System::AnsiString FPort;
  79.     Classes::TNotifyEvent FOnExecute;
  80.     TAHMPStep FProgressStep;
  81.     TAHMMessages* FAHMMessages;
  82.     void __fastcall SetAHMMessages(TAHMMessages* Value);
  83.     
  84. public:
  85.     __fastcall virtual TAHMMailHost(Classes::TComponent* AOwner);
  86.     __fastcall virtual ~TAHMMailHost(void);
  87.     virtual bool __fastcall Execute(void);
  88.     
  89. __published:
  90.     __property TAHMMessages* Messages = {read=FAHMMessages, write=SetAHMMessages};
  91.     __property Classes::TNotifyEvent OnExecute = {read=FOnExecute, write=FOnExecute};
  92.     __property TAHMPStep ProgressStep = {read=FProgressStep, write=FProgressStep, nodefault};
  93.     __property System::AnsiString Port = {read=FPort, write=FPort};
  94.     __property System::AnsiString Host = {read=FHost, write=FHost};
  95. };
  96.  
  97. class DELPHICLASS TAHMAttachments;
  98. class PASCALIMPLEMENTATION TAHMAttachments : public Classes::TCollection 
  99. {
  100.     typedef Classes::TCollection inherited;
  101.     
  102. private:
  103.     TAHMMessage* FAHMMessage;
  104.     TAHMAttachment* __fastcall GeTAHMAttachment(int Index);
  105.     void __fastcall SeTAHMAttachment(int Index, TAHMAttachment* Value);
  106.     
  107. protected:
  108.     DYNAMIC Classes::TPersistent* __fastcall GetOwner(void);
  109.     System::AnsiString __fastcall GetMimeType(const System::AnsiString FileName);
  110.     
  111. public:
  112.     __fastcall TAHMAttachments(TAHMMessage* AOwner);
  113.     HIDESBASE TAHMAttachment* __fastcall Add(System::AnsiString Filename);
  114.     bool __fastcall Delete(int Index);
  115.     __property TAHMAttachment* Items[int Index] = {read=GeTAHMAttachment, write=SeTAHMAttachment/*, default
  116.         */};
  117. public:
  118.     /* TCollection.Destroy */ __fastcall virtual ~TAHMAttachments(void) { }
  119.     
  120. };
  121.  
  122. class PASCALIMPLEMENTATION TAHMMessage : public Classes::TCollectionItem 
  123. {
  124.     typedef Classes::TCollectionItem inherited;
  125.     
  126. private:
  127.     System::AnsiString FFrommail;
  128.     System::AnsiString FReplyTo;
  129.     System::AnsiString FSendTo;
  130.     System::AnsiString FSubject;
  131.     System::AnsiString FFromname;
  132.     System::AnsiString FMessageID;
  133.     System::AnsiString FInReplyTo;
  134.     System::AnsiString FDate;
  135.     Classes::TStrings* FMessage;
  136.     TAHMMailHost* FAHMMailHost;
  137.     Classes::TStrings* FAttTypes;
  138.     TAHMAttachments* FAHMAttachments;
  139.     void __fastcall SetAHMAttachments(TAHMAttachments* Value);
  140.     void __fastcall SetMessage(Classes::TStrings* Value);
  141.     virtual System::AnsiString __fastcall GetDisplayName(void);
  142.     
  143. public:
  144.     __fastcall virtual TAHMMessage(Classes::TCollection* Collection);
  145.     __fastcall virtual ~TAHMMessage(void);
  146.     __property TAHMMailHost* Owner = {read=FAHMMailHost};
  147.     __property System::AnsiString Date = {read=FDate};
  148.     __property System::AnsiString MessageID = {read=FMessageID};
  149.     __property System::AnsiString InReplyTo = {read=FInReplyTo, write=FInReplyTo};
  150.     
  151. __published:
  152.     __property System::AnsiString FromMail = {read=FFrommail, write=FFrommail};
  153.     __property System::AnsiString ReplyTo = {read=FReplyTo, write=FReplyTo};
  154.     __property System::AnsiString SendTo = {read=FSendTo, write=FSendTo};
  155.     __property System::AnsiString Subject = {read=FSubject, write=FSubject};
  156.     __property System::AnsiString FromName = {read=FFromname, write=FFromname};
  157.     __property Classes::TStrings* Message = {read=FMessage, write=SetMessage};
  158.     __property TAHMAttachments* Attachments = {read=FAHMAttachments, write=SetAHMAttachments};
  159. };
  160.  
  161. class PASCALIMPLEMENTATION TAHMAttachment : public Classes::TCollectionItem 
  162. {
  163.     typedef Classes::TCollectionItem inherited;
  164.     
  165. private:
  166.     System::AnsiString FFileName;
  167.     Classes::TStringList* FBodyEncoded;
  168.     Classes::TMemoryStream* FBodyBin;
  169.     System::AnsiString FMimeType;
  170.     TAHMMessage* FAHMMessage;
  171.     virtual System::AnsiString __fastcall GetDisplayName(void);
  172.     
  173. public:
  174.     __fastcall virtual TAHMAttachment(Classes::TCollection* Collection);
  175.     __fastcall virtual ~TAHMAttachment(void);
  176.     void __fastcall SaveToFile(System::AnsiString FileName);
  177.     __property TAHMMessage* Owner = {read=FAHMMessage};
  178.     __property System::AnsiString MimeType = {read=FMimeType};
  179.     
  180. __published:
  181.     __property System::AnsiString FileName = {read=FFileName, write=FFileName};
  182. };
  183.  
  184. class DELPHICLASS TAHMSMTPMail;
  185. class PASCALIMPLEMENTATION TAHMSMTPMail : public Ahmtiemails::TAHMMailHost 
  186. {
  187.     typedef Ahmtiemails::TAHMMailHost inherited;
  188.     
  189. private:
  190.     Classes::TStrings* FSignature;
  191.     bool FBusy;
  192.     bool FSMTPError;
  193.     bool FConnected;
  194.     System::AnsiString FReplyCode;
  195.     System::AnsiString FReplyString;
  196.     System::AnsiString FDateTimeFormat;
  197.     Word FSendProgress;
  198.     Word FEncodeProgress;
  199.     bool FCanceled;
  200.     Classes::TNotifyEvent FOnConnect;
  201.     Classes::TNotifyEvent FOnDisconnect;
  202.     Classes::TNotifyEvent FOnBeforeSend;
  203.     Classes::TNotifyEvent FOnAfterSend;
  204.     Classes::TNotifyEvent FOnSuccessSend;
  205.     TAHMOnError FOnError;
  206.     TAHMSendingProgress FOnSendProgress;
  207.     TAHMOnCodingStart FOnEncodeStart;
  208.     TAHMOnCodingProgress FOnEncodeProgress;
  209.     Classes::TNotifyEvent FOnEncodeEnd;
  210.     void __fastcall SetSignature(Classes::TStrings* Value);
  211.     void __fastcall DoConnect(System::TObject* Sender, Scktcomp::TCustomWinSocket* Socket);
  212.     void __fastcall DoDisconnect(System::TObject* Sender, Scktcomp::TCustomWinSocket* Socket);
  213.     void __fastcall RaiseErrorAndExit(System::TObject* Sender, Scktcomp::TCustomWinSocket* Socket, Scktcomp::TErrorEvent 
  214.         ErrorEvent, int &ErrorCode);
  215.     void __fastcall RaiseError(Scktcomp::TErrorEvent ErrorEvent);
  216.     void __fastcall DoEncodeStart(System::AnsiString FileName, int Size);
  217.     void __fastcall DoEncodeProgress(Word Percent);
  218.     void __fastcall DoEncodeEnd(void);
  219.     void __fastcall DoSendProgress(Word Percent);
  220.     void __fastcall DoOnBeforeSend(void);
  221.     void __fastcall DoOnAfterSend(void);
  222.     System::AnsiString __fastcall CreateUIN(void);
  223.     Classes::TStringList* __fastcall InitializeMessage(TAHMMessage* &VMessage);
  224.     System::AnsiString __fastcall CreateBounds(void);
  225.     System::AnsiString __fastcall GetSocketText(void);
  226.     void __fastcall SendSocketText(const System::AnsiString VTxt);
  227.     
  228. protected:
  229.     void __fastcall Base64Encode(TAHMAttachment* &VAttachment);
  230.     
  231. public:
  232.     __fastcall virtual TAHMSMTPMail(Classes::TComponent* AOwner);
  233.     __fastcall virtual ~TAHMSMTPMail(void);
  234.     void __fastcall Connect(void);
  235.     void __fastcall Disconnect(void);
  236.     virtual bool __fastcall Execute(void);
  237.     bool __fastcall SendMessage(TAHMMessage* VMessage);
  238.     __property bool Connected = {read=FConnected, nodefault};
  239.     __property System::AnsiString ReplyCode = {read=FReplyCode};
  240.     __property System::AnsiString ReplyString = {read=FReplyString};
  241.     __property bool SMTPError = {read=FSMTPError, nodefault};
  242.     __property bool Canceled = {read=FCanceled, write=FCanceled, nodefault};
  243.     
  244. __published:
  245.     __property Classes::TStrings* Signature = {read=FSignature, write=SetSignature};
  246.     __property System::AnsiString DateTimeFormat = {read=FDateTimeFormat, write=FDateTimeFormat};
  247.     __property Classes::TNotifyEvent OnConnect = {read=FOnConnect, write=FOnConnect};
  248.     __property Classes::TNotifyEvent OnDisconnect = {read=FOnDisconnect, write=FOnDisconnect};
  249.     __property TAHMOnError OnError = {read=FOnError, write=FOnError};
  250.     __property Classes::TNotifyEvent OnBeforeSend = {read=FOnBeforeSend, write=FOnBeforeSend};
  251.     __property Classes::TNotifyEvent OnAfterSend = {read=FOnAfterSend, write=FOnAfterSend};
  252.     __property Classes::TNotifyEvent OnSuccessSend = {read=FOnSuccessSend, write=FOnSuccessSend};
  253.     __property TAHMOnCodingStart OnEncodeStart = {read=FOnEncodeStart, write=FOnEncodeStart};
  254.     __property TAHMOnCodingProgress OnEncodeProgress = {read=FOnEncodeProgress, write=FOnEncodeProgress
  255.         };
  256.     __property Classes::TNotifyEvent OnEncodeEnd = {read=FOnEncodeEnd, write=FOnEncodeEnd};
  257.     __property TAHMSendingProgress OnSendProgress = {read=FOnSendProgress, write=FOnSendProgress};
  258. };
  259.  
  260. class DELPHICLASS TAHMPOPMail;
  261. class PASCALIMPLEMENTATION TAHMPOPMail : public Ahmtiemails::TAHMMailHost 
  262. {
  263.     typedef Ahmtiemails::TAHMMailHost inherited;
  264.     
  265. private:
  266.     TAHMMailSessionState FSessionState;
  267.     System::AnsiString FUsername;
  268.     System::AnsiString FPassword;
  269.     bool FPOPError;
  270.     System::AnsiString FPOPErrorString;
  271.     bool FConnected;
  272.     bool FReceivingVMessage;
  273.     int FSize;
  274.     Word FStep;
  275.     System::AnsiString FReplyCode;
  276.     System::AnsiString FReplyString;
  277.     bool FCanceled;
  278.     Word FDecodeProgress;
  279.     Word FRetrieveProgress;
  280.     bool FBusy;
  281.     Classes::TStrings* FDeletedItems;
  282.     bool FDelOfServ;
  283.     Word FVMessagesCount;
  284.     Classes::TNotifyEvent FOnConnect;
  285.     Classes::TNotifyEvent FOnDisconnect;
  286.     TAHMOnError FOnError;
  287.     TAHMOnCodingStart FOnDecodeStart;
  288.     TAHMOnCodingProgress FOnDecodeProgress;
  289.     Classes::TNotifyEvent FOnDecodeEnd;
  290.     TAHMBeforeRetrieve FOnBeforeRetrieve;
  291.     Classes::TNotifyEvent FOnAfterRetrieve;
  292.     TAHMOnCodingProgress FOnRetrieveProgress;
  293.     TAHMOnDelete FOnDelete;
  294.     void __fastcall DoConnect(System::TObject* Sender, Scktcomp::TCustomWinSocket* Socket);
  295.     void __fastcall DoDisconnect(System::TObject* Sender, Scktcomp::TCustomWinSocket* Socket);
  296.     void __fastcall RaiseError(int err);
  297.     void __fastcall RaiseErrorAndExit(System::TObject* Sender, Scktcomp::TCustomWinSocket* Socket, Scktcomp::TErrorEvent 
  298.         ErrorEvent, int &ErrorCode);
  299.     bool __fastcall FindInHeaders(const System::AnsiString que, const Classes::TStringList* StrList, int 
  300.         &Line);
  301.     bool __fastcall FindInStringList(const System::AnsiString que, const Classes::TStringList* StrList, 
  302.         int &Line, int &position);
  303.     bool __fastcall FindInStringListCS(const System::AnsiString que, const Classes::TStringList* StrList
  304.         , int &Line, int &position);
  305.     bool __fastcall GetUUAttachments(const Classes::TStringList* StrList, int &Line, System::AnsiString 
  306.         &FileName);
  307.     System::AnsiString __fastcall GetSocketText(void);
  308.     void __fastcall SendSocketText(const System::AnsiString VText);
  309.     
  310. protected:
  311.     void __fastcall Base64Decode(TAHMAttachment* &VAttachment);
  312.     void __fastcall UUDecode(TAHMAttachment* &VAttachment);
  313.     
  314. public:
  315.     __fastcall virtual TAHMPOPMail(Classes::TComponent* AOwner);
  316.     __fastcall virtual ~TAHMPOPMail(void);
  317.     __property Classes::TStrings* DeletedItems = {read=FDeletedItems, write=FDeletedItems};
  318.     void __fastcall Connect(void);
  319.     bool __fastcall Login(void);
  320.     Word __fastcall Init(void);
  321.     TAHMMessage* __fastcall RetrieveMessage(Word Index);
  322.     int __fastcall RetrieveAllMessages(TAHMMessages* AHMVMessageList);
  323.     System::AnsiString __fastcall RetrieveHeaders(Word Index);
  324.     void __fastcall DeleteMessage(Word Index);
  325.     void __fastcall Disconnect(void);
  326.     virtual bool __fastcall Execute(void);
  327.     __property bool POPError = {read=FPOPError, nodefault};
  328.     __property System::AnsiString ErrorString = {read=FPOPErrorString};
  329.     __property Word VMessagesCount = {read=FVMessagesCount, nodefault};
  330.     __property TAHMMailSessionState SessionState = {read=FSessionState, nodefault};
  331.     __property bool Connected = {read=FConnected, nodefault};
  332.     __property System::AnsiString ReplyCode = {read=FReplyCode};
  333.     __property System::AnsiString ReplyString = {read=FReplyString};
  334.     __property bool Canceled = {read=FCanceled, write=FCanceled, nodefault};
  335.     
  336. __published:
  337.     __property Messages  = {stored=false};
  338.     __property bool DeleteOfServer = {read=FDelOfServ, write=FDelOfServ, default=0};
  339.     __property System::AnsiString Username = {read=FUsername, write=FUsername};
  340.     __property System::AnsiString Password = {read=FPassword, write=FPassword};
  341.     __property Classes::TNotifyEvent OnConnect = {read=FOnConnect, write=FOnConnect};
  342.     __property Classes::TNotifyEvent OnDisconnect = {read=FOnDisconnect, write=FOnDisconnect};
  343.     __property TAHMOnError OnError = {read=FOnError, write=FOnError};
  344.     __property TAHMOnCodingStart OnDecodeStart = {read=FOnDecodeStart, write=FOnDecodeStart};
  345.     __property TAHMOnCodingProgress OnDecodeProgress = {read=FOnDecodeProgress, write=FOnDecodeProgress
  346.         };
  347.     __property Classes::TNotifyEvent OnDecodeEnd = {read=FOnDecodeEnd, write=FOnDecodeEnd};
  348.     __property TAHMBeforeRetrieve BeforeRetrieve = {read=FOnBeforeRetrieve, write=FOnBeforeRetrieve};
  349.     __property Classes::TNotifyEvent AfterRetrieve = {read=FOnAfterRetrieve, write=FOnAfterRetrieve};
  350.     __property TAHMOnCodingProgress OnRetrieveProgress = {read=FOnRetrieveProgress, write=FOnRetrieveProgress
  351.         };
  352.     __property TAHMOnDelete OnDelete = {read=FOnDelete, write=FOnDelete};
  353. };
  354.  
  355. //-- var, const, procedure ---------------------------------------------------
  356. #define crlf "\r\n"
  357.  
  358. }    /* namespace Ahmtiemails */
  359. #if !defined(NO_IMPLICIT_NAMESPACE_USE)
  360. using namespace Ahmtiemails;
  361. #endif
  362. //-- end unit ----------------------------------------------------------------
  363. #endif    // AHMTIEmails
  364.