[Svn] r4011 - in trunk/roundcubemail: . program/localization/en_US program/localization/pl_PL program/steps/mail program/steps/settings

trac at roundcube.net trac at roundcube.net
Wed Sep 29 14:56:10 CEST 2010


Author: alec
Date: 2010-09-29 07:56:10 -0500 (Wed, 29 Sep 2010)
New Revision: 4011

Modified:
   trunk/roundcubemail/CHANGELOG
   trunk/roundcubemail/program/localization/en_US/labels.inc
   trunk/roundcubemail/program/localization/pl_PL/labels.inc
   trunk/roundcubemail/program/steps/mail/func.inc
   trunk/roundcubemail/program/steps/mail/show.inc
   trunk/roundcubemail/program/steps/settings/func.inc
Log:
- Add option to automatically send read notifications for known senders (1485883)


Modified: trunk/roundcubemail/CHANGELOG
===================================================================
--- trunk/roundcubemail/CHANGELOG	2010-09-29 12:36:53 UTC (rev 4010)
+++ trunk/roundcubemail/CHANGELOG	2010-09-29 12:56:10 UTC (rev 4011)
@@ -4,6 +4,7 @@
 - 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
 -------------

Modified: trunk/roundcubemail/program/localization/en_US/labels.inc
===================================================================
--- trunk/roundcubemail/program/localization/en_US/labels.inc	2010-09-29 12:36:53 UTC (rev 4010)
+++ trunk/roundcubemail/program/localization/en_US/labels.inc	2010-09-29 12:56:10 UTC (rev 4011)
@@ -315,9 +315,10 @@
 $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['japanese'] = 'Japanese';
 $labels['korean'] = 'Korean';
 $labels['chinese'] = 'Chinese';
-																												
+
 ?>

Modified: trunk/roundcubemail/program/localization/pl_PL/labels.inc
===================================================================
--- trunk/roundcubemail/program/localization/pl_PL/labels.inc	2010-09-29 12:36:53 UTC (rev 4010)
+++ trunk/roundcubemail/program/localization/pl_PL/labels.inc	2010-09-29 12:56:10 UTC (rev 4011)
@@ -260,9 +260,10 @@
 $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ć';

Modified: trunk/roundcubemail/program/steps/mail/func.inc
===================================================================
--- trunk/roundcubemail/program/steps/mail/func.inc	2010-09-29 12:36:53 UTC (rev 4010)
+++ trunk/roundcubemail/program/steps/mail/func.inc	2010-09-29 12:56:10 UTC (rev 4011)
@@ -1584,12 +1584,20 @@
   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('*')))

Modified: trunk/roundcubemail/program/steps/mail/show.inc
===================================================================
--- trunk/roundcubemail/program/steps/mail/show.inc	2010-09-29 12:36:53 UTC (rev 4010)
+++ trunk/roundcubemail/program/steps/mail/show.inc	2010-09-29 12:56:10 UTC (rev 4011)
@@ -72,17 +72,19 @@
       $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 @@
   return $out;
 }
 
-
-
 function rcmail_remote_objects_msg($attrib)
 {
   global $MESSAGE, $RCMAIL;
@@ -203,7 +203,22 @@
   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',
   'mailboxname' => 'rcmail_mailbox_name_display',
@@ -228,4 +243,3 @@
 
 exit;
 
-

Modified: trunk/roundcubemail/program/steps/settings/func.inc
===================================================================
--- trunk/roundcubemail/program/steps/settings/func.inc	2010-09-29 12:36:53 UTC (rev 4010)
+++ trunk/roundcubemail/program/steps/settings/func.inc	2010-09-29 12:56:10 UTC (rev 4011)
@@ -323,6 +323,7 @@
       $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(

_______________________________________________
http://lists.roundcube.net/mailman/listinfo/svn


More information about the Svn mailing list