:format system
:module
:help.m
alias set.ctcp {
	fset format_ctcp $0-
	fset format_ctcp_cloak $0-                               
	fset format_ctcp_cloak_func $0-
	fset format_ctcp_cloak_func_user $0-
	fset format_ctcp_cloak_unknown $0-
	fset format_ctcp_cloak_unknown_user $0-
	fset format_ctcp_cloak_user $0-
	fset format_ctcp_func $0-
	fset format_ctcp_func_user $0-
	fset format_ctcp_unknown $0-
	fset format_ctcp_unknown_user $0-
	fset format_ctcp_user $0-
        ^restub set.ctcp format.m
}
alias stat.update {
	^wset * status_format $status_format  
	^wset * status_format1 $status_format1
	^wset * status_umode $status_umode
	^wset * status_format2 $status_format2
	^wset * status_lag $status_lag
	^wset * status_channel $status_channel
	^wset * status_mode $status_mode
	^wset * status_chanop $status_chanop  
	^wset * status_format3 $status_format3
	^wset * status_mail $status_mail  
	^wset * status_users $status_users  
	^wset * status_server $status_server
	^wset * status_voice $status_voice  
	^wset * status_away $status_away    
	^wset * status_notify $status_notify
	^wset * input_prompt $input_prompt
	^wset * status_hold_lines $status_hold_lines
	^wset * status_query $status_query
	^wset * status_format3 $status_format3
	^wset * status_clock $status_clock
	^wset * status_nick $status_nick
        ^restub stat.update format.m
}
alias npmt {
	return $(c4)[$(c3)$[-2]i$(c4)]$(c3)
        ^restub npmt format.m
}
eval addhelp format&format $(c4)[$(c3)type$(c4)] [$(c3)value$(c4)]&sets over 350 script formats.
alias format {
	if ([$0]) {
		switch ($0) {
			(ab) {
				^alias showformat { xecho -b $fparse(format_autobot #bitchx Pheret) }
				^alias showformat2 { xecho -b $npmt() $fparse(format_autobot #bitchx Pheret) }
				_formshit abot $1-
				xecho -c $fparse(format_usage format $0 $(c4)[$(c3)num$(c4)]$(cl))
			}						
			(ac) {
				^alias showformat { xecho -b $fparse(format_action $time() myn #bitchx likes to hump boy ass.) }
				^alias showformat2 { xecho -b $npmt() $fparse(format_action $time() myn #bitchx #bitchx likes to hump boy ass.) }
				_formshit action $1-
				xecho -c $fparse(format_usage format $0 $(c4)[$(c3)num$(c4)]$(cl))
			}
			(aw) {
				^alias showformat { xecho -b $fparse(format_send_action $time() daedo #bitchx is away.. not here $awayformat()) }
				^alias showformat2 { xecho -b $npmt() $fparse(format_send_action $time() daedo  #bitchx is away.. not here $awayformat()) }
				_formshit away $1-
				xecho -c $fparse(format_usage format $0 $(c4)[$(c3)num$(c4)]$(cl))
			}
			(bx) {
				^alias showformat {
					xecho -c $fparse(format_header title)
					xecho -c $fparse(format_midbar args)
					xecho -c $fparse(format_footer title)
				}
				^alias showformat2 {
					xecho -c $npmt() 
					xecho -c $fparse(format_header title)
					xecho -c $fparse(format_midbar args)
					xecho -c $fparse(format_footer title)
				}
				_formshit boxes $1-
				xecho -c $fparse(format_usage format $0 $(c4)[$(c3)num$(c4)]$(cl))
			}
			(cd) {
				^alias showformat {
					xecho -b $fparse(format_cdcc_prepack NOTICE daedo daedo 1 1 1 0 10 0 30282500 0 0 60565)
					xecho -b $fparse(format_cdcc_pack NOTICE daedo 1 1 60565 500 core01a by daedo)
					xecho -b $fparse(format_cdcc_note NOTICE daedo leet fucking script)
					xecho -b $fparse(format_cdcc_postpack NOTICE daedo daedo 1 1 1 0 10 0 30282500 0 0 60565)
				}
				^alias showformat2 {
					xecho -b $npmt() $fparse(format_cdcc_prepack NOTICE daedo daedo 1 1 1 0 10 0 30282500 0 0 60565)
					xecho -b      $fparse(format_cdcc_pack NOTICE daedo 1 1 60565 500 core01a by daedo)
					xecho -b      $fparse(format_cdcc_note NOTICE daedo leet fucking script)
					xecho -b      $fparse(format_cdcc_postpack NOTICE daedo daedo 1 1 1 0 10 0 30282500 0 0 60565)
					xecho -b  
				}
				_formshit cdcc $1-
				xecho -c $fparse(format_usage format $0 $(c4)[$(c3)num$(c4)]$(cl))
			}				
			(cl) {
				^alias showformat { xecho -b $(c4)Ä$(c2)Ä$(c1)Ä $(c2)join$(c4)\($(c3)#bitchx$(c4))$(c3) daedo..$(c2)$sar(/@/$(c1)@$(c2)/$sar(g/./$(c1).$(c2)/nate@buxton.ime.net)) }
				^alias showformat2 { xecho -b $npmt() $(c4)Ä$(c2)Ä$(c1)Ä $(c2)join$(c4)\($(c3)#bitchx$(c4))$(c3) daedo..$(c2)$sar(/@/$(c1)@$(c2)/$sar(g/./$(c1).$(c2)/nate@buxton.ime.net)) }
				_formshit colors $1-
				xecho -c $fparse(format_usage format $0 $(c4)[$(c3)num$(c4)]$(cl))
			}
			(ct) {
				^alias showformat { xecho -b $fparse(format_ctcp $time() daedo nate@buxton.ime.net #bitchx VERSION ) }
				^alias showformat2 { xecho -b $npmt() $fparse(format_ctcp $time() daedo nate@buxton.ime.net #bitchx VERSION ) }
				_formshit ctcp $1-
				xecho -c $fparse(format_usage format $0 $(c4)[$(c3)num$(c4)]$(cl))
			}
			(cr) {
				^alias showformat { xecho -b $fparse(format_ctcp_reply $time() daedo nate@buxton.ime.net PING 0.566 seconds) }
				^alias showformat2 { xecho -b $npmt() $fparse(format_ctcp_reply $time() daedo nate@buxton.ime.net PING 0.566 seconds) } 
				_formshit ctcpr $1-
				xecho -c $fparse(format_usage format $0 $(c4)[$(c3)num$(c4)]$(cl))
			}
			(dc) {
				^alias showformat { xecho -b $fparse(format_dcc_request $time() SEND core01a.tar.gz daedo nate@buxton.ime.net 127.0.0.1 1234 k 59.1) }
				^alias showformat2 { xecho -b $npmt() $fparse(format_dcc_request $time() SEND core01a.tar.gz daedo nate@buxton.ime.net 127.0.0.1 1234 k 59.1) }				
				_formshit dcc $1-
				xecho -c $fparse(format_usage format $0 $(c4)[$(c3)num$(c4)]$(cl))
			}
			(es) {
				@ G_ = G
				^alias showformat { xecho -c $G_ $G }
				^alias showformat2 { xecho -c $G_ $npmt() $G }
				_formshit estring $1-
				xecho -c $fparse(format_usage format $0 $(c4)[$(c3)num$(c4)]$(cl))
			}
			(jn) {
				^alias showformat { xecho -b $fparse(format_join $time() daedo nate@buxton.ime.net #bitchx) }
				^alias showformat2 { xecho -b $npmt() $fparse(format_join $time() daedo nate@buxton.ime.net #bitchx) }
				_formshit join $1-
				xecho -c $fparse(format_usage format $0 $(c4)[$(c3)num$(c4)]$(cl))
			}
			(ki) {
				^alias showformat { xecho -b $fparse(format_kick time() daedo #bitchx panasync you own me) }
				^alias showformat2 { xecho -b $npmt() $fparse(format_kick time() daedo #bitchx panasync you own me) }		
				_formshit kick $1-
				xecho -c $fparse(format_usage format $0 $(c4)[$(c3)num$(c4)]$(cl))
			}
			(kl) {
				^alias showformat { xecho -b $fparse(format_server_notice_kill_local time() panasync daedo!nate@buxton.ime.net lick my sack.) }
				^alias showformat2 { xecho -b $npmt() $fparse(format_server_notice_kill_local time() panasync daedo!nate@buxton.ime.net lick my sack.) }
				_formshit kill $1-
				xecho -c $fparse(format_usage format $0 $(c4)[$(c3)num$(c4)]$(cl))
			}
			(ks) {
				^alias showformat { 
					xecho -b $kstr 
					xecho -b $kbstr
				}
				^alias showformat2 {
					xecho -b $npmt() $kstr 
					xecho -b      $kbstr
				}
				_formshit kstring $1-
				xecho -c $fparse(format_usage format $0 $(c4)[$(c3)num$(c4)]$(cl))
			}
			(md) {
				^alias showformat { xecho -b $fparse(format_mode_channel $time() daedo nate@buxton.ime.net #bitchx +o panasync) }
				^alias showformat2 { xecho -b $npmt() $fparse(format_mode_channel $time() daedo nate@buxton.ime.net #bitchx +o panasync) } 
				_formshit mode $1-
				xecho -c $fparse(format_usage format $0 $(c4)[$(c3)num$(c4)]$(cl))
			}
			(ms) {
				^alias showformat { xecho -b $fparse(format_msg $time() daedo nate@buxton.ime.net hi there) }
				^alias showformat2 { xecho -b $npmt() $fparse(format_msg $time() daedo nate@buxton.ime.net hi there) }
				_formshit msg $1-
				xecho -c $fparse(format_usage format $0 $(c4)[$(c3)num$(c4)]$(cl))
			}
			(nc) {
				^alias showformat { xecho -b $fparse(format_nick_comp $N hi there) }
				^alias showformat2 { xecho -b $npmt() $fparse(format_nick_comp $N hi there) }
				_formshit ncomp $1-
				xecho -c $fparse(format_usage format $0 $(c4)[$(c3)num$(c4)]$(cl))
			}
			(nk) {
				^alias showformat { xecho -b $fparse(format_nickname $time() daedo #bitchx daedo_) }
				^alias showformat2 { xecho -b $npmt() $fparse(format_nickname $time() daedo #bitchx daedo_) }
				_formshit nick $1-
				xecho -c $fparse(format_usage format $0 $(c4)[$(c3)num$(c4)]$(cl))
			}
			(no) {
				^alias showformat { xecho -b $fparse(format_notice $time() daedo nate@buxton.ime.net hi there) }
				^alias showformat2 { xecho -b $npmt() $fparse(format_notice $time() daedo nate@buxton.ime.net hi there) }
				_formshit notice $1-
				xecho -c $fparse(format_usage format $0 $(c4)[$(c3)num$(c4)]$(cl))
			}
			(pt) {
				^alias showformat { xecho -b $fparse(format_leave $time() daedo nate@buxton.ime.net #bitchx) }
				^alias showformat2 { xecho -b $npmt() $fparse(format_leave $time() daedo nate@buxton.ime.net #bitchx) }
				_formshit part $1-
				xecho -c $fparse(format_usage format $0 $(c4)[$(c3)num$(c4)]$(cl))
			}
			(pu) {
				^alias showformat { xecho -b $fparse(format_public $time() daedo #bitchx hi there) }
				^alias showformat2 { xecho -b $npmt() $fparse(format_public $time() daedo #bitchx hi there) }
				_formshit pub $1-
				xecho -c $fparse(format_usage format $0 $(c4)[$(c3)num$(c4)]$(cl))
			}
			(qs) {
				^alias showformat { xecho -b $qstr }
				^alias showformat2 { xecho -b $npmt() $qstr }
				_formshit qstring $1-
				xecho -c $fparse(format_usage format $0 $(c4)[$(c3)num$(c4)]$(cl))
			}
			(qt) {
				^alias showformat { xecho -b $fparse(format_channel_signoff $time() daedo nate@buxton.ime.net #bitchx $qstr bubye!@#) }
				^alias showformat2 { xecho -b $npmt() $fparse(format_channel_signoff $time() daedo nate@buxton.ime.net #bitchx $qstr bubye!@#) }
				_formshit quit $1-
				xecho -c $fparse(format_usage format $0 $(c4)[$(c3)num$(c4)]$(cl))
			}
			(sa) {
				^alias showformat { xecho -b $fparse(format_send_action $time() daedo #bitchx lubs you!@#) }
				^alias showformat2 { xecho -b $npmt() $fparse(format_send_action $time() daedo #bitchx lubs you!@#) }
				_formshit saction $1-
				xecho -c $fparse(format_usage format $0 $(c4)[$(c3)num$(c4)]$(cl))
			}
			(sb) { 
				^alias showformat {
					xecho -c $fparse(format_status_format1) 
					xecho -c $fparse(format_status_format2)
					xecho -c $fparse(format_input_prompt)
				}
				^alias showformat2 {
                                        xecho -c $npmt() $fparse(format_status_format1)
                                        xecho -c      $fparse(format_status_format2)
                                        xecho -c      $fparse(format_input_prompt) 
				}
				_formshit sbar $1-
				xecho -c $fparse(format_usage format $0 $(c4)[$(c3)num$(c4)]$(cl))
			}
			(sc) {	
				^alias showformat {
					if (fparse(format_scan_header1) != [format_scan_header1]) { xecho -c $fparse(format_scan_header1 #bitchx 10 20 30 40 50) }
					if (fparse(format_scan_header2) != [format_scan_header2]) { xecho -c $fparse(format_scan_header2 #bitchx 10 20 30 40 50) }
					xecho -c $fparse(format_scan_users @panasync @[Nuke] @void +lindex daedo)
					if (fparse(format_scan_footer1) != [format_scan_footer1]) { xecho -c $fparse(format_scan_footer1 #bitchx 10 20 30 40 50) }
					if (fparse(format_scan_footer2) != [format_scan_footer2]) { xecho -c $fparse(format_scan_footer2 #bitchx 10 20 30 40 50) }
				}
				^alias showformat2 {
					xecho -c $npmt()
					if (fparse(format_scan_header1) != [format_scan_header1]) { xecho -c $fparse(format_scan_header1 #bitchx 10 20 30 40 50) }
					if (fparse(format_scan_header2) != [format_scan_header2]) { xecho -c $fparse(format_scan_header2 #bitchx 10 20 30 40 50) }
					xecho -c $fparse(format_scan_users @panasync @[Nuke] @void +lindex daedo)
					if (fparse(format_scan_footer1) != [format_scan_footer1]) { xecho -c $fparse(format_scan_footer1 #bitchx 10 20 30 40 50) }
					if (fparse(format_scan_footer2) != [format_scan_footer2]) { xecho -c $fparse(format_scan_footer2 #bitchx 10 20 30 40 50) }
				}
				_formshit sc $1-
				xecho -c $fparse(format_usage format $0 $(c4)[$(c3)num$(c4)]$(cl))
			}
			(st) {
				^alias showformat { xecho -b $fparse(format_send_ctcp $time() daedo VERSION) }
				^alias showformat2 { xecho -b $npmt() $fparse(format_send_ctcp $time() daedo VERSION) }
				_formshit sctcp $1-
				xecho -c $fparse(format_usage format $0 $(c4)[$(c3)num$(c4)]$(cl))
			}
			(sd) {
				^alias showformat { xecho -b $fparse(format_send_dcc_chat $time() daedo CHAT) }
				^alias showformat2 { xecho -b $npmt() $fparse(format_send_dcc_chat $time() daedo CHAT) }
				_formshit sdcc $1-
				xecho -c $fparse(format_usage format $0 $(c4)[$(c3)num$(c4)]$(cl))
			}
			(sm) {
				^alias showformat { xecho -b $fparse(format_send_msg $time() daedo hi there) }
				^alias showformat2 { xecho -b $npmt() $fparse(format_send_msg $time() daedo hi there) }
				_formshit smsg $1-
				xecho -c $fparse(format_usage format $0 $(c4)[$(c3)num$(c4)]$(cl))
			}
			(sn) {
				^alias showformat { xecho -b $fparse(format_send_notice $time() daedo hi there) }
				^alias showformat2 { xecho -b $npmt() $fparse(format_send_notice $time() daedo hi there) } 
				_formshit snotice $1-
				xecho -c $fparse(format_usage format $0 $(c4)[$(c3)num$(c4)]$(cl))
			}
			(sp) {
				^alias showformat { xecho -b $fparse(format_send_public $time() #bitchx daedo hi there) }
				^alias showformat2 { xecho -b $npmt() $fparse(format_send_public $time() #bitchx daedo hi there) }
				_formshit spub $1-
				xecho -c $fparse(format_usage format $0 $(c4)[$(c3)num$(c4)]$(cl))
			}
			(sv) {
				^alias showformat { xecho -b $fparse(format_version $J $V $uname()) }
				^alias showformat2 { xecho -b $npmt() $fparse(format_version $J $V $uname()) }
				_formshit sv $1-
				xecho -c $fparse(format_usage format $0 $(c4)[$(c3)num$(c4)]$(cl))
			}
			(wa) {
				^alias showformat { xecho -b $fparse(format_bwall $time() #bitchx daedo daedo hi there) }
				^alias showformat2 { xecho -b $npmt() $fparse(format_bwall $time() #bitchx daedo daedo hi there) } 
				_formshit wall $1-
				xecho -c $fparse(format_usage format $0 $(c4)[$(c3)num$(c4)]$(cl))
			}
			(wi) {
				^alias showformat { 
					xecho -b $fparse(format_whois_header) 
					xecho -b $fparse(format_whois_nick daedo nate buxton.ime.net $country(buxton.ime.net))
					xecho -b $fparse(format_whois_name BitchX Baybee)
					xecho -b $fparse(format_whois_channels #bitchx #linux)
					xecho -b $fparse(format_whois_server irc.anet-stl.com (You only live twice))
					xecho -b $fparse(format_whois_footer)
				}
				^alias showformat2 {
					xecho -b $npmt() 
					xecho -b $fparse(format_whois_header) 
					xecho -b $fparse(format_whois_nick daedo nate buxton.ime.net $country(buxton.ime.net))
					xecho -b $fparse(format_whois_name BitchX Baybee)
					xecho -b $fparse(format_whois_channels #bitchx #linux)
					xecho -b $fparse(format_whois_server irc.anet-stl.com (You only live twice))
					xecho -b $fparse(format_whois_footer)
				}
				_formshit whois $1-
				xecho -c $fparse(format_usage format $0 $(c4)[$(c3)num$(c4)]$(cl))
			}
			(*) {
				xecho -b error: invalid format request
			}
		}
	}
	{
		xecho -c $fparse(format_header core formats)
		xecho -c $fparse(format_midbar $(c4)[$(c2)ab$(c4)]$(c3) autobot formats  $(c4)[$(c2)kl$(c4)]$(c3) kill formats     $(c4)[$(c2)sb$(c4)]$(c3) status bar)
		xecho -c $fparse(format_midbar $(c4)[$(c2)ac$(c4)]$(c3) action formats   $(c4)[$(c2)ks$(c4)]$(c3) kick strings     $(c4)[$(c2)sc$(c4)]$(c3) scan formats)
		xecho -c $fparse(format_midbar $(c4)[$(c2)aw$(c4)]$(c3) away formats     $(c4)[$(c2)md$(c4)]$(c3) mode formats     $(c4)[$(c2)sd$(c4)]$(c3) sent dcc formats)
		xecho -c $fparse(format_midbar $(c4)[$(c2)bx$(c4)]$(c3) box formats      $(c4)[$(c2)ms$(c4)]$(c3) msg formats      $(c4)[$(c2)sm$(c4)]$(c3) sent msg formats)
		xecho -c $fparse(format_midbar $(c4)[$(c2)cd$(c4)]$(c3) cdcc formats     $(c4)[$(c2)nc$(c4)]$(c3) nick completion  $(c4)[$(c2)sn$(c4)]$(c3) sent notice forms)
		xecho -c $fparse(format_midbar $(c4)[$(c2)cl$(c4)]$(c3) color formats    $(c4)[$(c2)nk$(c4)]$(c3) nick formats     $(c4)[$(c2)sp$(c4)]$(c3) sent public forms)
		xecho -c $fparse(format_midbar $(c4)[$(c2)ct$(c4)]$(c3) ctcp formats     $(c4)[$(c2)no$(c4)]$(c3) notice formats   $(c4)[$(c2)st$(c4)]$(c3) sent ctcp formats)
		xecho -c $fparse(format_midbar $(c4)[$(c2)cr$(c4)]$(c3) ctcp reply       $(c4)[$(c2)pt$(c4)]$(c3) part formats     $(c4)[$(c2)sv$(c4)]$(c3) version formats)
		xecho -c $fparse(format_midbar $(c4)[$(c2)dc$(c4)]$(c3) dcc formats      $(c4)[$(c2)pu$(c4)]$(c3) public formats   $(c4)[$(c2)wa$(c4)]$(c3) wall formats)
		xecho -c $fparse(format_midbar $(c4)[$(c2)es$(c4)]$(c3) echo strings     $(c4)[$(c2)qs$(c4)]$(c3) quit strings     $(c4)[$(c2)wi$(c4)]$(c3) whois formats)
		xecho -c $fparse(format_midbar $(c4)[$(c2)jn$(c4)]$(c3) join formats     $(c4)[$(c2)qt$(c4)]$(c3) quit formats)
		xecho -c $fparse(format_midbar $(c4)[$(c2)ki$(c4)]$(c3) kick formats     $(c4)[$(c2)sa$(c4)]$(c3) sent actions)
		xecho -c $fparse(format_footer core formats)
	}
        ^restub format format.m
}

alias _formshit {
	if ([$1]) {
		if (isdigit($1) && fexist($(formpath)$(0)/$(0)$(1))) {
			^load $(formpath)/$(0)/$(0)$(1)
			if ([$0] == [sbar]) { ^load $(formpath)sbar/sbardemo$(1) }
			@ $(0)form = [$1]
			loadformats
			xecho -b this is your new $(c2)$0$(c3) format:
			showformat
			xecho -b type /fsave to save.
		}
		{
			xecho -b error: invalid format request
		}
	}
	{
		for (@i=1,fexist($(formpath)$(0)/$(0)$(i)) == 1,@i++) {
			if ([$0] != [sbar]) { 
				^load $(formpath)$(0)/$(0)$(i) 
			}
			{
				^load $(formpath)sbar/sbardemo$(i)
			}			
			showformat2
		}
		if ([$0] != [sbar]) { ^load $(formpath)$(0)/$(0)$($(0)form) }
		xecho -b current $(c2)$0$(c3) format is set to $($(0)form)
	}
        ^restub _formshit format.m
}
eval addhelp rformat&rformat&randomly selects all formats.
alias rformat {
	fe ($glob($(formpath)*/)) frm {
		@ frmt = after(5 / $before(6 / $frm))
		^assign -i
		fe ($glob($(formpath)$(frmt)\/*)) form {
				@i++
		}
		if (frmt == [sbar]) {
			@ $(frmt)form = [${rand($i) / 2 + 1}]
		}
		{
			@ $(frmt)form = [${rand($i) + 1}]
		}
	}
	loadformats
	xecho -b type /fsave to save.
        ^restub rformat format.m
}