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

List:       kmail-devel
Subject:    [nPATCH #6402] Add x-uuencode decode support to KMail.
From:       Marc Mutz <mutz () kde ! org>
Date:       2002-09-28 23:24:24
[Download RAW message or body]

[Attachment #2 (multipart/mixed)]


Hi!

Well, it's really nano, since it only consists of moving the default: 
branch of switch statements and checking for a valid KMime::Codec being 
returned. The rest of the diff is indention due to the if ( codec )'s.

Attached is also a test message with an x-uuencode attachement. It's 
somehow not shown as it should in smart attachment mode, seems like 
KMail wants to show it inline, although the CD is set to attachment...

Oh, of course you'll need an uptodate libkdenetwork...

Marc

-- 
It is truly ironic that the United States, once the beacon for
promoting the principles of freedom of expression, is now
systematically infecting other countries with this dangerous public
policy choice [the DMCA] that will restrict more speech than any law
before it.    -- EFF FTAA Alert:
                 Stop Hollywood Forcing Technology Ban on 34 Countries

["forwarded message" (message/rfc822)]



Hi guys
     The attached file is Ali FIR Linux Driver Patch v0.7 for kernel after
Linux 2.4.2 (include 2.4.2). It resolves that issue that ALi FIR Controller
can't work with HP3600 transceiver. Please try it and please don't hesitate
to contact me if you have any question.


Benjamin
benjamin_kong@ali.com.tw

(See attached file: ali-ircc-v07-24x.diff.tar.gz)


["ali-ircc-v07-24x.diff.tar.gz" (application/octet-stream)]
["kmail-uuencode-support.diff" (text/x-diff)]

Index: kmmsgpart.cpp
===================================================================
RCS file: /home/kde/kdenetwork/kmail/kmmsgpart.cpp,v
retrieving revision 1.87
diff -u -3 -p -r1.87 kmmsgpart.cpp
--- kmmsgpart.cpp	2002/09/27 19:25:15	1.87
+++ kmmsgpart.cpp	2002/09/28 22:12:08
@@ -268,14 +268,15 @@ QByteArray KMMessagePart::bodyDecodedBin
   {
   case DwMime::kCteQuotedPrintable:
   case DwMime::kCteBase64:
+  default:
     {
       Codec * codec = Codec::codecForName( cteStr() );
-      assert( codec );
-      // Nice: we can use the convenience function :-)
-      result = codec->decode( mBody );
-      break;
+      if ( codec ) {
+	// Nice: we can use the convenience function :-)
+	result = codec->decode( mBody );
+	break;
+      } // else fall through
     }
-  default:
     kdWarning(5006) << "bodyDecodedBinary: unknown encoding '" << cteStr()
 		    << "'. Assuming binary." << endl;
   case DwMime::kCte7bit:
@@ -303,30 +304,31 @@ QCString KMMessagePart::bodyDecoded(void
   {
   case DwMime::kCteQuotedPrintable:
   case DwMime::kCteBase64:
+  default:
     {
       Codec * codec = Codec::codecForName( cteStr() );
-      assert( codec );
-      // We can't use the codec convenience functions, since we must
-      // return a QCString, not a QByteArray:
-      int bufSize = codec->maxDecodedSizeFor( mBody.size() ) + 1; // trailing NUL
-      result.resize( bufSize );
-      QByteArray::ConstIterator iit = mBody.begin();
-      QCString::Iterator oit = result.begin();
-      QCString::ConstIterator oend = result.begin() + bufSize;
-      if ( !codec->decode( iit, mBody.end(), oit, oend ) )
-	kdWarning(5006) << codec->name()
-			<< " lies about it's maxDecodedSizeFor( "
-			<< mBody.size() << " ). Result truncated!" << endl;
-      len = oit - result.begin();
-      result.truncate( len ); // adds trailing NUL
+      if ( codec ) {
+	// We can't use the codec convenience functions, since we must
+	// return a QCString, not a QByteArray:
+	int bufSize = codec->maxDecodedSizeFor( mBody.size() ) + 1; // trailing NUL
+	result.resize( bufSize );
+	QByteArray::ConstIterator iit = mBody.begin();
+	QCString::Iterator oit = result.begin();
+	QCString::ConstIterator oend = result.begin() + bufSize;
+	if ( !codec->decode( iit, mBody.end(), oit, oend ) )
+	  kdWarning(5006) << codec->name()
+			  << " lies about it's maxDecodedSizeFor( "
+			  << mBody.size() << " ). Result truncated!" << endl;
+	len = oit - result.begin();
+	result.truncate( len ); // adds trailing NUL
 #if QT_VERSION >= 0x030100
-      result = result.replace( "\r\n", "\n" );
+	result = result.replace( "\r\n", "\n" );
 #else
-      result = result.replace( QRegExp("\r\n"), "\n" );
+	result = result.replace( QRegExp("\r\n"), "\n" );
 #endif
-      break;
+	break;
+      } // else fall through...
     }
-  default:
     kdWarning(5006) << "bodyDecoded: unknown encoding '" << cteStr()
 		    << "'. Assuming binary." << endl;
   case DwMime::kCte7bit:

[Attachment #10 (application/pgp-signature)]
_______________________________________________
KMail Developers mailing list
kmail@mail.kde.org
http://mail.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