aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorMichael <icarus@dabo.de>2012-02-26 23:39:29 +0100
committerMichael <icarus@dabo.de>2012-02-26 23:39:29 +0100
commitfe3dfbee5638dd2988bd8b126652b3138572f02c (patch)
treed22540e6b2534321c1ba38385608a9729179ac33
parent437e18d7a7433ea5a9e3388c39ba32c7fe25eb18 (diff)
downloadvolse-hubzilla-fe3dfbee5638dd2988bd8b126652b3138572f02c.tar.gz
volse-hubzilla-fe3dfbee5638dd2988bd8b126652b3138572f02c.tar.bz2
volse-hubzilla-fe3dfbee5638dd2988bd8b126652b3138572f02c.zip
Mail: New options for actions after importing mails.
-rwxr-xr-xboot.php2
-rwxr-xr-xdatabase.sql3
-rwxr-xr-xinclude/poller.php46
-rwxr-xr-xmod/settings.php53
-rwxr-xr-xupdate.php6
-rwxr-xr-xview/settings_connectors.tpl2
-rw-r--r--view/theme/vier/style.css13
7 files changed, 84 insertions, 41 deletions
diff --git a/boot.php b/boot.php
index 54f318e5e..e9f9efd70 100755
--- a/boot.php
+++ b/boot.php
@@ -11,7 +11,7 @@ require_once('include/cache.php');
define ( 'FRIENDICA_PLATFORM', 'Friendica');
define ( 'FRIENDICA_VERSION', '2.3.1263' );
define ( 'DFRN_PROTOCOL_VERSION', '2.22' );
-define ( 'DB_UPDATE_VERSION', 1126 );
+define ( 'DB_UPDATE_VERSION', 1127 );
define ( 'EOL', "<br />\r\n" );
define ( 'ATOM_TIME', 'Y-m-d\TH:i:s\Z' );
diff --git a/database.sql b/database.sql
index 9ad96ca77..ced646f59 100755
--- a/database.sql
+++ b/database.sql
@@ -634,7 +634,8 @@ CREATE TABLE IF NOT EXISTS `mailacct` (
`mailbox` CHAR( 255 ) NOT NULL,
`user` CHAR( 255 ) NOT NULL ,
`pass` TEXT NOT NULL ,
-`reply_to` CHAR( 255 ) NOT NULL ,
+`action` INT NOT NULL ,
+`movetofolder` CHAR(255) NOT NULL ,
`pubmail` TINYINT(1) NOT NULL DEFAULT '0',
`last_check` DATETIME NOT NULL DEFAULT '0000-00-00 00:00:00'
) ENGINE = MyISAM DEFAULT CHARSET=utf8;
diff --git a/include/poller.php b/include/poller.php
index d79079fcd..cfbc46b87 100755
--- a/include/poller.php
+++ b/include/poller.php
@@ -454,11 +454,24 @@ function poller_run($argv, $argc){
intval($r[0]['id'])
);
}
- //logger("Mail: Deleting ".$msg_uid);
- //imap_delete($mbox, $msg_uid, FT_UID);
- imap_setflag_full($mbox, $msg_uid, "\\Seen", ST_UID);
- logger("Mail: Moving ".$msg_uid);
- imap_mail_move($mbox, $msg_uid, "Archiv", FT_UID);
+ switch ($mailconf[0]['action']) {
+ case 0:
+ break;
+ case 1:
+ logger("Mail: Deleting ".$msg_uid);
+ imap_delete($mbox, $msg_uid, FT_UID);
+ break;
+ case 2:
+ logger("Mail: Mark as seen ".$msg_uid);
+ imap_setflag_full($mbox, $msg_uid, "\\Seen", ST_UID);
+ break;
+ case 3:
+ logger("Mail: Moving ".$msg_uid." to ".$mailconf[0]['movetofolder']);
+ imap_setflag_full($mbox, $msg_uid, "\\Seen", ST_UID);
+ if ($mailconf[0]['movetofolder'] != "")
+ imap_mail_move($mbox, $msg_uid, $mailconf[0]['movetofolder'], FT_UID);
+ break;
+ }
continue;
}
@@ -520,11 +533,24 @@ function poller_run($argv, $argc){
q("UPDATE `item` SET `last-child` = 1 WHERE `id` = %d LIMIT 1",
intval($stored_item)
);
- //logger("Mail: Deleting ".$msg_uid);
- //imap_delete($mbox, $msg_uid, FT_UID);
- imap_setflag_full($mbox, $msg_uid, "\\Seen", ST_UID);
- logger("Mail: Moving ".$msg_uid);
- imap_mail_move($mbox, $msg_uid, "Archiv", FT_UID);
+ switch ($mailconf[0]['action']) {
+ case 0:
+ break;
+ case 1:
+ logger("Mail: Deleting ".$msg_uid);
+ imap_delete($mbox, $msg_uid, FT_UID);
+ break;
+ case 2:
+ logger("Mail: Mark as seen ".$msg_uid);
+ imap_setflag_full($mbox, $msg_uid, "\\Seen", ST_UID);
+ break;
+ case 3:
+ logger("Mail: Moving ".$msg_uid." to ".$mailconf[0]['movetofolder']);
+ imap_setflag_full($mbox, $msg_uid, "\\Seen", ST_UID);
+ if ($mailconf[0]['movetofolder'] != "")
+ imap_mail_move($mbox, $msg_uid, $mailconf[0]['movetofolder'], FT_UID);
+ break;
+ }
}
}
diff --git a/mod/settings.php b/mod/settings.php
index 91f4325da..90eb9dbd7 100755
--- a/mod/settings.php
+++ b/mod/settings.php
@@ -110,13 +110,15 @@ function settings_post(&$a) {
if(($a->argc > 1) && ($a->argv[1] == 'connectors')) {
if(x($_POST['imap-submit'])) {
- $mail_server = ((x($_POST,'mail_server')) ? $_POST['mail_server'] : '');
- $mail_port = ((x($_POST,'mail_port')) ? $_POST['mail_port'] : '');
- $mail_ssl = ((x($_POST,'mail_ssl')) ? strtolower(trim($_POST['mail_ssl'])) : '');
- $mail_user = ((x($_POST,'mail_user')) ? $_POST['mail_user'] : '');
- $mail_pass = ((x($_POST,'mail_pass')) ? trim($_POST['mail_pass']) : '');
- $mail_replyto = ((x($_POST,'mail_replyto')) ? $_POST['mail_replyto'] : '');
- $mail_pubmail = ((x($_POST,'mail_pubmail')) ? $_POST['mail_pubmail'] : '');
+ $mail_server = ((x($_POST,'mail_server')) ? $_POST['mail_server'] : '');
+ $mail_port = ((x($_POST,'mail_port')) ? $_POST['mail_port'] : '');
+ $mail_ssl = ((x($_POST,'mail_ssl')) ? strtolower(trim($_POST['mail_ssl'])) : '');
+ $mail_user = ((x($_POST,'mail_user')) ? $_POST['mail_user'] : '');
+ $mail_pass = ((x($_POST,'mail_pass')) ? trim($_POST['mail_pass']) : '');
+ $mail_action = ((x($_POST,'mail_action')) ? trim($_POST['mail_action']) : '');
+ $mail_movetofolder = ((x($_POST,'mail_movetofolder')) ? trim($_POST['mail_movetofolder']) : '');
+ $mail_replyto = ((x($_POST,'mail_replyto')) ? $_POST['mail_replyto'] : '');
+ $mail_pubmail = ((x($_POST,'mail_pubmail')) ? $_POST['mail_pubmail'] : '');
$mail_disabled = ((function_exists('imap_open') && (! get_config('system','imap_disabled'))) ? 0 : 1);
@@ -142,11 +144,14 @@ function settings_post(&$a) {
);
}
$r = q("UPDATE `mailacct` SET `server` = '%s', `port` = %d, `ssltype` = '%s', `user` = '%s',
+ `action` = %d, `movetofolder` = '%s',
`mailbox` = 'INBOX', `reply_to` = '%s', `pubmail` = %d WHERE `uid` = %d LIMIT 1",
dbesc($mail_server),
intval($mail_port),
dbesc($mail_ssl),
dbesc($mail_user),
+ intval($mail_action),
+ dbesc($mail_movetofolder),
dbesc($mail_replyto),
intval($mail_pubmail),
intval(local_user())
@@ -218,8 +223,8 @@ function settings_post(&$a) {
$openid = ((x($_POST,'openid_url')) ? notags(trim($_POST['openid_url'])) : '');
$maxreq = ((x($_POST,'maxreq')) ? intval($_POST['maxreq']) : 0);
$expire = ((x($_POST,'expire')) ? intval($_POST['expire']) : 0);
-
-
+
+
$expire_items = ((x($_POST,'expire_items')) ? intval($_POST['expire_items']) : 0);
$expire_notes = ((x($_POST,'expire_notes')) ? intval($_POST['expire_notes']) : 0);
$expire_starred = ((x($_POST,'expire_starred')) ? intval($_POST['expire_starred']) : 0);
@@ -561,23 +566,25 @@ function settings_content(&$a) {
$r = null;
}
- $mail_server = ((count($r)) ? $r[0]['server'] : '');
- $mail_port = ((count($r) && intval($r[0]['port'])) ? intval($r[0]['port']) : '');
- $mail_ssl = ((count($r)) ? $r[0]['ssltype'] : '');
- $mail_user = ((count($r)) ? $r[0]['user'] : '');
- $mail_replyto = ((count($r)) ? $r[0]['reply_to'] : '');
- $mail_pubmail = ((count($r)) ? $r[0]['pubmail'] : 0);
- $mail_chk = ((count($r)) ? $r[0]['last_check'] : '0000-00-00 00:00:00');
+ $mail_server = ((count($r)) ? $r[0]['server'] : '');
+ $mail_port = ((count($r) && intval($r[0]['port'])) ? intval($r[0]['port']) : '');
+ $mail_ssl = ((count($r)) ? $r[0]['ssltype'] : '');
+ $mail_user = ((count($r)) ? $r[0]['user'] : '');
+ $mail_replyto = ((count($r)) ? $r[0]['reply_to'] : '');
+ $mail_pubmail = ((count($r)) ? $r[0]['pubmail'] : 0);
+ $mail_action = ((count($r)) ? $r[0]['action'] : 0);
+ $mail_movetofolder = ((count($r)) ? $r[0]['movetofolder'] : '');
+ $mail_chk = ((count($r)) ? $r[0]['last_check'] : '0000-00-00 00:00:00');
+
-
$tpl = get_markup_template("settings_connectors.tpl");
$o .= replace_macros($tpl, array(
'$title' => t('Connector Settings'),
'$tabs' => $tabs,
-
+
'$diasp_enabled' => $diasp_enabled,
'$ostat_enabled' => $ostat_enabled,
-
+
'$h_imap' => t('Email/Mailbox Setup'),
'$imap_desc' => t("If you wish to communicate with email contacts using this service \x28optional\x29, please specify how to connect to your mailbox."),
'$imap_lastcheck' => array('imap_lastcheck', t('Last successful email check:'), $mail_chk,''),
@@ -589,8 +596,10 @@ function settings_content(&$a) {
'$mail_pass' => array('mail_pass', t('Email password:'), '', ''),
'$mail_replyto' => array('mail_replyto', t('Reply-to address:'), '', 'Optional'),
'$mail_pubmail' => array('mail_pubmail', t('Send public posts to all email contacts:'), $mail_pubmail, ''),
- '$submit' => t('Submit'),
-
+ '$mail_action' => array('mail_action', t('Action after import:'), $mail_action, '', array(0=>t('None'), 1=>t('Delete'), 2=>t('Mark as seen'), 3=>t('Move to folder'))),
+ '$mail_movetofolder' => array('mail_movetofolder', t('Move to folder:'), $mail_movetofolder, ''),
+ '$submit' => t('Submit'),
+
'$settings_connectors' => $settings_connectors
@@ -598,7 +607,7 @@ function settings_content(&$a) {
return $o;
}
-
+
require_once('include/acl_selectors.php');
$p = q("SELECT * FROM `profile` WHERE `is-default` = 1 AND `uid` = %d LIMIT 1",
diff --git a/update.php b/update.php
index 18dc90cce..8a2d891ca 100755
--- a/update.php
+++ b/update.php
@@ -1,6 +1,6 @@
<?php
-define( 'UPDATE_VERSION' , 1126 );
+define( 'UPDATE_VERSION' , 1127 );
/**
*
@@ -1090,3 +1090,7 @@ function update_1125() {
) ENGINE = MyISAM DEFAULT CHARSET=utf8");
}
+function update_1126() {
+ q("ALTER TABLE `mailacct` ADD `action` INT NOT NULL AFTER `pass`,
+ ADD `movetofolder` CHAR(255) NOT NULL AFTER `action`");
+}
diff --git a/view/settings_connectors.tpl b/view/settings_connectors.tpl
index 0f3357873..9493c8bf7 100755
--- a/view/settings_connectors.tpl
+++ b/view/settings_connectors.tpl
@@ -23,6 +23,8 @@ $settings_connectors
{{inc field_password.tpl with $field=$mail_pass }}{{endinc}}
{{inc field_input.tpl with $field=$mail_replyto }}{{endinc}}
{{inc field_checkbox.tpl with $field=$mail_pubmail }}{{endinc}}
+ {{inc field_select.tpl with $field=$mail_action }}{{endinc}}
+ {{inc field_input.tpl with $field=$mail_movetofolder }}{{endinc}}
<div class="settings-submit-wrapper" >
<input type="submit" id="imap-submit" name="imap-submit" class="settings-submit" value="$submit" />
diff --git a/view/theme/vier/style.css b/view/theme/vier/style.css
index 5ffb02f48..39f4ffea4 100644
--- a/view/theme/vier/style.css
+++ b/view/theme/vier/style.css
@@ -593,15 +593,15 @@ nav #nav-apps-link.selected {
#nav-notifications-mark-all {
/* padding: 1px 1px 2px 26px; */
/* border-bottom: 1px solid #364E59; */
- margin: 0px 0px 2px 0px;
- padding: 5px 10px;
+ /* margin: 0px 0px 2px 0px;
+ padding: 5px 10px; */
}
#nav-notifications-see-all {
/* padding: 1px 1px 2px 26px; */
/* border-bottom: 1px solid #364E59; */
- margin: 0px 0px 2px 0px;
- padding: 5px 10px;
+ /* margin: 0px 0px 2px 0px;
+ padding: 5px 10px; */
}
ul.menu-popup {
@@ -677,14 +677,14 @@ ul.menu-popup .empty {
max-height: 550px;
overflow: auto;
}
-#nav-notifications-menu a {
+/* #nav-notifications-menu a {
display: inline;
padding: 5px 0px;
margin: 0px 0px 2px 0px;
}
#nav-notifications-menu li:hover {
background-color: #bdcdd4;
-}
+}*/
#nav-notifications-menu img {
float: left;
@@ -1054,6 +1054,7 @@ section {
.shiny {
/* border-right: 10px solid #fce94f; */
border-right: 1px solid #A7C7F7;
+ padding-right: 12px;
}
#jot-preview-content .tread-wrapper {
background-color: #fce94f;