mirror of
https://github.com/EGroupware/egroupware.git
synced 2024-12-25 16:19:00 +01:00
use one function to get the data reqired on ItemOperationsGetAttachmentData AND/ot GetAttachmentData calls
This commit is contained in:
parent
61b99bc32e
commit
4363e7289a
@ -172,6 +172,22 @@ class mail_zpush implements activesync_plugin_write, activesync_plugin_sendmail,
|
||||
'default' => 'sendifnocalnotif',
|
||||
'admin' => False,
|
||||
);
|
||||
/*
|
||||
$settings['mail-useSignature'] = array(
|
||||
'type' => 'select',
|
||||
'label' => 'control if and which available signature is added to outgoing mails',
|
||||
'name' => 'mail-useSignature',
|
||||
'help' => 'control the use of signatures',
|
||||
'values' => array(
|
||||
'sendifnocalnotif'=>'only send if there is no notification in calendar',
|
||||
'send'=>'yes, always add EGroupware signatures to outgoing mails',
|
||||
'nosend'=>'no, never add EGroupware signatures to outgoing mails',
|
||||
),
|
||||
'xmlrpc' => True,
|
||||
'default' => 'nosend',
|
||||
'admin' => False,
|
||||
);
|
||||
*/
|
||||
return $settings;
|
||||
}
|
||||
|
||||
@ -1190,9 +1206,39 @@ class mail_zpush implements activesync_plugin_write, activesync_plugin_sendmail,
|
||||
*
|
||||
* @param string $fid - id
|
||||
* @param string $attname - should contain (folder)id
|
||||
* @return true, prints the content of the attachment
|
||||
* @return SyncItemOperationsAttachment-object
|
||||
*/
|
||||
function GetAttachmentData($fid,$attname) {
|
||||
ZLog::Write(LOGLEVEL_DEBUG,__METHOD__.": $fid (attname: '$attname')");
|
||||
return $this->_GetAttachmentData($fid,$attname);
|
||||
}
|
||||
|
||||
/**
|
||||
* ItemOperationsGetAttachmentData
|
||||
* Should return attachment data for the specified attachment. The passed attachment identifier is
|
||||
* the exact string that is returned in the 'AttName' property of an SyncAttachment. So, you should
|
||||
* encode any information you need to find the attachment in that 'attname' property.
|
||||
*
|
||||
* @param string $fid - id
|
||||
* @param string $attname - should contain (folder)id
|
||||
* @return SyncItemOperationsAttachment-object
|
||||
*/
|
||||
function ItemOperationsGetAttachmentData($fid,$attname) {
|
||||
ZLog::Write(LOGLEVEL_DEBUG,__METHOD__.": $fid (attname: '$attname')");
|
||||
return $this->_GetAttachmentData($fid,$attname);
|
||||
}
|
||||
|
||||
/**
|
||||
* _GetAttachmentData implements
|
||||
* -ItemOperationsGetAttachmentData
|
||||
* -GetAttachmentData
|
||||
*
|
||||
* @param string $fid - id
|
||||
* @param string $attname - should contain (folder)id
|
||||
* @return SyncItemOperationsAttachment-object
|
||||
*/
|
||||
private function _GetAttachmentData($fid,$attname)
|
||||
{
|
||||
ZLog::Write(LOGLEVEL_DEBUG,__METHOD__.": $fid (attname: '$attname')".function_backtrace());
|
||||
//error_log(__METHOD__.__LINE__." Fid: $fid (attname: '$attname')");
|
||||
list($folderid, $id, $part) = explode(":", $attname);
|
||||
@ -1215,38 +1261,6 @@ class mail_zpush implements activesync_plugin_write, activesync_plugin_sendmail,
|
||||
return $SIOattachment;
|
||||
}
|
||||
|
||||
/**
|
||||
* ItemOperationsGetAttachmentData
|
||||
* Should return attachment data for the specified attachment. The passed attachment identifier is
|
||||
* the exact string that is returned in the 'AttName' property of an SyncAttachment. So, you should
|
||||
* encode any information you need to find the attachment in that 'attname' property.
|
||||
*
|
||||
* @param string $fid - id
|
||||
* @param string $attname - should contain (folder)id
|
||||
* @return SyncItemOperationsAttachment-object
|
||||
*/
|
||||
function ItemOperationsGetAttachmentData($fid,$attname) {
|
||||
ZLog::Write(LOGLEVEL_DEBUG,__METHOD__.": $fid (attname: '$attname')".function_backtrace());
|
||||
//error_log(__METHOD__.__LINE__." Fid: $fid (attname: '$attname')");
|
||||
list($folderid, $id, $part) = explode(":", $attname);
|
||||
|
||||
$this->splitID($folderid, $account, $folder);
|
||||
|
||||
if (!isset($this->mail)) $this->mail = Mail::getInstance(false,self::$profileID,true,false,true);
|
||||
|
||||
$this->mail->reopen($folder);
|
||||
$attachment = $this->mail->getAttachment($id,$part,0,false,true,$folder);
|
||||
$SIOattachment = new SyncItemOperationsAttachment();
|
||||
fseek($attachment['attachment'], 0, SEEK_SET); // z-push requires stream seeked to start
|
||||
$SIOattachment->data = $attachment['attachment'];
|
||||
if (isset($attachment['type']) )
|
||||
$SIOattachment->contenttype = $attachment['type'];
|
||||
|
||||
unset($attachment);
|
||||
|
||||
return $SIOattachment;
|
||||
}
|
||||
|
||||
/**
|
||||
* StatMessage should return message stats, analogous to the folder stats (StatFolder). Entries are:
|
||||
* 'id' => Server unique identifier for the message. Again, try to keep this short (under 20 chars)
|
||||
|
Loading…
Reference in New Issue
Block a user