Writing

Feed Software, technology, sysadmin war stories, and more.

Saturday, August 20, 2011

Building Adium from source to fix bugs and drop cruft

There's more detail filtering in on this situation where certain XMPP/Jabber clients using Google Talk started spewing raw XML a couple of days ago. I ranted about this recently.

It seems that Adium inherited this problem from libpurple, so, yes, my fears have been confirmed: it will be necessary to upgrade to the 1.4 branch to get this fix. That means I have to pick up the badness previously described in my rant.

Or, at least, it would, if I stuck with the stock binaries. I choose to break free of their cruft. For the benefit of anyone else who is bothered by this, here is what you do.

First, you're going to need Mercurial installed so you can check out their source. If you have MacPorts installed, 'sudo port install mercurial' will do it ... eventually. Hang on for a long and bumpy ride and hope you aren't actually using your laptop as a laptop, since it will be scorching hot by the time this is done.

Once you have that, you can then make a directory somewhere and 'hg clone http://hg.adium.im/adium-1.4'. This is another long lap-warming adventure as you pull in nearly a gig of stuff. Finally, in theory, you should be able to cd into the new adium-1.4 directory and run 'make'. If that works for you, skip down a bit. Otherwise, if you get crazy gunk about ppc7400 and conflicting fat binaries, you have more work to do, as I did.

At this point you have to drop into Xcode -- you do have that, right? If not, prepare to sign up for the Apple developer program and another huge download and install. Once in Xcode, if you're like me, you'll be lost at first. It's a maze of new-fangled twisty passages and GUI gunk. Here's what to do: open the project, then dig in the left side for "Targets". Open each one, then for each of the configurations (debug, release, release-debug), edit "Valid Architectures" to be just "i386 x86_64". I'm assuming you're on an Intel-based Mac here, obviously.

Anyway, once you've done all of this, you can run 'make' again and it should heat up like crazy once again and finally return a long time later. You should now have a binary which works, but it has the cruft in it. Note that we did this first to establish that everything is OK before meddling with the code. Now it's time to take out the cruft.

If you're using the Stockholm theme (hint: if you don't know which theme you're on, you're almost certainly on that), drop into Resources/Message Styles/Stockholm.AdiumMessageStyle/Contents/Resources/Styles, noting the tab-completion-tripping embedded space. There, find main.css, and look for the ".x-message:hover .x-time" definition. Comment out its visibility and that ridiculous hovering time will go away.

Now it gets a bit more complicated. Removing the focus bar involves actually disabling it in the source since it's not part of any theme. In Plugins/WebKit Message View (again with the embedded spaces), there's a file called AIWebKitMessageViewController.m. Dig around in there for @"focus" and you'll find a place where it's on a line with addMarkAt. I recommend just throwing that whole section in an "#if 0" block and going on with life. I added "// Eat flaming death" to mine just to make it easy to find later. Further down in that file, there's something called markForFocusChange. I just added a return at the top, along with another "eat flaming death" comment for good measure.

Compile it again and then you should have a directory called build/Release-Debug/Adium.app. Copy that entire directory to wherever you like to store applications, and you're done.

Congratulations. You have now polluted your Mac with the kind of basement-dwelling Linux hacker crap we've had to do for the past 20 years just to get a bug fix and not have to drink their UI Kool-Aid.

I guess it could be worse. It could be yet another horrible UI change to Gmail, where you're totally ignored, even if you work there!