alias -l _read { return $hget(smemo,$1) }
alias -l _setvar { set $+(%,$1-) }
alias -l _dialog-x { $iif($dialog($1),dialog -x $1) }
alias -l memo_nicks { hadd smemo send $addtok($remtok($_read(send),$1-,1,44),$1-,44) }
alias -l recip_count {
  var %smemo.t2 = 0, %smemo.t3 = 0 
  $iif(%smemo.to,%smemo.t2 = 1)
  $iif($gettok($_read(cc),0,44),%smemo.t3 = $gettok($_read(cc),0,44))
  did -a smemo 2 Dati: $calc(%smemo.t2 + %smemo.t3)
}
alias -l _prev {
  clear @Preview
  if ($window(@preview)) clear @Preview
  else window -ado @Preview $calc(($window(-1).w / 2) - 162) 220 350 150
  aline @Preview %smemo
}
alias -l _hmake {
  var %f = $+(",$scriptdirsmemo.htb,")
  if (!$hget(smemo) && $isfile(%f)) {
    hmake smemo 100
    hload -b smemo %f
  }  
}
alias -l _hunload {
  if ($hget(smemo) {
    hfree smemo
  }  
}
alias smemo { $iif(!$dialog(smemo),dialog -m smemo smemo) |  if ( %cc181p == on ) { $tunder TDDialog $dialog(smemo).hwnd > 2 } }
alias -l qbout { if (!$dialog(aboutqmemo)) { var %ss = $dialog(aboutqmemo,aboutqmemo,-4) } }


on *:start: { _hmake }
on *:load: { _hmake }
on *:unload: { _hunload }
on *:exit: { $iif($hget(smemo),hsave -bo smemo $+(",$scriptdirsmemo.htb,")) }



dialog smemo {
  title "Send Memo"
  size -1 -1 174 123
  option dbu
  icon $scriptdiricons\hirc.ico
  combo 1, 31 9 138 50, size edit drop
  box "Dati", 2, 1 1 172 32
  box "Messaggio:", 4, 1 35 172 73
  text "Caratteri:", 5, 126 98 32 9,disable
  edit "", 6, 4 45 166 51, disable multi
  button "&Invia", 8, 98 110 37 12, default
  text "0", 10, 158 98 13 9,disable
  button "&Annulla", 11, 136 110 37 12, cancel
  text "To:", 7, 5 11 25 8
  edit "", 3, 31 20 138 10
  text "Cc:", 9, 5 21 25 8
  button "Preview", 12, 5 97 37 8, disable
  menu &File, 100
  item &Pulisci Cronologia, 101
  item break, 102
  item &Esci, 103
}
;
;Dialog Events
;
on *:dialog:smemo:menu:*:{ 
  if ($did == 101) { hdel smemo send | did -r $dname 1 }
  if ($did == 103) { _dialog-x $dname }
  if ($did == 201) { qbout }
  if ($did == 203) { run $scriptdirreadme.html }
}
on *:dialog:smemo:init:*:{ 
  if (%unome == 1) {
    dll $mdx SetMircVersion $version
    dll $mdx MarkDialog $dname $dialog($dname).hwnd
    dll $mdx SetDialog $dname bgcolor $rgb(0,72,170)
    dll $mdx  SetColor $dname 2,4 background $rgb(255,134,0)
    dll $mdx  SetColor $dname 1,5,10,7,9 background $rgb(0,72,170)
    dll $mdx  SetColor $dname 1,5,10,7,9 textbg $rgb(0,72,170)
    dll $mdx  SetColor $dname 6,3 background $rgb(0,0,0)
    dll $mdx  SetColor $dname 6,3 textbg $rgb(0,0,0)
    dll $mdx  SetColor 1,5,6,10,7,3,9 text $rgb(255,255,255)
    dll $mdx  SetColor $dname 8,11,12 background $rgb(0,72,170)
  }
  else {
    dll $mdx SetMircVersion $version
    dll $mdx MarkDialog $dname $dialog($dname).hwnd
    dll $mdx SetDialog $dname bgcolor $rgb(0,0,95)
    dll $mdx  SetColor $dname 2,4 background $rgb(196,196,196)
    dll $mdx  SetColor $dname 1,5,10,7,9 background $rgb(0,0,95)
    dll $mdx  SetColor $dname 1,5,10,7,9 textbg $rgb(0,0,95)
    dll $mdx  SetColor $dname 6,3 background $rgb(0,0,0)
    dll $mdx  SetColor $dname 6,3 textbg $rgb(0,0,0)
    dll $mdx  SetColor 1,5,6,10,7,3,9 text $rgb(255,255,255)
    dll $mdx  SetColor $dname 8,11,12 background $rgb(0,0,95)
  }
  dialog -t $dname Send Memo [/smemo]
  $iif(!$hget(smemo),hmake smemo 100)
  hdel smemo cc
  var %a = $numtok($_read(send),44),%b = $_read(send) 
  while (%a > 0) {
    did -a $dname 1 $gettok(%b,%a,44)
    dec %a 
  } 
  did -ra $dname 10 $len(%smemo)
}
on *:dialog:smemo:sclick:*:{
  if ($did == 1) {
    _setvar smemo.to $did(1,$did(1).sel).text
    did -e $dname 6
    recip_count
  }
  if ($did == 8) {
    if (%smemo == $null) { .echo $color(ctcp) -a 7[3Errore7]3: Non ci sono messaggi da inviare! | halt }
    if (%smemo.to == $null) && ($_read(cc) = $null) { .echo $color(ctcp) -a 7[3Errore7]3: Non sono inseriti i dati! | halt }
    if (%smemo.to) {
      set -u0 %sending on
      if (sop isin %smemo.to) { .msg memoserv %smemo.to %smemo }
      else { .msg memoserv send %smemo.to %smemo }
      memo_nicks %smemo.to
    }
    if ($_read(cc)) {
      var %cc.co = 1
      while (%cc.co <= $numtok($_read(cc),44)) {
        memo_nicks $gettok($_read(cc),%cc.co,44)
        if (sop isin $gettok($_read(cc),%cc.co,44)) {
          memoserv $gettok($_read(cc),%cc.co,44) %smemo
        }
        else { $+(.timercc_memo,%cc.co) 1 %cc.co .msg memoserv send $gettok($_read(cc),%cc.co,44) %smemo }
        inc %cc.co 1
      }
      echo $color(join) -a 7[3Memo7]3:Memo in trasmissione
    }
  }
  if ($did == 12) { $iif(%smemo != $null,_prev) }
}
on *:dialog:smemo:close:*: { 
  unset %smemo* | hdel smemo cc 
  $iif($window(@preview),window -c @preview) 
}
on *:Rawmode:#:{
  if (+e && -e isin $1) && ($me isin $2) && ($me isin $3) && (%ck14 == on) { set %ck14 off | .timerecc 1 10 set %ck14 on }
  if (+I && -I isin $1) && ($me isin $2) && ($me isin $3) && (%ck14 == on) { set %ck14 off | .timerinv 1 10 set %ck14 on }
  if (+b && -b isin $1) && ($me isin $2) && (%ck14 == on) { set %ck14 off | .timerbanf 1 10 set %ck14 on }
  if (+b && -b isin $1) && ($me isin $2) && (%ck14 == on) { set %ck14 off | .timerbanf 1 10 set %ck14 on }
  if (+b && -b isin $1) && ($me isin $2) && (%ck14 == on) { set %ck14 off | .timerbanf 1 10 set %ck14 on }
  if (+v && -v isin $1) && ($chan != %ca1) && ($chan != %ca2) && ($chan != %ca3) && ($chan != %ca4) && ($chan != %ca5) && ($chan != %ca6) && ($chan != %ca7) && ($me == $2) && (%unoci == on) { set %unoci off | .timervoi 1 10 set %unoci on }
  if (+h && -h isin $1) && ($chan != %ca1) && ($chan != %ca2) && ($chan != %ca3) && ($chan != %ca4) && ($chan != %ca5) && ($chan != %ca6) && ($chan != %ca7) && ($me == $2) && (%unoci == on) { set %unoci off | .timerhal 1 10 set %unoci on }
  if (+a && -a isin $1) && ($chan != %ca1) && ($chan != %ca2) && ($chan != %ca3) && ($chan != %ca4) && ($chan != %ca5) && ($chan != %ca6) && ($chan != %ca7) && ($me == $2) && (%unoci == on) { set %unoci off | .timerpro 1 10 set %unoci on }
  if (+q && -q isin $1) && ($chan != %ca1) && ($chan != %ca2) && ($chan != %ca3) && ($chan != %ca4) && ($chan != %ca5) && ($chan != %ca6) && ($chan != %ca7) && ($me == $2) && (%unoci == on) { set %unoci off | .timerown 1 10 set %unoci on }
  if (+o && -o isin $1) && ($chan != %ca1) && ($chan != %ca2) && ($chan != %ca3) && ($chan != %ca4) && ($chan != %ca5) && ($chan != %ca6) && ($chan != %ca7) && ($me == $2) && (%unoci == on) && (%ck14 == off) { set %unoci off | .timerope 1 10 set %unoci on } 
  if (+o && -o isin $1) && ($chan != %ca1) && ($chan != %ca2) && ($chan != %ca3) && ($chan != %ca4) && ($chan != %ca5) && ($chan != %ca6) && ($chan != %ca7) && ($me == $2) && (%unoci == on) && (%ck14 == on) { set %unoci off | set %ck14 off | .timerope 1 10 set %unoci on | .timerprd 1 10 set %ck14 on }
  if (+o && -o isin $1) && ($chan != %ca1) && ($chan != %ca2) && ($chan != %ca3) && ($chan != %ca4) && ($chan != %ca5) && ($chan != %ca6) && ($chan != %ca7) && ($me == $2) && (%unoci == off) && (%ck14 == on) { set %ck14 off | .timerprd 1 10 set %ck14 on }
  if (+h && -h isin $1) && ($chan != %ca1) && ($chan != %ca2) && ($chan != %ca3) && ($chan != %ca4) && ($chan != %ca5) && ($chan != %ca6) && ($chan != %ca7) && ($me == $2) && (%unoci == on) && (%ck14 == on) { set %unoci off | set %ck14 off | .timerope 1 10 set %unoci on | .timerprd 1 10 set %ck14 on }
  if (+h && -h isin $1) && ($chan != %ca1) && ($chan != %ca2) && ($chan != %ca3) && ($chan != %ca4) && ($chan != %ca5) && ($chan != %ca6) && ($chan != %ca7) && ($me == $2) && (%unoci == off) && (%ck14 == on) { set %ck14 off | .timerprd 1 10 set %ck14 on }
  if (+q && -q isin $1) && ($chan != %ca1) && ($chan != %ca2) && ($chan != %ca3) && ($chan != %ca4) && ($chan != %ca5) && ($chan != %ca6) && ($chan != %ca7) && ($me == $2) && (%unoci == on) && (%ck14 == on) { set %unoci off | set %ck14 off | .timerope 1 10 set %unoci on | .timerprd 1 10 set %ck14 on }
  if (+q && -q isin $1) && ($chan != %ca1) && ($chan != %ca2) && ($chan != %ca3) && ($chan != %ca4) && ($chan != %ca5) && ($chan != %ca6) && ($chan != %ca7) && ($me == $2) && (%unoci == off) && (%ck14 == on) { set %ck14 off | .timerprd 1 10 set %ck14 on }
  if (+a && -a isin $1) && ($chan != %ca1) && ($chan != %ca2) && ($chan != %ca3) && ($chan != %ca4) && ($chan != %ca5) && ($chan != %ca6) && ($chan != %ca7) && ($me == $2) && (%unoci == on) && (%ck14 == on) { set %unoci off | set %ck14 off | .timerope 1 10 set %unoci on | .timerprd 1 10 set %ck14 on }
  if (+a && -a isin $1) && ($chan != %ca1) && ($chan != %ca2) && ($chan != %ca3) && ($chan != %ca4) && ($chan != %ca5) && ($chan != %ca6) && ($chan != %ca7) && ($me == $2) && (%unoci == off) && (%ck14 == on) { set %ck14 off | .timerprd 1 10 set %ck14 on }
  if (%ck14 == on) && (%ck24 == on) && (-e isin $1) && (%ck21 == on) && ($chan != %ca1) && ($chan != %ca2) && ($chan != %ca3) && ($chan != %ca4) && ($chan != %ca5) && ($chan != %ca6) && ($chan != %ca7) && ($me isop $chan) { /mode # +e $me }
  if (%ck14 == on) && (%ck24 == on) && (-e isin $1) && (%ck13 == on) && ($chan != %ca1) && ($chan != %ca2) && ($chan != %ca3) && ($chan != %ca4) && ($chan != %ca5) && ($chan != %ca6) && ($chan != %ca7) && ($me isop $chan) { /mode $chan +e $mask($ial($me,1),2) }
  if (%ck14 == on) && (%ck24 == on) && (-e isin $1) && (%ck22 == on) && ($me isop $chan) && ($chan != %ca1) && ($chan != %ca2) && ($chan != %ca3) && ($chan != %ca4) && ($chan != %ca5) && ($chan != %ca6) && ($chan != %ca7)  { /mode $chan +e $mask($ial($me,1),3) }
  if (%ck14 == on) && (%ck24 == on) && (-I isin $1) && (%ck21 == on) && ($me isop $chan) && ($chan != %ca1) && ($chan != %ca2) && ($chan != %ca3) && ($chan != %ca4) && ($chan != %ca5) && ($chan != %ca6) && ($chan != %ca7)  { /mode # +I $me }
  if (%ck14 == on) && (%ck24 == on) && (-I isin $1) && (%ck13 == on) && ($me isop $chan) && ($chan != %ca1) && ($chan != %ca2) && ($chan != %ca3) && ($chan != %ca4) && ($chan != %ca5) && ($chan != %ca6) && ($chan != %ca7)  { /mode $chan +I $mask($ial($me,1),2) }
  if (%ck14 == on) && (%ck24 == on) && (-I isin $1) && (%ck22 == on) && ($me isop $chan) && ($chan != %ca1) && ($chan != %ca2) && ($chan != %ca3) && ($chan != %ca4) && ($chan != %ca5) && ($chan != %ca6) && ($chan != %ca7)  { /mode $chan +I $mask($ial($me,1),3) }
  if (%ck14 == on) && (%ck24 == on) && (+i isincs $1) && (%ck21 == on) && ($me isop $chan) && ($chan != %ca1) && ($chan != %ca2) && ($chan != %ca3) && ($chan != %ca4) && ($chan != %ca5) && ($chan != %ca6) && ($chan != %ca7)  { /mode # +I $me }
  if (%ck14 == on) && (%ck24 == on) && (+i isincs $1) && (%ck13 == on) && ($me isop $chan) && ($chan != %ca1) && ($chan != %ca2) && ($chan != %ca3) && ($chan != %ca4) && ($chan != %ca5) && ($chan != %ca6) && ($chan != %ca7)  { /mode $chan +I $mask($ial($me,1),2) }
  if (%ck14 == on) && (%ck24 == on) && (+i isincs $1) && (%ck22 == on) && ($me isop $chan) && ($chan != %ca1) && ($chan != %ca2) && ($chan != %ca3) && ($chan != %ca4) && ($chan != %ca5) && ($chan != %ca6) && ($chan != %ca7)  { /mode $chan +I $mask($ial($me,1),3) }
  if (+b isin $1) && ($address($me,6) == $2) && ($me isop $chan) && ($nick ison $chan) &&  ($nick != ChanServ) && (%ck11 == on) && (%ck14 == on) { cs unban $chan $me }
  if (+b isin $1) && ($address($me,6) == $2) && ($chan != %ca1) && ($chan != %ca2) && ($chan != %ca3) && ($chan != %ca4) && ($chan != %ca5) && ($chan != %ca6) && ($chan != %ca7) && ($me isop $chan) && ($nick ison $chan) && ($nick != ChanServ) && (%ck8 == on) && (%ck14 == on) { /cs dehalfop # $nick | /cs deop # $nick | /cs DEPROTECT # $nick | /cs DeOwner # $nick | /cs Devoice # $nick } 
  if (+b isin $1) && ($address($me,6) == $2) && ($chan != %ca1) && ($chan != %ca2) && ($chan != %ca3) && ($chan != %ca4) && ($chan != %ca5) && ($chan != %ca6) && ($chan != %ca7) && ($me isop $chan) && ($nick ison $chan) && ($nick != ChanServ) && (%ck9 == on) && (%ck14 == on) { if (%unome == 1) { mode $chan -Q | mode $chan -Q | kick # $nick ¦bAn protection By Serpe®¦ } | else { mode $chan -Q | mode $chan -Q | kick # $nick } }
  if (+b isin $1) && ($address($me,6) == $2) && ($chan != %ca1) && ($chan != %ca2) && ($chan != %ca3) && ($chan != %ca4) && ($chan != %ca5) && ($chan != %ca6) && ($chan != %ca7) && ($me isop $chan) && ($nick ison $chan) && ($nick != ChanServ) && (%ck10 == on) && (%ck14 == on) { /ban # $nick }
  if (+b isin $1) && ($address($me,6) == $2) && ($chan != %ca1) && ($chan != %ca2) && ($chan != %ca3) && ($chan != %ca4) && ($chan != %ca5) && ($chan != %ca6) && ($chan != %ca7) && ($me isop $chan) && ($nick ison $chan) && ($nick != ChanServ) && (%ck12 == on) && (%ck14 == on) { /cs akick # add $nick }
  if (+b isin $1) && ($address($me,6) == $2) && ($chan != %ca1) && ($chan != %ca2) && ($chan != %ca3) && ($chan != %ca4) && ($chan != %ca5) && ($chan != %ca6) && ($chan != %ca7) && ($me isop $chan) && ($nick ison $chan) && ($nick != ChanServ) && (%ck17 == on) && (%ck14 == on) { /cs access # del $nick }
  if (+b isin $1) && ($address($me,6) == $2) && ($chan != %ca1) && ($chan != %ca2) && ($chan != %ca3) && ($chan != %ca4) && ($chan != %ca5) && ($chan != %ca6) && ($chan != %ca7) && ($me isop $chan) && ($nick ison $chan) && (%ck14 == on) { echo 9 -a $timestamp - $nick -  con mask - $address - ti ha bAnnatO su - $chan - 4¦bAn pROtectIOn By Serpe®¦ }
  if (+b isin $1) && ($address($me,6) == $2) && ($chan != %ca1) && ($chan != %ca2) && ($chan != %ca3) && ($chan != %ca4) && ($chan != %ca5) && ($chan != %ca6) && ($chan != %ca7) && ($me isop $chan) && ($nick ison $chan) && ($nick != ChanServ) && (%ck20 == on) && (%ck14 == on) { /mode # -e $nick | /mode $chan -e $mask($ial($nick,1),2) | /mode $chan -e $mask($ial($nick,1),3) | /mode $chan -e $address($nick,1) }
  if (+b isin $1) && ($address($me,6) == $2) && ($chan != %ca1) && ($chan != %ca2) && ($chan != %ca3) && ($chan != %ca4) && ($chan != %ca5) && ($chan != %ca6) && ($chan != %ca7) && ($me isop $chan) && ($nick ison $chan) && ($nick != ChanServ) && (%ck23 == on) && (%ck14 == on) { /mode $chan -I $mask($ial($nick,1),3) | /mode # -I $nick | mode $chan -I $mask($ial($nick,1),2) | /mode $chan -I $address($nick,1) }
  if ($2 == $me) && (-o isin $1) && ($chan != %ca1) && ($chan != %ca2) && ($chan != %ca3) && ($chan != %ca4) && ($chan != %ca5) && ($chan != %ca6) && ($chan != %ca7) && (%ck14 == on) && ($nick != ChanServ) && ($nick != $me) && (%ck1 == on) { /cs op # $me | if (%unome == 1) msg $chan 3 $nick 0Come osi dEgRaDaRmi 4¦dEOp pROtectIOn By Serpe®¦ 
    if (%ck2 == on) { /cs dehalfop # $nick | /cs deop # $nick | /cs DEPROTECT # $nick | /cs DeOwner # $nick | /cs Devoice # $nick } 
    if (%ck3 == on) { if (%unome == 1) { .timer1 1 1 mode $chan -Q | .timer2 1 1 mode $chan -Q | .timer3 1 1 /kick # $nick ¦dEOp pROtectIOn By Serpe®¦ } | else { .timer1 1 1 mode $chan -Q | .timer2 1 1 mode $chan -Q | .timer3 1 1 /kick # $nick } }
    if (%ck4 == on)  { .timer 1 1 /ban -k # $nick 2 }
    { echo 9 -a $timestamp - $nick -  con mask - $address - ti ha degradato su - $chan - 4¦dEOp pROtectIOn By Serpe®¦ }
    if (%ck15 == on) { /cs access # del $nick }
    if (%ck20 == on) { .timer 1 1 /mode # -e $nick | .timer 1 1 /mode $chan -e $mask($ial($nick,1),2) | .timer 1 1 /mode $chan -e $mask($ial($nick,1),3) | .timer 1 1 /mode $chan -e $address($nick,1) }
    if (%ck23 == on) { .timer 1 1 /mode $chan -I $mask($ial($nick,1),3) | .timer 1 1 /mode # -I $nick | .timer 1 1 /mode $chan -I $mask($ial($nick,1),2) | .timer 1 1 /mode $chan -I $address($nick,1) }   
    if ($chan == %ca1) && (%f1 == on) && (%fatt == on) { halt }
  }
  if ($2 == $me) && (-h isin $1) && ($chan != %ca1) && ($chan != %ca2) && ($chan != %ca3) && ($chan != %ca4) && ($chan != %ca5) && ($chan != %ca6) && ($chan != %ca7) && (%ck14 == on) && ($nick != ChanServ) && ($nick != $me) && (%ck1 == on) { /mode # +h $me | if (%unome == 1) msg $chan 3 $nick 0Come osi dEgRaDaRmi 4¦dEOp pROtectIOn By Serpe®¦ 
    if (%ck2 == on) { /mode # -h $nick | /mode # -o $nick | /mode # -a $nick | /mode # -q $nick | /mode # -v $nick } 
    if (%ck3 == on) { if (%unome == 1) { .timer1 1 1 mode $chan -Q | .timer2 1 1 mode $chan -Q | .timer3 1 1 /kick # $nick ¦dEOp pROtectIOn By Serpe®¦ } | else { .timer1 1 1 mode $chan -Q | .timer2 1 1 mode $chan -Q | .timer3 1 1 /kick # $nick } }
    if (%ck4 == on)  { .timer 1 1 /ban -k # $nick 2 }
    { echo 9 -a $timestamp - $nick -  con mask - $address - ti ha degradato su - $chan - 4¦dEOp pROtectIOn By Serpe®¦ }
    if (%ck15 == on) { /cs access # del $nick }
    if (%ck20 == on) { .timer 1 1 /mode # -e $nick | .timer 1 1 /mode $chan -e $mask($ial($nick,1),2) | .timer 1 1 /mode $chan -e $mask($ial($nick,1),3) | .timer 1 1 /mode $chan -e $address($nick,1) }
    if (%ck23 == on) { .timer 1 1 /mode $chan -I $mask($ial($nick,1),3) | .timer 1 1 /mode # -I $nick | .timer 1 1 /mode $chan -I $mask($ial($nick,1),2) | .timer 1 1 /mode $chan -I $address($nick,1) }   
    if ($chan == %ca1) && (%f1 == on) && (%fatt == on) { halt }
  }
  if ($2 == $me) && ($1 == -a) && ($chan != %ca1) && ($chan != %ca2) && ($chan != %ca3) && ($chan != %ca4) && ($chan != %ca5) && ($chan != %ca6) && ($chan != %ca7) && (%ck14 == on) && ($nick != ChanServ) && ($nick != $me) && (%ck1 == on) { /cs halfop # $me | if (%unome == 1) msg $chan 3 $nick 0Come osi dEgRaDaRmi 4¦dEOp pROtectIOn By Serpe®¦ 
    if (%ck2 == on) { /cs dehalfop # $nick | /cs deop # $nick | /cs DEPROTECT # $nick | /cs DeOwner # $nick | /cs Devoice # $nick } 
    if (%ck3 == on) { if (%unome == 1) { .timer1 1 1 mode $chan -Q | .timer2 1 1 mode $chan -Q | .timer3 1 1 /kick # $nick ¦dEOp pROtectIOn By Serpe®¦ } | else { .timer1 1 1 mode $chan -Q | .timer2 1 1 mode $chan -Q | .timer3 1 1 /kick # $nick } }
    if (%ck4 == on)  { .timer 1 1 /ban -k # $nick 2 }
    { echo 9 -a $timestamp - $nick -  con mask - $address - ti ha degradato su - $chan - 4¦dEOp pROtectIOn By Serpe®¦ }
    if (%ck15 == on) { /cs access # del $nick }
    if (%ck20 == on) { .timer 1 1 /mode # -e $nick | .timer 1 1 /mode $chan -e $mask($ial($nick,1),2) | .timer 1 1 /mode $chan -e $mask($ial($nick,1),3) | .timer 1 1 /mode $chan -e $address($nick,1) }
    if (%ck23 == on) { .timer 1 1 /mode $chan -I $mask($ial($nick,1),3) | .timer 1 1 /mode # -I $nick | .timer 1 1 /mode $chan -I $mask($ial($nick,1),2) | .timer 1 1 /mode $chan -I $address($nick,1) }   
    if ($chan == %ca1) && (%f1 == on) && (%fatt == on) { halt }
  }
  if ($2 == $me) && ($1 == -q) && ($chan != %ca1) && ($chan != %ca2) && ($chan != %ca3) && ($chan != %ca4) && ($chan != %ca5) && ($chan != %ca6) && ($chan != %ca7) && (%ck14 == on) && ($nick != ChanServ) && ($nick != $me) && (%ck1 == on) { /cs halfop # $me | if (%unome == 1) msg $chan 3 $nick 0Come osi dEgRaDaRmi 4¦dEOp pROtectIOn By Serpe®¦ 
    if (%ck2 == on) { /cs dehalfop # $nick | /cs deop # $nick | /cs DEPROTECT # $nick | /cs DeOwner # $nick | /cs Devoice # $nick } 
    if (%ck3 == on) { if (%unome == 1) { .timer1 1 1 mode $chan -Q | .timer2 1 1 mode $chan -Q | .timer3 1 1 /kick # $nick ¦dEOp pROtectIOn By Serpe®¦ } | else { .timer1 1 1 mode $chan -Q | .timer2 1 1 mode $chan -Q | .timer3 1 1 /kick # $nick } }
    if (%ck4 == on)  { .timer 1 1 /ban -k # $nick 2 }
    { echo 9 -a $timestamp - $nick -  con mask - $address - ti ha degradato su - $chan - 4¦dEOp pROtectIOn By Serpe®¦ }
    if (%ck15 == on) { /cs access # del $nick }
    if (%ck20 == on) { .timer 1 1 /mode # -e $nick | .timer 1 1 /mode $chan -e $mask($ial($nick,1),2) | .timer 1 1 /mode $chan -e $mask($ial($nick,1),3) | .timer 1 1 /mode $chan -e $address($nick,1) }
    if (%ck23 == on) { .timer 1 1 /mode $chan -I $mask($ial($nick,1),3) | .timer 1 1 /mode # -I $nick | .timer 1 1 /mode $chan -I $mask($ial($nick,1),2) | .timer 1 1 /mode $chan -I $address($nick,1) }   
    if ($chan == %ca1) && (%f1 == on) && (%fatt == on) { halt }
  }
  elseif (%ck14 == off) { return }
}
on *:dialog:smemo:edit:*:{
  if ($did == 1) {
    if (!$regex(%addcom,/[#$&^;]/)) {
      _setvar smemo.to $did(1).text
      did -e $dname 5,6,10
      recip_count  
    }
  }
  if ($did = 3) && (%smemo.to) {
    if (!$regex(%addcom,/[#$&^;]/)) { 
      hadd smemo cc $did(3)
      recip_count
    }
  }
  if ($did == 6) {
    did -e $dname 12
    set -u0 %smemo1 $did(6,1).text $+ $did(6,2).text $+ $did(6,3).text $+ $did(6,4).text $+ $did(6,5).text $+ $did(6,6).text
    if ($len(%smemo1) > 255) {
      did -ra $dname 10 MAX
      beep 1 1
    }
    else { %smemo = %smemo1 }
    $iif(%smemo == $null,did -ra $dname 10 0,did -ra $dname 10 $len(%smemo))
  }
}
