[Evolution-hackers] EMsgComposer API support for "Send and Archive"



I am working on an Evolution extension that adds a "Send and Archive"
menu item and toolbar button to Evolution mail composer windows.  It
would be enabled only for replies or forwards.  The intent is that
selecting this action first sends the newly-composed message, then
archives the forwarded or replied-to source message.  Gmail has offered
this as an optional feature for some time (
http://gmailblog.blogspot.com/2009/01/new-in-labs-send-archive.html),
and it is also available as a Thunderbird extension (https://addons.moz
illa.org/en-us/thunderbird/addon/send-and-archive/).  I'm really
missing this feature in Evolution, so I'm trying to scratch my own
itch.

Unfortunately, I don't see how to trigger the archiving behavior at
exactly the right times.  e_msg_composer_send() is very much fire-and 
-forget.  There's no callback once this *specific* send attempt
completes.  Connecting to EMsgComposer's "send" signal will trigger for
*all* sends, not just the ones initiated by my "Send and Archive"
action, so I could not tell whether to archive or not.  I cannot merely
delay connecting to the "send" signal until I am inside the "activate"
signal for my "Send and Archive" action: if the attempt to send fails,
my "send" signal callback will still be connected.  If the user later
clicks "Send" (not "Send and Archive"), then my "send" signal callback
will still trigger, and I'll archive the source message when I
shouldn't have.

Is there a creative way to set up the right triggers at the right times
that I just haven't thought of?  Or is this truly impossible within the
current API?  If the latter, would the Evolution team be willing to
consider API changes that would allow better support for a feature like
this in the future?  (A good start might be for e_msg_composer_send()
to return the EActivity it creates: this exactly represents the current
send attempt and could be monitored for status changes.)

Regards,
Ben


[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]