[Pymilter] Request for comment: Support new callbacks
Stuart D. Gathman
stuart at bmsi.com
Thu May 21 22:14:28 EDT 2009
Request for comment
I added experimental support in CVS for the 3 new callbacks: unknown, data,
negotiate. I haven't liked the milter.set_xxx_callback(callable) API.
For these new callbacks, I added keyword parameters to register:
milter.register('myfilter',unknown=doUnknown,data=doData)
If not set, the callbacks of course take the default action. This probably
won't affect too many people since they generally use Milter.runmilter().
I would like to deprecate the set_xxx_callback methods and make all
the callbacks settable via keyword args to register.
Other ideas for specifying callbacks:
pass a data class or dict with callbacks to register.
The negotiate callback needs more work. For instance, if the
python code does nothing with the current version and a recent sendmail, then
no further callbacks will be called! (Because all the available
SMFIP_NR_* and SMFIP_NO* flags will be copied.) Maybe this is reasonable,
however, since the default action is to return SMFIS_ALL_OPTS, and
presumably if you define negotiate callback, you know what you are doing.
I would like the Milter class to be able to detect which callback
member functions are not overridden, and set the SMFIP_NO* flags
accordingly.
I may be confused about how the flags are used. It seems weird that
you have to carefully clear the SMFIP_NR and SMFIP_NO flags while
leaving other flags intact in the protocol flag word. This will take
some experimenting. Perhaps I should change to python negotiate API
to take an input tuple and output list, with the list initialized
to reasonable defaults by the C code.
--
Stuart D. Gathman <stuart at bmsi.com>
Business Management Systems Inc. Phone: 703 591-0911 Fax: 703 591-6154
"Confutatis maledictis, flammis acribus addictis" - background song for
a Microsoft sponsored "Where do you want to go from here?" commercial.
More information about the Pymilter
mailing list