From 3f7a05c3bec8519ddd2149b44466555ceeb0d27f Mon Sep 17 00:00:00 2001 From: Ander Punnar Date: Sun, 16 Aug 2026 18:57:50 +0300 Subject: [PATCH] make channel scopes configurable --- src/meshcore_cli/meshcore_cli.py | 12 ++++++++++++ 1 file changed, 12 insertions(+) diff --git a/src/meshcore_cli/meshcore_cli.py b/src/meshcore_cli/meshcore_cli.py index 9b644c18..1b268c2c 100644 --- a/src/meshcore_cli/meshcore_cli.py +++ b/src/meshcore_cli/meshcore_cli.py @@ -41,6 +41,15 @@ MCCLI_ADDRESS = MCCLI_CONFIG_DIR + "default_address" MCCLI_HISTORY_FILE = MCCLI_CONFIG_DIR + "history" MCCLI_INIT_SCRIPT = MCCLI_CONFIG_DIR + "init" +MCCLI_SCOPES_FILE = MCCLI_CONFIG_DIR + "scopes" + +MCCLI_SCOPES = {} +if os.path.exists(MCCLI_SCOPES_FILE) : + with open(MCCLI_SCOPES_FILE, "r") as lines: + for line in lines: + line = line.strip() + channel, scope = line.split(" ") + MCCLI_SCOPES[channel] = scope PAYLOAD_TYPENAMES = ["REQ", "RESPONSE", "TEXT_MSG", "ACK", "ADVERT", "GRP_TXT", "GRP_DATA", "ANON_REQ", "PATH", "TRACE", "MULTIPART", "CONTROL"] ROUTE_TYPENAMES = ["TC_FLOOD", "FLOOD", "DIRECT", "TC_DIRECT"] @@ -1236,6 +1245,8 @@ async def process_line(mc, line, contact=None, scope="*", prev_contact=None, pre if '%' in dest and scope!=None : dest_scope = dest.split("%")[-1] dest = dest[:-len(dest_scope)-1] + if dest in MCCLI_SCOPES.keys(): + dest_scope = MCCLI_SCOPES[dest] nc = await get_contact_from_arg(mc, dest) if nc is None: if dest == "public" : @@ -1253,6 +1264,7 @@ async def process_line(mc, line, contact=None, scope="*", prev_contact=None, pre dest_scope = prev_scope elif dest == "~" or dest == "/" or dest == mc.self_info['name']: nc = None + dest_scope = "" elif dest == "!" : nc = process_event_message.last_node else :