You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

UserLiveStatusEvent.php 1.9KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101
  1. <?php
  2. declare(strict_types=1);
  3. /**
  4. * @copyright Copyright (c) 2020, Georg Ehrke
  5. *
  6. * @author Georg Ehrke <oc.list@georgehrke.com>
  7. *
  8. * @license AGPL-3.0
  9. *
  10. * This code is free software: you can redistribute it and/or modify
  11. * it under the terms of the GNU Affero General Public License, version 3,
  12. * as published by the Free Software Foundation.
  13. *
  14. * This program is distributed in the hope that it will be useful,
  15. * but WITHOUT ANY WARRANTY; without even the implied warranty of
  16. * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
  17. * GNU Affero General Public License for more details.
  18. *
  19. * You should have received a copy of the GNU Affero General Public License, version 3,
  20. * along with this program. If not, see <http://www.gnu.org/licenses/>
  21. *
  22. */
  23. namespace OCP\User\Events;
  24. use OCP\EventDispatcher\Event;
  25. use OCP\IUser;
  26. /**
  27. * @since 20.0.0
  28. */
  29. class UserLiveStatusEvent extends Event {
  30. /**
  31. * @var string
  32. * @since 20.0.0
  33. */
  34. public const STATUS_ONLINE = 'online';
  35. /**
  36. * @var string
  37. * @since 20.0.0
  38. */
  39. public const STATUS_AWAY = 'away';
  40. /**
  41. * @var string
  42. * @since 20.0.0
  43. */
  44. public const STATUS_OFFLINE = 'offline';
  45. /** @var IUser */
  46. private $user;
  47. /** @var string */
  48. private $status;
  49. /** @var int */
  50. private $timestamp;
  51. /**
  52. * @param IUser $user
  53. * @param string $status
  54. * @param int $timestamp
  55. * @since 20.0.0
  56. */
  57. public function __construct(IUser $user,
  58. string $status,
  59. int $timestamp) {
  60. parent::__construct();
  61. $this->user = $user;
  62. $this->status = $status;
  63. $this->timestamp = $timestamp;
  64. }
  65. /**
  66. * @return IUser
  67. * @since 20.0.0
  68. */
  69. public function getUser(): IUser {
  70. return $this->user;
  71. }
  72. /**
  73. * @return string
  74. * @since 20.0.0
  75. */
  76. public function getStatus(): string {
  77. return $this->status;
  78. }
  79. /**
  80. * @return int
  81. * @since 20.0.0
  82. */
  83. public function getTimestamp(): int {
  84. return $this->timestamp;
  85. }
  86. }