All pastes #913994 Raw Edit

Acc.mrc

public text v1 · immutable
·published 2008-02-22 15:18 UTC
rendered paste body

alias channel {
  var %c, %x
  if ($+($chr(37),$chr(35)) !isin $active) { halt }
  %c = $remove($active,$chr(35),$chr(37)) 
  %x = $+(accessmodelist$chr(46),%c)
  if ($dialog(%x) == $null) { accessx }
  else { dialog -x %x %x }
}

raw *:*:{
  if ( $numeric == 801 ) {
    if $dialog(accessmodelist. $+ $remove($2,$chr(35),$chr(37))) { /access $2 }
  }
  if ( $numeric == 802 ) {
    if $dialog(accessmodelist. $+ $remove($2,$chr(35),$chr(37))) { /access $2 }
  }
  if ( $numeric == 803 ) {
    if $dialog(accessmodelist. $+ $remove($2,$chr(35),$chr(37))) { dialog -c accessmodelist. $+ $remove($2,$chr(35),$chr(37)) accessmodelist. }
    dialog -mar accessmodelist. $+ $remove($2,$chr(35),$chr(37)) accessmodelist.
    did -r accessmodelist. $+ $remove($2,$chr(35),$chr(37)) 1
  }
  if ( $numeric == 804 ) {
    if $dialog(accessmodelist. $+ $remove($2,$chr(35),$chr(37))) { did -a accessmodelist. $+ $remove($2,$chr(35),$chr(37)) 1 $3 $4 $5 $6 $7- }
  }
  if ( $numeric == 805 ) {
    return
  }
  if ( $numeric == 820 ) {
    if $dialog(accessmodelist. $+ $remove($2,$chr(35),$chr(37))) { /access $2 }
  }
  if ( $numeric == 913 ) {
    echo $2 $+($chr(3),$chr(55),$chr(42)) You are currently not an Op in this room and not able to set any changes...
    halt
  }
}

alias accessx {
  access $chan
}

dialog accessmodelist.* {
  title "TAChat Options Dialog"
  size -1 -1 456 432
  option pixels
  icon add.ico, 0
  button "Close", 2, 350 376 90 20, flat ok cancel
  button "Remove Entry", 3, 350 184 90 20, flat
  button "Clear Owners", 4, 350 216 90 20, flat
  button "Clear Grants", 5, 350 280 90 20, flat
  button "Clear Hosts", 6, 350 248 90 20, flat
  button "Add New Entry", 7, 350 152 90 20, flat
  list 1, 22 160 306 250, sort size extsel hsbar vsbar
  button "Refresh List", 8, 350 344 90 20, flat
  link "http://tachat.org/", 10, 352 400 90 16
  button "Clear Denys", 9, 350 312 90 20, flat
  box "channelname", 11, 8 136 332 284
  box "cPanel Control", 12, 344 136 102 284
  box "modename", 13, 8 8 440 124

  check "Only ops set &Topic", 14, 16 80 140 20
  check "&No external messages", 15, 16 104 140 20
  check "&Invite only", 16, 160 80 140 20
  check "&Moderated", 17, 160 104 140 20
  check "&Hidden", 18, 304 80 140 20
  check "&Secret", 19, 304 104 140 20

  text "Current Room Topic:", 20, 18 32 106 16
  edit "", 21, 16 48 420 21
}


on *:dialog:accessmodelist.*:init:*: {
  if ($did == 0) {
    var %x = $+($chr(37),$chr(35),$remove($dname,accessmodelist.))
    dialog -t $dname TAChat Options Dialog $+($chr(91),$chr(37),$chr(35),$remove($dname,accessmodelist.),$chr(93))
  }
  did -ra $dname 11 accesslist: $+($chr(37),$chr(35),$remove($dname,accessmodelist.))
  did -ra $dname 13 modelist: $+($chr(37),$chr(35),$remove($dname,accessmodelist.))

  did -ra $dname 21 $chan(%x).topic
  if (t isincs $chan(%x).mode) { did -c $dname 14 }
  if (n isincs $chan(%x).mode) { did -c $dname 15 }
  if (i isincs $chan(%x).mode) { did -c $dname 16 }
  if (m isincs $chan(%x).mode) { did -c $dname 17 }
  if (h isincs $chan(%x).mode) { did -c $dname 18 }
  if (s isincs $chan(%x).mode) { did -c $dname 19 }
}

on *:dialog:accessmodelist.*:sclick:*: {
  if ($did == 2) {
    var %nk = $+($chr(37),$chr(35)) $+ $remove($dname,accessmodelist.)
    if ($me !isop %nk) {
      echo %nk $+($chr(3),$chr(55),$chr(42)) You are currently not an Op in this room and not able to set any changes...
      halt
    }
    if ($did($dname,21) != $chan(%nk).topic) { TOPIC %nk $did($dname,21) }
    if ($did($dname,14).state == 0) {
      if (t isincs $chan(%nk).mode) { MODE %nk -t }
    }
    if ($did($dname,14).state == 1) {
      if (t !isincs $chan(%nk).mode) { MODE %nk +t }
    }
    if ($did($dname,15).state == 0) {
      if (n isincs $chan(%nk).mode) { MODE %nk -n }
    }
    if ($did($dname,15).state == 1) {
      if (n !isincs $chan(%nk).mode) { MODE %nk +n }
    }
    if ($did($dname,16).state == 0) {
      if (i isincs $chan(%nk).mode) { MODE %nk -i }
    }
    if ($did($dname,16).state == 1) {
      if (i !isincs $chan(%nk).mode) { MODE %nk +i }
    }
    if ($did($dname,17).state == 0) {
      if (m isincs $chan(%nk).mode) { MODE %nk -m }
    }
    if ($did($dname,17).state == 1) {
      if (m !isincs $chan(%nk).mode) { MODE %nk +m }
    }
    if ($did($dname,18).state == 0) {
      if (h isincs $chan(%nk).mode) { MODE %nk -h }
    }
    if ($did($dname,18).state == 1) {
      if (h !isincs $chan(%nk).mode) { MODE %nk +h }
    }
    if ($did($dname,19).state == 0) {
      if (s isincs $chan(%nk).mode) { MODE %nk -s }
    }
    if ($did($dname,19).state == 1) {
      if (s !isincs $chan(%nk).mode) { MODE %nk +s }
    }
  }
  if ($did == 3) {
    access $+($chr(37),$chr(35)) $+ $remove($dname,accessmodelist.) delete $did(1).seltext 
  }
  if ($did == 4) {
    access $+($chr(37),$chr(35)) $+ $remove($dname,accessmodelist.) clear Owner 
    access $active 
  }
  if ($did == 5) {
    access $+($chr(37),$chr(35)) $+ $remove($dname,accessmodelist.) clear Grant
    access $active 
  }
  if ($did == 6) {
    access $+($chr(37),$chr(35)) $+ $remove($dname,accessmodelist.) clear Host
    access $active 
  }
  if ($did == 7) {
    if $dialog(addaccess) { dialog -c addaccess addaccess }
    dialog -m addaccess addaccess
    .set -n %x $dname
  }
  if ($did == 8) {
    access $+($chr(37),$chr(35)) $+ $remove($dname,accessmodelist.)
    access $active 
  }
  if ($did == 9) {
    access $+($chr(37),$chr(35)) $+ $remove($dname,accessmodelist.) clear Deny
    access $active 
  }
  if ($did == 10) {
    run http://tachat.org/
  }
}


dialog addaccess {
  title "Add Access"
  size -1 -1 128 120
  option dbu
  icon $scriptdir/ta.ico, 0
  combo 1, 8 16 60 42, sort size drop
  text "Access Type:", 2, 6 8 32 8
  button "Add", 3, 16 104 45 10, flat ok
  button "Cancel", 4, 64 104 45 10, flat cancel
  text "Mask To Add:", 5, 6 32 33 8
  edit "", 6, 8 40 114 10, autohs
  text "Reason:", 7, 6 80 24 8
  edit "", 8, 8 88 114 10, autohs
  text "How Long: (Not Avalible Until Version 1.2)", 9, 6 56 103 8
  combo 10, 8 64 44 50, disable size edit drop
}
on *:dialog:addaccess:init:*: {
  did -a $dname 1 Owner  
  did -a $dname 1 Host
  did -a $dname 1 Grant
  did -a $dname 1 Deny
  did -c $dname 1 4
  did -a $dname 10 0
  did -a $dname 10 5
  did -a $dname 10 10
  did -a $dname 10 30
  did -a $dname 10 60
  did -c $dname 10 1
}
on *:dialog:addaccess:sclick:3: {
  if (!$did(6)) halt
  access $+($chr(37),$chr(35)) $+ $remove(%x,accessmodelist.) add $did(1).seltext $did(6) $calc($did(10).text - 1 ) : $+ $did(8)
  unset %x
  access $active 
}