|
35 | 35 | from meshcore import MeshCore, EventType, logger |
36 | 36 |
|
37 | 37 | # Version |
38 | | -VERSION = "v1.5.5" |
| 38 | +VERSION = "v1.5.7" |
39 | 39 |
|
40 | 40 | # default ble address is stored in a config file |
41 | 41 | MCCLI_CONFIG_DIR = str(Path.home()) + "/.config/meshcore/" |
@@ -586,6 +586,7 @@ def make_completion_dict(contacts, pending={}, to=None, channels=None): |
586 | 586 | "max_flood_attempts" : None, |
587 | 587 | "flood_after" : None, |
588 | 588 | "path_hash_mode": None, |
| 589 | + "default_scope": None, |
589 | 590 | }, |
590 | 591 | "get" : {"name":None, |
591 | 592 | "bat":None, |
@@ -627,6 +628,7 @@ def make_completion_dict(contacts, pending={}, to=None, channels=None): |
627 | 628 | "stats_packets":None, |
628 | 629 | "allowed_repeat_freq":None, |
629 | 630 | "path_hash_mode":None, |
| 631 | + "default_scope":None, |
630 | 632 | }, |
631 | 633 | "?get":None, |
632 | 634 | "?set":None, |
@@ -2243,7 +2245,12 @@ async def next_cmd(mc, cmds, json_output=False): |
2243 | 2245 | print(f"Error : {res}") |
2244 | 2246 | else: |
2245 | 2247 | print(f"Policy for adv_loc: {policy}") |
2246 | | - |
| 2248 | + case "default_scope": |
| 2249 | + res = await mc.commands.set_default_flood_scope(cmds[2]) |
| 2250 | + if res.type == EventType.ERROR: |
| 2251 | + print(f"Error : {res}") |
| 2252 | + else: |
| 2253 | + print("Default scope set") |
2247 | 2254 | case _: # custom var |
2248 | 2255 | if cmds[1].startswith("_") : |
2249 | 2256 | vname = cmds[1][1:] |
@@ -2534,6 +2541,9 @@ async def next_cmd(mc, cmds, json_output=False): |
2534 | 2541 | case "allowed_repeat_freq" : |
2535 | 2542 | res = await mc.commands.get_allowed_repeat_freq() |
2536 | 2543 | print(json.dumps(res.payload)) |
| 2544 | + case "default_scope" : |
| 2545 | + res = await mc.commands.get_default_flood_scope() |
| 2546 | + print(json.dumps(res.payload)) |
2537 | 2547 | case _ : |
2538 | 2548 | res = await mc.commands.get_custom_vars() |
2539 | 2549 | logger.debug(res) |
@@ -3875,6 +3885,8 @@ def get_help_for (cmdname, context="line") : |
3875 | 3885 | When entering chat mode, scope will be reset to *, meaning classic flood. |
3876 | 3886 | You can switch scope using the scope command, or postfixing the to command with %<scope>. |
3877 | 3887 | Scope can also be applied to a command using % before the scope name. For instance login%#Morbihan will limit diffusion of the login command (which is usually sent flood to get the path to a repeater) to the #Morbihan region. |
| 3888 | +
|
| 3889 | + default_scope for the device can be set/get by using set default_scope and get default_scope, if set, the scope will revert to this default. |
3878 | 3890 | """) |
3879 | 3891 |
|
3880 | 3892 | elif cmdname == "contact_info": |
|
0 commit comments