Update of /cvsroot/mahogany/M/src/mail
In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv9962/src/mail
Modified Files:
SendMessageCC.cpp
Log Message:
check for lines longer than SMTP max when sending text parts and encode them if
necessary
Index: SendMessageCC.cpp
===================================================================
RCS file: /cvsroot/mahogany/M/src/mail/SendMessageCC.cpp,v
retrieving revision 1.226
retrieving revision 1.227
diff -b -u -2 -r1.226 -r1.227
--- SendMessageCC.cpp 11 Mar 2004 11:15:36 -0000 1.226
+++ SendMessageCC.cpp 10 Apr 2004 23:16:09 -0000 1.227
@@ -681,4 +681,33 @@
}
+// Check if text can be sent without encoding it (using QP or Base64): for
+// this it must not contain 8bit chars and must not have too long lines
+static bool NeedsToBeEncoded(const unsigned char *text)
+{
+ if ( !text )
+ return false;
+
+ size_t lenLine = 0;
+ while ( *text )
+ {
+ if ( *text == '\n' )
+ {
+ lenLine = 0;
+ text++;
+ continue;
+ }
+
+ if ( !isascii(*text++) )
+ return true;
+
+ // the real limit is bigger (~990) but chances are that anything with
+ // lines of such length is not plain text
+ if ( ++lenLine > 800 )
+ return true;
+ }
+
+ return false;
+}
+
// ----------------------------------------------------------------------------
// SendMessageCC header stuff
@@ -1457,5 +1486,5 @@
// if the actual message text is in 7 bit, avoid encoding it even if
// some charset which we would have normally encoded was used
- if ( enc == wxFONTENCODING_SYSTEM || strutil_is7bit(data) )
+ if ( enc == wxFONTENCODING_SYSTEM && !NeedsToBeEncoded(data) )
{
bdy->encoding = ENC7BIT;
-------------------------------------------------------
This SF.Net email is sponsored by: IBM Linux Tutorials
Free Linux tutorial presented by Daniel Robbins, President and CEO of
GenToo technologies. Learn everything from fundamentals to system
administration.http://ads.osdn.com/?ad_id=1470&alloc_id=3638&op=click
_______________________________________________
Mahogany-cvsupdates mailing list
[EMAIL PROTECTED]
https://lists.sourceforge.net/lists/listinfo/mahogany-cvsupdates