Writings Photos Code Contact Resume
planet debian

You are here

Using mutt as a mailbox converter

Submitted by msameer on Mon, 19/05/2008 - 1:31pm

I'm planning to move all my mailboxes to an IMAP server running on foolab.org, use offlineIMAP to sync between vader "my laptop" and naboo "foolab.org". It will also allow me to access my email from multiple computers at the same time.

I'm using mutt as my primary email client.

The big problem is offlineIMAP needs a local Maildir while I'm using mbox

I can upload the emails from mutt to the IMAP server but why do I have to redownlosd them again ? Beside, it's a lot of manual work.

I didn't really find a good mbox to maildir converter so I decided to use mutt.

Mutt knows how to handle such things. It's an email reader!

Thanks to the folks in #mutt for a few tips. Now here is my setup:

1) My mail is in ~/Mail
2) I don't have subdirectories
3) No white spaces in folder names.
4) You don't have a mailbox called "foo" ;-)
5) Create a directory called done. There we will place the mbox files after processing.

Now here how it goes:

1) Place this in a file, let's call it "/tmp/muttrc" and use emacs for that ;-)

macro index <F3> "<tag-pattern>~A<enter><tag-prefix><copy-message>=foo<enter>y<quit>y"
folder-hook . push <F3>

2) cd ~/Mail

3) Execute this bash snippet:

for i in `find -maxdepth 1 -type f`; do box=`basename $i`;
  echo "Processing $box" && mutt -F /tmp/muttrc  -n -m Maildir -R -f $box && mv $box done/ && mv foo  $box; done

4) Now to convert my outbox "which is an MH dir":

mutt -F /tmp/muttrc   -n -m Maildir -R -f done/outbox/

It worked fine for me. I had to interfere 2 times because I 2 had 0 sized mailboxes. Otherwise, it worked like a charm!

P.S. Don't forget to edit ~/.procmailrc and to set the default mutt mbox_type to Maildir


Katoob, the baby has a new father.

Submitted by msameer on Mon, 12/05/2008 - 7:31pm

This post has a bit of my history and emotions. It can be skipped!

The summary is: Katoob has a new maintainer.

...

Yes, a long time.

Back in 2002, Gtk 2.x was just released. Efforts were spent porting, rewriting and redesigning parts of GNOME. The aim was GNOME 2.0 and later on 2.x

Previously, we had Gtk which did not support Arabic at all.
At that time, the only usable Arabic capable GUI editor was a closed source one, Axmedit. I was also trying to learn programming and write something useful. Katoob was born at that time. The aim ? provide the Arabic user with something usable and the secret agenda was me learning Gtk and get my hands dirty with C. Not having enough skills to contribute to something as large as GNOME.

It wasn't called Katoob (Which means something like an exaggerated writer in arabic). Me and Alaa wanted to call it gDhad (G is for GNU, Gtk, GPL, ... and Dhad is the letter. Arabic is known as the language of "dhad") but a miscommunication lead to that name.

Arabeyes hosted the project in the beginning. The problem was it was released after the first version of GNOME2. I missed a contest.

The problem is that it was already used by a few of my friends. A lot of testing has been done in the beginning. I still remember feeding it various media files as well as random garbage to see what will happen.

Years later, the whole thing grew into a pile of spaghetti code. It was the time for me to start learning C++. What else can I use to learn it ?
Then 0.5 was born. A bit cleaner, C++, Gtkmm and moving it to my own place. It even survived my migration from CVS to SVN last year.

It also started to be used by more people.

As I become busier with work and as my interests have started to change, I found myself incapable of maintaining it. It's actually a motivation problem more than anything else. I'm not involved into Arabization issues (I was never involved but people claimed I was ;-)) and I wasn't getting enough testing.

I don't use it a lot anymore. Everything supports Arabic now. I don't think we need that project anymore.
I can also use Emacs to read and write Arabic

Now, Fred Morcos decided to step up and maintain it. Good luck to him. At least I found someone to take care of the baby.


multi-gnome-terminal is back to life.

Submitted by msameer on Mon, 18/02/2008 - 11:46am

OK. This is the beauty of FOSS. The project has been dead upstream for a while now. It survived until it was removed from lenny.

Now me and 2 other users decided to adapt it. port it or rewrite it in gtk2.

We are having a discussion about the whole situation.

To anyone still using multi-gnome-terminal: Please share with us the features you were actually using. These are the ones more likely to be implemented and no new features will probably be added, maybe help us coding and/or testing or participate in the discussions.


Automatically insert a statement in each function in C++

Submitted by msameer on Fri, 08/02/2008 - 2:16pm

And I thought I'll never do such things again ?
I wanted to insert a debugging statement at the beginning of each function.

for i in *.cc *.c; do sed -i -e 's/\([a-zA-Z0-9 _*:~]*([^).]*) *{\)/\1 \nprintf("%s\\n", __PRETTY_FUNCTION__); /g' $i; done

It can probably be used to insert anything too.

It's dirty but it worked for me. Just keep a backup or make sure the latest code is in any RCS just in case.

It only failed with a function that was commented using C++ style comments "//".
I didn't try it with class methods defined inside header files


Of GNOME and fonts.

Submitted by msameer on Mon, 28/01/2008 - 1:52pm

Thanks to those 2 comments. Although placing Xft.dpi: 96 in my ~/.Xdefaults did not help, but I managed to do it through the appearance control center applet. I had to purge the gtk-qt theme engine because it was freezing the dialog and setting it via gconf-editor didn't work as expected.

I had to fight with my fonts this morning but here's my configuration. Maybe it'll be useful to anyone:
DejaVu sans book 12
96 DPI
greyscale smoothing, subpixel slight RGB.

I'm not yet satisfied but it's more usable now.

Thanks Phaeronix for the help too.


I love KDE. It just works!

Submitted by msameer on Fri, 25/01/2008 - 5:13pm

I have 2 laptops. My personal one at home and my work one at the office. Both are running testing. A month or two ago, I did a dist-upgrade on the home one. Later on I rebooted (DUH!) it for a reason I can't remember just to end up with very tiny fonts under GNOME. It took me some time to tweak them back again and play with the GNOME anti-aliasing dialog. Now if you know me well, you know that the last thing someone should do to me is to touch my font settings. I have a very sensitive eye (Because I have a very low vision) and I hardly tweak the fonts. All went somehow fine after that. Problem is I wasn't sure whether it was fglrx or GNOME who's responsible for that.

I always do a dist-upgrade everyday (!) but never bother to restart X or reboot. A few days ago, GNOME at the office crashed on me and guess what ? I ended up with the same problem again. Fonts. Tried tweaking it this time but no use. Copying the font settings from the other laptop was not an option because I'm using a large LCD at work but I can't afford to buy one for my personal laptop :-)

I thought it was fglrx, downgraded the driver but no use.

I decided that's it. I always used GNOME because I know Gtk+, gtkmm and somehow pygtk but the fonts breaking again was really too much.

I ended up switching back to KDE 3.x at work and at home. I just don't feel like using 2 different environments. This will confuse me ;-)

I remember I used KDE 1, GNOME 1.4, KDE 2.2, window maker, GNOME2, tried all the window managers out there until I settled with pekwm, hpanel, a few dockapps and that was my custom assembled DE. Until I switched to amd64 and the version I was using of pekwm (It was a CVS snapshot) started throwing exceptions. I wasn't really sure why and didn't have time to fix it. I wanted my laptop to be up and running again. I ended up trying the latest release but it did not work with hpanel (It was a hacked version because it wasn't originally working fine). and that's why I went back to GNOME.

Anyway, No flame please but KDE just rocks, it just works! I'm still having problems with fonts under Konsole (Bye multi-gnome-terminal) but I just need to free a few hours to test all the fonts out there.
Amarok works fine although the UI is a bit "cluttered" (But I managed to get it to crash :-))
I remember my phone complaining about not being correctly unmounted and warning about data corruption whenever I unplug it from the USB cable after asking GNOME to unmount it, KDE simply doesn't have this problem. The bad thing is that they removed "panel icons zooming upon mouse hover" but the tooltips are large and clear. Of course Arabic is still not that good under Konsole but I'd blame myself for that :-)

Konqueror is crappy as usual. I'm still using Opera :-(

Well done KDE team, Debian KDE team, GNOME team and Debian GNOME KDE team.

Thanks for the fish :-)

Now I guess I need to get myself familiar with the KDE/Qt API.


It feels like losing a child...

Submitted by msameer on Sun, 20/01/2008 - 2:28am

So, today Multi GNOME terminal has been removed from debian as part of the efforts to get rid of gtk 1.x.

I'm neither ranting nor blaming. I'm just expressing my feelings.

I knew before it happened and I acknoledged the removel. It's dead upstream and I don't think it can be easily ported. I've been using this terminal since 4 or 5 years. Let's see if I can live without it. I know there are a lot but this one was lightweight and it was using zvt which was noticeably faster than vte.
This was one of the packages I worked on with "He" as part of the NM T&S and I quite learned a lot from it.


katoob under maemo.

Submitted by msameer on Mon, 03/12/2007 - 4:31pm

So the svn repository now contains what should be katoob 0.5.9 (Hopefully). Which can now run under maemo.
* It's not possible to input Arabic except by using the emulator or the multipress input ways (From the tools menu) and only using the hardware keyboard. Probably I'm not playing nice with gtk input methods in general.
* The right click menu doesn't work. I still need to investigate.
* Even if it does, the dict support is broken because the installed libcurl doesn't support the dict protocol (I probably need to provide custom packages).
* No spell checking yet. I should probably package or port enchant.
* The icon is not visible in either the menu or the task navigator.
* UNIX signal handlers don't work. If you shut down the device, you will lose all the unsaved documents. Seems it's not working in general also!
* The about box is broken. The only fix I can think of is a smaller icon.
* The print dialog is also messed up.
* Seems we are not playing nice with dbus. A new tab won't be opened if you try to launch the application again from the menu.
* Trying to click the input menu buttons won't work too.

katoob-maemo.png

drupal and the N810

Submitted by msameer on Mon, 22/10/2007 - 1:04pm

Here it goes. Lighttpd, php, sqlite and drupal with sqlite support.

All compiled inside scratchbox using the beta Chinook SDK.

s.png

Nokia N810

Submitted by msameer on Fri, 19/10/2007 - 1:32pm

First post from the N810. Had to do a bit of hacking to get Arabic! can't say I'm completely happy with it in general yet.

n810_0.png