Sergio and Dirk-Jan are often discussing in parallel with me on software development of tinymail over instant messaging, so I decided to start an IRC channel on the topic. People with questions or who are actively developing on or with tinymail are invited to #tinymail on GimpNET.
Today I finished the observer stuff. You can register an observer to both a folderstore and a folder and get notified about folder renames, header adds and removes, count changes, folder removes and folder deletions (and other things). The default ui components will all auto act on such changes (by auto updating themselves as good as possible). You can of course register your own view (or model) as an observer of a folder too.
The observer/observable part of tinymail is the core-principle of the Push E-mail feature too. Actually of all the changes that need action use it. Implementing the role that the observable plays is what is flexible about this: It doesn’t matter whether it’s IMAP IDLE doing this, or an event coming from SyncML. And maybe tomorrow we will get these notifications from the telephone network just like how SMS messages are also being notified to our phone software? That tomorrow will be possible with tinymail’s infrastructure. Or maybe will some network start supporting some way of communicating this information over GPRS without needing an active TCP/IP connection? Maybe we need a small kernel module to communicate this to the application layer? Using D-BUS maybe? Multicast? inotify? Four such techniques at the same time? Pickable by the user as a plugin? A closed-source one from PhoneCodersDotCom? Also that will tinymail’s design for this cope with.
So .. this: gimpnet.#tinymail.add_observer (you), where ‘you’ is an instance of a type that implements an update method. And a ‘foreach observer o: o.update()’ in the channel type whenever something happens (Don’t call me, I call you). And not this: while (true) you.pollforstuff (gimpnet.#tinymail). It’s sooooo simple, but you would be surprised to see how many projects and cowboy-programmers get it totally wrong over and over again.