Updates
Writing this plugin in python has been nothing but a joy. I've honestly never had an easier time just whipping out a script and adding features to it. I almost did it in perl, as weechat has a scripting interface for perl and I am more knowledgeable with perl, but I feel as if I would have had a harder time writing this in perl.
Recent changes to the script include:
- Now sends entire message body as a reply. (IMAP breaks the message body into multiple lines, and this was tripping up my script since I expected it all on one line)
- Does not send the user's signature or quoted messages if user defines strings that indicate a signature:
- User can define what strings are present that indicate a signature so that the entire message history is not sent.
i.e. Gmail on Android sends my signature asTony Lademan
so I add that to the array, but Gmail on the web sends my signature as
-- Tony Lademan
so I also add "--" to the array as well. Similarly, if you don't have a signature, but your client quotes messages with a string such as On DATE, NAME wrote:, then you can add wrote: or the name to your array. Commands are described in the comment body of the script. Multiple strings can be stored and will be used to determine when the script should stop reading the message body.
- Rudimentary help descriptions for the commands.
There's no change log in the file itself yet, not sure if I should do that or push this to its own git repo and make a separate CHANGELOG file that aggregates all of the relevant logs from my current "scripts" repo. Or just push my entire scripts repo somewhere public and not give a shit.
Link to the original post with links to the source.
Here it is
As promised, I'm releasing the code to my recent weechat script in a state that I am mildly comfortable with.
Pretty source
Download (My server tries to execute .py files, so you'll need to rename it)
In my haste, I do not have error checking for things like failed logins. Make sure your username and password are correct if you try to use this.
You will need to have the imaplib python module installed.
Solving problems that never really existed
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
Seven in the morning
Well, thanksgiving break is over and now there's one week of classes and then midterms. Everything moves way too quickly. It feels like I never have enough time to prepare for anything.
If you're looking for a fun strategy game, let me recommend Greed Corp. It's a turn based game based around eliminating the other players. It's a tile based game, and that aspect reminds me heavily of physical board games like Carcassonne or Settlers of Catan. The build options are very limited in Greed Corp, though. You can build and destruct harvesters, build armories that let you build units (of which there is a single kind) and carriers, and turrets.
On the surface, it seems pretty simple, but one of the unique parts about this game is that the tiles have layers, and certain actions can strip these layers until that tile is destroyed. By the end of a specific match, the level will look nothing like what you started with. This can obviously really mess up transportation or harvesting plans, and so is a very valuable or detestable strategy.
I bought it for $2.50 since it is on sale until noon today central time over at http://steampowered.com. Normally it's only ten dollars, which is still a pretty good price for this game.
And now off to campus for thirteen hours.
Posted from WordPress for Android
There used to be a bike attached to this.
Posted from WordPress for Android
