From 1fbea9d98636c40cfe761e8f531d6b3821ab7e28 Mon Sep 17 00:00:00 2001 From: marknl <marknl@ispconfig3> Date: Fri, 26 Aug 2011 09:47:16 -0400 Subject: [PATCH] FS#1522 - Add getmail configuration option read_all --- interface/web/mail/templates/mail_get_edit.htm | 16 +++++++++++----- install/sql/ispconfig3.sql | 1 + interface/web/mail/lib/lang/en_mail_get.lng | 1 + server/scripts/run-getmail.sh | 2 +- server/conf/getmail.conf.master | 1 + interface/web/mail/form/mail_get.tform.php | 6 ++++++ server/plugins-available/getmail_plugin.inc.php | 6 ++++++ install/sql/incremental/upd_0014.sql | 2 ++ 8 files changed, 29 insertions(+), 6 deletions(-) diff --git a/install/sql/incremental/upd_0014.sql b/install/sql/incremental/upd_0014.sql new file mode 100644 index 0000000..9a278ec --- /dev/null +++ b/install/sql/incremental/upd_0014.sql @@ -0,0 +1,2 @@ +-- database patch for getmail read_all option +ALTER TABLE `mail_get` ADD ( `source_read_all` varchar(255) NOT NULL default 'y'); \ No newline at end of file diff --git a/install/sql/ispconfig3.sql b/install/sql/ispconfig3.sql index 501c9d0..93793cf 100644 --- a/install/sql/ispconfig3.sql +++ b/install/sql/ispconfig3.sql @@ -630,6 +630,7 @@ `source_username` varchar(255) default NULL, `source_password` varchar(64) default NULL, `source_delete` varchar(255) NOT NULL default 'y', + `source_read_all` varchar(255) NOT NULL default 'y', `destination` varchar(255) default NULL, `active` varchar(255) NOT NULL default 'y', PRIMARY KEY (`mailget_id`) diff --git a/interface/web/mail/form/mail_get.tform.php b/interface/web/mail/form/mail_get.tform.php index 13b963d..0d08055 100644 --- a/interface/web/mail/form/mail_get.tform.php +++ b/interface/web/mail/form/mail_get.tform.php @@ -117,6 +117,12 @@ 'default' => 'y', 'value' => array(0 => 'n',1 => 'y') ), + 'source_read_all' => array ( + 'datatype' => 'VARCHAR', + 'formtype' => 'CHECKBOX', + 'default' => 'y', + 'value' => array(0 => 'n',1 => 'y') + ), 'destination' => array ( 'datatype' => 'VARCHAR', 'formtype' => 'SELECT', diff --git a/interface/web/mail/lib/lang/en_mail_get.lng b/interface/web/mail/lib/lang/en_mail_get.lng index e2180e5..efb9628 100644 --- a/interface/web/mail/lib/lang/en_mail_get.lng +++ b/interface/web/mail/lib/lang/en_mail_get.lng @@ -5,6 +5,7 @@ $wb["source_username_txt"] = 'Username'; $wb["source_password_txt"] = 'Password'; $wb["source_delete_txt"] = 'Delete emails after retrieval'; +$wb["source_read_all_txt"] = 'Retrieve all emails (incl. read mails)'; $wb["destination_txt"] = 'Destination'; $wb["active_txt"] = 'Active'; $wb["limit_fetchmail_txt"] = 'The max. number of Fetchmail records for your account is reached.'; diff --git a/interface/web/mail/templates/mail_get_edit.htm b/interface/web/mail/templates/mail_get_edit.htm index 6d45cdb..22c23cf 100644 --- a/interface/web/mail/templates/mail_get_edit.htm +++ b/interface/web/mail/templates/mail_get_edit.htm @@ -24,11 +24,17 @@ <input name="source_password" id="source_password" value="{tmpl_var name='source_password'}" size="30" maxlength="255" type="password" class="textInput" /> </div> <div class="ctrlHolder"> - <p class="label">{tmpl_var name='source_delete_txt'}</p> - <div class="multiField"> - {tmpl_var name='source_delete'} - </div> - </div> + <p class="label">{tmpl_var name='source_delete_txt'}</p> + <div class="multiField"> + {tmpl_var name='source_delete'} + </div> + </div> + <div class="ctrlHolder"> + <p class="label">{tmpl_var name='source_read_all_txt'}</p> + <div class="multiField"> + {tmpl_var name='source_read_all'} + </div> + </div> <div class="ctrlHolder"> <label for="destination">{tmpl_var name='destination_txt'}</label> <select name="destination" id="destination" class="selectInput"> diff --git a/server/conf/getmail.conf.master b/server/conf/getmail.conf.master index 2f48d76..029c6fe 100644 --- a/server/conf/getmail.conf.master +++ b/server/conf/getmail.conf.master @@ -2,6 +2,7 @@ # message_log = /var/log/getmail.log message_log_syslog = 1 delete = {DELETE} +read_all = {READ_ALL} [retriever] type = {TYPE} diff --git a/server/plugins-available/getmail_plugin.inc.php b/server/plugins-available/getmail_plugin.inc.php index 7c6669a..6b8a7ee 100644 --- a/server/plugins-available/getmail_plugin.inc.php +++ b/server/plugins-available/getmail_plugin.inc.php @@ -108,6 +108,12 @@ } else { $tpl = str_replace('{DELETE}','0',$tpl); } + + if($data["new"]["read_all"] == 'y') { + $tpl = str_replace('{READ_ALL}', '1', $tpl); + } else { + $tpl = str_replace('{READ_ALL}', '0', $tpl); + } // Set the data retriever if($data["new"]["type"] == 'pop3') { diff --git a/server/scripts/run-getmail.sh b/server/scripts/run-getmail.sh index 13e514c..0ab8cc5 100644 --- a/server/scripts/run-getmail.sh +++ b/server/scripts/run-getmail.sh @@ -14,7 +14,7 @@ else touch /tmp/.getmail_lock if [ "$rcfiles" != "" ]; then - /usr/bin/getmail -n -v -g /etc/getmail $rcfiles + /usr/bin/getmail -v -g /etc/getmail $rcfiles fi rm -f /tmp/.getmail_lock fi -- Gitblit v1.9.1