query imap server only, if account is active (or no smtp server configured)

This commit is contained in:
Ralf Becker 2012-10-11 10:27:19 +00:00
parent 76be223537
commit e1cf8a4911

View File

@ -769,26 +769,32 @@ class emailadmin_bo extends so_sql
return false; return false;
} }
/**
* Query user data from incomming (IMAP) and outgoing (SMTP) mail-server
*
* @param int $_accountID
* @return array
*/
function getUserData($_accountID) function getUserData($_accountID)
{ {
if($userProfile = $this->getUserProfile('felamimail')) { if($userProfile = $this->getUserProfile('felamimail')) {
$icServerKeys = array_keys((array)$userProfile->ic_server);
$profileID = array_shift($icServerKeys);
$icServer = $userProfile->getIncomingServer($profileID);
if(($icServer instanceof defaultimap) && $username = $GLOBALS['egw']->accounts->id2name($_accountID)) {
$icUserData = $icServer->getUserData($username);
}
$ogServerKeys = array_keys((array)$userProfile->og_server); $ogServerKeys = array_keys((array)$userProfile->og_server);
$profileID = array_shift($ogServerKeys); $profileID = array_shift($ogServerKeys);
$ogServer = $userProfile->getOutgoingServer($profileID); $ogServer = $userProfile->getOutgoingServer($profileID);
if(($ogServer instanceof defaultsmtp)) { if(($ogServer instanceof defaultsmtp)) {
$ogUserData = $ogServer->getUserData($_accountID); $ogUserData = $ogServer->getUserData($_accountID);
} }
// query imap server only, if account is active (or no smtp server configured)
if (!isset($ogUserData) || $ogUserData['accountStatus'] == 'active')
{
$icServerKeys = array_keys((array)$userProfile->ic_server);
$profileID = array_shift($icServerKeys);
$icServer = $userProfile->getIncomingServer($profileID);
if(($icServer instanceof defaultimap) && $username = $GLOBALS['egw']->accounts->id2name($_accountID)) {
$icUserData = $icServer->getUserData($username);
}
}
return (array)$icUserData + (array)$ogUserData; return (array)$icUserData + (array)$ogUserData;
} }
return false; return false;