[Gambas-devel] [RFC] Gambas implementation of the pop3 protocol

Sebastian Kulesz sebikul at ...176...
Sat Aug 25 00:53:53 CEST 2012


On Fri, Aug 24, 2012 at 7:44 PM, Benoît Minisini
<gambas at ...1...> wrote:
> Le 24/08/2012 05:39, Sebastian Kulesz a écrit :
>> Hi! I made a component to implement the pop3 protocol purely in Gambas
>> and wanted some feedback on how the API should be implemented.
>>
>> Right now there is an exported class called Pop3Client that wraps the
>> call depending if the connection should be encrypted or not using 2
>> sub classes (TCPClient & SSLClient) which share the same API. If it is
>> encrypted, an openssl process is used to execute the commands and read
>> the response, if it's not, a plain socket is used.
>>
>> At first i wanted to include asynchronous support, but it was REALLY
>> buggy and difficult to implement, so i left it synchronous. A list of
>> the implemented commands can be found at the top of the
>> Pop3Client.class file. Although the user can use the Pop3Client.Send()
>> call directly to send any command, their implementation should return
>> the data on a semi parsed form
>>
>> I'm not sure how the API should be implemented and if the structure
>> i'm using is the best approach. How would you implement the protocol?
>> How would you abstract encrypted and non encrypted connections so that
>> the difference cannot be seen by the developer?
>> When executing a command that requires a large amount of data to be
>> downloaded (e.g retrieve a message with attachments), subsequent calls
>> can be overlapped, is there a way to avoid this?
>>
>> * Protocol specifications: http://tools.ietf.org/html/rfc1939
>>
>> Thanks a lot!!
>>
>
> I will look at it.
>
> Check if the new gb.task component could allow you to implement an
> asynchronous version of the Pop3Client (like FtpClient and HttpClient).
>
> SmtpClient handle encrypted connections the same way as you. Maybe you
> can look at its code?
>
> Now we will need a MIME library to parse MIME messages...
>
> Regards,
>
> --
> Benoît Minisini
>
> ------------------------------------------------------------------------------
> Live Security Virtual Conference
> Exclusive live event will cover all the ways today's security and
> threat landscape has changed and how IT managers can respond. Discussions
> will include endpoint security, mobile security and the latest in malware
> threats. http://www.accelacomm.com/jaw/sfrnl04242012/114/50122263/
> _______________________________________________
> Gambas-devel mailing list
> Gambas-devel at lists.sourceforge.net
> https://lists.sourceforge.net/lists/listinfo/gambas-devel

Hey, I was about to propose an implementation of a threading
component! Well done!

The code used to talk to openssl was actually taken from the
SmtpClient class, there is a notice about that in the source code. ;)

I believe that asynchronous implementation should wait until A. the
api is well defined and B. the gb.task component matures a little bit.
However, i will start playing around with it so i can give some
feedback.

The MIME parsing should definitely be done using an external library,
like gmime [0]. There are a LOT of specifications that need to be read
and implemented, and i think that reinventing the wheel using another
material would be pointless in this case.

[0] http://spruce.sourceforge.net/gmime/
* Supported specifications also listed here

Thanks!




More information about the Devel mailing list