ECNotification.cpp 2.0 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990
  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. #include <kopano/platform.h>
  18. #include "ECNotification.h"
  19. #include "ECMAPI.h"
  20. #include "SOAPUtils.h"
  21. namespace KC {
  22. ECNotification::ECNotification()
  23. {
  24. Init();
  25. }
  26. ECNotification::~ECNotification()
  27. {
  28. FreeNotificationStruct(m_lpsNotification, true);
  29. }
  30. ECNotification::ECNotification(const ECNotification &x)
  31. {
  32. Init();
  33. *this = x;
  34. }
  35. ECNotification::ECNotification(notification &notification)
  36. {
  37. Init();
  38. *this = notification;
  39. }
  40. void ECNotification::Init()
  41. {
  42. this->m_lpsNotification = s_alloc<notification>(nullptr);
  43. memset(m_lpsNotification, 0, sizeof(notification));
  44. }
  45. ECNotification& ECNotification::operator=(const ECNotification &x)
  46. {
  47. if(this != &x)
  48. CopyNotificationStruct(NULL, x.m_lpsNotification, *this->m_lpsNotification);
  49. return *this;
  50. }
  51. ECNotification& ECNotification::operator=(const notification &srcNotification)
  52. {
  53. CopyNotificationStruct(NULL, (notification *)&srcNotification, *this->m_lpsNotification);
  54. return *this;
  55. }
  56. void ECNotification::SetConnection(unsigned int ulConnection)
  57. {
  58. m_lpsNotification->ulConnection = ulConnection;
  59. }
  60. void ECNotification::GetCopy(struct soap *soap, notification &notification) const
  61. {
  62. CopyNotificationStruct(soap, this->m_lpsNotification, notification);
  63. }
  64. /**
  65. * Get object size
  66. *
  67. * @return Object size in bytes
  68. */
  69. size_t ECNotification::GetObjectSize(void) const
  70. {
  71. return NotificationStructSize(m_lpsNotification);
  72. }
  73. } /* namespace */