All pastes #809157 Raw Edit

Unnamed

public text v1 · immutable
·published 2007-12-08 09:04 UTC
rendered paste body
menu Status,Channel,MenuBar,Invite { 
  $iif($group(#inv) == on,$style(1)Disable,$style(0)Enable) Invite Control: { 
    var %status = $iif($group(#inv) == on,Disable,Enable) 
    $+(.,%status) #inv 
    echo -a 4» Invite Control has been $+(%status,d) 
  } 
} 
menu inv { 
  $iif($hget(invaccept,$address($active,3)),$style(1),$style(0)) Invite Auto-Accept $+([,$active,]): { 
    var %status = $iif($hget(invaccept,$address($active,3)) = 1,Del,Add) 
    $+(h,%status) invaccept $address($active,3) 1 
    echo -a 4» $active has been $iif(%status = del,deleted from,added to) Auto-Accept. 
  } 
} 
dialog inv { 
  title "Invite Control" 
  size -1 -1 130 47 
  option dbu 

  text "Chan::", 1, 4 7 25 10, right 
  text "Time:", 2, 82 7 15 10, left 
  text "", 3, 97 7 28 10, read 
  edit "", 4, 30 6 50 10, read
  box "", 7, 1 1 127 29 

  button "Auto-Accept", 15, 4 32 37 10, ok 
  button "Accept", 8, 42 32 20 10, ok 
  button "Decline", 9, 63 32 20 10, ok 
  button "Ignore", 10, 84 32 20 10, ok 
  box "", 11, 1 27 106 18 

  link "e-mail", 12, 110 31 15 8 
  text "v2.0.3", 13, 110 37 18 8 
  box "", 14, 107 27 21 18 

} 
on *:DIALOG:inv:sclick:8:{ 
  /join $chan
} 
on *:DIALOG:inv:sclick:15:{ 
  window -w %inv.nick 
  /notice %inv.nick $ewrap(Invite Accepted. $chan have been added to the Auto-Accept list. $+([,%inv.address,]) ) 
  dialog -x inv
  hadd -m invaccept %inv.address 1 
  window -a %inv.nick 
  unset %inv.* 
} 
on *:DIALOG:inv:sclick:9:{ 
  .notice %inv.nick $ewrap(Invite Declined. Sorry.) 
  window -c %inv.nick 
  unset %inv.* 
  dialog -x inv 
} 
on *:DIALOG:inv:sclick:10:{ 
  .notice %inv.nick $ewrap(Invite Declined. You have been ignored.) 
  window -c %inv.nick 
  .ignore -pu1200 %inv.nick 2 
  unset %inv.* 
  dialog -x inv 
} 
#inv on 
on *:START:{ 
  echo $color(info) -st 6» Script: Invite Control script by Mendo is loaded and running. 
  hmake invaccept 100 
  if ($exists(invaccept.hsh)) { 
    .hload -s invaccept invaccept.hsh 
    echo $color(info) -st 6» Script: hash table for Invite Control loaded 
  } 
} 
on *:EXIT:{ 
  hsave -s invaccept invaccept.hsh 
}  
on *:Invite:#: { 
  /dialog inv 
} 
} 
else { 
  set %inv.nick $nick 
  set %inv.address $address($nick,3) 
  window -h $nick 
  .notice %inv.nick $ewrap(Please Wait For Invite Acceptance/Decline) 
  dialog -mdo inv inv 
  did -a inv 3 $asctime(hh:nn:ss)    
  did -a inv 4 $nick 
  did -a inv 6 $1- 
  did -f inv 1 
} 
:end 
} 
#inv end 

alias dur { 
  return $replace($duration($1), wk,$chr(32) week,day,$chr(32) day,hr,$chr(32) hour,min,$chr(32) minute,sec,$chr(32) second ) 
} 
alias ewrap { 
  var %msg 
  var %tok = 1 
  var %word 
  while ($gettok($1-,%tok,32) != $null) { 
    %word = $gettok($1-,%tok,32) 
    %msg = %msg $+($chr(3)) $+ 15 $+ $upper($left(%word,1)) $+ $+($chr(3)) $+ 15 $+ $right(%word,-1) 
    inc %tok 
  } 
  return $+($chr(2),$chr(3)) $+ 12,1{~ $+ $+($chr(2),$chr(3)) $+ 15 $+ %msg $+ $+($chr(2),$chr(3)) $+ 12~} $+ $chr(15) 
}