TWiGGiRC Notify (TWiGGNoT) — File Browser

TWiGGiRCNotifyTWiGGNoTv1.65 / TWiGGiRCNotifyTWiGGNoTv1.65 / twiggnot.mrc

twiggnot.mrc — 15.32 KB — Download this file

alias verifycorrect {
  set %correct $$?="Is this correct? (y/n)"
}

on 1:LOAD: {
  :begin
  set %correct noask
  if %TWiGGNoT == $null && %correct != noask { echo 4 -a TWiGGiRC Notify: Welcome, it appears you haven't run any previous versions of TWiGGNoT before. | verifycorrect }
  if %correct != y && %correct != n && %correct != noask { echo 4 -a You must enter "y" or "n" | goto begin }
  if %correct == noask echo 4 -a TWiGGiRC Notify: You're upgrading from TWiGGNoT %TWiGGNoT.ver - nice to see you're keeping current!
  if %correct == n { echo 4 -a TWiGGiRC Notify: Uh oh :( that means something is wrong, or you're running a REALLY old version of TWiGGNoT.  If you're running v1.1 or earlier, don't worry about a thing.  If you're running anything newer, please email twiggy@null.net with a bug report | halt }
  if %correct == y {
    echo 4 -a TWiGGiRC Notify: Initializing TWiGGiRC Notify for the first time.  Converting your current notify list to a TWiGGiRC notify list.
    echo 4 -a Note: No longer use mIRC's options menu or the /notify command for notifies.  Read the twiggirc.nfo file for details, or type /tnhelp for help.
    set %count 0
    :start
    set %line $readini mirc.ini notify n [ $+ [ %count ] ]
    set %pos $pos(%line,:)
    if %line == $null goto end
    inc %count
    if NOTE isin $left(%line,%pos) {
      %pos2 = %pos - 5
      %pos3 = %pos + 1
      set %comment. [ $+ [ $left(%line,%pos2) ] ] $mid(%line,%pos3,$len(%line))
      echo 4 -a TWiGGiRC Notify: Comment converted for user $left(%line,%pos2) - set to: $mid(%line,%pos3,$len(%line))
    }
    set %host. [ $+ [ $left(%line,%pos2) ] ] $chr(42)
    goto start
    :end
    echo 4 -a TWiGGiRC Notify: 5Comment conversion completed!  Loading main script.
  }
  if $exists(twiggnot.mrc) == $false { echo 4 -a TWiGGiRC Notify: You haven't copied twiggnot.mrc into your mIRC directory.  Unload this script, copy it there, and reload it. | halt }
  if %TWiGGiRC.loaded != Yes {
    if $exists(twiggnot.mrc) == $true { 
      echo 4 -a TWiGGiRC Notify: Loading main script.
      set %TWiGGiRC.loaded Yes
      load -rs twiggntm.mrc
    }
  }
}

alias nautoinv {
  if ($1 == $null) { 
    echo 4 -a Usage: /nautoinv <nick> <num> <inv> (if no num is specified, it will be infinite)
    echo 4 -a or: /nautoinv <nick> with no Invite will clear that user's auto Invite
    echo 4 -a or: /nautoinv -s <nick> to display the autoInvite for that user
    echo 4 -a or: /nautoinv On/Off will enable/disable the Autoinv for ALL users
    echo 4 -a or: /nautoinv -l to list your notify autoInvite data.
    halt 
  }
  if ($1 == -s) { 
    if ($2 == $null) { echo 4 %TWiGGNoT TWiGGiRC Notify: You must specify a number of times to send the Invite and/or nick. | halt }
    if ($2 !isnotify) { echo 4 %TWiGGNoT TWiGGiRC Notify: $2 is not in your notify list - check the spelling. | halt }
    if (%n.autoinv. [ $+ [ $2 ] ] == $null) { echo 4 %TWiGGNoT TWiGGiRC Notify: No Auto Invite set for $2 | halt }
    echo 4 %TWiGGNoT TWiGGiRC Notify: Current Auto Invite for $2 is: " $+ %n.autoinv. [ $+ [ $2 ] ] $+ " 
    halt
  }
  if ($1 == Off) { set %n.autoinv Off | echo 4 %TWiGGNoT TWiGGiRC Notify: Auto Invite feature disabled | halt }
  if ($1 == On) { set %n.autoinv On | echo 4 %TWiGGNoT TWiGGiRC Notify: Auto Invite feature enabled | halt }
  if ($1 == -l) { 
    window -c @TWiGGiRC $+ $chr(160) $+ Notify
    window -a @TWiGGiRC $+ $chr(160) $+ Notify  0 0 600 200
    aline @TWiGGiRC $+ $chr(160) $+ Notify 4TWiGGiRC Currently set Notify Auto Invites
    aline @TWiGGiRC $+ $chr(160) $+ Notify 5------------------------------------------------------------------------
    aline @TWiGGiRC $+ $chr(160) $+ Notify Nick0-------1Num0---1Invite
    aline @TWiGGiRC $+ $chr(160) $+ Notify 5------------------------------------------------------------------------
    set %linenum 0
    :writeline
    inc %linenum
    set %wholeline $read -l $+ %linenum twiggnotinv.list
    %diff = [ $pos(%wholeline,@) - $pos(%wholeline,~) ]
    dec %diff 2
    %pos0 = $pos(%wholeline,~) - 2
    %pos1 = $pos(%wholeline,~) + 2
    %pos2 = $pos(%wholeline,@) - 1
    %diff2 = [ $len(%wholeline) - %pos2 ]
    dec %diff2 2
    set %line.ni $left(%wholeline,%pos0)
    set %line.num $mid(%wholeline,%pos1,%diff)
    if %line.num == -1 set %line.num All
    set %line.inv $chr(160) $+ $right(%wholeline,%diff2)
    %spc = 11 - $len(%line.ni)
    %inc = 2 - $len(%line.num)
    inc %spc %inc
    set %line.nick %line.ni $+ $str($chr(160),%spc)
    aline @TWiGGiRC $+ $chr(160) $+ Notify %line.nick %line.num %line.inv
    if (%linenum < $lines(twiggnotinv.list)) goto writeline
    halt
  }
  if ($abs($2) > 0) && ($2 != $null) goto skip2
  if ($2 == $null) { 
    unset %n.autoinv. [ $+ [ $1 ] ]
    write -ds $+ $1 twiggnotinv.list
    echo 4 %TWiGGNoT TWiGGiRC Notify: Auto Invite for user $1 cleared.
    halt
  }
  if ($1 !isnotify) { echo 4 %TWiGGNoT TWiGGiRC Notify: That user is not on your notify list.  Add them first by typing:  /not $1 | halt }
  set %n.autoinv. [ $+ [ $1 ] ] $2
  set %n.autoinv.num. [ $+ [ $1 ] ] -1
  write -s $+ $1 twiggnotinv.list $1 ~ %n.autoinv.num. [ $+ [ $1 ] ] @ %n.autoinv. [ $+ [ $1 ] ] 
  echo 4 %TWiGGNoT TWiGGiRC Notify: Auto Invite for user $1 set to $2
  halt
  :skip2
  if ($3 == $null) { 
    echo 4 %TWiGGNoT TWiGGiRC Notify: You must specify an Auto Invite channel - to clear an Auto Invite type /nautoinv <nick>
    unset %n.autoinv. [ $+ [ $1 ] ]
    unset %n.autoinv.num. [ $+ [ $1 ] ]
    write -ds $+ $1 twiggnotinv.list
    halt
  }
  if ($1 !isnotify) { echo 4 %TWiGGNoT TWiGGiRC Notify: That user is not on your notify list.  Add them first by typing:  /not $1 | halt }
  set %n.autoinv. [ $+ [ $1 ] ] $3
  set %n.autoinv.num. [ $+ [ $1 ] ] $2
  write -s $+ $1 twiggnotinv.list $1 ~ %n.autoinv.num. [ $+ [ $1 ] ] @  %n.autoinv. [ $+ [ $1 ] ] 
  echo 4 %TWiGGNoT TWiGGiRC Notify: Auto Invite for user $1 set to $3 - Invite will be sent $2 times.
}

alias nautomsgmod {
  if (%n.automsg == On) {
    if ($away == $false) {
      if (%n.automsg. [ $+ [ %notify.user ] ] != $null) { 
        checkhost %notify.user %notify.host
        if (%ishost == Yes) {
          msg %notify.user Hi, %notify.user, TWiGGiRC tells me you are on IRC right now, and $me has a message for you: " $+ %n.automsg. [ $+ [ %notify.user ] ] $+ " -- I'm currently not set away, so say hi! 
          if (%n.automsg.num. [ $+ [ %notify.user ] ] > 0) dec %n.automsg.num. [ $+ [ %notify.user ] ] 1
          if (%n.automsg.num. [ $+ [ %notify.user ] ] == 0) {
            set %n.automsg. [ $+ [ %notify.user ] ]
            set %n.automsg.num. [ $+ [ %notify.user ] ]
            echo 4 %TWiGGNoT TWiGGiRC Notify: Notify Auto Message count for user %notify.user has dropped to 0, no longer sending messages to %notify.user $+ .
          }
          if (%n.automsg.num. [ $+ [ %notify.user ] ] > 0) { echo 4 %TWiGGNoT TWiGGiRC Notify: Signon for user %notify.user on $fulldate - Auto Message " $+ %n.automsg. [ $+ [ %notify.user ] ] $+ " sent - to be sent %n.automsg.num. [ $+ [ %notify.user ] ] more times }
          if (%n.automsg.num. [ $+ [ %notify.user ] ] == -1) { echo 4 %TWiGGNoT TWiGGiRC Notify: Signon for user %notify.user on $fulldate - Auto Message " $+ %n.automsg. [ $+ [ %notify.user ] ] $+ " sent - will be sent each time %notify.user logs on }
          if (%notify.logging == On) write $mircdir $+ logs/TWiGGNot.txt Notify Automessage " $+ %n.automsg. [ $+ [ %notify.user ] ] $+ " sent to %notify.user at $time on $adate
          set %signon.time. [ $+ [ $1 ] ] $ctime
          halt 
        }
        if (%n.automsg. [ $+ [ %notify.user ] ] != $null) { echo 4 %TWiGGNoT TWiGGiRC Notify: Signon for user %notify.user on $fulldate from non-authenticated host - no Auto Message sent | beep }
        if (%notify.logging == On) write $mircdir $+ logs/TWiGGNot.txt Notify Signon for %notify.user at $time on $adate from non-authenticated host %notify.host - no Auto Message sent
        set %signon.time. [ $+ [ $1 ] ] $ctime
        halt
      }
    }
    if ($away == $true) {
      if (%n.automsg. [ $+ [ %notify.user ] ] != $null) { 
        checkhost %notify.user %notify.host
        if (%ishost == Yes ) {
          msg %notify.user Hi, %notify.user, TWiGGiRC tells me you are on IRC right now, and $me has a message for you: " $+ %n.automsg. [ $+ [ %notify.user ] ] $+ " -- Unfortunately, I'm currently set away ( $+ %naway.message $+ ) - my message logging is %Message.Logging $+ , and my CTCP Pager is %CTCP.Pager 
          if (%n.automsg.num. [ $+ [ %notify.user ] ] > 0) dec %n.automsg.num. [ $+ [ %notify.user ] ] 1
          if %n.automsg.num. [ $+ [ %notify.user ] ] == 0 {
            set %n.automsg. [ $+ [ %notify.user ] ]
            set %n.automsg.num. [ $+ [ %notify.user ] ]
            echo 4 %TWiGGNoT TWiGGiRC Notify: Notify Auto Message sent to %notify.user for the last time (count dropped to 0).
          }
          if (%n.automsg.num. [ $+ [ %notify.user ] ] > 0) { echo 4 %TWiGGNoT TWiGGiRC Notify: Signon for user %notify.user on $fulldate - Auto Message " $+ %n.automsg. [ $+ [ %notify.user ] ] $+ " sent while away - to be sent %n.automsg.num. [ $+ [ %notify.user ] ] more times }
          if (%n.automsg.num. [ $+ [ %notify.user ] ] == -1) { echo 4 %TWiGGNoT TWiGGiRC Notify: Signon for user %notify.user on $fulldate - Auto Message " $+ %n.automsg. [ $+ [ %notify.user ] ] $+ " sent while away - will be sent each time %notify.user logs on }
          if (%notify.logging == On) write $mircdir $+ logs/TWiGGNot.txt Notify Automessage " $+ %n.automsg. [ $+ [ %notify.user ] ] $+ " sent to %notify.user at $time on $adate while away ( $+ %naway.message $+ )
          if %n.automsg.num. [ $+ [ %notify.user ] ] == 0 write $mircdir $+ logs/TWiGGNot.txt TWiGGiRC Notify: Notify Auto Message count for user %notify.user has dropped to 0 at $time on $adate $+ , no longer sending messages to %notify.user.
          set %signon.time. [ $+ [ $1 ] ] $ctime
          halt 
        }
        echo 4 %TWiGGNoT TWiGGiRC Notify: Signon for user %notify.user on $fulldate from non-authenticated host - no Auto Message sent | beep
        if (%notify.logging == On) write $mircdir $+ logs/TWiGGNot.txt Notify Signon for user %notify.user at $time on $adate from non-authenticated host ( $+ %notify.host $+ )
        set %signon.time. [ $+ [ $1 ] ] $ctime
        halt
      }
    }
  }  
}  

alias nautoinvmod {
  if (%n.autoinv == On) {
    if ($away == $false) {
      if (%n.autoinv. [ $+ [ %notify.user ] ] != $null) { 
        checkhost %notify.user %notify.host
        if (%ishost == Yes) {
          msg %notify.user Hi, %notify.user, TWiGGiRC tells me you are on IRC right now, I'm currently here and my AutoInvite is on, so come on in to %n.autoinv. [ $+ [ %notify.user ] ]
          invite %notify.user %n.autoinv. [ $+ [ %notify.user ] ]
          if (%n.autoinv.num. [ $+ [ %notify.user ] ] > 0) dec %n.autoinv.num. [ $+ [ %notify.user ] ] 1
          if (%n.autoinv.num. [ $+ [ %notify.user ] ] == 0) {
            set %n.autoinv. [ $+ [ %notify.user ] ]
            set %n.autoinv.num. [ $+ [ %notify.user ] ]
            echo 4 %TWiGGNoT TWiGGiRC Notify: Notify Auto Message count for user %notify.user has dropped to 0, no longer sending messages to %notify.user $+ .
          }
          if (%n.autoinv.num. [ $+ [ %notify.user ] ] > 0) { echo 4 %TWiGGNoT TWiGGiRC Notify: Signon for user %notify.user on $fulldate - Auto Invite to channel %n.autoinv. [ $+ [ %notify.user ] ] sent - to be sent %n.autoinv.num. [ $+ [ %notify.user ] ] more times }
          if (%n.autoinv.num. [ $+ [ %notify.user ] ] == -1) { echo 4 %TWiGGNoT TWiGGiRC Notify: Signon for user %notify.user on $fulldate - Auto Invite to channel %n.autoinv. [ $+ [ %notify.user ] ] sent - will be sent each time %notify.user logs on }
          if (%notify.logging == On) write $mircdir $+ logs/TWiGGNot.txt Notify Auto Invite to channel %n.autoinv. [ $+ [ %notify.user ] ] sent to %notify.user at $time on $adate
          set %signon.time. [ $+ [ $1 ] ] $ctime
          halt 
        }
        if (%n.autoinv. [ $+ [ %notify.user ] ] != $null) { echo 4 %TWiGGNoT TWiGGiRC Notify: Signon for user %notify.user on $fulldate from non-authenticated host - no Auto Invite sent }
        if (%notify.logging == On) write $mircdir $+ logs/TWiGGNot.txt Notify Signon for %notify.user from non-authenticated host %notify.host at $time on $adate - no Auto Invite sent
        set %signon.time. [ $+ [ $1 ] ] $ctime
        halt
      }
    }
    if ($away == $true) {
      if (%n.autoinv. [ $+ [ %notify.user ] ] != $null) { 
        checkhost %notify.user %notify.host
        if (%ishost == Yes ) {
          msg %notify.user Hi, %notify.user, TWiGGiRC tells me you are on IRC right now, I'm currently away, but AutoInvite is on, so come on in to %n.autoinv. [ $+ [ %notify.user ] ]
          invite %notify.user %n.autoinv. [ $+ [ %notify.user ] ]
          if (%n.autoinv.num. [ $+ [ %notify.user ] ] > 0) dec %n.autoinv.num. [ $+ [ %notify.user ] ] 1
          if %n.autoinv.num. [ $+ [ %notify.user ] ] == 0 {
            set %n.autoinv. [ $+ [ %notify.user ] ]
            set %n.autoinv.num. [ $+ [ %notify.user ] ]
            echo 4 %TWiGGNoT TWiGGiRC Notify: Notify Auto Invite sent to %notify.user for the last time (count dropped to 0).
          }
          if (%n.autoinv.num. [ $+ [ %notify.user ] ] > 0) { echo 4 %TWiGGNoT TWiGGiRC Notify: Signon for user %notify.user on $fulldate - Auto Invite to channel %n.autoinv. [ $+ [ %notify.user ] ] sent while away - to be sent %n.autoinv.num. [ $+ [ %notify.user ] ] more times }
          if (%n.autoinv.num. [ $+ [ %notify.user ] ] == -1) { echo 4 %TWiGGNoT TWiGGiRC Notify: Signon for user %notify.user on $fulldate - Auto Invite to channel %n.autoinv. [ $+ [ %notify.user ] ] sent while away - will be sent each time %notify.user logs on }
          if (%notify.logging == On) write $mircdir $+ logs/TWiGGNot.txt Notify Auto Invite to channel %n.autoinv. [ $+ [ %notify.user ] ] sent to %notify.user at $time on $adate while away ( $+ %naway.message $+ )
          if %n.autoinv.num. [ $+ [ %notify.user ] ] == 0 write $mircdir $+ logs/TWiGGNot.txt TWiGGiRC Notify: Notify Auto Message count for user %notify.user has dropped to 0 at $time on $adate $+ , no longer sending messages to %notify.user.
          set %signon.time. [ $+ [ $1 ] ] $ctime
          halt 
        }
        echo 4 %TWiGGNoT TWiGGiRC Notify: Signon for user %notify.user on $fulldate from non-authenticated host - no Auto Invite sent | beep
        if (%notify.logging == On) write $mircdir $+ logs/TWiGGNot.txt Notify Signon for user %notify.user from non-authenticated host ( $+ %notify.host $+ ) at $time on $adate
        set %signon.time. [ $+ [ $1 ] ] $ctime
        halt
      }
    }
  }  
}  

alias notwav {
  if $1 == $null { echo 4 -a Usage: /notwav <user> <filename> | halt }
  set %wave. [ $+ [ $1 ] ] $2
  if $2 == $null { echo 4 -a TWiGGiRC Notify: You didn't specify a WAV file, find the file and select it with the browse window. | set %wave. [ $+ [ $1 ] ] $file="Choose a wave" $mircdir }
  echo 4 -a TWiGGiRC Notify: Wave file for $1 set to %wave. [ $+ [ $1 ] ]
}

alias notmode {
  if $1 != s && $1 != v { echo 4 -a Usage: /notmode <s/v> - s = standard, v = verbose | halt }
  set %notmode $1
  echo 4 -a TWiGGiRC Notify: Notify mode set to $1 (s = standard, v = verbose)
}