mirror of
https://github.com/TheCommsChannel/TC2-BBS-mesh.git
synced 2025-03-05 20:51:53 -08:00
Improved error handling when non-integer value is supplied in read mail or read bulletin menus.
This commit is contained in:
parent
2b7d47cb29
commit
ae1eb3d1e5
|
@ -198,11 +198,16 @@ def handle_bb_steps(sender_id, message, step, state, interface, bbs_nodes):
|
||||||
update_user_state(sender_id, {'command': 'BULLETIN_POST', 'step': 4, 'board': board_name})
|
update_user_state(sender_id, {'command': 'BULLETIN_POST', 'step': 4, 'board': board_name})
|
||||||
|
|
||||||
elif step == 3:
|
elif step == 3:
|
||||||
bulletin_id = int(message)
|
try:
|
||||||
sender_short_name, date, subject, content, unique_id = get_bulletin_content(bulletin_id)
|
bulletin_id = int(message)
|
||||||
send_message(f"From: {sender_short_name}\nDate: {date}\nSubject: {subject}\n- - - - - - -\n{content}", sender_id, interface)
|
sender_short_name, date, subject, content, unique_id = get_bulletin_content(bulletin_id)
|
||||||
board_name = state['board']
|
send_message(f"From: {sender_short_name}\nDate: {date}\nSubject: {subject}\n- - - - - - -\n{content}", sender_id, interface)
|
||||||
handle_bb_steps(sender_id, 'e', 1, state, interface, bbs_nodes)
|
board_name = state['board']
|
||||||
|
handle_bb_steps(sender_id, 'e', 1, state, interface, bbs_nodes)
|
||||||
|
except ValueError:
|
||||||
|
logging.info(f"Node {sender_id} entered a non-integer value in the read bulletin menu")
|
||||||
|
send_message("Your message must only contain the bulletin number Try again or e[X]it.", sender_id, interface)
|
||||||
|
|
||||||
|
|
||||||
elif step == 4:
|
elif step == 4:
|
||||||
subject = message
|
subject = message
|
||||||
|
@ -255,8 +260,8 @@ def handle_mail_steps(sender_id, message, step, state, interface, bbs_nodes):
|
||||||
handle_help_command(sender_id, interface)
|
handle_help_command(sender_id, interface)
|
||||||
|
|
||||||
elif step == 2:
|
elif step == 2:
|
||||||
mail_id = int(message)
|
|
||||||
try:
|
try:
|
||||||
|
mail_id = int(message)
|
||||||
sender_node_id = get_node_id_from_num(sender_id, interface)
|
sender_node_id = get_node_id_from_num(sender_id, interface)
|
||||||
sender, date, subject, content, unique_id = get_mail_content(mail_id, sender_node_id)
|
sender, date, subject, content, unique_id = get_mail_content(mail_id, sender_node_id)
|
||||||
send_message(f"Date: {date}\nFrom: {sender}\nSubject: {subject}\n{content}", sender_id, interface)
|
send_message(f"Date: {date}\nFrom: {sender}\nSubject: {subject}\n{content}", sender_id, interface)
|
||||||
|
@ -266,6 +271,9 @@ def handle_mail_steps(sender_id, message, step, state, interface, bbs_nodes):
|
||||||
logging.info(f"Node {sender_id} tried to access non-existent message")
|
logging.info(f"Node {sender_id} tried to access non-existent message")
|
||||||
send_message("Mail not found", sender_id, interface)
|
send_message("Mail not found", sender_id, interface)
|
||||||
update_user_state(sender_id, None)
|
update_user_state(sender_id, None)
|
||||||
|
except ValueError:
|
||||||
|
logging.info(f"Node {sender_id} entered a non-integer value in the read mail menu")
|
||||||
|
send_message("Your message must only contain the message number Try again or e[X]it.", sender_id, interface)
|
||||||
|
|
||||||
elif step == 3:
|
elif step == 3:
|
||||||
short_name = message.lower()
|
short_name = message.lower()
|
||||||
|
|
Loading…
Reference in a new issue