[Kde-pim] rfcdecoder move to lib?

Allen Winter winter at kde.org
Sat Mar 10 23:28:37 GMT 2007


On Wednesday 07 February 2007 5:35:42 pm Ingo Klöcker wrote:
> On Wednesday 07 February 2007 10:47, Tom Albers wrote:
> > At Tuesday 06 February 2007 23:55, you wrote:
> > > > And to you all, is that ok with you to move it to kdepimlibs and
> > > > where should it go? kdepimlibs/emailfunctions is a candidate but
> > > > that's a bit general for this specific imap lib.
> > >
> > > kdepimlibs/kmime would be more appropriate. At least for the RFC
> > > 2047/2231 codecs. But doesn't kmime already include such decoders?
> >
> > Yes, for me the primary reason is the fromImap and toImap functions,
> > which should be renamed to encodeImapFolderName() and
> > decodeImapFolderName(). This is used the correctly encode umlauts &
> > co in the communication to the IMAP-server. So it has little to do
> > with kmime.
> 
> So something like kdepimlibs/libimap would be more appropriate. I guess 
> over time there will be more imap-related code that you would want to 
> share with the imap4 ioslave.
> 
> > > > Are there any other copyright holders? svn log mentions several
> > > > people, but that's all due to porting or tiny fixes I think.
> > >
> > > Also the code needs to be cleaned up. For example, the decoding
> > > methods should take QByteArray arguments and the encoding methods
> > > should return QByteArray. After all RFC 2047 and RFC 2231 encoded
> > > strings are ASCII.
> > >
> > > And looking at (which is just a random code snippet I saw when
> > > glancing over the code)
> > >   signed char *latin = (signed char *) calloc (1, _str.length () +
> > > 1); char *latin_us = (char *) latin;
> > >   strcpy (latin_us, _str.toLatin1 ());
> > > makes me cringe.
> >
> > Not sure if that's in the functions I'm using, but this kind of code
> > is far beyond my knowledge, so if it needs to be cleaned up we need a
> > volunteer for that.
> 
> It's basically equivalent to
>   QByteArray latin_us_array( _str.toLatin1() );
>   char *latin_us = latin_us_array.data();
>   signed char *latin = (signed char *) latin_us;
> which I hope is more understandable to you. If that's the case, then 
> I've made my point. Apart from using evil functions like calloc() and 
> strcpy() the code isn't really easy to understand for C++ and Qt 
> hackers without a background in low-level C programming.
> 
I create kdepimlibs/kimap today.  So far it only contains the rfcdecoder class.

Except.. I renamed the rfcDecoder class to RfcCodecs, as was suggested
in a todo comment in the code. 

I did: doxygenate, stylize, namespace, etc. the code according to our standards.

I didn't:  do all the cleanups mentioned above; replace the evil calloc()
and strcpy() stuff;use QByteArrays; rename any methods.

Volunteers to take it from here?  And we really need some unit tests.

-Allen




-- 
KDEPIM Developer
I accept PayPal payments to awinterz at earthlink.net
_______________________________________________
kde-pim mailing list
kde-pim at kde.org
https://mail.kde.org/mailman/listinfo/kde-pim
kde-pim home page at http://pim.kde.org/


More information about the kde-pim mailing list