Open fg-10 opened 9 years ago
@flgo this is what I've been working on -- will it get the job done for you?
mainframe:process(Account, Mailbox, Queries)
searches for and then notifies all subscribers of the messages which satisfy Queries
.
A worker or client should be able to issue a process command.
Worker command rough draft:
["process", {
"account": Account, // Optional, default to all?
"mailbox": Mailbox,
"query": {
"from": From, // Optional
"to": To, // Optional
... see below ...
}
}
]
A client command would be similar, but without the account
arg.
The Queries
can be either a single query or a list of queries.
IMAP to Query:
{from, From}
{to, To}
{since, SinceDate}
{before, Before}
deleted
{subject, Subject}
{body, Body}
{not, $Query}
{or, $Query1, $Query2}
It would be great to be able to order emails by date, an example use case being a new user signs up, and emails should be processed, most recent first to give a feeling of liveness.
I'm not sure how this would be implemented though -- need to look a bit more through the IMAP spec.
Looks great, though I have a couple questions.
Thanks!
How does Switchboard make sure it does not "miss" any e-mails?
Yeah, I hear you -- now that it can process more than just a stream of emails as they arrive, it would be nice to have some sort of guarantee that a portion of emails have been processed.
To do this right, there needs to be a record of what emails have been processed, either through a date received marker (may not be sufficient) or just recording IDs.
What will happen if the server needs a reboot? Gotcha. This goes hand-in-hand with the previous question.
I'm going to plan on working on this as a separate issue. Having this process
described above will be useful at a low level, but there needs to be some logic managing processing emails on start.
@jtmoulia any news?
I've been tinkering on it, but haven't been able to devote the time needed to complete it.
So, it's progressing, but slowly. I'll report back with updates as I have them. Thanks for the bump -- it's good motivation.
@jtmoulia guess switchboard development kind of stopped couple months ago? To bad to see a project with such great potential go inactive :(
@flgo I'll take that bait -- we will support switchboard, just haven't been prioritizing it well. Thanks for the reminder :)
Tho, I'm going to get into issue #40 first.
After discussing with @jtmoulia a function to process existing e-mails would be very useful. Currently Switchboard only allows to process new e-mails. A function to also process existing e-mails would complete Switchboard for being a full IMAP API.