From cc3c9e6fac8fc73a1101611e83bc7b6bd5291c18 Mon Sep 17 00:00:00 2001 From: hickert Date: Wed, 10 Dec 2008 08:19:40 +0000 Subject: [PATCH] Updated DEBUG output for cyrus mail method git-svn-id: https://oss.gonicus.de/repositories/gosa/trunk@13219 594d385d-05f5-0310-b6e9-bd551577e9d8 --- .../mail/class_mail-methods-cyrus.inc | 46 ++++++++----------- 1 file changed, 18 insertions(+), 28 deletions(-) diff --git a/gosa-plugins/mail/personal/mail/class_mail-methods-cyrus.inc b/gosa-plugins/mail/personal/mail/class_mail-methods-cyrus.inc index 5f958c930..4c81f9cfd 100644 --- a/gosa-plugins/mail/personal/mail/class_mail-methods-cyrus.inc +++ b/gosa-plugins/mail/personal/mail/class_mail-methods-cyrus.inc @@ -33,7 +33,7 @@ class mailMethodCyrus extends mailMethod{ if (!isset($this->ServerList[$this->MailServer])){ $this->error = _("Mail server for this account is invalid!"); @DEBUG (DEBUG_MAIL, __LINE__, __FUNCTION__, __FILE__, - "The selected mail server '".$this->MailServer."' is invalid.",""); + "IMAP: The selected mail server '".$this->MailServer."' is invalid.",""); return(FALSE); } else { $cfg= $this->ServerList[$this->MailServer]; @@ -74,9 +74,9 @@ class mailMethodCyrus extends mailMethod{ $list = @imap_listmailbox($this->imap_handle, $cfg["connect"], $this->account_id); $res = is_array($list) && count($list); if($res){ - @DEBUG (DEBUG_MAIL, __LINE__, __FUNCTION__, __FILE__,"","Account exists in imap server."); + @DEBUG (DEBUG_MAIL, __LINE__, __FUNCTION__, __FILE__,"","IMAP: Account exists in imap server."); }else{ - @DEBUG (DEBUG_MAIL, __LINE__, __FUNCTION__, __FILE__,"","Account seems NOT to exists in imap server."); + @DEBUG (DEBUG_MAIL, __LINE__, __FUNCTION__, __FILE__,"","IMAP: Account seems NOT to exists in imap server."); } return($res); } @@ -142,10 +142,10 @@ class mailMethodCyrus extends mailMethod{ $quota = "(".$this->quotaUsage." / ".$this->quotaValue.")"; } @DEBUG (DEBUG_MAIL, __LINE__, __FUNCTION__, __FILE__, $quota , - "Successfully received account quota"); + "IMAP: Successfully received account quota"); }else{ @DEBUG (DEBUG_MAIL, __LINE__, __FUNCTION__, __FILE__, imap_last_error() , - "Failed to receive account quota"); + "IMAP: Failed to receive account quota"); } } @@ -196,11 +196,11 @@ class mailMethodCyrus extends mailMethod{ msg_dialog::display(_("IMAP error"), sprintf(_("Cannot modify IMAP mailbox quota: %s"), '

'.imap_last_error().''), ERROR_DIALOG); @DEBUG (DEBUG_MAIL, __LINE__, __FUNCTION__, __FILE__, "".$this->account_id.": (".$debug_number.")" , - "Set account quota on server '".$this->MailServer."' ".imap_last_error().""); + "IMAP: Set account quota on server '".$this->MailServer."' ".imap_last_error().""); return (FALSE); } @DEBUG (DEBUG_MAIL, __LINE__, __FUNCTION__, __FILE__, "".$this->account_id.": (".$debug_number.")" , - "Set account quota on server :".$this->MailServer); + "IMAP: Set account quota on server :".$this->MailServer); return (TRUE); } @@ -220,7 +220,7 @@ class mailMethodCyrus extends mailMethod{ $list = imap_listmailbox($this->imap_handle, $cfg["connect"], $this->account_id); if ($list === FALSE){ @DEBUG (DEBUG_MAIL, __LINE__, __FUNCTION__, __FILE__, "".$this->account_id."" , - "Add/Update account on server :".$this->MailServer); + "IMAP: Add/Update account on server :".$this->MailServer); if (!imap_createmailbox($this->imap_handle, $cfg["connect"]. $this->account_id)){ $this->error = imap_last_error(); return(FALSE); @@ -296,11 +296,11 @@ class mailMethodCyrus extends mailMethod{ $result[] = $str; } @DEBUG (DEBUG_MAIL, __LINE__, __FUNCTION__, __FILE__,trim(implode($result,", "),", "), - "Received mailbox folders."); + "IMAP: Received mailbox folders."); $this->error = imap_last_error(); }else{ @DEBUG (DEBUG_MAIL, __LINE__, __FUNCTION__, __FILE__,imap_last_error(), - "Cannot receive mailbox folders."); + "IMAP: Cannot receive mailbox folders."); $this->error = imap_last_error(); return(array()); } @@ -324,7 +324,7 @@ class mailMethodCyrus extends mailMethod{ if (!function_exists('imap_getacl')){ $this->error = _("The module imap_getacl is not implemented!"); @DEBUG (DEBUG_MAIL, __LINE__, __FUNCTION__, __FILE__,"The imap_getacl module is missing!", - "Cannot set folder acls."); + "IMAP: Cannot set folder acls."); return($folder_acls); } @@ -361,7 +361,7 @@ class mailMethodCyrus extends mailMethod{ if (!function_exists('imap_getacl')){ $this->error = _("The module imap_getacl is not implemented!"); @DEBUG (DEBUG_MAIL, __LINE__, __FUNCTION__, __FILE__,"The imap_getacl module is missing!", - "Cannot set folder acls."); + "IMAP: Cannot set folder acls."); return(FALSE); } @@ -379,7 +379,7 @@ class mailMethodCyrus extends mailMethod{ $userid = strtolower($userid); imap_setacl ($this->imap_handle, $folder_id, $userid, ""); @DEBUG (DEBUG_MAIL, __LINE__, __FUNCTION__, __FILE__,$folder_id." -> ".$userid, - "Removing folder permissions."); + "IMAP: Removing folder permissions."); } } } @@ -391,7 +391,7 @@ class mailMethodCyrus extends mailMethod{ foreach ($permissions as $user => $acl){ imap_setacl ($this->imap_handle, $folder_id, $user, $acl); @DEBUG (DEBUG_MAIL, __LINE__, __FUNCTION__, __FILE__,$folder_id." -> ".$user.": ".$acl, - "Setting new folder permissions."); + "IMAP: Setting new folder permissions."); } } return(TRUE); @@ -421,9 +421,6 @@ class mailMethodCyrus extends mailMethod{ @DEBUG (DEBUG_MAIL, __LINE__, __FUNCTION__, __FILE__,$sieve->error_raw ,"SIEVE: login failed."); $this->error = $sieve->error_raw; return(FALSE); - }else{ - @DEBUG (DEBUG_MAIL, __LINE__, __FUNCTION__, __FILE__, "Options: ".$cfg["sieve_option"] , - "SIEVE: login successfull."); } /* Build spamlevel. Spamassassin tags mails with "*" for each integer @@ -442,12 +439,9 @@ class mailMethodCyrus extends mailMethod{ if(!$sieve->sieve_getscript("gosa")){ $this->error = sprintf(_("Cannot retrieve SIEVE script: %s"),to_string($sieve->error_raw)); @DEBUG (DEBUG_MAIL, __LINE__, __FUNCTION__, __FILE__,$sieve->error_raw , - "SIEVE: Connot read 'gosa' sieve script."); + "SIEVE: Connot read 'gosa' sieve script."); $this->error = $sieve->error_raw; return(FALSE); - }else{ - @DEBUG (DEBUG_MAIL, __LINE__, __FUNCTION__, __FILE__,$sieve->error_raw , - "SIEVE: Sieve script named 'gosa' found."); } $is_valid_script = FALSE; @@ -462,12 +456,12 @@ class mailMethodCyrus extends mailMethod{ if($is_valid_script || strlen($script) == 0 || empty($script)){ @DEBUG (DEBUG_MAIL, __LINE__, __FUNCTION__, __FILE__,"" , - "SIEVE: Sieve script 'gosa' was a valid GOsa script and will be replaced."); + "SIEVE: Sieve script 'gosa' was a valid GOsa script and will be replaced."); }else{ $new_name = "non_gosa_".date("Ymd_H-i-s"); $sieve->sieve_sendscript($new_name, $script); @DEBUG (DEBUG_MAIL, __LINE__, __FUNCTION__, __FILE__,$this->sieve->error_raw , - "SIEVE: Non GOsa sieve script. Creating backup of the current sieve script '".$new_name."'."); + "SIEVE: Non GOsa sieve script. Creating backup of the current sieve script '".$new_name."'."); } } } @@ -533,11 +527,8 @@ class mailMethodCyrus extends mailMethod{ if (!$sieve->sieve_sendscript("gosa", $script)){ $this->error = sprintf(_("Cannot store SIEVE script: %s"), to_string($sieve->error_raw)); @DEBUG (DEBUG_MAIL, __LINE__, __FUNCTION__, __FILE__, "Error was: ".to_string($sieve->error_raw) , - "SIEVE: Writing new Sieve script failed!"); + "SIEVE: Writing new Sieve script failed!"); return(FALSE); - }else{ - @DEBUG (DEBUG_MAIL, __LINE__, __FUNCTION__, __FILE__,"Successfully written!" , - "SIEVE: NEW sieve script 'gosa' contains '".strlen($script)."' characters."); } if(!$sieve->sieve_setactivescript("gosa")){ @@ -545,7 +536,6 @@ class mailMethodCyrus extends mailMethod{ return(FALSE); } - @DEBUG (DEBUG_MAIL, __LINE__, __FUNCTION__, __FILE__,"","SIEVE: Logout"); $sieve->sieve_logout(); } } -- 2.30.2