summaryrefslogtreecommitdiffstats
path: root/lib
diff options
context:
space:
mode:
Diffstat (limited to 'lib')
-rw-r--r--lib/private/Contacts/ContactsMenu/ContactsStore.php3
-rw-r--r--lib/private/Server.php10
-rw-r--r--lib/public/Contacts/ContactsMenu/IContactsStore.php26
3 files changed, 38 insertions, 1 deletions
diff --git a/lib/private/Contacts/ContactsMenu/ContactsStore.php b/lib/private/Contacts/ContactsMenu/ContactsStore.php
index 108ff0d4989..43600470e1f 100644
--- a/lib/private/Contacts/ContactsMenu/ContactsStore.php
+++ b/lib/private/Contacts/ContactsMenu/ContactsStore.php
@@ -35,8 +35,9 @@ use OCP\IGroupManager;
use OCP\IUser;
use OCP\IUserManager;
use OCP\IUserSession;
+use OCP\Contacts\ContactsMenu\IContactsStore;
-class ContactsStore {
+class ContactsStore implements IContactsStore {
/** @var IManager */
private $contactsManager;
diff --git a/lib/private/Server.php b/lib/private/Server.php
index 0dfbcbb75ec..09128f33bfb 100644
--- a/lib/private/Server.php
+++ b/lib/private/Server.php
@@ -63,6 +63,7 @@ use OC\Collaboration\Collaborators\RemotePlugin;
use OC\Collaboration\Collaborators\UserPlugin;
use OC\Command\CronBus;
use OC\Contacts\ContactsMenu\ActionFactory;
+use OC\Contacts\ContactsMenu\ContactsStore;
use OC\Diagnostics\EventLogger;
use OC\Diagnostics\QueryLogger;
use OC\Federation\CloudIdManager;
@@ -1129,6 +1130,15 @@ class Server extends ServerContainer implements IServerContainer {
return new InstanceFactory($memcacheFactory->createLocal('remoteinstance.'), $c->getHTTPClientService());
});
+ $this->registerService(\OCP\Contacts\ContactsMenu\IContactsStore::class, function(Server $c) {
+ return new ContactsStore(
+ $c->getContactsManager(),
+ $c->getConfig(),
+ $c->getUserManager(),
+ $c->getGroupManager()
+ );
+ });
+
$this->connectDispatcher();
}
diff --git a/lib/public/Contacts/ContactsMenu/IContactsStore.php b/lib/public/Contacts/ContactsMenu/IContactsStore.php
new file mode 100644
index 00000000000..415c450072d
--- /dev/null
+++ b/lib/public/Contacts/ContactsMenu/IContactsStore.php
@@ -0,0 +1,26 @@
+<?php
+
+namespace OCP\Contacts\ContactsMenu;
+
+use OCP\IUser;
+
+interface IContactsStore {
+
+
+ /**
+ * @param IUser $user
+ * @param $filter
+ * @return IEntry[]
+ */
+ public function getContacts(IUser $user, $filter);
+
+ /**
+ * @brief finds a contact by specifying the property to search on ($shareType) and the value ($shareWith)
+ * @param IUser $user
+ * @param integer $shareType
+ * @param string $shareWith
+ * @return IEntry|null
+ */
+ public function findOne(IUser $user, $shareType, $shareWith);
+
+} \ No newline at end of file