1
0
mirror of https://github.com/nextcloud/ocsms.git synced 2026-08-11 16:32:55 +00:00

Set contact colours on uids (#152)

Signed-off-by: John Molakvoæ (skjnldsv) <skjnldsv@protonmail.com>
This commit is contained in:
John Molakvoæ
2017-01-03 11:22:05 +01:00
committed by Ner'zhul
parent 3a669de201
commit 8296cdca78
4 changed files with 35 additions and 4 deletions
+14
View File
@@ -23,6 +23,7 @@ class ContactCache {
private $contacts;
private $contactsInverted;
private $contactPhotos;
private $contactUids;
private $cfgMapper;
private $contactsManager;
@@ -30,6 +31,7 @@ class ContactCache {
public function __construct (ConfigMapper $cfgMapper, IContactsManager $contactsManager) {
$this->contacts = array();
$this->contactPhotos = array();
$this->contactUids = array();
$this->contactsInverted = array();
$this->cfgMapper = $cfgMapper;
@@ -60,6 +62,14 @@ class ContactCache {
return $this->contactPhotos;
}
public function getContactUids() {
// Only load contacts if they aren't in the buffer
if(count($this->contactUids) == 0) {
$this->loadContacts();
}
return $this->contactUids;
}
/**
* Partially importe this function from owncloud Chat app
* https://github.com/owncloud/chat/blob/master/app/chat.php
@@ -99,6 +109,10 @@ class ContactCache {
$photoURL = preg_replace("#^VALUE=uri:#","",$r["PHOTO"], 1);
$this->contactPhotos[$r["FN"]] = $photoURL;
}
if (isset ($r["UID"])) {
$this->contactUids[$r["FN"]] = $r["UID"];
}
}
}
}