Code

added schemacheck in index.php
[gosa.git] / include / class_mail-methods-kolab.inc
1 <?php
2 /*
3    This code is part of GOsa (https://gosa.gonicus.de)
4    Copyright (C) 2004  Cajus Pollmeier
6    This program is free software; you can redistribute it and/or modify
7    it under the terms of the GNU General Public License as published by
8    the Free Software Foundation; either version 2 of the License, or
9    (at your option) any later version.
11    This program is distributed in the hope that it will be useful,
12    but WITHOUT ANY WARRANTY; without even the implied warranty of
13    MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
14    GNU General Public License for more details.
16    You should have received a copy of the GNU General Public License
17    along with this program; if not, write to the Free Software
18    Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA
19  */
20 require_once("class_mail-methods-cyrus.inc");
22 class mailMethodKolab extends mailMethodCyrus
23 {
24   var $mbox= "-";
25   var $config;
26   var $gosaMailServer= "";
27   var $uattrib= "mail";
29   var $attribute_map= array("gosaMailAlternateAddress"  =>  "alias",
30                             "gosaMailQuota"             =>  "cyrus-userquota",
31                             "gosaMailServer"            =>  "kolabHomeServer");
33   function mailMethodKolab($config)
34   {
35     $this->config= $config->data['SERVERS']['IMAP'];
36   }
38   function updateMailbox($folder)
39   {
40   }
42   function setQuota($folder, $gosaMailQuota)
43   {
44     return (TRUE);
45   }
47   function setSharedFolderPermissions($folder, $permissions)
48   {
49   }
51   function deleteMailbox($folder)
52   {
53     return (TRUE);
54   }
57   function fixAttributesOnLoad(&$mailObject)
58   {
59     /* Convert attributes and objectClasses */
60     foreach ($this->attribute_map as $dest => $source){
61       if (isset($mailObject->attrs[$source])){
62         $mailObject->attrs[$dest]= $mailObject->attrs[$source];
63         unset ($mailObject->attrs[$source]);
64       }
65     }
67     /* Adjust server name if needed */
68     foreach ($mailObject->config->data['SERVERS']['IMAP'] as $srv => $dummy){
69       if (preg_match("%".$mailObject->attrs['gosaMailServer'][0]."$%", $srv)){
70         $mailObject->attrs['gosaMailServer']= array(0 => $srv, "count" => 1);
71         break;
72       }
73     }
74   }
77   function fixAttributesOnStore(&$mailObject)
78   {
79     /* Convert attributes and objectClasses */
80     foreach ($this->attribute_map as $source => $dest){
81       if (isset($mailObject->attrs[$source])){
82         $mailObject->attrs[$dest]= $mailObject->attrs[$source];
83         unset ($mailObject->attrs[$source]);
84       }
85     }
86     $objectclasses= array();
87     foreach ($mailObject->attrs['objectClass'] as $oc){
88       if ($oc !=  'kolabInetOrgPerson'){
89         $objectclasses[]= $oc;
90       }
91     }
92     $mailObject->attrs['objectClass']= $objectclasses;
93     $mailObject->attrs['objectClass'][]= 'kolabInetOrgPerson';
95     /* Remove imap:// tagging */
96     $mailObject->attrs['kolabHomeServer']= preg_replace('%imap://%', '', $mailObject->attrs['kolabHomeServer']);
97     $mailObject->attrs['gosaMailServer']= $mailObject->attrs['kolabHomeServer'];
98     $mailObject->attrs['kolabDeleteFlag']= array();
99   }
102   function fixAttributesOnRemove(&$mailObject)
103   {
104     /* Add attribute for object deletion and remove GOsa specific
105        values from entry. */
106     unset ($mailObject->attrs['mail']);
107     $mailObject->attrs['kolabDeleteFlag']= preg_replace('%imap://%', '', $mailObject->gosaMailServer);
108   }
112 // vim:tabstop=2:expandtab:shiftwidth=2:filetype=php:syntax:ruler:
113 ?>