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

List:       kmail-devel
Subject:    [PATCH] Fix for the reply-to-all bug.
From:       Marc Mutz <Marc.Mutz () uni-bielefeld ! de>
Date:       2001-06-30 14:11:44
[Download RAW message or body]

-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA1

Hi!

I finally tracked down this bug. After I was able to reproduce it, it 
was quite easy. For those of interested:

The bug was that the whole To: header was omitted when two conditions 
were met by the replied-to message' To: header:

1. It was folded after each address-delimiting ","
2. It contained the default identity of the user (Marc@Mutz.com in my 
case).

The first condition let decodeRFC204String() to delete separating 
whitespace (in violation to RFC822, BTW, since "CRLF LWSP-char" must be 
considered equivalent to LWSP-char), leaving only the separating ",".

This part of the bug is fixed by the first and only hunk for 
kmmsgbase.cpp.

The second condition made KMMessage::createReply()
(via toStr.find(<...>-Part of newmsg->from()) )
run back the length of the toStr in search for ", " (note the space, 
which is BTW also in violation of RFC822, which states that m#n abc is 
equivalent to abc m-1*n-1("," abc)), which it didn't find, leading to 
the interpretation of the whole to() string as a single address...

All in all the createReply() function is still very buggy, since it 
doesn't cope with (valid!) embedded (escaped) DQUOTE's in 
quoted-string's, nor does it seem to handle ',''s in quoted-string's. 
But fixing this would require a real parser, which I'm not going to 
write for _this_ code (doesn't mimelib provide an address-list 
parser?). I have to write one for the new mimelib-replacement, though.
Also, it always assumes the default identity for it's "strip my own 
mail address" functionality.

So the attached patch only replaces the search strings ", " with ','.

Marc

- -- 
Marc Mutz <Marc@Mutz.com>
http://marc.mutz.com/
http://www.mathematik.uni-bielefeld.de/~mmutz/
http://EncryptionHOWTO.sourceforge.net/
-----BEGIN PGP SIGNATURE-----
Version: GnuPG v1.0.6 (GNU/Linux)
Comment: For info see http://www.gnupg.org

iD8DBQE7PfnO3oWD+L2/6DgRAgfzAJ467Z1+O1rkmpdBcqeQHlqjzwa8MgCbBOqL
lOJ5B4OBUX8WRAvmAvdDxJA=
=yL5J
-----END PGP SIGNATURE-----

["kmail-fix-reply-to-all.diff;" (text/x-diff)]

Index: kmmsgbase.cpp
===================================================================
RCS file: /home/kde/kdenetwork/kmail/kmmsgbase.cpp,v
retrieving revision 1.79
diff -u -3 -p -r1.79 kmmsgbase.cpp
--- kmmsgbase.cpp	2001/06/21 15:34:52	1.79
+++ kmmsgbase.cpp	2001/06/30 14:08:03
@@ -287,7 +287,7 @@ QString KMMsgBase::decodeRFC2047String(c
       result += *pos;
     }
   }
-  return result.replace(QRegExp("\n[ \t]"),"");
+  return result.replace(QRegExp("\n[ \t]")," ");
 }
 
 
Index: kmmessage.cpp
===================================================================
RCS file: /home/kde/kdenetwork/kmail/kmmessage.cpp,v
retrieving revision 1.210
diff -u -3 -p -r1.210 kmmessage.cpp
--- kmmessage.cpp	2001/06/27 09:46:27	1.210
+++ kmmessage.cpp	2001/06/30 14:08:05
@@ -706,14 +706,14 @@ KMMessage* KMMessage::createReply(bool r
     {
       int pos1, pos2, quot;
       quot = toStr.findRev("\"", i);
-      pos1 = toStr.findRev(", ", i);
+      pos1 = toStr.findRev(',', i);
       if (pos1 < quot)
       {
         quot = toStr.findRev("\"", quot - 1);
-        pos1 = toStr.findRev(", ", quot);
+        pos1 = toStr.findRev(',', quot);
       }
       if( pos1 == -1 ) pos1 = 0;
-      pos2 = toStr.find(", ", i);
+      pos2 = toStr.find(',', i);
       toStr = toStr.left(pos1) + toStr.right(toStr.length() - pos2);
     }
     else
@@ -724,14 +724,14 @@ KMMessage* KMMessage::createReply(bool r
     {
       int pos1, pos2, quot;
       quot = ccStr.findRev("\"", i);
-      pos1 = ccStr.findRev(", ", i);
+      pos1 = ccStr.findRev(',', i);
       if (pos1 < quot)
       {
         quot = ccStr.findRev("\"", quot - 1);
-        pos1 = ccStr.findRev(", ", quot);
+        pos1 = ccStr.findRev(',', quot);
       }
       if( pos1 == -1 ) pos1 = 0;
-      pos2 = ccStr.find(", ", i);
+      pos2 = ccStr.find(',', i);
       ccStr = ccStr.left(pos1) + ccStr.right(ccStr.length() - pos2 - 1); //Daniel
     }
     else

_______________________________________________
Kmail Developers mailing list
Kmail@master.kde.org
http://master.kde.org/mailman/listinfo/kmail


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

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