[Svn] r1908 - in trunk/roundcubemail: . program/js program/localization/en_US program/steps/mail

trac at roundcube.net trac at roundcube.net
Wed Oct 1 16:57:43 CEST 2008


Author: alec
Date: 2008-10-01 09:57:43 -0500 (Wed, 01 Oct 2008)
New Revision: 1908

Modified:
   trunk/roundcubemail/CHANGELOG
   trunk/roundcubemail/program/js/app.js
   trunk/roundcubemail/program/localization/en_US/messages.inc
   trunk/roundcubemail/program/steps/mail/compose.inc
   trunk/roundcubemail/program/steps/mail/sendmail.inc
Log:
- Better handling of "no identity" and "no email in identity" situations (#1485117)


Modified: trunk/roundcubemail/CHANGELOG
===================================================================
--- trunk/roundcubemail/CHANGELOG	2008-10-01 12:18:16 UTC (rev 1907)
+++ trunk/roundcubemail/CHANGELOG	2008-10-01 14:57:43 UTC (rev 1908)
@@ -6,6 +6,7 @@
 - Fix compose window width/height (#1485396)
 - Allow calling msgimport.sh/msgexport.sh from any directory (#1485431)
 - Localized filesize units (#1485340)
+- Better handling of "no identity" and "no email in identity" situations (#1485117)
 
 2008/09/29 (alec)
 ----------

Modified: trunk/roundcubemail/program/js/app.js
===================================================================
--- trunk/roundcubemail/program/js/app.js	2008-10-01 12:18:16 UTC (rev 1907)
+++ trunk/roundcubemail/program/js/app.js	2008-10-01 14:57:43 UTC (rev 1908)
@@ -1924,9 +1924,18 @@
     var input_to = rcube_find_object('_to');
     var input_cc = rcube_find_object('_cc');
     var input_bcc = rcube_find_object('_bcc');
+    var input_from = rcube_find_object('_from');
     var input_subject = rcube_find_object('_subject');
     var input_message = rcube_find_object('_message');
 
+    // check sender (if have no identities)
+    if (input_from.type == 'text' && !rcube_check_email(input_from.value, true))
+      {
+      alert(this.get_label('nosenderwarning'));
+      input_from.focus();
+      return false;
+      }
+
     // check for empty recipient
     var recipients = input_to.value ? input_to.value : (input_cc.value ? input_cc.value : input_bcc.value);
     if (!rcube_check_email(recipients.replace(/^\s+/, '').replace(/[\s,;]+$/, ''), true))

Modified: trunk/roundcubemail/program/localization/en_US/messages.inc
===================================================================
--- trunk/roundcubemail/program/localization/en_US/messages.inc	2008-10-01 12:18:16 UTC (rev 1907)
+++ trunk/roundcubemail/program/localization/en_US/messages.inc	2008-10-01 14:57:43 UTC (rev 1908)
@@ -56,6 +56,7 @@
 $messages['noemailwarning'] = 'Please enter a valid email address';
 $messages['nonamewarning']  = 'Please enter a name';
 $messages['nopagesizewarning'] = 'Please enter a page size';
+$messages['nosenderwarning'] = 'Please enter sender e-mail address';
 $messages['norecipientwarning'] = 'Please enter at least one recipient';
 $messages['nosubjectwarning']  = 'The "Subject" field is empty. Would you like to enter one now?';
 $messages['nobodywarning'] = 'Send this message without text?';
@@ -90,5 +91,6 @@
 $messages['importerror'] = 'Import failed! The uploaded file is not a valid vCard file.';
 $messages['importconfirm'] = '<b>Successfully imported $inserted contacts, $skipped existing entries skipped</b>:<p><em>$names</em></p>';
 $messages['opnotpermitted'] = 'Operation not permitted!';
+$messages['nofromaddress'] = 'Missing e-mail address in selected identity';
 
-?>
\ No newline at end of file
+?>

Modified: trunk/roundcubemail/program/steps/mail/compose.inc
===================================================================
--- trunk/roundcubemail/program/steps/mail/compose.inc	2008-10-01 12:18:16 UTC (rev 1907)
+++ trunk/roundcubemail/program/steps/mail/compose.inc	2008-10-01 14:57:43 UTC (rev 1908)
@@ -81,7 +81,7 @@
 }
 
 // add some labels to client
-rcube_add_label('nosubject', 'norecipientwarning', 'nosubjectwarning', 'nobodywarning', 'notsentwarning', 'savingmessage', 'sendingmessage', 'messagesaved', 'converting');
+rcube_add_label('nosubject', 'nosenderwarning', 'norecipientwarning', 'nosubjectwarning', 'nobodywarning', 'notsentwarning', 'savingmessage', 'sendingmessage', 'messagesaved', 'converting');
 
 // add config parameter to client script
 $OUTPUT->set_env('draft_autosave', !empty($CONFIG['drafts_mbox']) ? $CONFIG['draft_autosave'] : 0);

Modified: trunk/roundcubemail/program/steps/mail/sendmail.inc
===================================================================
--- trunk/roundcubemail/program/steps/mail/sendmail.inc	2008-10-01 12:18:16 UTC (rev 1907)
+++ trunk/roundcubemail/program/steps/mail/sendmail.inc	2008-10-01 14:57:43 UTC (rev 1908)
@@ -63,9 +63,10 @@
     $out = $sql_arr;
     $out['mailto'] = $sql_arr['email'];
     $name = strpos($sql_arr['name'], ",") ? '"'.$sql_arr['name'].'"' : $sql_arr['name'];
-    $out['string'] = sprintf('%s <%s>',
-                             rcube_charset_convert($name, RCMAIL_CHARSET, $OUTPUT->get_charset()),
-                             $sql_arr['email']);
+    $out['string'] = rcube_charset_convert($name, RCMAIL_CHARSET, $OUTPUT->get_charset());
+    if ($sql_arr['email'])
+      $out['string'] .= ' <' . $sql_arr['email'] . '>';
+
     return $out;
     }
 
@@ -160,9 +161,12 @@
   $mailto = 'undisclosed-recipients:;';
 
 // get sender name and address
-$identity_arr = rcmail_get_identity(get_input_value('_from', RCUBE_INPUT_POST));
-$from = $identity_arr['mailto'];
+$from = get_input_value('_from', RCUBE_INPUT_POST);
+$identity_arr = rcmail_get_identity($from);
 
+if ($identity_arr)
+  $from = $identity_arr['mailto'];
+
 if (empty($identity_arr['string']))
   $identity_arr['string'] = $from;
 
@@ -351,6 +355,12 @@
 // Begin SMTP Delivery Block 
 if (!$savedraft)
 {
+  // check for 'From' address (identity may be incomplete)
+  if ($identity_arr && !$identity_arr['mailto']) {
+    $OUTPUT->show_message('nofromaddress', 'error');
+    $OUTPUT->send('iframe'); 
+  }
+
   $sent = rcmail_deliver_message($MAIL_MIME, $from, $mailto);
   
   // return to compose page if sending failed

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



More information about the Svn mailing list