Menu

isop

Help
2002-08-11
2002-08-13
  • Shannon Wynter

    Shannon Wynter - 2002-08-11

    Hey... I've been through the sources I can't find any OBVIOUS reference to an IS OP except the one in the user module...

    Is there a way to find out if a channel member is opped regardles of if they are or are not in or specified as an op in the config?

     
    • Shannon Wynter

      Shannon Wynter - 2002-08-11

      I Dumped($self) and can't find anything resembling this... I can write a tracker plugin for this if there is not one already availible... one question how do I access one plugin's variables from another plugin

      EG.

      optrackers isop(user)

      from genprotection

      thanks

       
    • Andrew Burke

      Andrew Burke - 2002-08-13

      We don't really have a facility for doing that.  Really that should probably become part of UserUpdater and update some data structure in the channel object.  Maybe something like isopped($nick) would be appropriate?

       
      • Shannon Wynter

        Shannon Wynter - 2002-08-13

        Yes, this would be good.

        I had a fairly efficiant way of tracking ops and voices in my original script (before moving to perlbot)

        Perhaps you can tailor this code for perlbot

        (Forgive me for errors below, I'm retyping from memory, not tested source)

        ----- User Status Monitoring ----

        sub ModeChange {
          my $event = shift;
          my @Args = @{$event->{args}};
          my $modeline = shift(@Args);

          my $chan = $event->{to}[0];

          if ($modeline =~ /[ov]/) {
            while ($modeline !~ /^([+-][a-z])+$/) {
              $modeline =~ s/([+-])([a-z])([a-z])/$1$2$1$3/;
            }
         
            my @modes = $modeline =~ /([+-][a-z])/g;

            my %modehash;
            @modehash{@Args} = @modes;

            while (my($Nick,$Mode) = each (%modehash)) {
              if ($Mode == '-o') {
                delete($UserTracking{$chan}{$Nick}{'op'});
              } elsif ($Mode == '+o') {
                $UserTracking{$chan}{$Nick}{op} = 1;
              } elsif ($mode == '-v') {
                delete($UserTracking{$chan}{$Nick}{'voice'});
              } elsif ($Mode == '+o') {
                $UserTracking{$chan}{$Nick}{'voice'} = 1;
              }
              my @NModes = keys(%{$UserTracking{$chan}{$Nick}});
              if ($#NModes == -1) {
                delete($UserTracking{$chan}{$Nick});
              }
            }
          }
        }

        sub isopped {
          $nick = $shift;
          $chan = $shift;

          return $UserTracking{$chan}{$Nick}{op};
        }

        sub isvoiced {
          $nick = $shift;
          $chan = $shift;

          return $UserTracking{$chan}{$Nick}{voice};
        }

         

Log in to post a comment.

Want the latest updates on software, tech news, and AI?
Get latest updates about software, tech news, and AI from SourceForge directly in your inbox once a month.