diff options
author | Joas Schilling <coding@schilljs.com> | 2020-09-23 15:38:49 +0300 |
---|---|---|
committer | Joas Schilling <coding@schilljs.com> | 2020-09-24 12:13:46 +0300 |
commit | eea37cf12e65304535e06507e363c3102ba1e9ab (patch) | |
tree | cf58158d1937b7b2dc1d5baecd7d7dbe27c41ccc /lib | |
parent | 9a7ff2471c07343456e436f2032c51721a240735 (diff) |
Set the user status when a mobile client polls for messages
Signed-off-by: Joas Schilling <coding@schilljs.com>
Diffstat (limited to 'lib')
-rw-r--r-- | lib/Controller/ChatController.php | 17 |
1 files changed, 17 insertions, 0 deletions
diff --git a/lib/Controller/ChatController.php b/lib/Controller/ChatController.php index 5777a1bd1..5c2dd2b59 100644 --- a/lib/Controller/ChatController.php +++ b/lib/Controller/ChatController.php @@ -42,9 +42,11 @@ use OCP\Collaboration\Collaborators\ISearchResult; use OCP\Comments\IComment; use OCP\Comments\MessageTooLongException; use OCP\Comments\NotFoundException; +use OCP\EventDispatcher\IEventDispatcher; use OCP\IL10N; use OCP\IRequest; use OCP\IUserManager; +use OCP\User\Events\UserLiveStatusEvent; use OCP\UserStatus\IManager as IUserStatusManager; use OCP\UserStatus\IUserStatus; @@ -86,6 +88,9 @@ class ChatController extends AEnvironmentAwareController { /** @var ISearchResult */ private $searchResult; + /** @var IEventDispatcher */ + private $eventDispatcher; + /** @var IL10N */ private $l; /** @var ITimeFactory */ @@ -104,6 +109,7 @@ class ChatController extends AEnvironmentAwareController { IUserStatusManager $statusManager, SearchPlugin $searchPlugin, ISearchResult $searchResult, + IEventDispatcher $eventDispatcher, ITimeFactory $timeFactory, IL10N $l) { parent::__construct($appName, $request); @@ -119,6 +125,7 @@ class ChatController extends AEnvironmentAwareController { $this->statusManager = $statusManager; $this->searchPlugin = $searchPlugin; $this->searchResult = $searchResult; + $this->eventDispatcher = $eventDispatcher; $this->timeFactory = $timeFactory; $this->l = $l; } @@ -267,6 +274,16 @@ class ChatController extends AEnvironmentAwareController { ]); if ($isMobileApp && $this->participant->getInCallFlags() === Participant::FLAG_DISCONNECTED) { $this->room->ping($this->participant->getUser(), $this->participant->getSessionId(), $this->timeFactory->getTime()); + + if ($lookIntoFuture) { + // Bump the user status again + $event = new UserLiveStatusEvent( + $this->userManager->get($this->participant->getUser()), + IUserStatus::ONLINE, + $this->timeFactory->getTime() + ); + $this->eventDispatcher->dispatchTyped($event); + } } } |