Nothing big today, except how much fun I have on a daily basis, making toys like the following. If you have a Mac and use IRC, you must have Colloquy - there is literally nothing better until 2038 when our robot overlords do away with IRC forever. Until then, it's trivial to make extensions like the following:
function viewMessage( body, connection, view ) {
var msg = new JVMutableChatMessage('', connection.localUser());
msg.setBodyAsHTML(body);
view.sendMessage(msg);
view.echoSentMessageToDisplay(msg);
return true;
}
function processUserCommand( command, arguments, connection, view ) {
if( command == "rtfm" ) {
switch( arguments[1] ) {
case "air":
return viewMessage("http://labs.adobe.com/wiki/index.php/AIR:Documentation", connection, view);
case "maven":
return viewMessage("http://maven.apache.org/guides/index.html", connection, view);
case "google":
return viewMessage("Google it! http://www.google.com", connection, view);
default:
return viewMessage("RTFM!", connection, view);
}
}
return false;
}You need to copy the above code into a plugin file (RTFM.js) and put it in a Colloquy plugin directory~/Library/Application Support/Colloquy/PlugIns
/Library/Application Support/Colloquy/PlugIns
/Network/Library/Application Support/Colloquy/PlugIns
The Javascript hook is in the
processUserCommand method. This one I created out of frustration with repeating myself - answering questions with the answer "RTFM", then posting a link to said "fucking manual":/rtfm airWill output a link to the AIR documentation of the following style onto the current channel:
http://labs.adobe.com/wiki/index.php/AIR:DocumentationAs I said, nothing big. All of the details are here - though documentation could really improve... I had to read through a little bit of Objective-C to even figure out the above.








0 comments:
Post a Comment