From 8bf833daa95371d2eb4d7babfa78a1adc8310fc4 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?TC=C2=B2?= <130875305+TheCommsChannel@users.noreply.github.com> Date: Thu, 4 Jul 2024 11:42:29 -0400 Subject: [PATCH] Make short_name case insensitive Make short_name case insensitive and added config.ini to gitignore, added example_config.ini, and updated README --- .gitignore | 1 + README.md | 8 +++++++- command_handlers.py | 2 +- config.ini | 6 +++--- example_config.ini | 34 ++++++++++++++++++++++++++++++++++ utils.py | 2 +- 6 files changed, 47 insertions(+), 6 deletions(-) create mode 100644 example_config.ini diff --git a/.gitignore b/.gitignore index adffc7d..ec35470 100644 --- a/.gitignore +++ b/.gitignore @@ -3,3 +3,4 @@ bulletins.db venv/ .venv .idea +config.ini \ No newline at end of file diff --git a/README.md b/README.md index 22259a2..68730ba 100644 --- a/README.md +++ b/README.md @@ -54,7 +54,13 @@ If you're a Docker user, TC²-BBS Meshtastic is available on Docker Hub! pip install -r requirements.txt ``` -5. Set up the configuration in `config.ini`: +5. Rename `example_config.ini`: + + ```sh + mv example_config.ini config.ini + ``` + +6. Set up the configuration in `config.ini`: **[interface]** If using `type = serial` and you have multiple devices connected, you will need to uncomment the `port =` line and enter the port of your device. diff --git a/command_handlers.py b/command_handlers.py index c247133..dd59a0e 100644 --- a/command_handlers.py +++ b/command_handlers.py @@ -273,7 +273,7 @@ def handle_mail_steps(sender_id, message, step, state, interface, bbs_nodes): update_user_state(sender_id, None) elif step == 3: - short_name = message + short_name = message.lower() nodes = get_node_info(interface, short_name) if not nodes: send_message("I'm unable to find that node in my database.", sender_id, interface) diff --git a/config.ini b/config.ini index b953fd1..39ac10f 100644 --- a/config.ini +++ b/config.ini @@ -17,7 +17,7 @@ [interface] type = serial -# port = /dev/ttyACM0 +port = COM3 # hostname = 192.168.x.x @@ -30,5 +30,5 @@ type = serial # [sync] # bbs_nodes = !17d7e4b7,!18e9f5a3,!1a2b3c4d -# [sync] -# bbs_nodes = !17d7e4b7 +[sync] +bbs_nodes = !f53f441f diff --git a/example_config.ini b/example_config.ini new file mode 100644 index 0000000..b953fd1 --- /dev/null +++ b/example_config.ini @@ -0,0 +1,34 @@ +############################### +#### Select Interface type #### +############################### +# [type = serial] for USB connected devices +#If there are multiple serial devices connected, be sure to use the "port" option and specify a port +# Linux Example: +# port = /dev/ttyUSB0 +# +# Windows Example: +# port = COM3 +# [type = tcp] for network connected devices (ESP32 devices only - this does not work for WisBlock) +# If using tcp, remove the # from the beginning and replace 192.168.x.x with the IP address of your device +# Example: +# [interface] +# type = tcp +# hostname = 192.168.1.100 + +[interface] +type = serial +# port = /dev/ttyACM0 +# hostname = 192.168.x.x + + +############################ +#### BBS NODE SYNC LIST #### +############################ +# Provide a list of other nodes running TC²-BBS to sync mail messages and bulletins with +# Enter in a list of other BBS Nodes by their nodeID separated by commas (no spaces) +# Example: +# [sync] +# bbs_nodes = !17d7e4b7,!18e9f5a3,!1a2b3c4d + +# [sync] +# bbs_nodes = !17d7e4b7 diff --git a/utils.py b/utils.py index 460aea8..4fa3009 100644 --- a/utils.py +++ b/utils.py @@ -28,7 +28,7 @@ def send_message(message, destination, interface): def get_node_info(interface, short_name): nodes = [{'num': node_id, 'shortName': node['user']['shortName'], 'longName': node['user']['longName']} for node_id, node in interface.nodes.items() - if node['user']['shortName'] == short_name] + if node['user']['shortName'].lower() == short_name] return nodes