IECChangeAdvisor.h 3.4 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103
  1. /*
  2. * Copyright 2005 - 2016 Zarafa and its licensors
  3. *
  4. * This program is free software: you can redistribute it and/or modify
  5. * it under the terms of the GNU Affero General Public License, version 3,
  6. * as published by the Free Software Foundation.
  7. *
  8. * This program is distributed in the hope that it will be useful,
  9. * but WITHOUT ANY WARRANTY; without even the implied warranty of
  10. * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
  11. * GNU Affero General Public License for more details.
  12. *
  13. * You should have received a copy of the GNU Affero General Public License
  14. * along with this program. If not, see <http://www.gnu.org/licenses/>.
  15. *
  16. */
  17. #ifndef IECCHANGEADVISOR_H
  18. #define IECCHANGEADVISOR_H
  19. #include "IECChangeAdviseSink.h"
  20. namespace KC {
  21. /**
  22. * IECChangeAdvisor: Interface for registering change notifications on folders.
  23. */
  24. class IECChangeAdvisor : public IUnknown{
  25. public:
  26. virtual HRESULT __stdcall GetLastError(HRESULT hResult, ULONG ulFlags, LPMAPIERROR *lppMAPIError) = 0;
  27. /**
  28. * Configure the change change advisor based on a stream.
  29. *
  30. * @param[in] lpStream
  31. * The stream containing the state of the state of the change advisor. This stream
  32. * is obtained by a call to UpdateState.
  33. * If lpStream is NULL, an empty state is assumed.
  34. * @param[in] lpGuid
  35. * Unused. Set to NULL.
  36. * @param[in] lpAdviseSink
  37. * The advise sink that will receive the change notifications.
  38. * @param[in] ulFlags
  39. * - SYNC_CATCHUP Update the internal state, but don't perform any operations
  40. * on the server.
  41. */
  42. virtual HRESULT __stdcall Config(LPSTREAM lpStream, LPGUID lpGUID, IECChangeAdviseSink *lpAdviseSink, ULONG ulFlags) = 0;
  43. /**
  44. * Store the current internal state in the stream pointed to by lpStream.
  45. *
  46. * @param[in] lpStream
  47. * The stream in which the current state will be stored.
  48. */
  49. virtual HRESULT __stdcall UpdateState(LPSTREAM lpStream) = 0;
  50. /**
  51. * Register one or more folders for change notifications through this change advisor.
  52. *
  53. * @param[in] lpEntryList
  54. * A list of keys specifying the folders to monitor. A key is an 8 byte
  55. * block of data. The first 4 bytes specify the sync id of the folder to
  56. * monitor. The second 4 bytes apecify the change id of the folder to monitor.
  57. * Use the SSyncState structure to easily create and access this data.
  58. */
  59. virtual HRESULT __stdcall AddKeys(LPENTRYLIST lpEntryList) = 0;
  60. /**
  61. * Unregister one or more folder for change notifications.
  62. *
  63. * @param[in] lpEntryList
  64. * A list of keys specifying the folders to monitor. See AddKeys for
  65. * information about the key format.
  66. */
  67. virtual HRESULT __stdcall RemoveKeys(LPENTRYLIST lpEntryList) = 0;
  68. /**
  69. * Check if the change advisor is monitoring the folder specified by a particular sync id.
  70. *
  71. * @param[in] ulSyncId
  72. * The sync id of the folder.
  73. * @return hrSuccess if the folder is being monitored.
  74. */
  75. virtual HRESULT __stdcall IsMonitoringSyncId(ULONG ulSyncId) = 0;
  76. /**
  77. * Update the changeid for a particular syncid.
  78. *
  79. * This is used to update the state of the changeadvisor. This is also vital information
  80. * when a reconnect is required.
  81. *
  82. * @param[in] ulSyncId
  83. * The syncid for which to update the changeid.
  84. * @param[in] ulChangeId
  85. * The new changeid for the specified syncid.
  86. */
  87. virtual HRESULT __stdcall UpdateSyncState(ULONG ulSyncId, ULONG ulChangeId) = 0;
  88. };
  89. } /* namespace */
  90. #endif