Mail plugins for modifying headers on outgoing messages
Mail plugins for modifying headers on outgoing messages
- Subject: Mail plugins for modifying headers on outgoing messages
- From: Wade Tregaskis <email@hidden>
- Date: Thu, 18 Nov 2004 16:18:04 +1100
I'm writing a Mail plugin to add Hashcash support, and while it's
pretty easy to read immutable messages at various places, and there's
suitable notifications to catch for doing so, there appears to be no
"ideal" way to slide some code into the sending process. GPGMail takes
a very verbose approach with replacing controllers and nasty such
hacks, which is fine for their use where they use other functionality
derived from that, but seems like major overkill for what I want.
Additionally, it would be better to calculate the Hashcash stamps when
messages are actually sent (not just queued or placed in the Outbox).
So, knowing all this and after a few hours of playful hacking, I've
found at least "an" approach is to pose as MailDelivery and override
the headersForDelivery method. I at first tried modifying the
OutgoingMessage class (and related), but for some strange reason any
changes you make to these have no actual effect - it seems they're
created redundantly, or at least doing something obscure and tricky. I
can't figure out what the real class is for outgoing messages, thus the
MailDelivery approach, which I feel is less elegant, but does actually
work (as evident by the X-Hashcash in this email's headers).
Anyway, the point I'm getting at is, is this the best way to do what I
want? I know posing as MailDelivery is generally a bad thing, but
there seems to be no other way to do it - Mail isn't of course really
designed with plugins in mind, and while interface stuff is easy enough
to modify, the guts of it are almost air-tight to the outside world.
A problem with the approach I've taken is that it's entirely
non-interactive... I can probably post activity messages, but that's
about it, I imagine. Not without some really icky hacking about,
anyway. In my use as it stands this shouldn't really be a problem, but
I've an eye for the future...
Wade Tregaskis (AIM, Yahoo & Skype: wadetregaskis, ICQ: 40056898, MSN &
email: email@hidden, Jabber:
email@hidden)
-- Sed quis custodiet ipsos custodes?
P.S. Yes yes, people who add plugins to Mail will be hexed into the
next life, I know. :P
_______________________________________________
Do not post admin requests to the list. They will be ignored.
Cocoa-dev mailing list (email@hidden)
Help/Unsubscribe/Update your Subscription:
This email sent to email@hidden