Home GnuPG
Diffusion GpgOL 9207e8fb039b

Factor logic out of event handler
9207e8fb039bUnpublished

Unpublished Commit · Learn More

Not On Permanent Ref: This commit is not an ancestor of any permanent ref.

Description

Factor logic out of event handler

* src/Makefile.am: Add mail.h and mail.cpp
* src/mail.cpp, src/mail.h: New. Class containing information and
  functionality to work with mails.
* src/application-events.cpp (EVENT_SINK_INVOKE): Create mail objects
  on ItemLoad event for Mailitems.
* src/mailitem-events.cpp (HTML_TEMPLATE): Move to mail.cpp
  (BEGIN_EVENT_SINK): Reduce member variables.
  (MailItemEvents::MailItemEvents): Less initializations.
  (MailItemEvents::handle_read): Moved to Mail::insert_plaintext.
  (MailItemEvents::handle_before_read): Moved to Mail::process_message
  (do_crypto_on_item): Moved to Mail::do_crypto
  (needs_crypto): Moved to Mail::needs_crypto
  (EVENT_SINK_INVOKE): Get reference to according mail object.
  (EVENT_SINK_INVOKE): Call Mail methods according to events.
  (EVENT_SINK_INVOKE): Wipe code moved to Mail::wipe

mailitem-events should only "respond to events" from now on.
Encapsulating all information about a Mail in a single class makes
sense as we can keep track of data independently of events. The
mix of state variables (e.g. needs_wipe) in the event handler
made it difficult to access that information from anywhere.
Additionally we now keep track of all Mail items loaded with
our Event sinks set and expose them through Mail::get_mail_for_item.
This should help solving problems like "wiping all plaintext on
unload"

Details

Provenance
aheineckeAuthored on Oct 30 2015, 2:49 PM
Parents
rO55c2d14b39e6: Fix recipient lookup for SMTP addresses
Branches
Unknown
Tags
Unknown