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:
@@ -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"];
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user