Welcome to mirror list, hosted at ThFree Co, Russian Federation.

github.com/nextcloud/spreed.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorJoas Schilling <coding@schilljs.com>2018-03-21 16:20:04 +0300
committerJoas Schilling <coding@schilljs.com>2018-03-21 17:15:54 +0300
commit0be200e09923547b7e970fee4c3cf6ee9849a04b (patch)
treea889907bb94afdc4ead0e137cb133ce4edfeb471 /lib/GuestManager.php
parentb57ac3334efa7f35211b3d0fa0c2bfea076a109f (diff)
Update participant list also when not in call
Signed-off-by: Joas Schilling <coding@schilljs.com>
Diffstat (limited to 'lib/GuestManager.php')
-rw-r--r--lib/GuestManager.php31
1 files changed, 21 insertions, 10 deletions
diff --git a/lib/GuestManager.php b/lib/GuestManager.php
index 7eb4afa25..70c769c11 100644
--- a/lib/GuestManager.php
+++ b/lib/GuestManager.php
@@ -24,36 +24,47 @@ namespace OCA\Spreed;
use OCP\DB\QueryBuilder\IQueryBuilder;
use OCP\IDBConnection;
+use Symfony\Component\EventDispatcher\EventDispatcherInterface;
+use Symfony\Component\EventDispatcher\GenericEvent;
class GuestManager {
/** @var IDBConnection */
protected $connection;
- public function __construct(IDBConnection $connection) {
+ /** @var EventDispatcherInterface */
+ protected $dispatcher;
+
+ public function __construct(IDBConnection $connection, EventDispatcherInterface $dispatcher) {
$this->connection = $connection;
+ $this->dispatcher = $dispatcher;
}
/**
- * @param string $sessionHash
+ * @param Room $room
+ * @param string $sessionId
* @param string $displayName
* @throws \Doctrine\DBAL\DBALException
*/
- public function updateName($sessionHash, $displayName) {
+ public function updateName(Room $room, $sessionId, $displayName) {
+ $sessionHash = sha1($sessionId);
$result = $this->connection->insertIfNotExist('*PREFIX*talk_guests', [
'session_hash' => $sessionHash,
'display_name' => $displayName,
], ['session_hash']);
- if ($result === 1) {
- return;
+ if ($result === 0) {
+ $query = $this->connection->getQueryBuilder();
+ $query->update('talk_guests')
+ ->set('display_name', $query->createNamedParameter($displayName))
+ ->where($query->expr()->eq('session_hash', $query->createNamedParameter($sessionHash)));
+ $query->execute();
}
- $query = $this->connection->getQueryBuilder();
- $query->update('talk_guests')
- ->set('display_name', $query->createNamedParameter($displayName))
- ->where($query->expr()->eq('session_hash', $query->createNamedParameter($sessionHash)));
- $query->execute();
+ $this->dispatcher->dispatch(self::class . '::updateName', new GenericEvent($room, [
+ 'sessionId' => $sessionId,
+ 'newName' => $displayName,
+ ]));
}
/**