# major.src

# MajorBBS Clone Command Shell for Synchronet

# $Id: major.src,v 1.11 2011/08/31 00:26:18 rswindell Exp $

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

!include sbbsdefs.inc

:main
cmd_home
menu major/main
getstr 10
compare_str ""
if_true
	end_cmd
	end_if
ungetstr
getkey
node_action node_main
logkey_comma

cmdkey ?
	end_cmd

cmdkey T
	exec_bin chat_sec
	end_cmd

cmdkey I
	text_file_section
	end_cmd

cmdkey F
	call message
	end_cmd

cmdkey E
	cmd_home
	menu major/email
	getstr 10
	compare_str ""
	if_true
		end_cmd
		end_if
	ungetstr
	getkey
        logkey

	cmdkey R
		mail_read
		end_cmd

	cmdkey W
		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 S
	        int i
	        copy i _netmail_misc
	        or i _inetmail_misc
	        and i NMAIL_FILE
	        compare i 0
	        if_false
			no_yes "\r\nAttach a file"
			end_if
		if_true
			mail_send_netmail
		else
			mail_send_netfile
			end_if
		end_cmd

	cmdkey U
		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_file
		end_cmd

	cmdkey E
		mail_read_sent
		end_cmd

	cmdkey X
		cmd_pop
		end_cmd

	end_cmd

cmdkey L
	call transfers
	end_cmd

cmdkey D
	exec_bin xtrn_sec
	end_cmd

cmdkey A
	cmd_home
	menu major/userdefs
	getstr 10
	compare_str ""
	if_true
		end_cmd
		end_if
	ungetstr
	getkey
        logkey

	cmdkey S
		info_user
		end_cmd

	cmdkey A
		user_defaults
		end_cmd

	cmdkey X
		cmd_pop
		end_cmd

	end_cmd

cmdkey R
	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 S
	compare_ars SYSOP or exempt Q or I or N
	if_true
		call sysop
		end_if
	end_cmd

cmdkey X
	file_download_batch
	if_true
		end_cmd
                end_if
	logoff
	end_cmd

end_cmd

############################### Message Section ###############################

:message
cmd_home
menu major/msg
getstr 10
compare_str ""
if_true
	end_cmd
        end_if
ungetstr
getkey

# Update node status
node_action node_main
logkey_comma

cmdkey ?
	end_cmd

cmdkey X
	cmd_pop
	return
	end_cmd

cmdkey R
	msg_read
	end_cmd

cmdkey W
	msg_post
	end_cmd

cmdkey Q
	cmd_home
	menu major/quickscn
	getstr 10
	compare_str ""
	if_true
		end_cmd
		end_if
	ungetstr
	getkey
        logkey

	cmdstr S
                msg_new_scan
                end_cmd

	cmdstr L
		msg_your_scan
                end_cmd

	cmdstr K
		msg_find_text
                end_cmd

	cmdstr C
		cmd_home
		menu maincfg
		async
		print "\r\nyhConfig: n"
		getcmd ?QNPIS
		logkey

		cmdkey ?
			compare_ars expert
			if_true
				menu maincfg
				end_if
			end_cmd

		cmdkey N
			msg_new_scan_cfg
			end_cmd

		cmdkey S
			msg_your_scan_cfg
			end_cmd

		cmdkey P
			msg_ptrs_cfg
			end_cmd

		cmdkey I
			msg_ptrs_reinit
			end_cmd

		cmdkey Q
			cmd_pop
			end_cmd

		end_cmd
        cmd_pop
        end_cmd

cmdkey T
	exec_bin chat_sec
	end_cmd

cmdkey S
	msg_select_area
	end_cmd

cmdkey F
	call transfers
        end_cmd

cmd_pop
return

############################ Transfer Menu Commands ###########################
:transfers
cmd_home
menu major/file
getstr 10
compare_str ""
if_true
	end_cmd
	end_if
ungetstr
getkey
logkey

cmdkey F
	print "\r\nchList Files\r\n"
	getfilespec
	if_true
		file_list
		end_if
	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 U
	print "\r\nchUpload File\r\n"
	chkfile "%zmenu/upload.*"
	if_true
		menu upload
                end_if
	file_upload
	end_cmd

cmdkey S
	file_select_area
	end_cmd

cmdkey X
	cmd_pop
	return
	end_cmd

end_cmd

############################## Sysop Commands #################################

:sysop
menu sysmain
print "n\r\nchSelect an option (or X to exit): n"
getstrupr 40

compare_str "X"
if_true
        return
	end_if

exec_bin "str_cmds %s"
goto sysop

