I have no real experience with POP3, but I think your client looks simple and nice. Some comments on the pike code:
o Improve the error checking. I think it's reasonable that all the functions throws exceptions for any type of I/O error, except maybe for the operation to open a connection. If you don't want that for some reason, you should at least propagate the error values for the I/O operations better, e.g. returning some kind of success/failure flag and store the errno value in the object so that the user can read it.
o You throw errors from the pop server directly. I don't know exactly what those error messages looks like, but it's likely that they get hard to identify when the context is lost. You should do something like this:
error("Failed to open POP3 connection to %s. Server reply: %s\n", hostname, response);
error("Failed to log in to POP3 account. Server reply: %s\n", response);
etc.
o Maybe combine send_user and send_password to one function? Or is it useful to do one without the other?
o This looks bogus:
do { recv = socket->gets(); } while(!recv);
Doesn't it hang the process if an I/O error occurs there or if the server has closed the connection?
o It's perhaps a bit nicer to make objects of the messages instead of returning them as arrays. That would also make it easier to do future extensions.
o Consider using static instead of private a bit more. Your class becomes hard to inherit if all the low level functions are private.
o It's better to use werror(describe_error(error)) instead of werror(error[0]).
o Fix support for encryption over TLS (aka SSL)?
o Fix an asynchronous mode using callbacks?
/ Martin Stjernholm, Roxen IS
Previous text:
2003-10-08 17:36: Subject: bugs and pop3
Hello everyone,
I'm new to pike, but willing to help.
I found a small error in the reference manual. In the file : refdoc/traditionnal_manual/chapter_2.html 2.1.1 If "If you are interested in having something" instead of "If you are *not* interested in having something"
And on the website, in the forums subsection, you should say something about the pike-devel list, i found it by chance...
Now something a little more interesting : I write a pop3 client module It's documented with autodoc and available here : http://lucane.org/~vincent/pike/POP3.pmod/Client.pike
Do you have any comments on it ?
Have a nice day, Vincent.
/ Brevbäraren