mirror of
https://github.com/meshcore-dev/meshcore-cli.git
synced 2026-04-20 22:13:48 +00:00
can now add pending contact by name
This commit is contained in:
parent
bd1049c123
commit
0b81bc7aa0
1 changed files with 11 additions and 0 deletions
|
|
@ -399,6 +399,10 @@ def make_completion_dict(contacts, pending={}, to=None, channels=None):
|
|||
for c in it :
|
||||
contact_list[c[1]['adv_name']] = None
|
||||
|
||||
pit = iter(pending.items())
|
||||
for c in pit :
|
||||
pending_list[c[1]['adv_name']] = None
|
||||
|
||||
pit = iter(pending.items())
|
||||
for c in pit :
|
||||
pending_list[c[1]['public_key']] = None
|
||||
|
|
@ -2369,6 +2373,13 @@ async def next_cmd(mc, cmds, json_output=False):
|
|||
case "add_pending":
|
||||
argnum = 1
|
||||
contact = mc.pop_pending_contact(cmds[1])
|
||||
if contact is None: # try to find by name
|
||||
key = None
|
||||
for c in mc.pending_contacts.items():
|
||||
if c[1]['adv_name'] == cmds[1]:
|
||||
key = c[1]['public_key']
|
||||
contact = mc.pop_pending_contact(key)
|
||||
break
|
||||
if contact is None:
|
||||
if json_output:
|
||||
print(json.dumps({"error":"Contact does not exist"}))
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue