attempt to copy/move mails between servers; failed so far: no connection to the targetserver is even attempted by horde library

This commit is contained in:
Klaus Leithoff 2013-12-18 12:14:18 +00:00
parent efc237024c
commit c0d749ceac
2 changed files with 11 additions and 3 deletions

View File

@ -2892,10 +2892,11 @@ class mail_bo
* @param string $currentFolder
* @param boolean $returnUIDs - control wether or not the action called should return the new uids
* caveat: not all servers do support that
* @param int $_targetProfileID - target profile ID, should only be handed over when target server is differen from source
*
* @return mixed/bool true,false or new uid
*/
function moveMessages($_foldername, $_messageUID, $deleteAfterMove=true, $currentFolder = Null, $returnUIDs = false)
function moveMessages($_foldername, $_messageUID, $deleteAfterMove=true, $currentFolder = Null, $returnUIDs = false, $_targetProfileID = Null)
{
$msglist = '';
@ -2917,6 +2918,12 @@ class mail_bo
$uidsToMove = new Horde_Imap_Client_Ids();
$uidsToMove->add($_messageUID);
}
if (!is_null($_targetProfileID) && $_targetProfileID !== $this->icServer->ImapServerId)
{
$target = emailadmin_account::read($_targetProfileID)->imapServer();
$_foldername = $target->getMailbox($_foldername);
error_log(__METHOD__.__LINE__.' Sourceserver:'.$this->icServer->ImapServerId.' TargetServer:'.$_targetProfileID.' TargetFolderObject'.array2string($_foldername));
}
try
{

View File

@ -3701,7 +3701,7 @@ blockquote[type=cite] {
$_folderName = $this->mail_bo->decodeEntityFolderName($_folderName);
// only copy or move are supported as method
if (!($_copyOrMove=='copy' || $_copyOrMove=='move')) $_copyOrMove='copy';
list($profileID,$targetFolder) = explode(self::$delimiter,$_folderName,2);
list($targetProfileID,$targetFolder) = explode(self::$delimiter,$_folderName,2);
if ($_messageList=='all' || !empty($_messageList['msg']))
{
@ -3714,6 +3714,7 @@ blockquote[type=cite] {
{
$uidA = self::splitRowID($_messageList['msg'][0]);
$folder = $uidA['folder']; // all messages in one set are supposed to be within the same folder
$sourceProfileID = $uidA['profileID'];
}
foreach($_messageList['msg'] as $rowID)
{
@ -3721,7 +3722,7 @@ blockquote[type=cite] {
$messageList[] = $hA['msgUID'];
}
$this->mail_bo->moveMessages($targetFolder,$messageList,($_copyOrMove=='copy'?false:true),$folder);
$this->mail_bo->moveMessages($targetFolder,$messageList,($_copyOrMove=='copy'?false:true),$folder,false,($targetProfileID!=$sourceProfileID?$targetProfileID:null));
$response = egw_json_response::get();
$response->call('egw_refresh',($_copyOrMove=='copy'?lang('copied %1 message(s) from %2 to %3',count($messageList),$folder,$targetFolder):lang('moved %1 message(s) from %2 to %3',count($messageList),$folder,$targetFolder)),'mail');
}