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:
Diffstat (limited to 'lib/Manager.php')
-rw-r--r--lib/Manager.php37
1 files changed, 37 insertions, 0 deletions
diff --git a/lib/Manager.php b/lib/Manager.php
index 43c4bf180..c96e5f2c8 100644
--- a/lib/Manager.php
+++ b/lib/Manager.php
@@ -225,6 +225,43 @@ class Manager {
}
/**
+ * @param string $searchToken
+ * @param int $limit
+ * @param int $offset
+ * @return Room[]
+ */
+ public function searchRoomsByToken(string $searchToken = '', int $limit = null, int $offset = null): array {
+ $query = $this->db->getQueryBuilder();
+ $query->select('*')
+ ->from('talk_rooms')
+ ->setMaxResults(1);
+
+ if ($searchToken !== '') {
+ $query->where($query->expr()->iLike('token', $query->createNamedParameter(
+ '%' . $this->db->escapeLikeParameter($searchToken) . '%'
+ )));
+ }
+
+ $query->setMaxResults($limit)
+ ->setFirstResult($offset)
+ ->orderBy('token', 'ASC');
+ $result = $query->execute();
+
+ $rooms = [];
+ while ($row = $result->fetch()) {
+ if ($row['token'] === null) {
+ // FIXME Temporary solution for the Talk6 release
+ continue;
+ }
+
+ $rooms[] = $this->createRoomObject($row);
+ }
+ $result->closeCursor();
+
+ return $rooms;
+ }
+
+ /**
* @param string $participant
* @param bool $includeLastMessage
* @return Room[]