gecko-dev/grendel/contrib/edit_from_header_directly.diff

81 lines
3.7 KiB
Diff

Index: AddressList.java
===================================================================
RCS file: /cvsroot/mozilla/grendel/composition/AddressList.java,v
retrieving revision 1.4
diff -r1.4 AddressList.java
241a242,246
> // If the last addressee line was a From: we don't want the new one
> // to be one as well, since only the last From: will be valid.
> if(lastAL.getDeliveryMode() == Addressee.FROM) {
> addAddresseLine (new Addressee ("", Addressee.TO));
> } else {
242a248
> }
Index: Addressee.java
===================================================================
RCS file: /cvsroot/mozilla/grendel/composition/Addressee.java,v
retrieving revision 1.1
diff -r1.1 Addressee.java
34a35
> public static final int FROM = 6;
36c37
< public static final String[] mDeliveryStr = {"To:", "Cc:", "Bcc:", "Group:", "Reply-To:", "Followup-To:"};
---
> public static final String[] mDeliveryStr = {"To:", "Cc:", "Bcc:", "Group:", "Reply-To:", "Followup-To:", "From:"};
Index: CompositionPanel.java
===================================================================
RCS file: /cvsroot/mozilla/grendel/composition/CompositionPanel.java,v
retrieving revision 1.7
diff -r1.7 CompositionPanel.java
435,436c435,437
< javax.mail.Address[] toAddress = new InternetAddress[1];
< toAddress[0] = new InternetAddress(recipients[i].getText());
---
> if(recipients[i].getDelivery() != Addressee.FROM) {
> javax.mail.Address[] toAddress = new InternetAddress[1];
> Message.RecipientType deliverMode = Message.RecipientType.TO;
438c439
< Message.RecipientType deliverMode = Message.RecipientType.TO;
---
> toAddress[0] = new InternetAddress(recipients[i].getText());
440,451c441,464
< //map grendel.composition.Addressee delivery modes
< // into javax.mail.Message delivery modes.
< switch (recipients[i].getDelivery()) {
< case Addressee.TO:
< deliverMode = Message.RecipientType.TO;
< break;
< case Addressee.CC:
< deliverMode = Message.RecipientType.CC;
< break;
< case Addressee.BCC:
< deliverMode = Message.RecipientType.BCC;
< break;
---
> //map grendel.composition.Addressee delivery modes
> // into javax.mail.Message delivery modes.
> switch (recipients[i].getDelivery()) {
> case Addressee.TO:
> deliverMode = Message.RecipientType.TO;
> break;
> case Addressee.CC:
> deliverMode = Message.RecipientType.CC;
> break;
> case Addressee.BCC:
> deliverMode = Message.RecipientType.BCC;
> break;
> }
> msg.addRecipients(deliverMode, toAddress);
> } else {
> // Should we consider assert()ing if the user has multiple
> // From: entries, or silently use the last listed one?
> // Rarely will the user have multiple From's, I think...
> // Probably the place for a Dialog which asks 'You've already
> // set a From: entry! Use this instead? (Y/N/Cancel).
> userName = recipients[i].getText();
>
> //set who's sending this message.
> msg.setFrom (new InternetAddress(userName));
453d465
< msg.addRecipients(deliverMode, toAddress);