Gus Mueller
2010-01-23 23:33:42 UTC
I promised that I'd have a prototype by the weekend, and that's what we've got now. However- I need to stress that this isn't Letters, and in fact the name of the prototype is CrashyEmailApp.
It still isn't a very good foundation to build on, but it's something and if you'd like to follow along with it, you can check it out here:
http://github.com/ccgus/letters
It's a skeleton. My next task is to start rearranging things a bit in LetterBox (which is the backend framework based off MailCore that does smtp and imap stuff via libetpan) so that you tell it "hey, go fetch me info for this account, and load this folder".
The general design for this I've come up with is CEA (CrashyEmailApp) will just tell LetterBox "I'm the delegate for this account, here's a block that I want you to use when my request is ready" and it'll go do it's thing. CEA will then get various updates along the lines of this:
- Authentication was good / bad.
- I've downloaded some headers for the folder you requested, you can pull them out of the cache and display them. I've still got more to come, and will let you know when I'm finished with this task.
- I've downloaded the message bodies for the folder, you can pull these out of the cache too.
- You didn't ask for it, but I checked the server and there's new messages in INBOX.
- I did something, the results are in the cache.
- etc.
The basic idea is that CEA will never have a direct connection to the server. It asks LetterBox to do something, LetterBox will then grab a server connection (from a pool, libetpan isn't thread safe) and do the request, update the cache, and then tell CEA that it's updated (with relevant userinfo supplied). CEA will rarely have a direct line to the server. In a sense, this is almost like the daemon idea but way easier for me to set breakpoints and debug.
Of course, this is all just in my head and needs to be pounded out into code.
Suggestions for improvements to this idea or reasonable alternatives? I've left lots of things vague on purpose, since things always seem to change a bit once you start coding. But I think the general architecture is a decent and obvious.
-gus
--
August 'Gus' Mueller
Flying Meat Inc.
http://flyingmeat.com/
It still isn't a very good foundation to build on, but it's something and if you'd like to follow along with it, you can check it out here:
http://github.com/ccgus/letters
It's a skeleton. My next task is to start rearranging things a bit in LetterBox (which is the backend framework based off MailCore that does smtp and imap stuff via libetpan) so that you tell it "hey, go fetch me info for this account, and load this folder".
The general design for this I've come up with is CEA (CrashyEmailApp) will just tell LetterBox "I'm the delegate for this account, here's a block that I want you to use when my request is ready" and it'll go do it's thing. CEA will then get various updates along the lines of this:
- Authentication was good / bad.
- I've downloaded some headers for the folder you requested, you can pull them out of the cache and display them. I've still got more to come, and will let you know when I'm finished with this task.
- I've downloaded the message bodies for the folder, you can pull these out of the cache too.
- You didn't ask for it, but I checked the server and there's new messages in INBOX.
- I did something, the results are in the cache.
- etc.
The basic idea is that CEA will never have a direct connection to the server. It asks LetterBox to do something, LetterBox will then grab a server connection (from a pool, libetpan isn't thread safe) and do the request, update the cache, and then tell CEA that it's updated (with relevant userinfo supplied). CEA will rarely have a direct line to the server. In a sense, this is almost like the daemon idea but way easier for me to set breakpoints and debug.
Of course, this is all just in my head and needs to be pounded out into code.
Suggestions for improvements to this idea or reasonable alternatives? I've left lots of things vague on purpose, since things always seem to change a bit once you start coding. But I think the general architecture is a decent and obvious.
-gus
--
August 'Gus' Mueller
Flying Meat Inc.
http://flyingmeat.com/