Ok, a variation:

my $BlockCode = $Plugins::SrvrPowerCtrl::Plugin::blockAction('set' ,
'pluginname', 'reason for blocking');


Code:
--------------------
    
  sub blockAction {
        my $set = shift;
        my $caller = shift;
        my $reason = shift;
        my $code;
        my $element;
        my $num;
  
        if (!defined($set)) {
                return 0;
        }
  
        if ($set eq 'set') {
                $code = int(rand(1000000));
                push ( @{$g{aBlockAction}}, 
                        { 
                                caller => $caller, 
                                reason => $reason, 
                                code   => $code,
                        } );
                return 1;
        } elsif ($set eq 'clear' ) {
                $num = 0;
                foreach my $element($g{aBlockAction}) {
                        if ( ($element->{'caller'} eq $caller) && 
($element->{'code'} eq $reason) ) {
                                delete $g{aBlockAction}[$num];
                                return 1
                        }
                        $num++;
                }
        }
  
        return 0;
  }
--------------------

Now,  plugin would clear it's block with:

$Plugins::SrvrPowerCtrl::Plugin::blockAction('clear', 'pluginname',
$BlockCode);


-- 
gharris999
------------------------------------------------------------------------
gharris999's Profile: http://forums.slimdevices.com/member.php?userid=115
View this thread: http://forums.slimdevices.com/showthread.php?t=48521

_______________________________________________
plugins mailing list
[email protected]
http://lists.slimdevices.com/lists/listinfo/plugins

Reply via email to