Advertisement
Aha2Y

Untitled

Apr 18th, 2012
472
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Perl 1.22 KB | None | 0 0
  1. #!/usr/bin/perl
  2.  
  3. Xchat::hook_command("power", "power_main");
  4.  
  5. use warnings;
  6. use strict;
  7.  
  8. ### Main routine.
  9.  
  10. sub power_main {
  11.    my($networks, $oppedchans, $wholechannels);
  12.    my $opped = my $whole = "0";
  13.    my $oldcontext = Xchat::get_context();
  14.    my @channels = Xchat::get_list("channels");
  15.    foreach my $temp (@channels){
  16.       my $chan = $temp->{"channel"};
  17.       my $type = $temp->{"type"};
  18.       if($type == "1"){
  19.          $networks++;
  20.       }
  21.       if($type == "2"){
  22.          Xchat::set_context("$chan");
  23.          my $userinfo = Xchat::user_info();
  24.          if($userinfo->{"prefix"} =~ /^[@~&]$/){
  25.             my $users = Xchat::get_list("users");
  26.             Xchat::set_context("$oldcontext");
  27.             $oppedchans++;
  28.             $wholechannels++;
  29.             $opped = $opped + $users;
  30.             $whole = $whole + $users;
  31.          } else {
  32.             my $uopusers = Xchat::get_list("users");
  33.             Xchat::set_context("$oldcontext");
  34.             $wholechannels++;
  35.             $whole = $whole + $uopusers;
  36.          }
  37.       }
  38.  
  39.    }
  40.    Xchat::command("say I'm opped in $oppedchans/$wholechannels channels on $networks network/s. I've got the power about $opped/$whole users.");
  41.    return 1;
  42. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement