Virtual folders with Dovecot and Debian

I use client side virtual folders a bit for my mail. Specifically, I tag messages with IMAP flags like todo and important, and then in Icedove / Thunderbird, I set up a special folder as a saved search which shows message that are either unseen, or marked todo in my inbox. It works rather well, and I use the same set-up on my laptop, and work and home desktop machines.

But it’s not very useful on my phone, which doesn’t allow such sophisticated client side behaviour. My phone mail applications shows the most recent 25 messages in a folder, but there are times when it would be really useful to look up messages that are labeled as important but rather old. It would be time consuming to look through the older messages, and difficult to find the one I want anyway.

As a result, I’ve been looking at the possibility of using virtual server side folders using dovecot on my Debian mail server. I was put off by the documentation which left a lot of questions unanswered.

Here’s how I did it on Debian. First of all edit the config file /etc/dovecot/dovecot.conf, back up this file first, so you can restore working behaviour if something goes wrong.

You must also add the virtual folder plugin.

Now restart dovecot and check your normal folders are working.

Note that I found dovecot will generally not serve physical folders correctly if the virtual mail folder (even if empty) does not exist. I consider this a bug, but one that needs to be worked around, at least for me.

If that’s all done and working you can begin to create virtual folders. I created two directories within my ~/Mail/virtual folders; which were inbox-todo and inbox-important respectively. Inside each I put the following files.

which shows all unseen and mail labelled todo in my inbox and

which shows only important mail in my inbox.

It seems to be working, my normal folders appear to be working perfectly correctly (but I’ll know better in a couple more hours/days); my phone has successfully subscribed to the two virtual folders, though the folder list shows a number of files which I’m certain it should not, again, this looks like a dovecot bug to be honest.

Fixing g1 Accelerometer

I had noted before that my accelerometer had broken on my Android g1 phone, so that one axis was out by about 40 degrees. Despite lots of “helpful” suggestions from my friends on how to fix it (you know who you are), nothing worked. This did.

Connect to the phone with adb (from the Android SDK), in the following way.

Now it works.

Cyanogen Android ROM on the g1

I’ve had my Google development phone, the g1, for some time now. I haven’t had the luxury of time to write anything for it, but I mainly wanted it to try out Android anyway. I’ve reviewed the phone before, and again after some canonical firmware upgrades.

I use the truly excellent K9 application for mail, it has good support for self signed certificates, now has IMAP push support and is generally excellent. However, it stores all the mail on the shockingly limited internal memory on the device. That, and upgrades to things like Google Maps, adding truly excellent new functionality, left me constantly looking for applications to remove.

This is why in the end I decided to try Cyanogen’s ROMs. Since I have a development phone, I didn’t need to root it, and just followed the relevant instructions (in truth, I couldn’t be bothered to downgrade the OS to root it first).

Here are some observations about the new ROM:

  • Apps2sd is amazing.
    I have the whole pleasure of trying different apps all over again, without sweating about every byte. I don’t have to worry about how much data is in my contacts (whether I assign them icons), my emails, and so on. I have plenty of room. I was delighted to be able to install DocumentsToGo. Which makes the phone much more useful for work emails. Loads of great apps I had to remove have been reinstated, and I can play with others, like the awesome Google Googles.

  • Extra workspaces
    There are five workspaces, making for more widget playroom. I now have a calendar app taking up a whole workspace with the events to come. Excellent.

  • It fixes several problems I had with MMS functionality.
    • It fakes a variety of user agents, meaning that a test video message I sent myself on o2 finally worked, for the first time ever.
    • The stock ROM allows you to prevent data access when roaming, which is good. But it also doesn’t fetch MMS when roaming, which is (for me) a nuisance, and these are usually on a different tariff system. So when you receive an MMS on roaming, you end up enabling all data access to quickly receive the MMS, and then turn it off again. The Cyanogen ROM has an option to retrieve MMS on roaming.
  • UI feels snappier
  • USB tethering
    can be enabled, which JustWorks (TM) with Debian. Excellent.

On the downside, I have had some reset problems, but admittedly I have sometimes been pushing the phone very hard indeed to test it. And the battery life on the g1 is still awful. I know Noodles has solved the problem by not actually using his phone :-), but I want to use mine.

Another minor problem I encountered some weeks ago was the accelerometer suddenly starting serious misreporting on one axis. This problem seems to be becoming less severe, but even reinstalling the stock and then cyanogen ROM did not fix it. However, note I did not wipe the user data.

Cyanogen has made my phone fun to have again. And I will still replace it when a new Android handset comes out that I really like, but a lot of the urgency has gone. I’ll certainly buy him a beer for Christmas.