Implement IncomingBox Client, based on namespaced blobs
Definition of done:
creating a class that can be instantiated by the trusted app in the client, that does ALL the following:
-
check periodically for pending documents #8872 (closed) -
define an interface for the incoming mail consumer and the processing flow #8881 (closed) -
download the pending documents #8874 (closed) -
register a callback for the incoming mail consumer #8875 (closed) -
delete the pending documents when insertion done #8873 (closed)
This class is initialized with the namespace of the consumer app, so for instance (just a proposal, open for discussion):
incoming = soledad.IncomingBox('mx')
incoming.addConsumer(incomingMailConsumer)
I think that's all the public api that's needed. For sure this needs to have some relation with the BlobManager, and to handle the polling loop state internally.
For context, the incomingMail would be an implementor of some IIconmingBoxConsumer interface (the output of #8881 (closed)), something that can look like:
class IncomingBoxConsumer(object):
implements(IIncomingBoxConsumer)
def __init__(self, inbox):
self.inbox = inbox
def decrypt(self, msg):
# decrypt pipeline
def process(self, msg):
# get all the pieces from email
def save(self, msg):
self.inbox.addMessage(msg)
kali can provide this class, and refactor incoming mail to do that, but this mechanism should exist and be well tested before doing that refactor.
The call from delete must happen after a successful execution of the save() call.