From 49f3ea83392b98e5d1e362c37282819fb6f8dce7 Mon Sep 17 00:00:00 2001 From: Hemna Date: Fri, 5 Nov 2021 10:39:47 -0400 Subject: [PATCH] Fixed a problem with send-message command This patch fixes a problem with the packets object not being initialized correctly for the send-message command from the command line. Also adds the --wait-response option for send-message, which by default is now False --- aprsd/main.py | 20 ++++++++++++++++++-- 1 file changed, 18 insertions(+), 2 deletions(-) diff --git a/aprsd/main.py b/aprsd/main.py index b07f8fd..78ff12c 100644 --- a/aprsd/main.py +++ b/aprsd/main.py @@ -276,6 +276,14 @@ def sample_config(): default=False, help="Don't wait for an ack, just sent it to APRS-IS and bail.", ) +@click.option( + "--wait-response", + "-w", + is_flag=True, + show_default=True, + default=False, + help="Wait for a response to the message?", +) @click.option("--raw", default=None, help="Send a raw message. Implies --no-ack") @click.argument("tocallsign", required=False) @click.argument("command", nargs=-1, required=False) @@ -286,6 +294,7 @@ def send_message( aprs_login, aprs_password, no_ack, + wait_response, raw, tocallsign, command, @@ -316,6 +325,9 @@ def send_message( else: LOG.info(f"L'{aprs_login}' To'{tocallsign}' C'{command}'") + packets.WatchList(config=config) + packets.SeenList(config=config) + got_ack = False got_response = False @@ -348,8 +360,12 @@ def send_message( ) ack.send_direct() - if got_ack and got_response: - sys.exit(0) + if got_ack: + if wait_response: + if got_response: + sys.exit(0) + else: + sys.exit(0) try: client.ClientFactory.setup(config)