From d9141dc2d086f06c228751732fa58edcd1754f22 Mon Sep 17 00:00:00 2001 From: Craig Lamparter Date: Mon, 11 Jan 2021 09:13:37 -0800 Subject: [PATCH] update query plugin to resend last N messages. syntax: ?rN --- aprsd/plugins/query.py | 17 ++++++++++++++++- 1 file changed, 16 insertions(+), 1 deletion(-) diff --git a/aprsd/plugins/query.py b/aprsd/plugins/query.py index cd63c7c..26420ac 100644 --- a/aprsd/plugins/query.py +++ b/aprsd/plugins/query.py @@ -22,6 +22,21 @@ class QueryPlugin(plugin.APRSDPluginBase): searchstring = "^" + self.config["ham"]["callsign"] + ".*" # only I can do admin commands if re.search(searchstring, fromcall): + + # resend last N most recent + r = re.search(r"^\?[rR]([0-9]).*", message) + if r is not None: + if len(tracker) > 0: + last_n = r.group(1) + reply = messaging.NULL_MESSAGE + LOG.debug(reply) + tracker.restart_delayed(count=int(last_n)) + else: + reply = "No delayed msgs to resend" + LOG.debug(reply) + return reply + + # resend all r = re.search(r"^\?[rR].*", message) if r is not None: if len(tracker) > 0: @@ -29,7 +44,7 @@ class QueryPlugin(plugin.APRSDPluginBase): LOG.debug(reply) tracker.restart_delayed() else: - reply = "No Delayed Msgs" + reply = "No delayed msgs" LOG.debug(reply) return reply