mailnag
mailnag copied to clipboard
Create Avatar Plugins
Currently avatar functionality is available in the Mailnag GNOME-Shell extension exclusively. In the long run this functionality should be moved (via plugins) to Mailnag core.
Benefits
- Desktop extensions (gnome-shell, cinnamon, ...) can make use of a generic avatar interface without the need for implementing their own logic
- Desktop extensions just need to check if dbus Mailnag Mail objects have the avatar_path property set and load the image it points to
- Desktop extensions don't need to be set up via make and bundled with binaries (aggregate-avatars)
- The mailnag-gnome-shell extension hosted at extensions.gnome.org will support avatars
Gravatar/libravatar plugin (included in Mailnag core?)
- Pulls the avatar for a given email from gravatar.com
- Caches avatars in $XDG_RUNTIME_DIR/gravatar-plugin-cache
- Assigns the path of an avatar image to mail.avatar_path in the MAILS_ADDED plugin hook
- Can be included in the Mailnag core project since no further dependencies are required
Folks plugin (optional)
- Retrieves avatars from libfolks when being enabled
- Caches avatars in $XDG_RUNTIME_DIR/folks-plugin-cache
- Assigns the path of an avatar image to mail.avatar_path in the MAILS_ADDED plugin hook
- Dependes on libfolks, a GNOME dependency, so this plugin should be developed in an external project (repo)
- Move the aggregate-avatars stuff from mailnag-gnome-shell into this project
- Remove the "Show avatars" options from mailnag-gnome-shell prefs
Required changes in Mailnag (core)
- The Mail class needs to be extended by an avatar_path property
- This new property also needs to be exposed by the dbus plugin
- The MAILS_ADDED hook of avatar plugins needs to be called before the MAILS_ADDED hook of other plugin (esp. the dbus plugin) so some kind of plugin hook priority has to be introduced
- The version needs to be bumped and avatar plugins are required to depend on this or newer Mailnag versions
After further thinking, I slightly changed my mind:
- This all should go into single plugin (otherwise it would confuse users and would be hard to maintain)
- The folks backend should be optional and only be activatable in the plugin preferences if required dependencies are installed (distro packages should recommend those dependecies though)
- Instead of adding an mail.avatar_path property, a generic mail.attributes dictionary should be added, which can also be utilized by future plugins and extensions. In case of the avatar plugin mail.attributes["avatar"] should be set
- The plugin should not be installed by default since it's functionality is only useful for other external plugins/extensions (it's not used in Mailnag core)