]> git.mxchange.org Git - friendica.git/commitdiff
Mail: New options for actions after importing mails.
authorMichael <icarus@dabo.de>
Sun, 26 Feb 2012 22:39:29 +0000 (23:39 +0100)
committerMichael <icarus@dabo.de>
Sun, 26 Feb 2012 22:39:29 +0000 (23:39 +0100)
boot.php
database.sql
include/poller.php
mod/settings.php
update.php
view/settings_connectors.tpl
view/theme/vier/style.css

index 54f318e5e9f0284e9dd44f2a17c701074fca85b0..e9f9efd70d5ee8c9c06ada5d60b467a54ac53b9a 100755 (executable)
--- 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' );
index 9ad96ca77dca3c541373a8b0891717f0cfaa19c3..ced646f595e3f8d105f15c5e2099a003739e56bb 100755 (executable)
@@ -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;
index d79079fcda1d2d886e205303d030e6ba529df6a1..cfbc46b87e9d08c5ee5728caa8099ee7a52763ee 100755 (executable)
@@ -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;
+                                                       }
                                                }
                                        }
 
index 91f4325dad3b73a2d0495e1e356d485a1afbf834..90eb9dbd78870b02451d6cd88385a52031e59456 100755 (executable)
@@ -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",
index 18dc90cce0b40218eee7f804197ab15234e53cc4..8a2d891cab42c195f12e532cb80bbfc06a632815 100755 (executable)
@@ -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`");
+}
index 0f3357873e8bae5a3eb6f104a236d4552bcd67e9..9493c8bf7795d24e904ec44925944694023b0f31 100755 (executable)
@@ -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" />
index 5ffb02f48b070f56d2287babda41ca20c49bbf6b..39f4ffea47657fc5c7bbc6fccd8fe2fa1230e57a 100644 (file)
@@ -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;