summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authoralecpl <alec@alec.pl>2010-09-29 12:56:10 +0000
committeralecpl <alec@alec.pl>2010-09-29 12:56:10 +0000
commita99968259d001ebc8bd98f0f2a0aa544ed4740e8 (patch)
tree919414917e3963878df8323820eb4693b57cb27b
parente99991996dbb9e7b0b0ff6cfa94dc0fb2522eb66 (diff)
- Add option to automatically send read notifications for known senders (1485883)
-rw-r--r--CHANGELOG1
-rw-r--r--program/localization/en_US/labels.inc9
-rw-r--r--program/localization/pl_PL/labels.inc7
-rw-r--r--program/steps/mail/func.inc14
-rw-r--r--program/steps/mail/show.inc30
-rw-r--r--program/steps/settings/func.inc1
6 files changed, 44 insertions, 18 deletions
diff --git a/CHANGELOG b/CHANGELOG
index 2013dd54a..82270ab06 100644
--- a/CHANGELOG
+++ b/CHANGELOG
@@ -4,6 +4,7 @@ CHANGELOG Roundcube Webmail
- Messages caching: performance improvements, fixed syncing, fixes related with #1486748
- Add link to identities in compose window (#1486729)
- Add Internationalized Domain Name (IDNA) support (#1483894)
+- Add option to automatically send read notifications for known senders (1485883)
RELEASE 0.4.1
-------------
diff --git a/program/localization/en_US/labels.inc b/program/localization/en_US/labels.inc
index 3fe75e879..704a84b38 100644
--- a/program/localization/en_US/labels.inc
+++ b/program/localization/en_US/labels.inc
@@ -315,9 +315,10 @@ $labels['logoutcompact'] = 'Compact Inbox on logout';
$labels['uisettings'] = 'User Interface';
$labels['serversettings'] = 'Server Settings';
$labels['mailboxview'] = 'Mailbox View';
-$labels['mdnrequests'] = 'Sender notifications';
-$labels['askuser'] = 'ask the user';
-$labels['autosend'] = 'send automatically';
+$labels['mdnrequests'] = 'On request for return receipt';
+$labels['askuser'] = 'ask me';
+$labels['autosend'] = 'send receipt';
+$labels['autosendknown'] = 'send receipt to my contacts only';
$labels['ignore'] = 'ignore';
$labels['readwhendeleted'] = 'Mark the message as read on delete';
$labels['flagfordeletion'] = 'Flag the message for deletion instead of delete';
@@ -405,5 +406,5 @@ $labels['vietnamese'] = 'Vietnamese';
$labels['japanese'] = 'Japanese';
$labels['korean'] = 'Korean';
$labels['chinese'] = 'Chinese';
-
+
?>
diff --git a/program/localization/pl_PL/labels.inc b/program/localization/pl_PL/labels.inc
index 821f244c3..0aeae8db2 100644
--- a/program/localization/pl_PL/labels.inc
+++ b/program/localization/pl_PL/labels.inc
@@ -260,9 +260,10 @@ $labels['logoutcompact'] = 'Przy wylogowaniu porządkuj folder Odebrane';
$labels['uisettings'] = 'Interfejs użytkownika';
$labels['serversettings'] = 'Ustawienia serwera';
$labels['mailboxview'] = 'Widok skrzynki pocztowej';
-$labels['mdnrequests'] = 'Potwierdzenia odbioru';
-$labels['askuser'] = 'pytaj';
-$labels['autosend'] = 'wyślij automatycznie';
+$labels['mdnrequests'] = 'Na żadanie potwierdzenia odbioru';
+$labels['askuser'] = 'pytaj mnie';
+$labels['autosend'] = 'wyślij potwierdzenie';
+$labels['autosendknown'] = 'wyślij potwierdzenie tylko do moich kontaktów';
$labels['ignore'] = 'ignoruj';
$labels['readwhendeleted'] = 'Podczas usuwania oznacz wiadomość jako przeczytaną';
$labels['flagfordeletion'] = 'Oznacz wiadomość do usunięcia zamiast ją usuwać';
diff --git a/program/steps/mail/func.inc b/program/steps/mail/func.inc
index 95bae0b10..d7c65236b 100644
--- a/program/steps/mail/func.inc
+++ b/program/steps/mail/func.inc
@@ -1584,12 +1584,20 @@ function rcmail_deliver_message(&$message, $from, $mailto, &$smtp_error, &$body_
return $sent;
}
-
-function rcmail_send_mdn($uid, &$smtp_error)
+/**
+ * Send the MDN response
+ *
+ * @param mixed $message Original message object (rcube_message) or UID
+ * @param array $smtp_error SMTP error array (reference)
+ *
+ * @return boolean Send status
+ */
+function rcmail_send_mdn($message, &$smtp_error)
{
global $RCMAIL, $IMAP;
- $message = new rcube_message($uid);
+ if (!is_a($message, rcube_message))
+ $message = new rcube_message($message);
if ($message->headers->mdn_to && !$message->headers->mdn_sent &&
($IMAP->check_permflag('MDNSENT') || $IMAP->check_permflag('*')))
diff --git a/program/steps/mail/show.inc b/program/steps/mail/show.inc
index 382733f5e..bc208ab7c 100644
--- a/program/steps/mail/show.inc
+++ b/program/steps/mail/show.inc
@@ -72,17 +72,19 @@ if ($uid = get_input_value('_uid', RCUBE_INPUT_GET)) {
$mbox_name != $CONFIG['drafts_mbox'] &&
$mbox_name != $CONFIG['sent_mbox'])
{
- if (intval($CONFIG['mdn_requests']) === 1)
- {
- if (rcmail_send_mdn($MESSAGE->uid, $smtp_error))
+ $mdn_cfg = intval($CONFIG['mdn_requests']);
+
+ if ($mdn_cfg == 1 || ($mdn_cfg == 3 && rcmail_contact_exists($MESSAGE->sender['mailto']))) {
+ // Send MDN
+ if (rcmail_send_mdn($MESSAGE, $smtp_error))
$OUTPUT->show_message('receiptsent', 'confirmation');
else if ($smtp_error)
$OUTPUT->show_message($smtp_error['label'], 'error', $smtp_error['vars']);
else
$OUTPUT->show_message('errorsendingreceipt', 'error');
}
- else if (empty($CONFIG['mdn_requests']))
- {
+ else if ($mdn_cfg != 2) {
+ // Ask user
$OUTPUT->add_label('mdnrequest');
$OUTPUT->set_env('mdn_request', true);
}
@@ -181,8 +183,6 @@ function rcmail_message_attachments($attrib)
return $out;
}
-
-
function rcmail_remote_objects_msg($attrib)
{
global $MESSAGE, $RCMAIL;
@@ -203,6 +203,21 @@ function rcmail_remote_objects_msg($attrib)
return html::div($attrib, $msg);
}
+function rcmail_contact_exists($email)
+{
+ global $RCMAIL;
+
+ if ($email) {
+ // @TODO: search in all address books?
+ $CONTACTS = $RCMAIL->get_address_book(null, true);
+ $existing = $CONTACTS->search('email', $email, true, false);
+ if ($existing->count)
+ return true;
+ }
+
+ return false;
+}
+
$OUTPUT->add_handlers(array(
'messageattachments' => 'rcmail_message_attachments',
@@ -228,4 +243,3 @@ if ($MESSAGE && $MESSAGE->headers && !$MESSAGE->headers->seen &&
exit;
-
diff --git a/program/steps/settings/func.inc b/program/steps/settings/func.inc
index b03947845..e35edde47 100644
--- a/program/steps/settings/func.inc
+++ b/program/steps/settings/func.inc
@@ -323,6 +323,7 @@ function rcmail_user_prefs($current=null)
$select_mdn_requests = new html_select(array('name' => '_mdn_requests', 'id' => $field_id));
$select_mdn_requests->add(rcube_label('askuser'), 0);
$select_mdn_requests->add(rcube_label('autosend'), 1);
+ $select_mdn_requests->add(rcube_label('autosendknown'), 3);
$select_mdn_requests->add(rcube_label('ignore'), 2);
$blocks['main']['options']['mdn_requests'] = array(