Skip to content
This repository was archived by the owner on Apr 9, 2024. It is now read-only.

Make oczpush compatible with OC5 contacts app #25

Open
wants to merge 1 commit into
base: master
Choose a base branch
from
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
18 changes: 9 additions & 9 deletions backend/occontacts.php
Original file line number Diff line number Diff line change
Expand Up @@ -51,7 +51,7 @@ public function Logon($username, $domain, $password) {
if(OC_User::login($username,$password)){
OC_Util::setUpFS();
ZLog::Write(LOGLEVEL_DEBUG, 'OCContacts::Logon : Logged');
$addressBooks = OC_Contacts_Addressbook::All($username);
$addressBooks = \OCA\Contacts\Addressbook::All($username);
$this->addressBookId = $addressBooks[0]['id'];
ZLog::Write(LOGLEVEL_DEBUG, 'OCContacts::Logon : addressBook selected :'.$addressBooks[0]['displayname']);
$this->userTZ=\OCP\Config::getUserValue(\OCP\USER::getUser(), 'calendar', 'timezone', date_default_timezone_get());
Expand Down Expand Up @@ -219,7 +219,7 @@ public function GetMessageList($folderid, $cutoffdate) {
ZLog::Write(LOGLEVEL_DEBUG, 'OCContacts::GetMessageList('.$folderid.')');
$messages = array();

foreach ( OC_Contacts_VCard::all($this->addressBookId) as $cardEntry ) {
foreach ( \OCA\Contacts\VCard::all($this->addressBookId) as $cardEntry ) {
$message["id"] = substr($cardEntry['uri'],0,-4);
$message["mod"] = $cardEntry['lastmodified'];
$message["flags"] = 1;
Expand Down Expand Up @@ -264,7 +264,7 @@ public function GetMessage($folderid, $id, $contentparameters) {
// Parse the vcard
$message = new SyncContact();

$card=OC_Contacts_VCard::findWhereDAVDataIs($this->addressBookId, $id.'.vcf');
$card=\OCA\Contacts\VCard::findWhereDAVDataIs($this->addressBookId, $id.'.vcf');
$data = $card['carddata'];

$data = str_replace("\x00", '', $data);
Expand Down Expand Up @@ -496,7 +496,7 @@ public function StatMessage($folderid, $id) {

$message = array();

$cardEntry=OC_Contacts_VCard::findWhereDAVDataIs($this->addressBookId,$id.'.vcf');
$cardEntry=\OCA\Contacts\VCard::findWhereDAVDataIs($this->addressBookId,$id.'.vcf');
// ZLog::Write(LOGLEVEL_DEBUG, 'OCContacts::StatMessage('.print_r($cardEntry,true));
$message["id"] = substr($cardEntry['uri'],0,-4);
$message["mod"] = $cardEntry['lastmodified'];
Expand Down Expand Up @@ -556,7 +556,7 @@ public function ChangeMessage($folderid, $id, $message) {
} else {
$newvcard = false;

$card = OC_Contacts_VCard::findWhereDAVDataIs($this->addressBookId, $id.'.vcf');
$card = \OCA\Contacts\VCard::findWhereDAVDataIs($this->addressBookId, $id.'.vcf');
$data = $card['carddata'];
$data = str_replace("\x00", '', $data);
$data = str_replace("\r\n", "\n", $data);
Expand Down Expand Up @@ -630,10 +630,10 @@ public function ChangeMessage($folderid, $id, $message) {
if ($newvcard)
{
ZLog::Write(LOGLEVEL_DEBUG, 'OCContacts::ChangeMessage, OC_Contacts_VCard::add('.$this->addressBookId.', '.$data);
OC_Contacts_VCard::addFromDAVData($this->addressBookId,$id.".vcf",$data);
\OCA\Contacts\VCard::addFromDAVData($this->addressBookId,$id.".vcf",$data);
} else {
ZLog::Write(LOGLEVEL_DEBUG, 'OCContacts::ChangeMessage, OC_Contacts_VCard::edit('.$this->addressBookId.', '.$data);
OC_Contacts_VCard::editFromDAVData($this->addressBookId,$id.".vcf",$data);
\OCA\Contacts\VCard::editFromDAVData($this->addressBookId,$id.".vcf",$data);
}
return $this->StatMessage($folderid, $id);
}
Expand Down Expand Up @@ -664,8 +664,8 @@ public function SetReadFlag($folderid, $id, $flags) {
* @throws StatusException could throw specific SYNC_STATUS_* exceptions
*/
public function DeleteMessage($folderid, $id) {
$card=OC_Contacts_VCard::findWhereDAVDataIs($this->addressBookId,$id.'.vcf');
return OC_Contacts_VCard::delete($card['id']);
$card=\OCA\Contacts\VCard::findWhereDAVDataIs($this->addressBookId,$id.'.vcf');
return \OCA\Contacts\VCard::delete($card['id']);
}

/**
Expand Down