Skip to content
Draft
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
12 changes: 12 additions & 0 deletions src/meshcore_cli/meshcore_cli.py
Original file line number Diff line number Diff line change
Expand Up @@ -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"]
Expand Down Expand Up @@ -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" :
Expand All @@ -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 :
Expand Down