mirror of
https://github.com/evennia/evennia.git
synced 2026-03-20 23:06:31 +01:00
More command sanitizing checks, renamed startup script to startup.sh.
This commit is contained in:
parent
81a13d873f
commit
9335adc03a
5 changed files with 29 additions and 3 deletions
|
|
@ -283,8 +283,12 @@ def cmd_say(cdat):
|
|||
"""
|
||||
Room-based speech command.
|
||||
"""
|
||||
session_list = session_mgr.get_session_list()
|
||||
session = cdat['session']
|
||||
|
||||
if not functions_general.cmd_check_num_args(session, cdat['uinput']['splitted'], 1, errortext="Say What?"):
|
||||
return
|
||||
|
||||
session_list = session_mgr.get_session_list()
|
||||
pobject = session.get_pobject()
|
||||
speech = ' '.join(cdat['uinput']['splitted'][1:])
|
||||
|
||||
|
|
|
|||
|
|
@ -1,5 +1,6 @@
|
|||
from django.contrib.auth.models import User
|
||||
import functions_db
|
||||
import functions_general
|
||||
|
||||
"""
|
||||
Commands that are available from the connect screen.
|
||||
|
|
@ -13,8 +14,8 @@ def cmd_connect(cdat):
|
|||
|
||||
session = cdat['session']
|
||||
|
||||
if len(cdat['uinput']['splitted']) != 3:
|
||||
session.msg("Missing arguments!")
|
||||
# Argument check.
|
||||
if not functions_general.cmd_check_num_args(session, cdat['uinput']['splitted'], 2):
|
||||
return
|
||||
|
||||
uemail = cdat['uinput']['splitted'][1]
|
||||
|
|
@ -44,10 +45,20 @@ def cmd_create(cdat):
|
|||
Handle the creation of new accounts.
|
||||
"""
|
||||
session = cdat['session']
|
||||
|
||||
# Argument check.
|
||||
if not functions_general.cmd_check_num_args(session, cdat['uinput']['splitted'], 2):
|
||||
return
|
||||
|
||||
server = session.server
|
||||
quote_split = ' '.join(cdat['uinput']['splitted']).split("\"")
|
||||
uname = quote_split[1]
|
||||
lastarg_split = quote_split[2].split()
|
||||
|
||||
if len(lastarg_split) != 2:
|
||||
session.msg("You must specify an email address, followed by a password!")
|
||||
return
|
||||
|
||||
email = lastarg_split[0]
|
||||
password = lastarg_split[1]
|
||||
|
||||
|
|
|
|||
BIN
evennia.sql
BIN
evennia.sql
Binary file not shown.
|
|
@ -5,6 +5,17 @@ import commands_unloggedin
|
|||
"""
|
||||
General commonly used functions.
|
||||
"""
|
||||
|
||||
def cmd_check_num_args(session, arg_list, min_args, errortext="Missing arguments!"):
|
||||
"""
|
||||
Check a player command's splitted argument list to make sure it contains
|
||||
the minimum allowable number of arguments.
|
||||
"""
|
||||
if len(arg_list) < min_args+1:
|
||||
session.msg(errortext)
|
||||
return False
|
||||
return True
|
||||
|
||||
def print_errmsg(errormsg):
|
||||
"""
|
||||
Prints/logs an error message. Pipe any errors to be logged through here.
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue