Added category parsing

This commit is contained in:
Christoph Haas 2016-12-05 20:21:08 +01:00
parent cc6b3898a5
commit 35a157ead9
2 changed files with 20 additions and 1 deletions

View File

@ -1,5 +1,11 @@
{ {
"repositories": [
{
"type": "vcs",
"url": "https://github.com/h44z/vcard"
}
],
"require": { "require": {
"jeroendesloovere/vcard": "1.2.*" "jeroendesloovere/vcard": "dev-patchcategories"
} }
} }

View File

@ -397,6 +397,11 @@ class ContactModule extends Module
$vCard->addNote($notes); $vCard->addNote($notes);
} }
if (!empty($this->getProp($messageProps, "categories"))) {
$categories = array_map('trim', explode(';', trim($this->getProp($messageProps, "categories"), " ;")));
$vCard->addCategories($categories);
}
$hasPicture = $this->getProp($messageProps, "has_picture"); $hasPicture = $this->getProp($messageProps, "has_picture");
if (!empty($hasPicture) && $hasPicture === true) { if (!empty($hasPicture) && $hasPicture === true) {
$attachNum = -1; $attachNum = -1;
@ -921,6 +926,14 @@ class ContactModule extends Module
if (isset($vCard->note)) { if (isset($vCard->note)) {
$properties["notes"] = $vCard->note; $properties["notes"] = $vCard->note;
} }
if (isset($vCard->categories) && count($vCard->categories) > 0) {
$categories = array();
foreach ($vCard->categories as $category) {
$categories[] = $category;
}
$properties["categories"] = $categories;
}
if (isset($vCard->rawPhoto) || isset($vCard->photo)) { if (isset($vCard->rawPhoto) || isset($vCard->photo)) {
if (!is_writable(TMP_PATH . "/")) { if (!is_writable(TMP_PATH . "/")) {
error_log("Can not write to export tmp directory!"); error_log("Can not write to export tmp directory!");