Please excuse my english. I should sleep now
I know what you've all been thinking the last weeks. "What is going on with that blog plugin for Tomboy?" You haven't? Can't you at least pretend? Thank you, that's better.
For about a week, I've been working more or less non-stop on a complete rewrite, and now, I'm finally "done".
What has changed? A lot!
First of all: the name! I now call it Tomboy Blogposter, since it really isn't just for Wordpress, even though that continues to be my primary testing platform.
Also, it is no longer using the MetaWeblog API. Instead, it is using the Atom Publishing Protocol (APP), which is avalible in the latest version of Wordpress, and also in Blogspot.Why? A couple of reasons:
- To begin with, Blogspot only supports APP. Wordpress supports both. Everyone I know (except for hetzz, who use LiveJournal, which doesn't support neither APP nor MetaWeblog) use one of those two, and most of the people in my feed reader also use one of those two. I think it's better to support many users, than many blog engines.
- Secondly, this time I can do all the code myself. I used to use a big XML-RPC library, and while it mostly worked, it had a few bugs, and it included both a server and a client implementation, which I think is overkill for this plugin. I tried to reimplement it myself, and extract the pieces that were interesting, but it was driving me nuts (see next point), and had to skip that idea. Now, 950 lines of ozamosi-code might be a far, far worse alternative than that library, but now I know on who to blame all the bugs :D
- Finally, APP is simply a better protocol than MetaWeblog API. Mark Pillgrim commented MetaWeblog with "So we've reinvented XML, over RPC, over XML. Badly." I agree. APP is just a normal Atom entry that is being pushed to the server, instead of lot's of creepy RPC. REST is actually quite elegant. APP is on it's way to become a RFC, which of course isn't proof that is it better, but it still is a good sign.
The biggest downside is that APP in Wordpress 2.2 comes with a bug which makes it fuck upp all your syntax ("Hey! Pretty, valid XHTML! Let's tear that into pieces!"). I think this would fix it (one of the changes is "Better support for XHTML"), but I haven't tried it. I really hope that patch ends up in 2.3, since it looks like stuff I'd like to use (categories!).
Edit: After testing the patch, it seems to work fine, after you've fixed the syntax error that it creates sigh
But I've done more than that.
Since it was a pain to test two blog engines when you only can post to one at a time, I made it possible to add multiple blogs - in my case, my regular Wordpress blog, and a Blogger blog used for testing. This has it's real use cases as well: it's not terribly uncommon for people to have different blogs for different topics - say one private blog, and one more official, and maybe one shared one too.
To facilitate this, I moved from GConf configuration storage to a custom XML file. This is more flexible, since I can add many "groups" of keys (as in: many accounts, with many pieces of information per account) easily.
Since Atom doesn't have one specific form of authentication, I've implemented the ones that Wordpress and Blogger use. Wordpress use HTTP Basic, while Blogger use it's custom GoogleClient thingy. This actually mean that my plugin works with more APP servers than Drivel, the client I've been using as a reference, since it only supports Google (yes, I am very proud of this). Now, Blogger logs in using HTTPS, and everyone who relies on HTTP Basic should too. Being lazy, I haven't implemented a frontend to Mono's certificate handling thingy - instead, it just trusts all certificates. My rationale for doing that is that I believe people using encryption generally only want to protect themself from Wireshark when they're using their unencrypted wifi, and aren't too concerned about really evil attacks. If I'm wrong, tell me, yell att derfian and/or fix the problem ;) The end result is, either way, that HTTPS "just works", even though it isn't as secure as it could be.
I do no longer store your passwords in plain text. Instead, they are encrypted in the supersecure cipher base64. Yeah, ok, base64 isn't really encryption at all, but simply an odd charset, but at least you won't give everyone standing behind you your password when you open the wrong file. Also, you can choose not to enter a password at all, and you will be asked for your password every time you want to post your data.
It no longer posts the notes as drafts. I'll reimplement that as an option some day...
Download it here
A difficulty with APP is finding the right URL, so here's a short explaination to how you find it.
There are two concepts we need to understand here: the Service Document, and the Collection Document. A Collection looks like a feed, and - more importantly for us - it can be posted to, in order to create new posts. A Service Document is a list with URL:s and names to all Collections. The current APP draft explains that it is not decided how one is supposed to find the Service Document, though.
On Wordpress, the URL to your Service document is <blog_url>/wp-app.php/service - in my case, that means http://flukkost.nu/blog/wp-app.php/service. However, that returns two Collections - "Posts" and "Media". I can promise you that you don't want media, since that only accepts media types this plugin won't upload, so you could instead just add the Posts collection, that has the url <blog_url>/wp-app.php/posts
Blogger uses an older draft of the APP protocol, which means it's Service Document is simply... Broken, with respect to a modern draft. That means you cannot add it. Instead, use the Collection. You can find it if you view the source to your Blogger blog - it's the address in the <link> tag that has rel service.post. It follows the template http://www.blogger.com/feeds/<blog_id>/posts/default. My blog has id 4164605321218185513, which means my Collection document is http://www.blogger.com/feeds/4164605321218185513/posts/default.
Now, I'm becoming quite satisfied with this plugin, functionality-wize. I now need more bug fixing, code cleanups/beautification, UI beautification/HIG-fication, and then I'm hoping to get it into the official tomboy code tree, which would mean I'd get my first code into Tomboy, and thus my first code into Gnome. Now that would be something...
(and yes, there was a 0.3.0 - I discovered it was broken when using either Wordpress or Blogger. This version hopefully at least posts)