From 0c1c587bc764c17d5d3258a0a6ea0cd2a40412f6 Mon Sep 17 00:00:00 2001 From: Nestpebble Date: Fri, 27 Sep 2024 01:26:01 +0100 Subject: [PATCH 1/5] strip ! from tonode, cos its copied by default on the android app. --- mesh_bot.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/mesh_bot.py b/mesh_bot.py index 81e2ac1..9301016 100755 --- a/mesh_bot.py +++ b/mesh_bot.py @@ -478,7 +478,7 @@ def handle_bbspost(message, message_from_id, deviceID): return "example: bbspost $subject #message" elif "@" in message and not "example:" in message: toNode = message.split("@")[1].split("#")[0] - toNode = toNode.rstrip() + toNode = toNode.rstrip().strip("!") if toNode.isalpha() or not toNode.isnumeric(): toNode = get_num_from_short_name(toNode, deviceID) if toNode == 0: From 0b101d662e794274be28e8e2ca90b8e3a948c418 Mon Sep 17 00:00:00 2001 From: Nestpebble Date: Fri, 27 Sep 2024 02:26:55 +0100 Subject: [PATCH 2/5] trying to simplify nodeid entry... --- mesh_bot.py | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/mesh_bot.py b/mesh_bot.py index 9301016..d975fbb 100755 --- a/mesh_bot.py +++ b/mesh_bot.py @@ -478,8 +478,10 @@ def handle_bbspost(message, message_from_id, deviceID): return "example: bbspost $subject #message" elif "@" in message and not "example:" in message: toNode = message.split("@")[1].split("#")[0] - toNode = toNode.rstrip().strip("!") - if toNode.isalpha() or not toNode.isnumeric(): + toNode = toNode.rstrip() + if "!" in toNode and toNode.strip("!").ishex(): + toNode = toNode.strip("!") + elif toNode.isalpha() or not toNode.isnumeric(): toNode = get_num_from_short_name(toNode, deviceID) if toNode == 0: return "Node not found " + message.split("@")[1].split("#")[0] From f23c4e2b6a44496f76392f4b31f71c81a1605f82 Mon Sep 17 00:00:00 2001 From: Nestpebble Date: Fri, 27 Sep 2024 02:29:58 +0100 Subject: [PATCH 3/5] sdf --- mesh_bot.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/mesh_bot.py b/mesh_bot.py index d975fbb..95ce04e 100755 --- a/mesh_bot.py +++ b/mesh_bot.py @@ -479,7 +479,7 @@ def handle_bbspost(message, message_from_id, deviceID): elif "@" in message and not "example:" in message: toNode = message.split("@")[1].split("#")[0] toNode = toNode.rstrip() - if "!" in toNode and toNode.strip("!").ishex(): + if "!" in toNode and toNode.strip("!").isHex(): toNode = toNode.strip("!") elif toNode.isalpha() or not toNode.isnumeric(): toNode = get_num_from_short_name(toNode, deviceID) From 55472bbbc082e29a24be5471aedc2ea5a4e8c5c4 Mon Sep 17 00:00:00 2001 From: Nestpebble Date: Fri, 27 Sep 2024 03:12:40 +0100 Subject: [PATCH 4/5] try this --- mesh_bot.py | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) diff --git a/mesh_bot.py b/mesh_bot.py index 95ce04e..bc8ccbb 100755 --- a/mesh_bot.py +++ b/mesh_bot.py @@ -479,8 +479,12 @@ def handle_bbspost(message, message_from_id, deviceID): elif "@" in message and not "example:" in message: toNode = message.split("@")[1].split("#")[0] toNode = toNode.rstrip() - if "!" in toNode and toNode.strip("!").isHex(): - toNode = toNode.strip("!") + if "!" in toNode: + try: + int(toNode.strip("!"),16) + toNode = int(toNode.strip("!"),16) + except ValueError as e: + logger.debug("toNode is not hex, error: {e}") elif toNode.isalpha() or not toNode.isnumeric(): toNode = get_num_from_short_name(toNode, deviceID) if toNode == 0: From df5f648b26fc80f90420ffabe55ef5952a8554db Mon Sep 17 00:00:00 2001 From: Nestpebble Date: Fri, 27 Sep 2024 03:30:21 +0100 Subject: [PATCH 5/5] try and round off adding an interpreter to the bbs DM --- mesh_bot.py | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/mesh_bot.py b/mesh_bot.py index bc8ccbb..932eaad 100755 --- a/mesh_bot.py +++ b/mesh_bot.py @@ -479,12 +479,13 @@ def handle_bbspost(message, message_from_id, deviceID): elif "@" in message and not "example:" in message: toNode = message.split("@")[1].split("#")[0] toNode = toNode.rstrip() - if "!" in toNode: + # if toNode preceded by !, or is 8 characters long try to interpret as hex + if "!" in toNode or len(toNode) == 8: try: - int(toNode.strip("!"),16) toNode = int(toNode.strip("!"),16) except ValueError as e: logger.debug("toNode is not hex, error: {e}") + # if toNode is all alpha or not totally numeric, see if it is a shortname elif toNode.isalpha() or not toNode.isnumeric(): toNode = get_num_from_short_name(toNode, deviceID) if toNode == 0: