All pastes #466560 Raw Edit

Miscellany

public text v1 · immutable
·published 2007-05-01 01:33 UTC
rendered paste body
#!/usr/bin/perl

#author: neozen (Ross Heflin)
#license: GPL

$name="xchat-thinklight";
$version="v0.0.1a";
$description="blinks thinklight on Channel Msg Hilight";

#time for light to be on
$onwait=0.1;#fraction of sec to leave on
$offwait=0.1;#fraction of sec to have off between blinks
$numblink=2;


#register with Xchat
Xchat::register( $name, $version, $description);

#hook channel_msg_hilight
Xchat::hook_command("Channel Msg Hilight", blink_thinklight);

sub blink_thinklight
{
    for ($i=0; $i<$numblink; $i++)
    {
        #turn light on
        Xchat::command("EXEC echo on>/proc/acpi/ibm/light");

        #wait a bit
        select(undef, undef, undef, $onwait);

        #shut it off
        Xchat::command("EXEC echo off>/proc/acpi/ibm/light");

        #wait a bit
        select(undef, undef, undef, $offwait);
    }

    return Xchat::EAT_NONE;
}