mirror of
https://github.com/the-djmaze/snappymail.git
synced 2026-06-29 07:16:07 +00:00
vCard parser fixes
This commit is contained in:
@@ -7,6 +7,12 @@
|
||||
&.focused .b-content {
|
||||
}
|
||||
|
||||
.b-folders-user {
|
||||
.e-link.print-count.system .badge {
|
||||
display: none !important;
|
||||
}
|
||||
}
|
||||
|
||||
.b-toolbar {
|
||||
position: absolute;
|
||||
top: 0;
|
||||
|
||||
@@ -252,7 +252,7 @@
|
||||
if (-1 < iIndex)
|
||||
{
|
||||
aResult[0] = true;
|
||||
aResult[1] = (iIndex + 1) + ' / ' + iLen;
|
||||
aResult[1] = (iIndex + 1) + '/' + iLen;
|
||||
aResult[2] = aThreads[iIndex];
|
||||
aResult[3] = 0 < iIndex && aThreads[iIndex - 1] ? aThreads[iIndex - 1] : '';
|
||||
aResult[4] = aThreads[iIndex + 1] ? aThreads[iIndex + 1] : '';
|
||||
|
||||
@@ -353,7 +353,7 @@ class AddressBook extends \RainLoop\Providers\AbstractProvider
|
||||
$oVCard->UID = \Sabre\DAV\UUIDUtil::getUUID();
|
||||
}
|
||||
|
||||
$oContact->PopulateByVCard($oVCard->serialize());
|
||||
$oContact->PopulateByVCard($oVCard->UID, $oVCard->serialize());
|
||||
|
||||
if (0 < \count($oContact->Properties))
|
||||
{
|
||||
|
||||
@@ -182,7 +182,7 @@ class Contact
|
||||
/**
|
||||
* @return string
|
||||
*/
|
||||
public function ToVCard($sPreVCard = '')
|
||||
public function ToVCard($sPreVCard = '', $oLogger = null)
|
||||
{
|
||||
$this->UpdateDependentValues();
|
||||
|
||||
@@ -191,6 +191,11 @@ class Contact
|
||||
return '';
|
||||
}
|
||||
|
||||
if ("\xef\xbb\xbf" === \substr($sPreVCard, 0, 3))
|
||||
{
|
||||
$sPreVCard = \substr($sPreVCard, 3);
|
||||
}
|
||||
|
||||
$oVCard = null;
|
||||
if (0 < \strlen($sPreVCard))
|
||||
{
|
||||
@@ -198,7 +203,14 @@ class Contact
|
||||
{
|
||||
$oVCard = \Sabre\VObject\Reader::read($sPreVCard);
|
||||
}
|
||||
catch (\Exception $oExc) {};
|
||||
catch (\Exception $oExc)
|
||||
{
|
||||
if ($oLogger)
|
||||
{
|
||||
$oLogger->WriteException($oExc);
|
||||
$oLogger->WriteDump($sPreVCard);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
if (!$oVCard)
|
||||
@@ -484,8 +496,13 @@ class Contact
|
||||
}
|
||||
}
|
||||
|
||||
public function PopulateByVCard($sVCard, $sEtag = '')
|
||||
public function PopulateByVCard($sUid, $sVCard, $sEtag = '', $oLogger = null)
|
||||
{
|
||||
if ("\xef\xbb\xbf" === \substr($sVCard, 0, 3))
|
||||
{
|
||||
$sVCard = \substr($sVCard, 3);
|
||||
}
|
||||
|
||||
$this->Properties = array();
|
||||
|
||||
if (!\class_exists('Sabre\DAV\Client'))
|
||||
@@ -502,7 +519,16 @@ class Contact
|
||||
{
|
||||
$oVCard = \Sabre\VObject\Reader::read($sVCard);
|
||||
}
|
||||
catch (\Exception $oExc) {};
|
||||
catch (\Exception $oExc)
|
||||
{
|
||||
if ($oLogger)
|
||||
{
|
||||
$oLogger->WriteException($oExc);
|
||||
$oLogger->WriteDump($sVCard);
|
||||
}
|
||||
|
||||
$this->IdContactStr = $sUid;
|
||||
}
|
||||
|
||||
$aProperties = array();
|
||||
if ($oVCard)
|
||||
|
||||
@@ -91,12 +91,17 @@ class PdoAddressBook
|
||||
if ($aItem && isset($aItem['id_contact'], $aItem['id_contact_str'], $aItem['changed'], $aItem['deleted'], $aItem['etag']) &&
|
||||
!empty($aItem['id_contact_str']))
|
||||
{
|
||||
$aResult[$aItem['id_contact_str']] = array(
|
||||
$sKeyID = $aItem['id_contact_str'];
|
||||
|
||||
$aResult[$sKeyID] = array(
|
||||
'deleted' => '1' === (string) $aItem['deleted'],
|
||||
'id_contact' => $aItem['id_contact'],
|
||||
'uid' => $sKeyID,
|
||||
'etag' => $aItem['etag'],
|
||||
'changed' => (int) $aItem['changed'],
|
||||
'deleted' => '1' === (string) $aItem['deleted']
|
||||
);
|
||||
|
||||
$aResult[$sKeyID]['changed_'] = \gmdate('c', $aResult[$sKeyID]['changed']);
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -141,12 +146,15 @@ class PdoAddressBook
|
||||
$sKeyID = \preg_replace('/\.vcf$/i', '', $sVcfFileName);
|
||||
|
||||
$mResult[$sKeyID] = array(
|
||||
'deleted' => false,
|
||||
'uid' => $sKeyID,
|
||||
'vcf' => $sVcfFileName,
|
||||
'etag' => \trim(\trim($aItem['{dav:}getetag']), '"\''),
|
||||
'lastmodified' => $aItem['{dav:}getlastmodified'],
|
||||
'changed' => \MailSo\Base\DateTimeHelper::ParseRFC2822DateString($aItem['{dav:}getlastmodified']),
|
||||
'deleted' => false
|
||||
'changed' => \MailSo\Base\DateTimeHelper::ParseRFC2822DateString($aItem['{dav:}getlastmodified'])
|
||||
);
|
||||
|
||||
$mResult[$sKeyID]['changed_'] = \gmdate('c', $mResult[$sKeyID]['changed']);
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -310,7 +318,7 @@ class PdoAddressBook
|
||||
}
|
||||
|
||||
$oResponse = $this->davClientRequest($oClient, 'PUT',
|
||||
$sPath.$oContact->CardDavNameUri(), $oContact->ToVCard($sExsistensBody));
|
||||
$sPath.$oContact->CardDavNameUri(), $oContact->ToVCard($sExsistensBody, $this->oLogger)."\r\n\r\n");
|
||||
|
||||
if ($oResponse && isset($oResponse['headers'], $oResponse['headers']['etag']))
|
||||
{
|
||||
@@ -358,8 +366,9 @@ class PdoAddressBook
|
||||
$oContact = new \RainLoop\Providers\AddressBook\Classes\Contact();
|
||||
}
|
||||
|
||||
$oContact->PopulateByVCard($sBody,
|
||||
!empty($oResponse['headers']['etag']) ? \trim(\trim($oResponse['headers']['etag']), '"\'') : '');
|
||||
$oContact->PopulateByVCard($aData['uid'], $sBody,
|
||||
!empty($oResponse['headers']['etag']) ? \trim(\trim($oResponse['headers']['etag']), '"\'') : '',
|
||||
$this->oLogger);
|
||||
|
||||
$this->ContactSave($sEmail, $oContact);
|
||||
unset($oContact);
|
||||
|
||||
@@ -483,7 +483,7 @@ class Client {
|
||||
if ($mr > 0)
|
||||
{
|
||||
$newurl = curl_getinfo($curl, CURLINFO_EFFECTIVE_URL);
|
||||
|
||||
|
||||
$rcurl = curl_copy_handle($curl);
|
||||
curl_setopt($rcurl, CURLOPT_HEADER, true);
|
||||
curl_setopt($rcurl, CURLOPT_NOBODY, true);
|
||||
@@ -512,7 +512,7 @@ class Client {
|
||||
}
|
||||
}
|
||||
} while ($code && --$mr);
|
||||
|
||||
|
||||
curl_close($rcurl);
|
||||
if ($mr > 0)
|
||||
{
|
||||
|
||||
@@ -12,9 +12,9 @@
|
||||
<div class="b-content opacity-on-panel-disabled" data-bind="nano: true">
|
||||
<div class="content g-scrollbox">
|
||||
<div class="content-wrapper">
|
||||
<div data-bind="template: { name: 'MailFolderListSystemItem', foreach: folderListSystem }"></div>
|
||||
<div class="b-folders-system" data-bind="template: { name: 'MailFolderListSystemItem', foreach: folderListSystem }"></div>
|
||||
<hr class="b-list-delimiter" />
|
||||
<div data-bind="template: { name: 'MailFolderListItem', foreach: folderList }"></div>
|
||||
<div class="b-folders-user" data-bind="template: { name: 'MailFolderListItem', foreach: folderList }"></div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
@@ -189,7 +189,8 @@
|
||||
<a class="btn btn-thin btn-dark-disabled-border dropdown-toggle" id="thread-list-view-dropdown-id" data-toggle="dropdown"
|
||||
href="#" tabindex="-1" data-tooltip-placement="bottom">
|
||||
<!--href="#" tabindex="-1" data-tooltip-placement="bottom" data-bind="command: threadListCommand">-->
|
||||
<b data-bind="text: viewThreadsControlDesc"></b>
|
||||
<i class="icon-list"></i>
|
||||
<!--<b data-bind="text: viewThreadsControlDesc"></b>-->
|
||||
</a>
|
||||
<a class="btn btn-thin" data-tooltip-placement="bottom" data-bind="command: threadBackCommand">
|
||||
<i class="icon-right-middle"></i>
|
||||
@@ -218,9 +219,9 @@
|
||||
<span class="flagParent">
|
||||
<i class="icon-star-empty flagOff" data-bind="css: {'icon-star flagOn': viewIsFlagged, 'icon-star-empty flagOff': !viewIsFlagged()}"></i>
|
||||
</span>
|
||||
<!-- <span class="thread-counter" data-bind="visible: viewThreadsControlVisibility"
|
||||
<span class="thread-counter" data-bind="visible: viewThreadsControlVisibility"
|
||||
style="font-weight: normal; margin-right: 5px">(<span
|
||||
data-bind="text: viewThreadsControlDesc"></span>)</span>-->
|
||||
data-bind="text: viewThreadsControlDesc"></span>)</span>
|
||||
<b style="color: red; margin-right: 5px" data-bind="visible: viewIsImportant">!</b>
|
||||
<span class="subject" data-bind="text: viewSubject, title: viewSubject"></span>
|
||||
<span class="i18n emptySubjectText" data-i18n-text="MESSAGE/EMPTY_SUBJECT_TEXT"></span>
|
||||
|
||||
Reference in New Issue
Block a user