TMut

I started a little sub of the tinymail project called TMut. It will implement a minimalistic E-mail client for, for example, mobile phones.

Although minimalistic, it will become a functional E-mail client. It will function as a basis for building on top of and as a potential usable client for your mobile.

TMut will help proving that tinymail scales to both larger projects like Modest, as that it scales to smaller E-mail client projects for mini devices like mobile phones, smaller PDAs and VoIP phones.

Although it’s not doing anything right now, all of the minimal tinymail components have already been put in place. I of course need my focus on tinymail itself, so I don’t know how fast this will be ready for use. A minimal E-mail client can be done quickly with tinymail, it should therefore be functional soon. And if not, doing TMut will be a good exercise for me to find the difficult spots and the things that need more documentation in the API.

Because I want TMut to be as language neutral as possible, I will be doing it in GObject with C. Mind that TMut is also going to play the role of a tinymail demo that is more functional than its current demo ui. I’m guessing people who’ll build their own client on top of tinymail want as few decorations as possible. Maybe they will inherit from the TMut types in stead of starting from scratch? Doing TMut in a specific language might limit the options for such teams.

Note: I updated this page on the tinymail ‘marketing’ pages. If any of the projects mentioned on the page want a different description and or prefer to be removed from that list, get in touch with me. If you are starting a project that uses tinymail and want to be listed, you can of course also contact me.

In support for Kathy Sierra

Although Kathy‘s message is to be passionate and although I can (try to) imagine how ill people like psychopaths can easily translate her call for being passionate into an act of making what they see as a funny picture, but what normal people see as a death threat: I don’t believe this was Kathy’s intention and hers isn’t to be blamed for this.

Rather the fact that biology needs discrepancies to detect faulty designs within our genes. Differently put, the people who did these dead threats are simply tryouts or rather errors of nature. They are an error because it’s in the interest of our society to neither encourage nor have asocials.

A lot human-like societies (like baboons) would have responded to this asocial by things like not offering the specimen access to females. So, the nature of other species shows that the best technique is to ignore these people, to try to make sure that they don’t have access to females (or males, if the guilty are females) and by forcing them out of the group, etc etc. Right? Let us let nature do its work: ignore them, deny them access to females and let their erroneous genes get extinct.

Kathy’s attempt of teaching us, software developers & co., about how to be passionate people and all that, has been in my opinion exceptionally good. I hope Kathy understands that by stopping her work on this, she would let them win the battle. I’m sure that this is just a pause for Kathy though.

In our society we need more passionate people Kathy. Through your work you created a lot such people. We need passionate people to be successful. You have been teaching us, passionates, how to be successful.

It was your book on design patterns too that made me want to do the project that I am doing right now. Your work is precious and important.

Kathy, I hope you won’t stop. But do pause if that is what you need.

Dogville, assertiveness

Although the real meaning behind of the story of the movie Dogville was probably different, I mostly enjoyed the movie for its lesson in why it’s necessary to be assertive.

Unless you saw the movie, this transcript is obviously missing quite some context. If so, I hereby once more recommend checking out the movie Dogville.

Mafia dad: It is you that is arrogant! You do not pass judgment because you sympathize with them.

Mafia dad: A deprived childhood and a homicide really isn’t necessarily a homicide, right? The only thing you can blame is circumstances.

Mafia dad: Rapists and murderers may be the victims according to you, but I call them dogs. And if they’re lapping up their own vomit the only way to stop them is with the lash

Grace: But dogs only obey their own nature. So why shouldn’t we forgive them?

Mafia dad: Dogs can be taught many useful things but not if we forgive them every time they obey their own nature

Grace: So, I’m arrogant? I’m arrogant because I forgive people?

Mafia dad: My God, can’t you see how condescending you are when you say that?

Mafia dad: I mean you have this preconceived notion that nobody can’t possibly attain the same high ethical standards as you, so you exonerate them. I can not think of anything more arrogant than that!

Mafia dad: You, my child, my dear child you forgive others with excuses that you would never in the world permit for yourself

Grace: Why shouldn’t I be merciful? Why?

Mafia dad: No, no, no you should, you should be merciful when there is time to be merciful. But you must maintain your own standard. You owe them that. The penalty you deserve for your transgressions they deserve for their transgressions.

Grace: They are human beings

Mafia dad: No, no, no. Does every human being need to be accountable for their actions? Of course they do but you don’t even give them that chance. And that is extremely arrogant. I love you, I love you to death. But you are the most arrogant person I have ever met. And you call me arrogant!

ps. The acting performance of Nicole Kidman was also awesome of course.

The Trap, a new documentary by Adam Curtis

I was just watching “The Trap, what happened to our dreams of freedom”, by Adam Curtis who did previous work like “The power of nightmares” and “The century of the self”.

Although I don’t know for how long it will stay there, you can at this moment find it at for example youtube: part 1, part 2, part 3,part 4, part 5, part 6, part 7

Its an interesting documentary that talks a little bit about things like Game theory. It looks like the second episode is online too, I haven’t yet looked at that one though.

Follow up on immediately showing headers while downloading

The majority of the bugs of that “it’s still a little bit buggy” quote of my last blog entry where caused by “gtk_tree_model_row_inserted” happening outside of the mainloop thread.

This has been fixed now, and since revision 1750 will the demo user interface utilize the feature.

Tinymail based mail user agents can therefore, like Dave’s excellent Polymer and Telomer, immediately start showing your summary while you are downloading it (not only after it finished downloading it).

With the Push E-mail support you will on top of that receive changes like incoming and deleted E-mail. Mail user agents based on tinymail can easily act on those events by updating the summary view’s model using build-in tinymail machinery (as this demo shows).

It’s also possible to know the X-Priority flag and soon it will be possible to have the message’s bodystructure upon those Push E-mail events. This will make it possible for your mail user agent to select ring tones based on this information. For example if your boss has send you an urgent meeting request, the mail user agent can launch a different ring tone.

And since you can base these decisions on more information than what SMS and MMS messages offer, I just gave the “big guys” at Nokia & co. a new feature for selling new phones! Tagging messages. I know, I know, I’m being naive by thinking that phones will someday ship with tinymail. Who knows? With tinymail, using folders of 10,000 messages fits in ~ 4 megs of RAM: modern phones have this amount of RAM already.

A big problem will of course be that SMS & MMS are more profitable than GPRS for the current mobile operators. I’m quite sure that will be an issue for “E-mail on phones” in stead of “SMS & MMS”. Let’s hope the Steve Jobs’s of our world will show those guys what today’s people really want.

These features need testing of course. They also need a real mail user agent to get fully fleshed out. People are today building one, but don’t let that stop you from creating your own mail user agent on top of tinymail. Although their project is about policy and although that policy might not be in line with your ideas, maybe you can join their team? Encourage them to design that policy in a flexible way?

They are your dreams. I’m building the framework to support them.

Immediately showing headers while downloading

I implemented letting the tinymail demo user interface fill up its summary view while downloading summary information. I, of course, created a little demo for it too.

I haven’t yet committed the work on this in tinymail’s repository, because it’s still a little bit buggy. You can expect that I will have this finished by the end of this weekend, though.

Youtube version of this movie

The folder monitor stuff of Modest needs some adaptations to leverage this new feature fully in that mail user client. I might take a look at improving Modest so that it too will immediately start displaying the headers while they are being downloaded.

iRex Technologies released code

I forgot to mention this, but iRex Technologies has released their source code and adaptations.

From talking with them at T-DOSE and FOSDEM, I have understood that they can use our community help in getting them to understand how to form a healthy win-win relationship with us. I hope the do-people of our community will contact them (for example at the various conferences) and guide them a little bit. I’m sure that this is learning for both sides: we need to understand how technology companies work and what they really need. They need to understand us and about our licensing ideas and ideals. Although I think with Nokia’s Maemo & OpenMoko at least the GNOME community seems to be getting it (like picking LGPL rather than GPL for libraries). Liking the GNOME platform myself, I’m of course biased.

My own personal guideline for this is: do they have the right intentions and are they just struggling to get there? Or do they have the intention to simply steal our work? There’s a huge difference in my opinion.

They had some legal struggles in the past it seems, which I think isn’t abnormal given that they are developing on top of a lot of new technology. It looks like they have the right intentions with our ideals, softwares and licensing. They have a real ePaper device that already and actually works. I’m sure they need quite a lot adaptations to our platforms and application software for the device itself. Why not show that the people who are involved with free software on desktop & mobile are a community of people who are serious with technology companies who want to support their own expertise by leveraging our softwares?

These times are our slot, let’s not miss it again. In general: if you have ideals about software development: please think “do”, not just “talk”. At least that’s my opinion.

Design by contract in tinymail

I finished wrapping the API launchers of tinymail‘s core abstraction library (libtinymail) with require and ensure sections, like Eiffel’s design by contract clauses. Unlike in Eiffel you can’t weaken them in tinymail, you can only strengthen them. I didn’t use nana or ‘DBC for C’ for this, just assertions that wrap the function pointer invocation of the interface’s class struct.

The benefit is that it’s not in the body of the implementation, but rather at the interface’s level: If DBC is enabled and your implementation doesn’t fulfill the ensure clause, then the application will abort. To put it in another way: all implementations must fulfill the full contract of the interfaces that they implement. Also must the client code that uses the interface fulfill the requires clause. So any client code that calls an API yet doesn’t fulfill the input contract, makes the application abort itself (if DBC checking is enabled).

As usual, I try to practice what I preach, here’s the documentation on both using the contracts (enabling the checks) and creating your own ones while doing development for and with tinymail.

FWD: Lemonade email client development

WordPress’s Dashboard notified me of this blog item of an Isode employee about tinymail, Modest and Lemonade.

The universe spontaneously …

Stephen Hawking tells us the universe spontaneously popped into existence from nothing. I don’t believe this. I believe the universe is. Full stop. It’s us, beings, who are limited by time.

Clearly, things do happen in that universe. Maybe a big bang did happen? I even believe that if it isn’t limited by time, the same things will have happened and will keep happening over and over again. Maybe is time an event like any other within that model?

The thing that really bugs me is the why; but I stopped questioning myself “what started it”. I think it never started, I think it is. To have a moment of starting, you need to be limited by time. Like how human beings, animals, planets and stars are limited by time.

Religious people will probably now think: it’s God who started all this. To which I would answer something about turtles all the way down (it doesn’t answer the question, it just moves it).

Design by contract, I’m in full agreement

Totally impressed by the language support for design by contract in Eiffel and in total agreement for the need for build-in support for this in modern higher programming languages (like what Eiffel clearly is), I decided to go for the idea and therefore I just started instrumenting all the interface method launchers of tinymail.

Maybe other people have better ideas for this with GObject and C? Please do contact me, as I’m truly interested in fully instrumenting tinymail with DBC contracts for all its interfaces. I started with the TnyDevice one. Interesting are the tny_device_force_online and tny_device_force_offline methods. They must ensure hat the result of the tny_device_is_online query will be either true in case of forcing online or false in case of forcing offline.

Any implementation of TnyDevice that doesn’t do this, is wrong. Since TnyDevice is implementable by the platform specific developer I want to know about their bugs without having to look at their code. Basically making it possible for me to say: look, run this suite and if you have assertions, it means that your implementation is broken. Fix it and come back.

I know that sounds harsh, but application developers whom I’ll ask to implement something will in stead be grateful for these contracts: they’ll very quickly know where there’s a bug in their own code.

Don’t go search the code for Design By Contract assertions yet. I’m adding them right now. You can of course join me on IRC: #tinymail at GimpNET.

Putting slides online, some personal chitchat

It’s not yet accepted but it looks like Dirk-Jan proposed doing a little chat about Modest at Guadec this year.

I figured it’s going to be a tinymail related presentation and maybe, who knows, will others do talks and presentations on the subject in future too? Although I might improve the location by giving it an actual page like the demos page, you can already find my own slides there. I left out the FOSDEM ’06 one as that one was about software design with GObject, not about tinymail. The FOSDEM ’07 one was about tinymail, so it’s available.

Oh .. I might be interested to do some marketing around tinymail. Nothing big though. I’m not sure yet: once Modest and other E-mail clients start getting used, it might automatically sell? Maybe marketing is overkill? The project might not be mature enough? Perhaps it’s just a bad idea? Perhaps it’s a great idea? I also don’t think there are a lot competent marketing people who understand free software (except for two crazy Australians, though that’s not marketing but rather ‘strategic consultancy’, right?).

Boy, it should be clear by now that I truly lack experience in leading a project. The idea of “leading a project” also scares the hell out of me. Given that I’m actually quite incompetent at some important social skills. Well, Daniel Coleman writes in his books about emotional intelligence that being self aware helps a lot. So I’m not fully incompetent! :-). At least one contributor actually wrote on his blog that he’s happy. I’m proud of that achievement! I never thought I could do that through a project (you know, making people happy).

Now these Subversion guys tell us, project leaders, that we need to be careful of both poisonous people and even of not becoming poisonous ourselves. I mostly agree with the end of their presentation (not with everything): that you need to be very careful with quickly identifying people as poisonous.

Riddl. me, Riddl. me th., Whr. Mem. at

Over time a lot projects start consuming rather more than less memory. Mostly it’s not due to the added features themselves. Often it’s rather due to the amount of code growing and maintainability getting harder. A result is often that the good ideas and great ideals about memory consumption fade away a little bit.

I disliked that strategy from day one for the tinymail project.

Also note that most of the times just throwing more into ram, does not necessarily mean that your application will perform better. Often the exact opposite is the case: because it’s often due to your design being broken. Most hacks are just what they are: hacks. Most hacks are in reality slowing down things too.

I made the decision that I will design in a flexible and adaptive way starting day one. This means that new features have always been easy to add to the framework, cause of its design. It’s a misconception that good design automatically means a lot memory consumption. In fact, the contrary is often true. It’s also a misconception that you can’t use C for this. When designing, the programming language is mostly irrelevant. Although D is indeed a kick ass programming language :-) (boy, it feels good to say subjective crap in my blogs. Moeha!).

I remember the days when I flooded my own blog about how tinymail was only consuming something like say ~18MB of heap allocations for displaying a folder of 50,000 items. Well, I have improved that figure a little bit. Today tinymail consumes 8,613K when displaying a folder of 50,000 items, with a ~10MB mmap (which hasn’t significantly changed since).

I made a new memory report which is available on the trac. I added quite a lot documentation about mmap, about how tinymail uses the memory and about the slab allocator. I did this to make sure that people who’ll be really reading the report will have as few misconceptions as possible.

You can of course reproduce the report and all steps for reproducing it are documented too.

Educating the masses: gdb with GTypeInterface, GObject, Priv variables and the G_TYPE_INSTANCE_GET_PRIVATE

Imagine you just created a nice GObject with a so called “priv thing” in it. Yes, “thing” is a good name for now. In your code you access that “priv thing” using the G_TYPE_INSTANCE_GET_PRIVATE GType “stuff”. Most of the time you are a happy hacker with a “priv thing”. Then suddenly you have a bug somewhere in client code of that GObject type of yours (by client code I mean: code that is using an instance of your type, like calling API on it).

You’ll most likely want to peek at that “priv thing”? Doesn’t sound very unusual, right?

Well it’s actually quite simple:

We have a GtkTreeModel, which is a GTypeInterface implemented as TnyGtkHeaderListModel. The instance of that TnyGtkHeaderListModel is called “self”. The instance (which in this debugging session plays the role of the client code for a TnyFolder instance) will do some stuff with another instance stored at self->folder. With some casting voodoo magic we can easily get the “folder” instance out of that. Nothing difficult here.

Let’s do this step by step …

(gdb) print self
$17 = (GtkTreeModel *) 0x82f8090
(gdb) print *self
$18 = <incomplete type>
(gdb) print ((TnyGtkHeaderListModel*)self)->folder
$19 = (TnyFolder *) 0x8253ba8
(gdb) print *((TnyGtkHeaderListModel*)self)->folder
$20 = <incomplete type>
(gdb)

We are after the “priv thing” of that folder instance: we’re not there yet. But let’s dig a little bit deeper!

(gdb) print * (TnyCamelFolder*) ((TnyGtkHeaderListModel*)self)->folder
$21 = {parent = {g_type_instance = {g_class = 0x80e0b98}, ref_count = 2, qdata = 0x0}}
(gdb)

We’re still not there, and we still haven’t even seen a sign of that “priv thing”. That’s because it’s somewhere deep inside the “crazyness” of the glib GType stuff. Don’t worry, we have yet another gdb trick as tool in our pocket. We can actually launch some of our own code. Including code from the glib library.

(gdb) print g_type_instance_get_private (((TnyGtkHeaderListModel*)self)->folder, tny_camel_folder_get_type())
$22 = 136657848
(gdb)

Okay, let’s not care about the number and just use that $22 label.

(gdb) print *$22
$23 = 1
(gdb)

Well…of course! Our beloved debugger doesn’t know how that pointer looks like! Let’s tell it. Because “we” .. know, right?

(gdb) print *(TnyCamelFolderPriv*)$22
$24 = {loaded = 1, headers_list_type = 0, folder_changed_id = 132, headers_managed = 1898, folder_lock = 0x826af80, folder = 0x81f7868,
  folder_name = 0x826afb0 "INBOX/30000", account = 0x80e58f8, store = 0x80e5a08, cached_length = 1898, unread_length = 49, unread_sync = 0,
  local_size = 258652, subscribed = 1, has_summary_cap = 1, iter = 0x81f6800, iter_parented = 1, cached_name = 0x826afc0 "30000",
  cached_folder_type = TNY_FOLDER_TYPE_NORMAL, remove_strat = 0x820a8b0, receive_strat = 0x820a6a0, observers = 0x8259fb0,
  sobservers = 0x8259fc8, self = 0x8253ba8, want_changes = 1, dont_fkill = 0, parent = 0x81f3ee0}
(gdb) 

Maybe we should make some gdb-shortcuts and do some integration with gdb and glib? I do like things like refdbg and I like all those other tools too. Yet I still have to fall back to using gdb most of the times.

Let’s play some more, digging deeper:

(gdb) print ((TnyCamelFolderPriv*)$22)->folder
$25 = (CamelFolder *) 0x81f7868
(gdb) print *((TnyCamelFolderPriv*)$22)->folder
$26 = {parent_object = {klass = 0x82a9130, hooks = 0x82f9190, ref_count = 1, flags = 0}, priv = 0x8216e00, name = 0x82f75f0 "30000",
  full_name = 0x825d4f0 "INBOX/30000", description = 0x0, parent_store = 0x80e5a08, summary = 0x80b8368, folder_flags = 3,
  permanent_flags = 8194079}
(gdb)
(gdb) print *((TnyCamelFolderPriv*)$22)->folder->parent_store
$31 = {parent_object = {parent_object = {klass = 0x80de0e0, hooks = 0x80bca80, ref_count = 7, flags = 0}, priv = 0x80e55e0,
    session = 0x80b9c00, provider = 0xb6233da0, status = CAMEL_SERVICE_CONNECTED, connect_op = 0x0, url = 0x80e6230, data = 0x80e5ba0},
  priv = 0x80e5778, folders = 0x80e57a8, flags = 11, mode = 3}
(gdb)

Push E-mail with Modest

Modest’s source code hasn’t been available for more than a week, and it is already supporting Push E-mail. I created a little video demo showing this feature.

We of course have Modest running on our Maemo devices, like the Nokia 770 and the N800. The Push E-mail feature works on the device too. You can expect video demos of Modest running on the device soon. For packages you will have to wait: we want to make sure that it’s rock stable and really works well.

Modest and the tinymail demo-ui showing Push-Email

Youtube version

Some notes: If you are going to experiment with your own Cyrus install, then make sure that you have the idled daemon of Cyrus running. You can also use these test IMAP servers for experimenting. They all support IMAP IDLE (therefore they support the Push E-mail of both tinymail and Modest). The Cyrus one also has condstore turned on on its INBOX folder, which is another Lemonade enhancement that you might want to test with.

I would like to stress that tinymail nor Modest have had intensive testing. Please don’t yet use it on real accounts unless you really don’t care about losing your E-mails and data. I try very hard to make sure that you do have testing infrastructure. You don’t have to test tinymail or Modest with your own accounts.