summary | shortlog | log | commit | commitdiff | tree
raw | patch | inline | side by side (parent: cfcebaf)
raw | patch | inline | side by side (parent: cfcebaf)
author | hickert <hickert@594d385d-05f5-0310-b6e9-bd551577e9d8> | |
Wed, 10 Dec 2008 10:01:48 +0000 (10:01 +0000) | ||
committer | hickert <hickert@594d385d-05f5-0310-b6e9-bd551577e9d8> | |
Wed, 10 Dec 2008 10:01:48 +0000 (10:01 +0000) |
git-svn-id: https://oss.gonicus.de/repositories/gosa/trunk@13235 594d385d-05f5-0310-b6e9-bd551577e9d8
gosa-plugins/mail/personal/mail/class_mail-methods.inc | patch | blob | history | |
gosa-plugins/mail/personal/mail/class_mailAccount.inc | patch | blob | history |
diff --git a/gosa-plugins/mail/personal/mail/class_mail-methods.inc b/gosa-plugins/mail/personal/mail/class_mail-methods.inc
index 768515c52deed79fe9399d1bf37230367921634c..634cb2a7d370c19991e046268a7cc63063e4700b 100644 (file)
protected $user_prefix = "user.";
protected $share_prefix = "share.";
+ /* Account ID creation */
+ protected $user_id = "__PREFIX____UATTRIB__";
+ protected $share_id = "__PREFIX____UATTRIB__";
+
/* Create accounts in cyrus style with '/' instead of '.' */
protected $cyrusUseSlashes= FALSE;
{
/* Build account identicator */
if($this->type == "user"){
- $str = $this->user_prefix;
+ $prefix = $this->user_prefix;
+ $acc_string = $this->user_id;
}else{
- $str = $this->share_prefix;
+ $prefix = $this->share_prefix;
+ $acc_string = $this->share_id;
}
/* Create account prefix and respect "cyrusUseSlashes"
*/
$uattrib = $this->uattrib;
if($this->cyrusUseSlashes){
- $str = preg_replace('/([^\\\\])\./',"\\1/",$str);
+ $prefix = preg_replace('/([^\\\\])\./',"\\1/",$prefix);
+ }
+ $prefix = preg_replace("/\\\\([\.\/])/","\\1",$prefix);
+
+ $domain = $mailpart = "";
+ if(preg_match("/\@/",$this->parent->$uattrib)){
+ $mailpart = preg_replace("/\@.*$/","",$this->parent->$uattrib);
+ $domain = preg_replace("/^[^\@]*+\@(.*)$/","\\1",$this->parent->$uattrib);
}
- $str = preg_replace("/\\\\([\.\/])/","\\1",$str);
- $str = trim(strtolower($str . $this->parent->$uattrib));
- if($this->account_id != $str){
- $this->account_id = $str;
- @DEBUG (DEBUG_MAIL, __LINE__, __FUNCTION__, __FILE__,"", "<b>MAIL:</b> AccountID generated: <b>".$str."</b>");
+ /* Create account_id
+ */
+ $from = array("/__CN__/","/__UID__/","/__PREFIX__/","/__UATTRIB__/","/__DOMAIN__/","/__MAILPART__/");
+ $to = array($this->parent->cn,$this->parent->uid,$prefix,$this->parent->$uattrib, $domain, $mailpart);
+
+ $acc_id = trim(strtolower(preg_replace($from,$to,$acc_string)));
+
+ if($this->account_id != $acc_id){
+ $this->account_id = $acc_id;
+ @DEBUG (DEBUG_MAIL, __LINE__, __FUNCTION__, __FILE__,"", "<b>MAIL:</b> AccountID generated: <b>".$acc_id."</b>");
}
}
}
/* Build account identicator */
- if($type == ""){
- $type = $this->type;
- }
- if($type == "user"){
- $str = $this->user_prefix;
+ if($this->type == "user"){
+ $prefix = $this->user_prefix;
+ $acc_string = $this->user_id;
}else{
- $str = $this->share_prefix;
- }
+ $prefix = $this->share_prefix;
+ $acc_string = $this->share_id;
+ }
/* Create account prefix and respect "cyrusUseSlashes"
Do not replace escaped dots for cyrusUseSlashes.
*/
$uattrib = $this->uattrib;
if($this->cyrusUseSlashes){
- $str = preg_replace('/([^\\\\])\./',"\\1/",$str);
+ $prefix = preg_replace('/([^\\\\])\./',"\\1/",$prefix);
}
- $str = preg_replace("/\\\\([\.\/])/","\\1",$str);
- $str = trim(strtolower($str . $this->parent->$uattrib));
+ $prefix = preg_replace("/\\\\([\.\/])/","\\1",$prefix);
+ $domain = $mailpart = "";
if(preg_match("/\@/",$this->parent->$uattrib)){
- list($mail,$domain) = split("\@",$this->parent->$uattrib);
- $str = trim(strtolower($str . $mail . $folder . "@" . $domain));
+ list($mailpart,$domain) = split("\@",$this->parent->$uattrib);
+ }
+
+ /* Create account_id
+ */
+ $from = array("/__CN__/","/__UID__/","/__PREFIX__/","/__UATTRIB__/","/__DOMAIN__/","/__MAILPART__/");
+ $to = array($this->parent->cn,$this->parent->uid,$prefix,$this->parent->$uattrib, $domain, $mailpart);
+
+ $acc_id = trim(strtolower(preg_replace($from,$to,$acc_string)));
+
+ if(preg_match("/\@/",$acc_id)){
+ list($mail,$domain) = split("\@",$acc_id);
+ $str = trim(strtolower($mail . $folder . "@" . $domain));
}else{
- $str = trim(strtolower($str . $this->parent->$uattrib));
+ $str = trim(strtolower($acc_id . $folder));
}
return($str) ;
}
diff --git a/gosa-plugins/mail/personal/mail/class_mailAccount.inc b/gosa-plugins/mail/personal/mail/class_mailAccount.inc
index 1516411ab1ab004604809cc837bba2d82cffc08b..d346f242aa82923661de7e7e04f65501cc461e34 100644 (file)
var $multiple_support = TRUE;
+ var $uid = "";
+ var $cn = "";
+
+
/*! \brief Initialize the mailAccount
*/
function __construct (&$config, $dn= NULL)
{
plugin::plugin($config,$dn);
+ /* Get attributes from parent object
+ */
+ foreach(array("uid","cn") as $attr){
+ if(isset($this->parent->by_object['group']) && isset($this->parent->by_object['group']->$attr)){
+ $this->$attr = &$this->parent->by_object['group']->$attr;
+ }elseif(isset($this->attrs[$attr])){
+ $this->$attr = $this->attrs[$attr][0];
+ }
+ }
+
/* Intialize the used mailMethod
*/
$tmp = new mailMethod($config,$this);