alias remlog {
	input " remove log? [y|n]: " if ([$0]==[y])
	{@unlink($twiddle($HOME)$(loadpath)$cyplog) 
	xecho -b $scriptname log removed.
}}
	
alias play readlog

alias readlog {
	more $twiddle($HOME)$(loadpath)$cyplog
	xecho -b type /remlog to remove log}


alias logm {
          if ([$0]==[]) {xecho -b cypress msg logging set to $(hwht)$toupper($msgl)}
          if ([$match($0 on off)]>[0]) {@msgl=[$0]
          xecho -b cypress msg logging set to $(hwht)$toupper($msgl)}{
	  if ([$0]!=[]&&[$match($0 on off)]==[0]) {xecho -b invalid choice}
    }}            

alias logp {
          if ([$0]==[]) {xecho -b cypress page logging set to $(hwht)$toupper($page)}
          if ([$match($0 on off)]>[0]) {@page=[$0]
          xecho -b cypress page logging set to $(hwht)$toupper($page)}{
	  if ([$0]!=[]&&[$match($0 on off)]==[0]) {xecho -b invalid choice}
    }}            

alias logc {
          if ([$0]==[]) {xecho -b cypress ctcp logging set to $(hwht)$toupper($ctcpl)}
          if ([$match($0 on off)]>[0]) {@ctcpl=[$0]
          xecho -b cypress ctcp logging set to $(hwht)$toupper($ctcpl)}{
	  if ([$0]!=[]&&[$match($0 on off)]==[0]) {xecho -b invalid choice}
    }}            

alias logd {
          if ([$0]==[]) {xecho -b cypress dcc logging set to $(hwht)$toupper($dccl)}
          if ([$match($0 on off)]>[0]) {@dccl=[$0]
          xecho -b cypress dcc logging set to $(hwht)$toupper($dccl)}{
	  if ([$0]!=[]&&[$match($0 on off)]==[0]) {xecho -b invalid choice}
    }}            

alias logn {
          if ([$0]==[]) {xecho -b cypress notice logging set to $(hwht)$toupper($notl)}
          if ([$match($0 on off)]>[0]) {@notl=[$0]
          xecho -b cypress notice logging set to $(hwht)$toupper($notl)}{
	  if ([$0]!=[]&&[$match($0 on off)]==[0]) {xecho -b invalid choice}
    }}            

alias logw {
          if ([$0]==[]) {xecho -b cypress wall logging set to $(hwht)$toupper($wlog)}
          if ([$match($0 on off)]>[0]) {@wlog=[$0]
          xecho -b cypress notice logging set to $(hwht)$toupper($wlog)}{
	  if ([$0]!=[]&&[$match($0 on off)]==[0]) {xecho -b invalid choice}
    }}            

alias logpub {
          if ([$0]==[]) {xecho -b cypress public logging set to $(hwht)$toupper($plog)}
          if ([$match($0 on off)]>[0]) {@plog=[$0]
          xecho -b cypress public logging set to $(hwht)$toupper($plog)}{
	  if ([$0]!=[]&&[$match($0 on off)]==[0]) {xecho -b invalid choice}
    }}            

  




on -public_other * if ([$awayl]==[ON]&&[$awaystat]==[1]&&[$match(*$N* $2-)]>=[1]&&[$plog]==[ON]) {
	@recvtime=[$strftime(%x at %I:%M:%S %p)]
	@savel = open($twiddle($HOME)$(loadpath)cyp.log W T)                              
        @write($savel PUBLIC $recvtime $(hblk)<$(hwht)$0$(hblk):$(cl)$1$(hblk)> $(cl)$2-) 
	@close($savel)}


on -public * if ([$awayl]==[ON]&&[$awaystat]==[1]&&[$match(*$N* $2-)]>=[1]&&[$plog]==[ON]) {
	@recvtime=[$strftime(%x at %I:%M:%S %p)]
	@savel = open($twiddle($HOME)$(loadpath)cyp.log W T)                              
        @write($savel PUBLIC $recvtime $(hblk)<$(hwht)$0$(hblk):$(cl)$1$(hblk)> $(cl)$2-) 
	@close($savel)}


on -ar_public * if ([$awayl]==[ON]&&[$awaystat]==[1]&&[$plog]==[ON]) {
	@recvtime=[$strftime(%x at %I:%M:%S %p)]
	@savel = open($twiddle($HOME)$(loadpath)cyp.log W T)                              
        @write($savel PUBLIC $recvtime $(hblk)<$(hwht)$0$(hblk):$(cl)$1$(hblk)> $(cl)$2-) 
	@close($savel)}

on -ar_public_other * if ([$awayl]==[ON]&&[$awaystat]==[1]&&[$plog]==[ON]) {
	@recvtime=[$strftime(%x at %I:%M:%S %p)]
	@savel = open($twiddle($HOME)$(loadpath)cyp.log W T)                              
        @write($savel PUBLIC $recvtime $(hblk)<$(hwht)$0$(hblk):$(cl)$1$(hblk)> $(cl)$2-) 
	@close($savel)}

on #-ctcp 2 " * " if ([$ctcpl]==[ON]&&[$awaystat]==[1]&&[$awayl]==[ON]) {
	@recvtime=[$strftime(%x at %I:%M:%S %p)]
	@savel = open($twiddle($HOME)$(loadpath)cyp.log W T)                              
	if ([$2]==[PAGE]&&[$toupper($page)]==[ON]) { 
		@write($savel PAGE $recvtime $(c1)$0 $(hblk)\($(c2)$userhost()$(hblk)\) $(cl)requested $(cl)$2 $(cl)$3- from $1)
        	^set BEEP ON
	        beep;beep;beep
	        xecho -b PAGE$(hblk):$(cyn) $recvtime $(cl)from $(cyn)$0$(hblk)[$(cyn)$msar(g@$(hblk)@$(cyn).$(hblk).$(cyn)$tr(///$userhost()))$(hblk)]$(cl) $3-
	}{
        @write($savel CTCP $recvtime $(c1)$0 $(hblk)\($(c2)$userhost()$(hblk)\) $(cl)requested $(cl)$2 $(cl)$3- from $1) 
	@close($savel)}}

on #-msg 4 " * " if ([$msgl]==[ON]&&[$awaystat]==[1]&&[$awayl]==[ON]) {
	@recvtime=[$strftime(%x at %I:%M:%S %p)]
	@savel = open($twiddle($HOME)$(loadpath)cyp.log W T)
	@write($savel MSG $recvtime $(c1)$0 $(hblk)\($(c2)$userhost()$(hblk)\) $(cl)$1-)
        @close($savel)}

on #-dcc_request 6 " * " if ([$dccl]==[ON]&&[$awaystat]==[1]&&[$awayl]==[ON]) {
	@recvtime=[$strftime(%x at %I:%M:%S %p)]
        @savel = open($twiddle($HOME)$(loadpath)cyp.log W T) 
        @write($savel DCC $recvtime $(c1)dcc $(hwht)$1 $(hwht)request from $0 $(hblk)[$(c2)$userhost()$(hblk)])
        @close($savel)}
on #-notice 3 " * " if ([$notl]==[ON]&&[$awaystat]==[1]&&[$awayl]==[ON]&&[$match(*[*#*]* $1-)]==[0]) {
	@recvtime=[$strftime(%x at %I:%M:%S %p)]
	@savel = open($twiddle($HOME)$(loadpath)cyp.log W T)
	@write($savel NOTICE $recvtime $(c1)$0 $(hblk)\($(c2)$userhost()$(hblk)\) $(cl)$1-) 
	@close($savel)}



on #-notice 4 "*[*#*]*" if ([$wlog]==[ON]&&[$awaystat]==[1]&&[$awayl]==[ON]) { 
	@recvtime=[$strftime(%x at %I:%M:%S %p)]
	@savel = open($twiddle($HOME)$(loadpath)cyp.log W T)
	@write($savel WALL $recvtime $0 $1 $2-) 
	@close($savel)}


