FDetect fix

By NiveusLuna on Jul 13, 2008

This is a fix I've made for the FDetect script made by Caelestia.net's Corwin. It should save the fignore hash table properly.
source for original: http://caelestia.net/scripts.php?id=12
If it doesn't, please let me know on irc.caelestia.net.

Update: fixed the action part to work on TelLaerad.net.
Update 2: after consultation with Corwin, added beeping (if channel is set to beep on messages), window coloring, and highlight capability.
update 3: fixed it so that you don't highlight yourself

Update 4:

  • added *** to the start of each line in windowed mode to make it easier to tell when a line is a new post or when it's just a runon that wrapped to a new line.
  • added proper detection for the Tel'Laerad / Argent Citadel variant of >Ambiance< (=Scene=)
on *:load:{
  if (($hget(fignore) == $null) && ($isfile(fignore.hsh) != $false)) {
    hmake fignore 10    
    hload fignore fignore.hsh  
  }
  echo -ag Loaded FsayDetect by Corwin
  echo -ag Commands:
  echo -ag /fdetect -- Toggles Non-windowed Fsay Detection
  echo -ag /fdetect -w Toggles Windowed Fsay Detection
  echo -ag /fignore <fsayed nickname> -- Ignores detection of a certain FSAY/ACTION Nickname
  echo -ag /fignore -u <User nickname> -- Ignores detection of FSAY/ACTIONs sent out by a user
  echo -ag /fignore -c <#channel [chan]> -- Ignores detection of FSAY/ACTIONs sent to a specific channel, "chan" is an optional argument that can be added to the command to only ignore in-channel detections, it will still be detected in the fsay window.
  echo -ag /fignore -r <fsayed nickname, user nickname, or channel> -- Unignores that FSAY/ACTION Nickname/Oper, putting no argument clears the list.
  echo -ag /fignore -l -- Lists the F-ignore list 
  echo -ag /fcommands -- Brings up this list of commands. 
  echo -ag Note: All detection is currently off.
}
on *:unload:{
  .disable #fdetect
  if ($hget(fignore) != $null) {
    hfree fignore
  }
  unset %fdetect
  unset %fdetectwin
}
alias fdetect { 
  if ($group(#fdetect) == off) {
    .enable #fdetect
  }
  if ($1 == -w) {
    if (%fdetectwin == $null) {
      set %fdetectwin on
      echo -ag Windowed FSAY detection enabled
    }
    else {
      unset %fdetectwin
      echo -ag Windowed FSAY detection disabled  
  } }
  elseif (%fdetect == $null) {
    set %fdetect on
    echo -ag Non-windowed FSAY detection enabled
  }
  else {
    unset %fdetect
    echo -ag Non-windowed FSAY detection disabled
  }
  if ($isfile(fignore.hsh) != $false) {
    if ($hget(fignore) == $null) {
      hmake fignore 10
    }
    hload fignore fignore.hsh  
  } 
  if ((%fdetect == $null) && (%fdetectwin == $null)) {
    .disable #fdetect
  }
}
#fdetect on
on *:connect:{ 
  if ($isfile(fignore.hsh) != $false) {
    if ($hget(fignore) == $null) {    
      hmake fignore 10    
    }
    hload fignore fignore.hsh  
} }
on ^*:text:*:#:{
  if ((RPG.irc == $site) || (npc.fakeuser.invalid == $site)) {
    if (($hget(fignore,$nick) != ignore) && ($hget(fignore,$chan) != cignore all) && ($hget($remove($address,@ $+ $site)) != uignore)) {
      if ((%fdetect != $null) && ($hget(fignore,$chan) != cignore chan)) {
        var %fnick = $remove($address,@ $+ $site)
        if (%fnick == $me) echo -bmt $chan ( $+ %fnick $+ ) <8 $+ $nick $+ > $1-
        else echo -blmt $chan ( $+ %fnick $+ ) <8 $+ $nick $+ > $1-   
        haltdef
      } 
      if (%fdetectwin != $null) {
        if ((%fdetect == $null)  && ($chan($chan).logfile != $null)) {
          haltdef
          write $chan($chan).logfile $logstamp ( $+ $remove($address,@ $+ $site) $+ ) < $+ $nick $+ > $1-
          if (%fnick == $me) echo -bmt $chan <8 $+ $nick $+ > $1-
          else echo -blmt $chan <8 $+ $nick $+ > $1-  
        }
        if ($window(@Fsay) == $null) {
          window -nk(0) @Fsay
        }
        if ($chr(31) !isin $nick) {
          if ($chr(61) $+ Scene $+ $chr(61) == $nick) {      
            echo -m @fsay *** $remove($address,@ $+ $site) used SCENE on $chan $+ : $timestamp < $+ $nick $+ > $1-  
          }
          else if (>Ambiance< == $nick) {
            echo -m @fsay *** $remove($address,@ $+ $site) used AMBIANCE on $chan $+ : $timestamp < $+ $nick $+ > $1-  
          } 
          else {
            echo -m @fsay *** $remove($address,@ $+ $site) FSAYed $nick on $chan $+ : $timestamp < $+ $nick $+ > $1-
        } }
        else {
          echo -m @fsay *** $remove($address,@ $+ $site) NPCed $nick on $chan $+ : $timestamp < $+ $nick $+ > $1-
      } } 
} } }
on ^*:ACTION:*:#:{
  if ((RPG.irc == $site) || (npc.fakeuser.invalid == $site)) {
    if (($hget(fignore,$nick) != ignore) && ($hget(fignore,$chan) != cignore all) && ($hget($remove($address,@ $+ $site)) != uignore)) {
      if ((%fdetect != $null) && ($hget(fignore,$chan) != cignore chan)) {
        var %fnick = $remove($address,@ $+ $site)
        if (%fnick == $me) echo -bmtc action $chan ( $+ %fnick $+ ) * $nick $1-
        else echo -blmtc action $chan ( $+ %fnick $+ ) * $nick $1-   
        haltdef
      }
      if (%fdetectwin != $null) {
        if ((%fdetect == $null)  && ($chan($chan).logfile != $null)) {
          haltdef
          var %fnick = $remove($address,@ $+ $site)
          write $chan($chan).logfile $logstamp ( $+ %fnick $+ ) * $nick $1-
          if (%fnick == $me) echo -bmtc action $chan * $nick $1-
          else echo -blmtgc action $chan * $nick $1-
        }
        if ($window(@Fsay) == $null) {
          window -nk(0) @Fsay
        }
        if ($chr(31) !isin $nick) {
          echo -m @fsay *** $remove($address,@ $+ $site) FACTIONed $nick on $chan $+ : $timestamp * $nick $1-
        }
        else {
          echo -m @fsay *** $remove($address,@ $+ $site) NPCAed $nick on $chan $+ : $timestamp * $nick $1-
      } }
} } }
#fdetect end
alias fignore { 
  if ($1 != $null) {
    if ($hget(fignore) == $null) {
      hmake fignore 10
    }
    if (($1 != -r) && ($1 != -l) && ($1 != -u) && ($1 != -c)) {      
      hadd fignore $$1 ignore 
      echo -agc info * Added $$1 to F-ignore list
      hsave -o fignore fignore.hsh
    }
    if ($1 == -u) { 
      if ($2 != $null) {
        hadd fignore $2 uignore 
        echo -agc info * Added user $2 to F-ignore list
        hsave -o fignore fignore.hsh
      } 
      else { 
        echo -agc info * /fignore -u: insufficient parameters
    } }
    if ($1 == -c) { 
      if ($2 != $null) {
        if ($3 == chan) {
          hadd fignore $2 cignore chan
          echo -agc info * Added $2 to F-ignore list (In channel detection only)
          hsave -o fignore fignore.hsh
        }
        else {
          if ($hget(fignore,$3) != $null) {
            hdel fignore $3
          }
          hadd fignore $2 cignore all
          echo -agc info * Added $2 to F-ignore list
          hsave -o fignore fignore.hsh
      } }
      else { 
        echo -agc info * /fignore -c: insufficient parameters
    } }
    if ($1 == -l) {
      if ($hget(fignore,0).item != 0) {
        var %inumber 1
        echo -agc info * Fignore list:       
        while (%inumber <= $hget(fignore,0).item) {
          if ($hget(fignore,%inumber).data == ignore) {          
            echo -agc info FSAYed Nickname: $hget(fignore,%inumber).item
          }          
          elseif ($hget(fignore,%inumber).data == uignore) {
            echo -agc info User: $hget(fignore,%inumber).item
          } 
          else {
            if ($hget(fignore,%inumber).data != cignore chan) {
              echo -agc info Channel: $hget(fignore,%inumber).item
            }
            else {
              echo -agc info Channel: $hget(fignore,%inumber).item (In channel detection only)
          } }
          inc %inumber 1      
      } }
      else {
        echo -agc info * F-ignore list empty  
    } }
    if ($1 == -r) {
      if ($2 == $null) {
        if ($file(fignore.hsh) != $null) {
          hfree fignore
          .remove fignore.hsh
          echo -agc info * F-ignore list cleared      
        }
        else {
          echo -agc info * F-ignore list empty
      } }
      if ($2 != $null) {
        if ($hget(fignore,$2) != $null) { 
          hdel fignore $2     
          echo -agc info * Removed $2 from the F-ignore list          
          if ($hget(fignore,0).item != 0) {          
            hsave -o fignore fignore.hsh
          }
          else {
            hfree fignore
            .remove fignore.hsh
        } } 
        else {
          echo -agc info * $2 is not in F-ignore list
  } } } }
  else {
    echo -agc info * /fignore: insufficient parameters 
} }
alias fcommands {
  echo -ag Commands:
  echo -ag /fdetect -- Toggles Non-windowed Fsay Detection
  echo -ag /fdetect -w Toggles Windowed Fsay Detection
  echo -ag /fignore <fsayed nickname> -- Ignores detection of a certain FSAY/ACTION Nickname
  echo -ag /fignore -u <User nickname> -- Ignores detection of FSAY/ACTIONs sent out by a user
  echo -ag /fignore -c <#channel [chan]> -- Ignores detection of FSAY/ACTIONs sent to a specific channel, "chan" is an optional argument that can be added to the command to only ignore in-channel detections, it will still be detected in the fsay window.
  echo -ag /fignore -r <fsayed nickname, user nickname, or channel> -- Unignores that FSAY/ACTION Nickname/Oper, putting no argument clears the list.
  echo -ag /fignore -l -- Lists the F-ignore list 
}

Comments

Sign in to comment.
Are you sure you want to unfollow this person?
Are you sure you want to delete this?
Click "Unsubscribe" to stop receiving notices pertaining to this post.
Click "Subscribe" to resume notices pertaining to this post.