[prev in list] [next in list] [prev in thread] [next in thread] 

List:       kde-commits
Subject:    KDE_3_2_BRANCH: kdepim/kmail
From:       Ingo Klöcker <kloecker () kde ! org>
Date:       2004-02-01 14:04:51
Message-ID: 20040201140451.C234A983A () office ! kde ! org
[Download RAW message or body]

CVS commit by kloecker: 

Backport of CVS commit by kloecker:

Fix a few issues with reply:
- Bug 72808: reply to myself is broken / empty To: address field
- Bug 62919: reply all should not use From when ReplyTo is set (except for mailing \
list messages)

And the following issue which I forgot to mention in my commit to HEAD:
- if one uses reply-all for replying to a message from oneself then now the first \
other recipient is added to To:; previously To: was empty because the own address \
(which was the sender address) is removed from the list of recipients and all other \
recipients were listed in the Cc: header. Requested by Dirk.


  M +31 -16    kmmessage.cpp   1.451.2.1


--- kdepim/kmail/kmmessage.cpp  #1.451:1.451.2.1
@@ -923,4 +923,8 @@ KMMessage* KMMessage::createReply( KMail
     QStringList recipients = splitEmailAddrList( toStr );
     toStr = stripMyAddressesFromAddressList( recipients ).join(", ");
+    // ... unless the list contains only my addresses (reply to self)
+    if ( toStr.isEmpty() && !recipients.isEmpty() )
+      toStr = recipients[0];
+
     break;
   }
@@ -958,21 +962,19 @@ KMMessage* KMMessage::createReply( KMail
     }
 
-    // if it is a mailing list, add the posting address
-    if ( !mailingListAddresses.isEmpty() )
-      recipients.prepend( mailingListAddresses[0] );
-
-    // add From address if appropriate
-    if ( !from().isEmpty() ) {
       if ( !mailingListAddresses.isEmpty() ) {
-        // in case of replying to a mailing list message add the From address
-        // to the list of CC recipients if it's not already there
-        if ( !addressIsInAddressList( from(), recipients ) ) {
+      // this is a mailing list message
+      if ( recipients.isEmpty() && !from().isEmpty() ) {
+        // The sender didn't set a Reply-to address, so we add the From
+        // address to the list of CC recipients.
           ccRecipients += from();
-          kdDebug(5006) << "Added " << from()
-                        << " to the list of CC recipients"
+        kdDebug(5006) << "Added " << from() << " to the list of CC recipients"
                         << endl;
         }
+      // if it is a mailing list, add the posting address
+      recipients.prepend( mailingListAddresses[0] );
       }
-      else if ( recipients.isEmpty() ) {
+    else {
+      // this is a normal message
+      if ( recipients.isEmpty() && !from().isEmpty() ) {
         // in case of replying to a normal message only then add the From
         // address to the list of recipients if there was no Reply-to address
@@ -1006,6 +1008,19 @@ KMMessage* KMMessage::createReply( KMail
       // strip all my addresses from the list of CC recipients
       ccRecipients = stripMyAddressesFromAddressList( ccRecipients );
+
+      // in case of a reply to self toStr might be empty. if that's the case
+      // then propagate a cc recipient to To: (if there is any).
+      if ( toStr.isEmpty() && !ccRecipients.isEmpty() ) {
+        toStr = ccRecipients[0];
+        ccRecipients.pop_front();
+      }
+
       msg->setCc( ccRecipients.join(", ") );
     }
+
+    if ( toStr.isEmpty() && !recipients.isEmpty() ) {
+      // reply to self without other recipients
+      toStr = recipients[0];
+    }
     break;
   }


[prev in list] [next in list] [prev in thread] [next in thread] 

Configure | About | News | Add a list | Sponsored by KoreLogic