# default.src

# Default Command Shell for Synchronet Version 2.00a+

# $Id: default.src,v 1.8 2002/05/16 02:10:51 rswindell Exp $

# @format.tab-size 8, @format.use-tabs true

###############################################################################
# This shell is an imitation of the Version 1c command set/structure	      #
#									      #
# It also serves as an example of a complex command shell using the Baja      #
# command shell language						      #
#									      #
###############################################################################

# Tips:
#
#	Tabstops should be set to 8 to view/edit this file
#	If your editor does not support control characters,
#		use \1 for Ctrl-A codes
#	All lines starting with # are considered comments and are ignored
#	Left margins (indents) are not relevant and used only for clarity
#	Almost everything is not case sensitive with the exception of @-codes

################################# Begins Here #################################

!include sbbsdefs.inc

# Set return point for main menu commands (via end_cmd)
cmd_home

# Display TEXT\MENU\MAIN.* if not in expert mode
compare_user_misc UM_EXPERT
if_false
	cls
	menu main
	end_if

# Update node status
node_action node_main
async

inc_main_cmds

# Display main Prompt
print "-c\r\nþ bhMain ncþ h"
compare_ars exempt T
if_true
	print "@TUSED@"
else
	print "@TLEFT@"
	end_if
print " nc[h@GN@nc] @GRP@ [h@SN@nc] @SUB@: n"

# Get key (with / extended commands allowed)
compare_user_misc UM_COLDKEYS
if_false
	getkeye
else
	getstrupr 60
	endif

compare_ars RIP
if_true
	getlines
	end_if

# Do nothing for control keys and space
cmdkey ^@
	end_cmd
cmdkey ^M
	end_cmd
cmdkey ^S
	end_cmd
 cmdkey  "
	end_cmd

# Write command to log file
logkey_comma

# Hitting number changes current sub-board
cmdkey digit
	compare_user_misc UM_COLDKEYS
	if_false
		ungetkey
		end_if
	msg_get_sub_num
	end_cmd

# Hitting /number changes current group
cmdkey edigit
	compare_user_misc UM_COLDKEYS
	if_false
		ungetkey
	else
		shift_str 1
		end_if
	msg_get_grp_num
	end_cmd

# Show the key hit
compare_user_misc UM_COLDKEYS
if_false
	printkey
	endif

# Next sub-board
cmdkey >
	msg_subboard_up
	end_cmd
cmdkey }
	msg_subboard_up
	end_cmd
cmdkey +
	msg_subboard_up
	end_cmd
cmdkey =
	msg_subboard_up
	end_cmd

# Previous sub-board
cmdkey <
	msg_subboard_down
	end_cmd
cmdkey {
	msg_subboard_down
	end_cmd
cmdkey -
	msg_subboard_down
	end_cmd

# Next group
cmdkey ]
	msg_group_up
	end_cmd

# Previous group
cmdkey [
	msg_group_down
	end_cmd

# String commands start with a semicolon
cmdkey ;
	compare_user_misc UM_COLDKEYS
	if_true
		shift_str 1
	else
		getstrupr 40
		end_if
	exec_bin str_cmds
	end_cmd

cmdkey T
	chkfile "%zmenu/tmessage.*"
	if_true
		menu tmessage
		end_if
        call file_transfers
        end_cmd

compare_user_misc UM_COLDKEYS
if_false
	crlf
	end_if
pause_reset

# Menu
cmdkey ?
	compare_user_misc UM_expert
	if_true
		menu main
		end_if
	end_cmd

# Sysop Menu
compare_ars SYSOP or EXEMPT Q or I or N
if_true
	cmdkey !
		menu sysmain
		end_cmd
	end_if

# Commands

cmdkey A
	auto_message
	end_cmd

cmdkey B
	print "\r\nchBrowse/New Message Scan\r\n"
	msg_browse_scan
	end_cmd

cmdkey C
	exec_bin chat_sec
	end_cmd

cmdkey D
	user_defaults
	end_cmd

cmdkey E
	call E-mail
	end_cmd

cmdkey F
	print "\r\nchFind Text in Messages\r\n"
	msg_find_text
	end_cmd

cmdkey /F
	msg_find_text_all
	end_cmd

cmdkey G
	text_file_section
	end_cmd

cmdkey I
	call main_info
	end_cmd

cmdkey J
	msg_select_area
	end_cmd

cmdkey /L
	nodelist_all
	end_cmd

cmdkey M
	minute_bank
	end_cmd

cmdkey N
	print "\r\nchNew Message Scan\r\n"
	msg_new_scan
	end_cmd

cmdkey /N
	msg_new_scan_all
	end_cmd

cmdkey O
	file_download_batch
	if_true
		end_cmd
                end_if
	logoff
	end_cmd

cmdkey /O
	file_download_batch
	if_true
		end_cmd
                end_if
	logoff_fast
	end_cmd

cmdkey P
	msg_post
	end_cmd

cmdkey Q
	msg_qwk
	end_cmd

cmdkey R
	msg_read
	end_cmd

cmdkey S
	print "\r\nchScan for Messages Posted to You\r\n"
	msg_your_scan
	end_cmd

cmdkey /S
	msg_your_scan_all
	end_cmd

cmdkey U
	print "\r\nchList Users\r\n"
	mnemonics "\r\n~Logons Today, ~Sub-board, or ~All: "
	getcmd LSA\r

	cmdkey L
		userlist_logons
		end_cmd
	cmdkey S
		userlist_sub
		end_cmd
	cmdkey A
		userlist_all
		end_cmd

	# fall-through for CR, Ctrl-C, etc
	end_cmd

cmdkey /U
	userlist_all
	end_cmd

cmdkey X
	xtrn_section
	end_cmd

cmdkey Z
	print "\r\nchContinuous New Message Scan\r\n"
	msg_cont_scan
	end_cmd

cmdkey /Z
	msg_cont_scan_all
	end_cmd

cmdkey *
	msg_show_subboards
	end_cmd

cmdkey /*
	msg_show_groups
	end_cmd

cmdkey &
	call main_cfg
	end_cmd

cmdkey #
	print "\r\nchType the actual number, not the symbol.\r\n"
	end_cmd

cmdkey /#
	print "\r\nchType the actual number, not the symbol.\r\n"
        end_cmd

# fall through
print "\r\nchUnrecognized command."
compare_user_misc UM_expert
if_true
	print " Hit 'i?nch' for a menu."
	end_if
crlf
end_cmd

# shouldn't hit next line
print "Problem in command shell."
pause
hangup
return

############################### E-mail Section ################################

:e-mail
cmd_home
compare_user_misc UM_expert
if_false
	menu e-mail
	end_if
async
print "\r\nyhE-mail: n"
getcmd ?SRFNUKQ\r
logkey

cmdkey ?
	compare_user_misc UM_expert
	if_true
		menu e-mail
		end_if
	end_cmd

cmdkey S
	print "_\r\nbhE-mail (User name or number): w"
	getname 40
	compare_str ""
	if_true
		end_cmd
		end_if
	compare_str "SYSOP"
	if_true
		setstr "1"
		end_if
	mail_send
	end_cmd

cmdkey U
	print "_\r\nbhE-mail (User name or number): w"
	getname 25
	compare_str ""
	if_true
		end_cmd
		end_if
	compare_str "SYSOP"
	if_true
		setstr "1"
		end_if
	mail_send_file
        end_cmd

cmdkey R
	mail_read
	end_cmd

cmdkey F
	setstr "1"
	mail_send_feedback
	end_cmd

cmdkey N
	no_yes "\r\nAttach a file"
	if_true
		mail_send_netmail
	else	
		mail_send_netfile
		end_if
	end_cmd

cmdkey K
	mail_read_sent
	end_cmd

cmdkey Q
	cmd_pop
	return
	end_cmd

cmd_pop
return

############################ Main Info Section	###############################

:main_info
cmd_home
compare_user_misc UM_expert
if_false
	menu maininfo
	end_if
async
print "\r\nyhInfo: n"
getcmd ?QISVY\r
logkey

cmdkey ?
	compare_user_misc UM_expert
	if_true
		menu maininfo
		end_if
	end_cmd

cmdkey I
	info_system
	end_cmd

cmdkey S
	info_subboard
	end_cmd

cmdkey Y
	info_user
	end_cmd

cmdkey V
	info_version
	end_cmd

cmdkey Q
	cmd_pop
	return
	end_cmd

cmd_pop
return

########################### Main Config Section  ##############################

:main_cfg

compare_user_misc UM_expert
if_false
	menu maincfg
	end_if
async
print "\r\nyhConfig: n"
getcmd ?QNPIS\r
logkey

cmdkey ?
	compare_user_misc UM_expert
	if_true
		menu maincfg
		end_if
	goto main_cfg
	end_cmd

cmdkey N
	msg_new_scan_cfg
	return
	end_cmd

cmdkey S
	msg_your_scan_cfg
	return
	end_cmd

cmdkey P
	msg_ptrs_cfg
	return
	end_cmd

cmdkey I
	msg_ptrs_reinit
	return
	end_cmd

return


########################### File Transfer Section #############################

:file_transfers

compare_ars file_cmds=0
if_true
	compare_user_misc UM_ask_nscan
	if_true
		crlf
		crlf
		yes_no "Search all libraries for new files"
		if_true
			file_new_scan_all
			end_if
		end_if
	end_if

cmd_home

compare_user_misc UM_expert
if_false
	cls
	menu transfer
	end_if

# Update node status
node_action node_xfer
async

inc_file_cmds

# Display main Prompt
print "-c\r\nþ bhFile ncþ h"
compare_ars exempt T
if_true
	print "@TUSED@"
else
	print "@TLEFT@"
	end_if
print " nc(h@LN@nc) @LIB@ (h@DN@nc) @DIR@: n"

# Get key (with / extended commands allowed)
compare_user_misc UM_COLDKEYS
if_false
	getkeye
else
	getstrupr 60
        endif

compare_ars RIP
if_true
	getlines
	end_if

# Do nothing for control keys and space
cmdkey ^@
	end_cmd
cmdkey ^M
	end_cmd
cmdkey ^S
	end_cmd
 cmdkey  "
	end_cmd

# Write command to log file
logkey_comma

# Hitting number changes current sub-board
cmdkey digit
	compare_user_misc UM_COLDKEYS
	if_false
		ungetkey
                end_if
	file_get_dir_num
	end_cmd

# Hitting /number changes current group
cmdkey edigit
	compare_user_misc UM_COLDKEYS
	if_false
		ungetkey
	else
		shift_str 1
                end_if
	file_get_lib_num
	end_cmd

# Show the key hit
compare_user_misc UM_COLDKEYS
if_false
	printkey
        endif

# Next directory
cmdkey >
	file_directory_up
	end_cmd
cmdkey }
	file_directory_up
	end_cmd
cmdkey +
	file_directory_up
	end_cmd
cmdkey =
	file_directory_up
	end_cmd

# Previous directory
cmdkey <
	file_directory_down
	end_cmd
cmdkey {
	file_directory_down
	end_cmd
cmdkey -
	file_directory_down
	end_cmd

# Next library
cmdkey ]
	file_library_up
	end_cmd

# Previous library
cmdkey [
	file_library_down
	end_cmd

# String commands start with a semicolon
cmdkey ;
	compare_user_misc UM_COLDKEYS
	if_true
		shift_str 1
	else
                getstrupr 40
		end_if
	exec_bin str_cmds
	end_cmd

cmdkey Q
        cmd_pop
        return
        end_cmd

compare_user_misc UM_COLDKEYS
if_false
	crlf
	end_if
pause_reset

# Menu
cmdkey ?
	compare_user_misc UM_expert
	if_true
		menu transfer
		end_if
	end_cmd

# Sysop Menu
compare_ars SYSOP
if_true
	cmdkey !
		menu sysxfer
		end_cmd
	end_if

# Commands

cmdkey B
	file_batch_section
	end_cmd

cmdkey C
	exec_bin chat_sec
	end_cmd

cmdkey D
	print "\r\nchDownload File(s)\r\n"
	file_download_batch
	if_true
		end_cmd
		end_if
	getfilespec
	if_true
		file_download
		end_if
	end_cmd

cmdkey /D
	print "\r\nchDownload File(s) from User(s)\r\n"
	file_download_user
	end_cmd

cmdkey E
	print "\r\nchList Extended File Information\r\n"
	getfilespec
	if_true
		file_list_extended
		end_if
	end_cmd

cmdkey F
	print "\r\nchFind Text in File Descriptions (no wildcards)\r\n"
	file_find_text
	end_cmd

cmdkey /F
	file_find_text_all
        end_cmd

cmdkey I
	call file_info
	end_cmd

cmdkey J
	file_select_area
	end_cmd

cmdkey L
	setstr *.*
	file_list
	end_cmd

cmdkey /L
	nodelist_all
	end_cmd

cmdkey N
	print "\r\nchNew File Scan\r\n"
	file_new_scan
	end_cmd

cmdkey /N
	file_new_scan_all
	end_cmd

cmdkey O
	file_download_batch
	if_true
		end_cmd
                end_if
	logoff
	end_cmd

cmdkey /O
	file_download_batch
	if_true
		end_cmd
                end_if
	logoff_fast
        end_cmd

cmdkey R
	print "\r\nchRemove/Edit File(s)\r\n"
	getfilespec
	if_true
		file_remove
		end_if
	end_cmd

cmdkey S
	print "\r\nchSearch for Filename(s)\r\n"
	file_find_name
	end_cmd

cmdkey /S
	file_find_name_all
	end_cmd

cmdkey T
	file_temp_section
	end_cmd

cmdkey U
	print "\r\nchUpload File\r\n"
	chkfile "%zmenu/upload.*"
	if_true
		menu upload
		end_if
	file_upload
	end_cmd

cmdkey /U
	print "\r\nchUpload File to User\r\n"
	file_upload_user
	end_cmd

cmdkey V
	print "\r\nchView File(s)\r\n"
	getfilespec
	if_true
		file_view
		end_if
	end_cmd

cmdkey Z
	print "\r\nchUpload File to Sysop\r\n"
	file_upload_sysop
	end_cmd

cmdkey *
	file_show_directories
	end_cmd

cmdkey /*
	file_show_libraries
	end_cmd

cmdkey &
	:xfercfg
	compare_user_misc UM_expert
	if_false
		menu xfercfg
		end_if
	async
	print "\r\nyhConfig: n"
	getcmd ?QBEP\r
	logkey

	cmdkey ?
		compare_user_misc UM_expert
		if_true
			menu xfercfg
			end_if
		goto xfercfg
		end_cmd

	cmdkey P
		file_ptrs_cfg
		end_cmd

	cmdkey B
		toggle_user_misc UM_BATCHFLAG
		end_cmd

	cmdkey E
		toggle_user_misc UM_EXTDESC
                end_cmd
	end_cmd

cmdkey #
	print "\r\nchType the actual number, not the symbol.\r\n"
	end_cmd

cmdkey /#
	print "\r\nchType the actual number, not the symbol.\r\n"
        end_cmd

# fall through
print "\r\nchUnrecognized command."
compare_user_misc UM_expert
if_true
	print " Hit 'i?nch' for a menu."
	end_if
crlf
end_cmd

# shouldn't hit next line
print "Problem in command shell."
pause
hangup

############################ File Info Section	###############################

:file_info
cmd_home
compare_user_misc UM_expert
if_false
	menu xferinfo
	end_if
async
print "\r\nyhInfo: n"
getcmd ?TYDUQ\r
logkey

cmdkey ?
	compare_user_misc UM_expert
	if_true
		menu xferinfo
		end_if
	end_cmd

cmdkey T
	info_xfer_policy
	end_cmd

cmdkey Y
	info_user
	end_cmd

cmdkey D
	info_directory
	end_cmd

cmdkey U
	userlist_dir
	end_cmd

cmdkey Q
	cmd_pop
	return
	end_cmd

cmd_pop
return

#end of DEFAULT.SRC
