mirror of
https://github.com/craigerl/aprsd.git
synced 2025-07-30 20:32:27 -04:00
fix query command syntax ?, ?3, ?d(elete), ?a(ll)
This commit is contained in:
parent
4ca5c29d49
commit
0b5c9dacf0
@ -17,14 +17,14 @@ class QueryPlugin(plugin.APRSDPluginBase):
|
|||||||
LOG.info("Query COMMAND")
|
LOG.info("Query COMMAND")
|
||||||
|
|
||||||
tracker = messaging.MsgTrack()
|
tracker = messaging.MsgTrack()
|
||||||
reply = "Pending Messages ({})".format(len(tracker))
|
reply = "Pending messages ({})".format(len(tracker))
|
||||||
|
|
||||||
searchstring = "^" + self.config["ham"]["callsign"] + ".*"
|
searchstring = "^" + self.config["ham"]["callsign"] + ".*"
|
||||||
# only I can do admin commands
|
# only I can do admin commands
|
||||||
if re.search(searchstring, fromcall):
|
if re.search(searchstring, fromcall):
|
||||||
|
|
||||||
# resend last N most recent
|
# resend last N most recent: "?3"
|
||||||
r = re.search(r"^\?[rR]([0-9]).*", message)
|
r = re.search(r"^\?([0-9]).*", message)
|
||||||
if r is not None:
|
if r is not None:
|
||||||
if len(tracker) > 0:
|
if len(tracker) > 0:
|
||||||
last_n = r.group(1)
|
last_n = r.group(1)
|
||||||
@ -32,25 +32,26 @@ class QueryPlugin(plugin.APRSDPluginBase):
|
|||||||
LOG.debug(reply)
|
LOG.debug(reply)
|
||||||
tracker.restart_delayed(count=int(last_n))
|
tracker.restart_delayed(count=int(last_n))
|
||||||
else:
|
else:
|
||||||
reply = "No delayed msgs to resend"
|
reply = "No pending msgs to resend"
|
||||||
LOG.debug(reply)
|
LOG.debug(reply)
|
||||||
return reply
|
return reply
|
||||||
|
|
||||||
# resend all
|
# resend all: "?a"
|
||||||
r = re.search(r"^\?[rR].*", message)
|
r = re.search(r"^\?[aA].*", message)
|
||||||
if r is not None:
|
if r is not None:
|
||||||
if len(tracker) > 0:
|
if len(tracker) > 0:
|
||||||
reply = messaging.NULL_MESSAGE
|
reply = messaging.NULL_MESSAGE
|
||||||
LOG.debug(reply)
|
LOG.debug(reply)
|
||||||
tracker.restart_delayed()
|
tracker.restart_delayed()
|
||||||
else:
|
else:
|
||||||
reply = "No delayed msgs"
|
reply = "No pending msgs"
|
||||||
LOG.debug(reply)
|
LOG.debug(reply)
|
||||||
return reply
|
return reply
|
||||||
|
|
||||||
|
# delete all: "?d"
|
||||||
r = re.search(r"^\?[dD].*", message)
|
r = re.search(r"^\?[dD].*", message)
|
||||||
if r is not None:
|
if r is not None:
|
||||||
reply = "Deleted ALL delayed msgs."
|
reply = "Deleted ALL pending msgs."
|
||||||
LOG.debug(reply)
|
LOG.debug(reply)
|
||||||
tracker.flush()
|
tracker.flush()
|
||||||
return reply
|
return reply
|
||||||
|
Loading…
x
Reference in New Issue
Block a user