Implementation

Database Manager

The design of the database manager was inspired by alots database manager alot.db.DBManager.

class afew.Database.Database[source]

Convenience wrapper around notmuch.

add_message(path, sync_maildir_flags=False, new_mail_handler=None)[source]

Adds the given message to the notmuch index.

Parameters
  • path (str) – path to the message

  • sync_maildir_flags (bool) – if True notmuch converts the standard maildir flags to tags

  • new_mail_handler (a function that is called with a notmuch.Message object as its only argument) – callback for new messages

Raises

notmuch.NotmuchError if adding the message fails

Returns

a notmuch.Message object

close()[source]

Closes the notmuch database if it has been opened.

do_query(query)[source]

Executes a notmuch query.

Parameters

query (str) – the query to execute

Returns

the query result

Return type

notmuch.Query

get_messages(query, full_thread=False)[source]

Get all messages mathing the given query.

Parameters
Returns

an iterator over notmuch.Message objects

remove_message(path)[source]

Remove the given message from the notmuch index.

Parameters

path (str) – path to the message

walk_replies(message)[source]

Returns all replies to the given message.

Parameters

message (notmuch.Message) – the message to start from

Returns

an iterator over notmuch.Message objects

walk_thread(thread)[source]

Returns all messages in the given thread.

Parameters

thread (notmuch.Thread) – the tread you are interested in

Returns

an iterator over notmuch.Message objects

Filter

class afew.filters.BaseFilter.Filter(database, **kwargs)[source]
flush_changes()[source]

(Re)Initializes the data structures that hold the enqueued changes to the notmuch database.

Configuration management

Miscellanious utility functions