Thursday, December 3, 2009

tbird on FreeBSD

I recently moved to using thunderbird on freebsd and away from pine. I did this mainly because there are just too many oddly formatted html emails floating around work from people who are chained to lookout and don't know any better.

My pine config is still active and available but serves now only as a remote-in, or console bound backup mailer.

The first problem I encountered with t-bird is the helper apps. The list comes up blank from the installed freebsd port and there are no helper apps listed and no way to activate them. This was unlike pine where a url-viewer could be defined. With t-bird I discovered after much web digging if you have Freebsd/KDE/qt without gtk helper infrastructure, you'll need to define the url viewer for firefox. You do this under the advanced config editor, or in prefs.js:

user_pref("", "/usr/local/bin/firefox3");
user_pref("", "/usr/local/bin/firefox3");
user_pref("", "/usr/local/bin/firefox3");

For anything else, under pine/alpine you'd be editing your .mailcaprc, but under t-bird you'll need mimeTypes.rdf and Mime Edit. It was ridiculous how hard it was to find this functionality and for a long time I was hand editing the Mimetypes.rdf to add helper apps.

Friday, November 6, 2009


In my ancient post on Scripting up some tabs with konsole in kde was for 3.5 era and dcop. I had a lot of scripts that would just blast open windows in a konsole session, automatically connecting to my various machines in the remote computer lab. Depending on what I was doing, I could just exec a sript from the desktop to connect and use a suite of machines in a tabbed konsole session.

With dbus, and the 4.x kde upgrade I lost all that. Recently I've started trying to convert the old stuff to dbus.

For example, setting tab titles:

$ dbus-send --session --dest=$KONSOLE_DBUS_SERVICE --type=method_call --print-reply /Sessions/35 org.kde.konsole.Session.setTitle int32:1 string:"title"
method return sender=:1.88 -> dest=:1.187 reply_serial=2

It unfortuantely took me a long time to figure this out. One, since dbus-send spits out an incorrect error when the parameters are wrong. Instead of 'incorrect parameter,' you get 'no such method.' This makes sense from a OO standpoint since 'no such method' exists with 'those parameters''

$ dbus-send --session --dest=$KONSOLE_DBUS_SERVICE --type=method_call --print-reply /Sessions/35 org.kde.konsole.Session.setTitle
Error org.freedesktop.DBus.Error.UnknownMethod: No such method 'setTitle' in interface 'org.kde.konsole.Session' at object path '/Sessions/35' (signature '')

dbus-send supports all sorts of types, and from introspection, I knew setTitle needed a int and a string. dbus-send supports all types of things int16, int32, etc..
Without looking at the source, you just kind of have to guess which types to send.

$ qdbus $KONSOLE_DBUS_SERVICE /Sessions/35
method void org.kde.konsole.Session.close()
method QByteArray org.kde.konsole.Session.codec()
method QStringList org.kde.konsole.Session.environment()
method bool org.kde.konsole.Session.flowControlEnabled()
method int org.kde.konsole.Session.foregroundProcessId()
method bool org.kde.konsole.Session.isMonitorActivity()
method bool org.kde.konsole.Session.isMonitorSilence()
method int org.kde.konsole.Session.processId()
method void org.kde.konsole.Session.sendMouseEvent(int buttons, int column, int line, int eventType)
method void org.kde.konsole.Session.sendText(QString text)
method bool org.kde.konsole.Session.setCodec(QByteArray codec)
method void org.kde.konsole.Session.setEnvironment(QStringList environment)
method void org.kde.konsole.Session.setFlowControlEnabled(bool enabled)
method void org.kde.konsole.Session.setMonitorActivity(bool)
method void org.kde.konsole.Session.setMonitorSilence(bool)
method void org.kde.konsole.Session.setMonitorSilenceSeconds(int seconds)
method void org.kde.konsole.Session.setTitle(int role, QString title)
method QString org.kde.konsole.Session.title(int role)
method QDBusVariant org.freedesktop.DBus.Properties.Get(QString interface_name, QString property_name)
method QVariantMap org.freedesktop.DBus.Properties.GetAll(QString interface_name)
method void org.freedesktop.DBus.Properties.Set(QString interface_name, QString property_name, QDBusVariant value)
method QString org.freedesktop.DBus.Introspectable.Introspect()

Now onto, auto new tabs, title naming, and finishing the conversion.

Viewing /var/mail/username mail via thunderbird

Despite the really decrepit solutions you can find via Google, this is really easy.

1. create a "Movemail account"
2. exit thunderbird
3. cd ~/.thunderbird/{random}.default/Mail/localhost
4. ln -sf /var/mail/{username} Inbox
5. re-startup thunderbird
6. read mail.