MT5APIMail.h 3.2 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576
  1. //+------------------------------------------------------------------+
  2. //| MetaTrader 5 API Server |
  3. //| Copyright 2000-2019, MetaQuotes Software Corp. |
  4. //| http://www.metaquotes.net |
  5. //+------------------------------------------------------------------+
  6. #pragma once
  7. //+------------------------------------------------------------------+
  8. //| Mail recipients range |
  9. //+------------------------------------------------------------------+
  10. #pragma pack(push,1)
  11. struct MTMailRange
  12. {
  13. UINT64 first_login;
  14. UINT64 last_login;
  15. UINT reserved[4];
  16. };
  17. #pragma pack(pop)
  18. //+------------------------------------------------------------------+
  19. //| Mail Message interface |
  20. //+------------------------------------------------------------------+
  21. class IMTMail
  22. {
  23. public:
  24. //--- common methods
  25. virtual void Release(void)=0;
  26. virtual MTAPIRES Assign(const IMTMail* mail)=0;
  27. virtual MTAPIRES Clear(void)=0;
  28. //--- mail ID and parent mail ID
  29. virtual UINT64 ID(void) const=0;
  30. virtual UINT64 Parent(void) const=0;
  31. //--- subject
  32. virtual LPCWSTR Subject(void) const=0;
  33. virtual MTAPIRES Subject(LPCWSTR subject)=0;
  34. //--- from ID
  35. virtual UINT64 From(void) const=0;
  36. virtual MTAPIRES From(const UINT64 id)=0;
  37. //--- from name
  38. virtual LPCWSTR FromName(void) const=0;
  39. virtual MTAPIRES FromName(LPCWSTR name)=0;
  40. //--- to ID
  41. virtual UINT64 To(void) const=0;
  42. virtual MTAPIRES To(const UINT64 id)=0;
  43. //--- to name
  44. virtual LPCWSTR ToName(void) const=0;
  45. virtual MTAPIRES ToName(LPCWSTR name)=0;
  46. //--- to ID ranges
  47. virtual MTAPIRES ToRangesAdd(MTMailRange& range)=0;
  48. virtual MTAPIRES ToRangesDelete(const UINT pos)=0;
  49. virtual MTAPIRES ToRangesClear(void)=0;
  50. virtual UINT ToRangesTotal(void) const=0;
  51. virtual MTAPIRES ToRangesNext(const UINT pos,MTMailRange& range) const=0;
  52. //--- time
  53. virtual INT64 Time(void) const=0;
  54. //--- body
  55. virtual LPCVOID Body(void) const=0;
  56. virtual UINT BodySize(void) const=0;
  57. virtual MTAPIRES Body(LPCVOID body,const UINT body_size)=0;
  58. //--- attachments
  59. virtual MTAPIRES AttachmentsAdd(LPCWSTR filename,LPCVOID attachment,const UINT attachment_size)=0;
  60. virtual MTAPIRES AttachmentsClear(void)=0;
  61. virtual UINT AttachmentsTotal(void) const=0;
  62. virtual LPVOID AttachmentsBody(const UINT pos) const=0;
  63. virtual UINT AttachmentsSize(const UINT pos) const=0;
  64. virtual LPCWSTR AttachmentsName(const UINT pos) const=0;
  65. };
  66. //+------------------------------------------------------------------+
  67. //| Mail events notification interface |
  68. //+------------------------------------------------------------------+
  69. class IMTMailSink
  70. {
  71. public:
  72. virtual void OnMail(const IMTMail* /*mail*/) { };
  73. virtual MTAPIRES HookMail(IMTMail* /*mail*/) { return(MT_RET_OK); }
  74. };
  75. //+------------------------------------------------------------------+