summary | shortlog | log | commit | commitdiff | tree
raw | patch | inline | side by side (parent: 0cc79e0)
raw | patch | inline | side by side (parent: 0cc79e0)
author | hickert <hickert@594d385d-05f5-0310-b6e9-bd551577e9d8> | |
Mon, 19 Jan 2009 10:10:09 +0000 (10:10 +0000) | ||
committer | hickert <hickert@594d385d-05f5-0310-b6e9-bd551577e9d8> | |
Mon, 19 Jan 2009 10:10:09 +0000 (10:10 +0000) |
git-svn-id: https://oss.gonicus.de/repositories/gosa/trunk@13364 594d385d-05f5-0310-b6e9-bd551577e9d8
gosa-plugins/uwimap/contrib/procmail-discard.txt | [new file with mode: 0644] | patch | blob |
gosa-plugins/uwimap/contrib/procmail-footer.txt | [new file with mode: 0644] | patch | blob |
gosa-plugins/uwimap/contrib/procmail-header.txt | [new file with mode: 0644] | patch | blob |
gosa-plugins/uwimap/contrib/procmail-spam.txt | [new file with mode: 0644] | patch | blob |
gosa-plugins/uwimap/contrib/procmail-vacation.txt | [new file with mode: 0644] | patch | blob |
gosa-plugins/uwimap/personal/mail/class_mail-methods-uwimap.inc | [new file with mode: 0644] | patch | blob |
gosa-plugins/uwimap/plugin.dsc | [new file with mode: 0644] | patch | blob |
diff --git a/gosa-plugins/uwimap/contrib/procmail-discard.txt b/gosa-plugins/uwimap/contrib/procmail-discard.txt
--- /dev/null
@@ -0,0 +1,4 @@
+# Discard any local messages
+:0 :
+/dev/null
+
diff --git a/gosa-plugins/uwimap/contrib/procmail-footer.txt b/gosa-plugins/uwimap/contrib/procmail-footer.txt
--- /dev/null
@@ -0,0 +1,10 @@
+# Care for cleanups
+
+# Remove stale vacation cache
+:0
+* ! \$GOSA_VACATION ?? yes
+* ! ? test -f \$VACATION_CACHE
+{
+ rm -f \$VACATION_CACHE
+}
+
diff --git a/gosa-plugins/uwimap/contrib/procmail-header.txt b/gosa-plugins/uwimap/contrib/procmail-header.txt
--- /dev/null
@@ -0,0 +1,15 @@
+#*** Procmail script for $user ***
+
+DROPPRIVS=true
+
+
+# Include variable definitions from procmail library
+INCLUDERC=\$PMSRC/pm-javar.rc
+
+
+# Check for empty body and discard
+:0 B:
+*\$ ! \$NSPC
+/dev/null
+
+
diff --git a/gosa-plugins/uwimap/contrib/procmail-spam.txt b/gosa-plugins/uwimap/contrib/procmail-spam.txt
--- /dev/null
@@ -0,0 +1,34 @@
+# procmail spam handling
+GOSA_SPAM="yes"
+
+:0
+* ! ^From:.*($addrlist)
+* ! FROM_DAEMON
+{
+
+ # Do not add extra headers. This saves external shell call
+ # (formail). Also do not try to kill the message content,
+ # again saving one external call (awk). With these, the
+ # recipe is faster and more CPU friendly.
+ PM_JA_UBE_HDR = ""
+ JA_UBE_ATTACHMENT_ILLEGAL_KILL = "no"
+ JA_UBE_FLAG_FROM_NSLOOKUP = "no"
+
+ INCLUDERC = \$PMSRC/pm-jaube.rc
+
+ # Variable "ERROR" is set if message was UBE, record error
+ # to log file with "()\/"
+
+ :0 :
+ * ERROR ?? ()\/[a-z].*
+ {
+ # Don't save those *.exe, *.zip UBE attachements
+ :0
+ * ERROR ?? Attachment-FileIllegal
+ /dev/null
+
+ :0 :
+ $spambox
+ }
+}
+
diff --git a/gosa-plugins/uwimap/contrib/procmail-vacation.txt b/gosa-plugins/uwimap/contrib/procmail-vacation.txt
--- /dev/null
@@ -0,0 +1,35 @@
+# Vacation message
+GOSA_VACATION=yes
+VACATION_CACHE=\$HOME/.vacation.cache
+
+:0
+* ^TO_$mail
+* ! ^FROM_DAEMON
+* ! ^X-Loop: ($addrlist)
+* ! ^Precedence:.*(bulk|list|junk)
+{
+ :0 c: \$HOME/.vacation.\$LOCKEXT
+ * ! ? formail -rD 8192 \$VACATION_CACHE
+ {
+ # Compose reply and add some basic headers
+ :0 fhw
+ | formail -rt \
+ -A "Precedence: junk" \
+ -A "X-Loop: $mail"
+
+ :0 a # Formail succeeded
+ {
+ # Change subject
+ :0 fhw
+ * ^Subject: *\/[^ ].*
+ | formail -I "Subject: vacation (was: \$MATCH)"
+
+ :0 fb # put message to body
+ | echo -n "$vacmsg"
+
+ :0 # Send it
+ | \$SENDMAIL
+ }
+ }
+}
+
diff --git a/gosa-plugins/uwimap/personal/mail/class_mail-methods-uwimap.inc b/gosa-plugins/uwimap/personal/mail/class_mail-methods-uwimap.inc
--- /dev/null
@@ -0,0 +1,146 @@
+<?php
+/*
+ This code is part of GOsa (https://gosa.gonicus.de)
+ Copyright (C) 2004 Cajus Pollmeier
+
+ This program is free software; you can redistribute it and/or modify
+ it under the terms of the GNU General Public License as published by
+ the Free Software Foundation; either version 2 of the License, or
+ (at your option) any later version.
+
+ This program is distributed in the hope that it will be useful,
+ but WITHOUT ANY WARRANTY; without even the implied warranty of
+ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ GNU General Public License for more details.
+
+ You should have received a copy of the GNU General Public License
+ along with this program; if not, write to the Free Software
+ Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
+ */
+
+class mailMethodUwimap extends mailMethod{
+
+ protected $ServerList = array();
+ protected $imap_handle = NULL;
+ protected $quota_loaded = FALSE;
+
+ /* Allow modification of account_ids for existing mail accounts */
+ protected $modifyableMail = FALSE;
+
+ /* Allow modification of the mail server attribute existing mail accounts */
+ protected $modifyableServer = FALSE;
+
+ /* Enforces same value for 'mail' as used for 'cn' */
+ protected $mailEqualsCN = FALSE;
+
+ protected $enableDomainSelection= FALSE;
+ protected $enableQuota = FALSE;
+ protected $enableSieveManager = FALSE;
+ protected $enableVacationRange = FALSE;
+ protected $enableFolderTypes = FALSE;
+
+ /* the attribute used to create accounts */
+ protected $uattrib = "uid"; // Naming attribute for accounts, e.g. imap.
+
+ /* The account prefixes, keep the '.' here! See FAQ cyrusUseSlashes */
+ protected $user_prefix = "~.";
+ protected $share_prefix = "share.";
+
+ protected $procmaildir = "";
+
+ protected function init()
+ {
+ mailMethod::init();
+ if(isset($this->config->data['SERVERS']['IMAP'])){
+ $this->ServerList = $this->config->data['SERVERS']['IMAP'];
+ }
+
+ /* Check for required PROCMAIL_PATH configuration
+ */
+ if($this->config->get_cfg_value("procMailPath","") == ""){
+ msg_dialog::display(_("Configuration error"),msgPool::invalidConfigurationAttribute("procMailPath"), ERROR_DIALOG);
+ $this->procmaildir = "";
+ }else{
+ $this->procmaildir = $this->config->data['MAIN']['PROCMAIL_PATH'];
+ }
+ }
+
+
+ public function saveSieveSettings()
+ {
+ if(empty($this->procmaildir)){
+ @DEBUG (DEBUG_MAIL, __LINE__, __FUNCTION__, __FILE__, "",
+ "<b>MAIL</b>: Skippend writting scripts, 'procMailPath' is not configured");
+ return;
+ }
+
+ mailMethod::saveSieveSettings();
+ /* Map attribute from parent class
+ */
+ $mail = $this->parent->mail;
+ $gosaMailDeliveryMode = $this->parent->gosaMailDeliveryMode;
+ $gosaMailAlternateAddress = $this->parent->gosaMailAlternateAddress;
+ $gosaMailMaxSize = $this->parent->gosaMailMaxSize;
+ $gosaSpamMailbox = $this->parent->gosaSpamMailbox;
+ $gosaSpamSortLevel = $this->parent->gosaSpamSortLevel;
+ $gosaVacationMessage = $this->parent->gosaVacationMessage;
+
+ $recipe = "";
+ $addrlist = $mail;
+ foreach ($gosaMailAlternateAddress as $val){
+ $addrlist .= "|$val";
+ }
+ $user = $this->getUAttribValue();
+
+ /* Only create a new one, if it is not empty */
+ if (is_integer(strpos($gosaMailDeliveryMode, "R")) ||
+ is_integer(strpos($gosaMailDeliveryMode, "C")) ||
+ !is_integer(strpos($gosaMailDeliveryMode, "L")) ||
+ is_integer(strpos($gosaMailDeliveryMode, "V")) ||
+ is_integer(strpos($gosaMailDeliveryMode, "S"))) {
+ $text= implode ("", file(CONFIG_DIR."/procmail-header.txt"));
+ $text = preg_replace('/"/', '\\"', $text);
+ eval ("\$recipe.=\"$text\";");
+ }
+
+ /* Add anti-spam variables */
+ if (is_integer(strpos($gosaMailDeliveryMode, "S"))) {
+ $spambox = $gosaSpamMailbox;
+ $spamlevel = $gosaSpamSortLevel;
+ $text= implode ("", file(CONFIG_DIR."/procmail-spam.txt"));
+ $text = preg_replace('/"/', '\\"', $text);
+ eval ("\$recipe.=\"$text\";");
+ }
+
+ /* Add vacation recipe */
+ if (is_integer(strpos($gosaMailDeliveryMode, "V"))) {
+ $vacmsg = $gosaVacationMessage;
+ $text= implode ("", file(CONFIG_DIR."/procmail-vacation.txt"));
+ $text = preg_replace('/"/', '\\"', $text);
+ eval ("\$recipe.=\"$text\";");
+ }
+
+ /* Check if no local delivery is wanted */
+ if (!is_integer(strpos($gosaMailDeliveryMode, "L"))) {
+ $text= implode ("", file(CONFIG_DIR."/procmail-discard.txt"));
+ $text = preg_replace('/"/', '\\"', $text);
+ eval ("\$recipe.=\"$text\";");
+ }
+
+ /* Write procmail script */
+ if (!empty($recipe)) {
+ $text= implode ("", file(CONFIG_DIR."/procmail-footer.txt"));
+ $text = preg_replace('/"/', '\\"', $text);
+ eval ("\$recipe.=\"$text\";");
+ $file = $this->procmaildir . "/" . $this->getUAttribValue();
+
+ if (!file_put_contents($file, $recipe)) {
+ msg_dialog::display(_("Error"),(sprintf(_("Unable to write procmail script to '%s'."), $file)),ERROR_DIALOG);
+ }
+ }
+ }
+
+}
+
+// vim:tabstop=2:expandtab:shiftwidth=2:filetype=php:syntax:ruler:
+?>
diff --git a/gosa-plugins/uwimap/plugin.dsc b/gosa-plugins/uwimap/plugin.dsc
--- /dev/null
@@ -0,0 +1,7 @@
+[gosa-plugin]
+name = uw-imap
+description = "UW imap mail method"
+version = 2.6.3
+author = "Gero Kuhlmann <gero@gkminix.han.de>, Fabian Hickert <Fabian.Hickert@gonicus.de>"
+homepage = https://oss.gonicus.de/labs/gosa/
+depends = mail