[Twisted-Python] Hacking imap

Anders Hammarquist iko at cd.chalmers.se
Tue Jun 24 07:28:41 EDT 2003


In a message of Tue, 24 Jun 2003 01:23:53 EDT, Jp Calderone writes:
>On Tue, Jun 24, 2003 at 01:38:32AM +0200, Anders Hammarquist wrote:
>  Could you elaborate on "properly handle"?  I am currently making changes
>in this area as well, mainly in the direction of avoiding all the in-memory
>buffering the code currently does.

Certainly,

There are lots of places where literals aren't handled (I think that
the only place where they are handled is in APPEND, at least from what
my testing show). Anyplace where the syntax allows a string, a literal
is allowed.

The idea is to have the command dispatcher parse the arguments for each
command, and then pass the arguments to the command handling function.
This way, if the argument is a literal or a string, it can be passed as
a file object (but there is no need - for example, if a mailbox name
is given as a literal, there is little reason to give it in a file object).

So instead of naming the handler functions <state>_<COMMAND>, I'll have
<state>_<COMMAND> be a tuple containing ( <handler_function>,
<arg_parser>, <arg_parser>, ...) and then call the handler_function
with the results of the arg_parser functions.

/Anders

-- 
 -- Of course I'm crazy, but that doesn't mean I'm wrong.
Anders Hammarquist                                  | iko at cd.chalmers.se
Physics student, Chalmers University of Technology, | Hem: +46 31 88 48 50
G|teborg, Sweden.           RADIO: SM6XMM and N2JGL | Mob: +46 707 27 86 87




More information about the Twisted-Python mailing list