plugin.id = "away-notice";
plugin.init =
function _init( glob ) {
plugin.major = 1;
plugin.minor = 0;
plugin.version = plugin.major + "." + plugin.minor + " (11 Oct 2009)";
plugin.description = "Send away notice to user stalk me. " +
"By MakOke <gboxlan@gmail.com>";
return "OK";
}
plugin.enable =
function _enable() {
client.eventPump.addHook( [{set:"channel", type:"privmsg"}], awaynoticeHook, "awaynoticeHook" );
return true;
}
plugin.disable =
function _disable() {
client.eventPump.removeHookByName( "awaynoticeHook" );
return true;
}
function awaynoticeHook( e ) {
try {
var myRe = e.server.parent.stalkExpression;
var message = e.decodeParam( 2 );
if( myRe.test( message ) && e.server.me.isAway )
setTimeout( function() {
e.server.noticeTo( e.user.encodedName, "Do NOT Disturb - Away: " + String( client.prefs["awayIdleMsg"] ) );
display( "*[Away-Notice]:* To " + e.user.encodedName + " in " + e.channel.getURL() + "." );
}, 2000 );
} catch( ex ) {
client.displayHere( "Error in awaynotice hook: " + ex, "ERROR" );
}
}
Download File away-notice.js 1.1 KB