From ba747c0be201755bed0e36e02edfb85d31f5214f Mon Sep 17 00:00:00 2001
From: tbrehm <t.brehm@ispconfig.org>
Date: Wed, 30 May 2007 10:11:32 -0400
Subject: [PATCH] Enhanced getmail support and the installer.

---
 server/plugins-enabled/getmail_plugin.inc.php |   13 ++++++++++---
 1 files changed, 10 insertions(+), 3 deletions(-)

diff --git a/server/plugins-enabled/getmail_plugin.inc.php b/server/plugins-enabled/getmail_plugin.inc.php
index cc18d2d..65569d4 100644
--- a/server/plugins-enabled/getmail_plugin.inc.php
+++ b/server/plugins-enabled/getmail_plugin.inc.php
@@ -34,7 +34,7 @@
 	var $class_name = 'getmail_plugin';
 	
 	
-	var $getmail_config_dir = '/etc/getmail';
+	var $getmail_config_dir = '';
 	
 	/*
 	 	This function is called when the plugin is loaded
@@ -51,6 +51,8 @@
 		$app->plugins->registerEvent('mail_get_update','getmail_plugin','update');
 		$app->plugins->registerEvent('mail_get_delete','getmail_plugin','delete');
 		
+		
+		
 	}
 	
 	function insert($event_name,$data) {
@@ -62,6 +64,11 @@
 	
 	function update($event_name,$data) {
 		global $app, $conf;
+		
+		// load the server specific configuration options for getmail
+		$app->uses("getconf");
+		$getmail_config = $app->getconf->get_server_config($conf["server_id"], 'getmail');
+		$this->getmail_config_dir = $getmail_config["getmail_config_dir"];
 		
 		// Check if the config directory exists.
 		if(!is_dir($this->getmail_config_dir)) {
@@ -79,7 +86,7 @@
 			}
 
 			
-			if($data["new"]["source_active"] == 'y') {
+			if($data["new"]["active"] == 'y') {
 				// Open master template
 				$tpl = file_get_contents($conf["rootpath"].'/conf/getmail.conf.master');
 			
@@ -101,7 +108,7 @@
 				$tpl = str_replace('{SERVER}',$data["new"]["source_server"],$tpl);
 				$tpl = str_replace('{USERNAME}',$data["new"]["source_username"],$tpl);
 				$tpl = str_replace('{PASSWORD}',$data["new"]["source_password"],$tpl);
-				$tpl = str_replace('{DESTINATION}',$data["new"]["source_destination"],$tpl);
+				$tpl = str_replace('{DESTINATION}',$data["new"]["destination"],$tpl);
 				
 				// Write the config file.
 				file_put_contents($config_file_path,$tpl);

--
Gitblit v1.9.1