use UID for nicks, also mark addressbook as writeable
This commit is contained in:
parent
5874e561d1
commit
63d1116b5e
1 changed files with 4 additions and 5 deletions
|
@ -48,7 +48,7 @@ Config::init();
|
||||||
class abook_carddav extends addressbook_backend {
|
class abook_carddav extends addressbook_backend {
|
||||||
var $btype = 'local';
|
var $btype = 'local';
|
||||||
var $bname = 'carddav';
|
var $bname = 'carddav';
|
||||||
var $writeable = false;
|
var $writeable = true;
|
||||||
|
|
||||||
/* ========================== Private ======================= */
|
/* ========================== Private ======================= */
|
||||||
|
|
||||||
|
@ -100,7 +100,7 @@ class abook_carddav extends addressbook_backend {
|
||||||
$this->syncmgr = new Sync();
|
$this->syncmgr = new Sync();
|
||||||
|
|
||||||
// initial sync - we don't have a sync-token yet
|
// initial sync - we don't have a sync-token yet
|
||||||
$this->lastSyncToken = $this->syncmgr->synchronize($this->abook, $this->synchandler, ["FN", "N", "EMAIL", "ORG"], "");
|
$this->lastSyncToken = $this->syncmgr->synchronize($this->abook, $this->synchandler, ["FN", "N", "EMAIL", "ORG", "UID"], "");
|
||||||
|
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
@ -163,19 +163,18 @@ class abook_carddav extends addressbook_backend {
|
||||||
$ret = array();
|
$ret = array();
|
||||||
|
|
||||||
// list all addresses having an email
|
// list all addresses having an email
|
||||||
$all=$this->abook->query(['EMAIL' => "//"],["FN", "N", "EMAIL", "ORG"]);
|
$all=$this->abook->query(['EMAIL' => "//"],["FN", "N", "EMAIL", "ORG", "UID"]);
|
||||||
/*
|
/*
|
||||||
Returns an array of matched VCards:
|
Returns an array of matched VCards:
|
||||||
The keys of the array are the URIs of the vcards
|
The keys of the array are the URIs of the vcards
|
||||||
The values are associative arrays with keys etag (type: string) and vcard (type: VCard)
|
The values are associative arrays with keys etag (type: string) and vcard (type: VCard)
|
||||||
*/
|
*/
|
||||||
$id=1;
|
|
||||||
foreach($all as $uri => $one) {
|
foreach($all as $uri => $one) {
|
||||||
$vcard = $one['vcard'];
|
$vcard = $one['vcard'];
|
||||||
$names = $vcard->N->getParts();
|
$names = $vcard->N->getParts();
|
||||||
// last,first,additional,prefix,suffix
|
// last,first,additional,prefix,suffix
|
||||||
array_push($ret,array(
|
array_push($ret,array(
|
||||||
'nickname' => 'id'.$id++,
|
'nickname' => (string)$vcard->UID,
|
||||||
'name' => (string)$vcard->FN,
|
'name' => (string)$vcard->FN,
|
||||||
'firstname' => (string)$names[1],
|
'firstname' => (string)$names[1],
|
||||||
'lastname' => (string)$names[0],
|
'lastname' => (string)$names[0],
|
||||||
|
|
Loading…
Reference in a new issue