sugardeath

Solving problems that never really existed

Posted on December 1, 2011

I use a combination of weechat and bitlbee to have access to my oscar and xmpp chat accounts right next to irc. For a while it was set up to text me from Google Voice whenever I received a message from marked as away.   The problem is that Voice does not have a public API. The tool I was using was basically using curl to log in and pull data from the web page. It was very hacky, and when Google changed their authentication recently, it was completely broken.

Jason gave me the idea of using email instead. This was much easier to set up and since it uses a long standing standard, it shouldn't break.

This was good, but to respond to the messages I received, I'd still have to SSH into my computer, which is kind of painful on my phone over 3G and without a real keyboard.

To solve this non-issue (I really don't need to respond to people instantly), I wrote a python script for weechat that logs in to my secondary (or is it my tertiary) gmail account, where the replies are sent, and checks for new messages via imap. The only external library needed is imaplib, to facilitate imap communication. The format is easily abusable: If it is sent from my main gmail, then it assumes it is a reply. The subject contains the recipient of my message,  since my notifications put the person in the subject, and the body is the message itself. It's pretty simple to parse the imap message for this information, and even simpler to use the weechat library  to send the message to the appropriate person. I don't count the weechat library as external since it is implied when I say this is a weechat script.

The script checks every five minutes and so far works wonderfully.

I guess now that when I'm marked away, I'm not really away, per se.

I need to clean up the code a bit, make it more generic, and take advantage of setting options within weechat (I currently hard code my login information), but I plan to post the code here. I'll probably detail the entire set up I have since it is a combination of two plugins. Because of this requirement of the other script (away_action), I'm not sure if it would be appropriate to submit to the weechat script repository.

Anyway, I was able to whip this out in very little time, and I think I'm finally beginning to understand the appeal of python.

Posted from WordPress for Android

Comments (0) Trackbacks (0)

Sorry, the comment form is closed at this time.

Trackbacks are disabled.