Tagged as colloquy

edit delete favorite
Posted by eric on Oct 23, 2007
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 respective manuals: /rtfm air
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;
}
 
Please submit any bugs/features and report abuse. Thanks!
Spacer
Spacer
Spacer
Top Tags
Spacer