Update of /cvsroot/mahogany/M/src/mail
In directory usw-pr-cvs1:/tmp/cvs-serv13167/src/mail

Modified Files:
        Address.cpp 
Log Message:
1. replaced GetFullEmailAddress() with (static) Address::BuildFullForm()
2. quote the personal part of the address correctly in it now
3. OTOH, don't do it in the composer: this fixes the bugs 633 and 486


Index: Address.cpp
===================================================================
RCS file: /cvsroot/mahogany/M/src/mail/Address.cpp,v
retrieving revision 1.5
retrieving revision 1.6
diff -b -u -2 -r1.5 -r1.6
--- Address.cpp 22 Nov 2001 22:13:19 -0000      1.5
+++ Address.cpp 26 Apr 2002 13:15:06 -0000      1.6
@@ -198,4 +198,44 @@
 }
 
+/// construct the full email address of the form "name <email>"
+/* static */
+String Address::BuildFullForm(const String& name, const String& email)
+{
+   if ( !name )
+   {
+      // don't use unnecessary angle quotes then
+      return email;
+   }
+
+   String personal = name,
+          address;
+
+   // we need to quote the personal part if it's not an atext as defined by RFC
+   // 2822 (TODO: reuse IsATextChar() from matchurl.cpp!)
+   bool doQuote = strpbrk(name, ",;\"") != (const char *)NULL;
+   if ( doQuote )
+   {
+      address = '"';
+
+      // escape all quotes
+      personal.Replace("\"", "\\\"");
+   }
+
+   address += personal;
+
+   if ( doQuote )
+   {
+      address += '"';
+   }
+
+   if ( !email.empty() )
+   {
+      address << " <" << email << '>';
+   }
+   //else: can it really be empty??
+
+   return address;
+}
+
 // ----------------------------------------------------------------------------
 // AddressList


_______________________________________________
Mahogany-cvsupdates mailing list
[EMAIL PROTECTED]
https://lists.sourceforge.net/lists/listinfo/mahogany-cvsupdates

Reply via email to