Skip to content

Commit f6334ac

Browse files
committed
doccumentation on manual_add_contacts
1 parent ec585f3 commit f6334ac

File tree

3 files changed

+38
-5
lines changed

3 files changed

+38
-5
lines changed

README.md

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -180,6 +180,18 @@ f1down/#fdl|*> 8
180180
#fdl f1down: 8 [2521] 1.00-109
181181
```
182182

183+
### Contact management
184+
185+
To receive a message from another user, it is necessary to have its public key. This key is stored on a contact list in the device, and this list has a finite size (50 when meshcore started, now over 350 for most devices).
186+
187+
By default contacts are automatically added to the device contact list when an advertisement is received, so as soon as you receive an advert, you can talk with your buddy.
188+
189+
With growing number of users, it becomes necessary to manage contact list and one of the ways is to add contacts manually to the device. This is done by turning on `manual_add_contacts`. Once this option has been turned on, a pending list is built by meshcore-cli from the received adverts. You can view the list issuing a `pending_contacts` command, flush the list using `flush_pending` or add a contact from the list with `add_pending` followed by the key of the contact or its name (both will be auto-completed with tab).
190+
191+
This feature only really works in interactive mode.
192+
193+
Note: There is also an `auto_update_contacts` setting that has nothing to do with adding contacts, it permits to automatically sync contact lists between device and meshcore-cli (when there is an update in name, location or path).
194+
183195
### Issuing batch commands to contacts with apply to
184196

185197
`apply_to <f> <cmd>` : applies cmd to contacts matching filter `<f>` it can be used to apply the same command to a pool of repeaters, or remove some contacts matching a condition.

pyproject.toml

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@ build-backend = "hatchling.build"
44

55
[project]
66
name = "meshcore-cli"
7-
version = "1.3.1"
7+
version = "1.3.2"
88
authors = [
99
{ name="Florent de Lamotte", email="[email protected]" },
1010
]
@@ -17,7 +17,7 @@ classifiers = [
1717
]
1818
license = "MIT"
1919
license-files = ["LICEN[CS]E*"]
20-
dependencies = [ "meshcore >= 2.1.24", "prompt_toolkit >= 3.0.50", "requests >= 2.28.0", "pycryptodome" ]
20+
dependencies = [ "meshcore >= 2.2.0", "prompt_toolkit >= 3.0.50", "requests >= 2.28.0", "pycryptodome" ]
2121

2222
[project.urls]
2323
Homepage = "https://github.com/fdlamotte/meshcore-cli"

src/meshcore_cli/meshcore_cli.py

Lines changed: 24 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -32,7 +32,7 @@
3232
from meshcore import MeshCore, EventType, logger
3333

3434
# Version
35-
VERSION = "v1.3.1"
35+
VERSION = "v1.3.2"
3636

3737
# default ble address is stored in a config file
3838
MCCLI_CONFIG_DIR = str(Path.home()) + "/.config/meshcore/"
@@ -591,6 +591,9 @@ def make_completion_dict(contacts, pending={}, to=None, channels=None):
591591
"?at":None,
592592
"?node_discover":None,
593593
"?nd":None,
594+
"?pending_contacts":None,
595+
"?add_pending":None,
596+
"?flush_pending":None,
594597
}
595598

596599
contact_completion_list = {
@@ -3329,12 +3332,15 @@ def get_help_for (cmdname, context="line") :
33293332
lat <lat> : latitude
33303333
lon <lon> : longitude
33313334
coords <lat,lon> : coordinates
3332-
auto_update_contacts <> : automatically updates contact list
33333335
multi_ack <on/off> : multi-acks feature
33343336
telemetry_mode_base <mode> : set basic telemetry mode all/selected/off
33353337
telemetry_mode_loc <mode> : set location telemetry mode all/selected/off
33363338
telemetry_mode_env <mode> : set env telemetry mode all/selected/off
33373339
advert_loc_policy <policy> : "share" means loc will be shared in adv
3340+
manual_add_contacts <on/off>: let user manually add contacts to device
3341+
- when off device automatically adds contacts from adverts
3342+
- when on contacts must be added manually using add_pending
3343+
(pending contacts list is built by meshcli from adverts while connected)
33383344
display:
33393345
print_snr <on/off> : toggle snr display in messages
33403346
print_adverts <on/off> : display adverts as they come
@@ -3344,12 +3350,13 @@ def get_help_for (cmdname, context="line") :
33443350
channel_echoes <on/off> : print repeats for channel data
33453351
echo_unk_channels <on/off> : also dump unk channels (encrypted)
33463352
color <on/off> : color off should remove ANSI codes from output
3347-
prompt:
3353+
meshcore-cli behaviour:
33483354
classic_prompt <on/off> : activates less fancier prompt
33493355
arrow_head <string> : change arrow head in prompt
33503356
slash_start <string> : idem for slash start
33513357
slash_end <string> : slash end
33523358
invert_slash <on/off> : apply color inversion to slash
3359+
auto_update_contacts <on/of>: auto sync contact list with device
33533360
""")
33543361

33553362
elif cmdname == "scope":
@@ -3373,6 +3380,20 @@ def get_help_for (cmdname, context="line") :
33733380
- contact_type (ct)
33743381
""")
33753382

3383+
elif cmdname == "pending_contacts" or cmdname == "flush_pending" or cmdname == "add_pending":
3384+
print("""Contact management
3385+
3386+
To receive a message from another user, it is necessary to have its public key. This key is stored on a contact list in the device, and this list has a finite size (50 when meshcore started, now over 350 for most devices).
3387+
3388+
By default contacts are automatically added to the device contact list when an advertisement is received, so as soon as you receive an advert, you can talk with your buddy.
3389+
3390+
With growing number of users, it becomes necessary to manage contact list and one of the ways is to add contacts manually to the device. This is done by turning on manual_add_contacts. Once this option has been turned on, a pending list is built by meshcore-cli from the received adverts. You can view the list issuing a pending_contacts command, flush the list using flush_pending or add a contact from the list with add_pending followed by the key of the contact or its name (both will be auto-completed with tab).
3391+
3392+
This feature only really works in interactive mode.
3393+
3394+
Note: There is also an auto_update_contacts setting that has nothing to do with adding contacts, it permits to automatically sync contact lists between device and meshcore-cli (when there is an update in name, location or path).
3395+
""")
3396+
33763397
else:
33773398
print(f"Sorry, no help yet for {cmdname}")
33783399

0 commit comments

Comments
 (0)