1
0
mirror of https://github.com/craigerl/aprsd.git synced 2024-11-17 22:01:49 -05:00

Added QueryPlugin

Query Plugin looks for ^/?.* and currently only responds with
the list of pending messages in the MsgTrack queue.
This commit is contained in:
Hemna 2020-12-30 08:13:26 -05:00
parent 2659a0b3b9
commit 28f3daf6d0

View File

@ -31,6 +31,7 @@ CORE_PLUGINS = [
"aprsd.plugin.FortunePlugin", "aprsd.plugin.FortunePlugin",
"aprsd.plugin.LocationPlugin", "aprsd.plugin.LocationPlugin",
"aprsd.plugin.PingPlugin", "aprsd.plugin.PingPlugin",
"aprsd.plugin.QueryPlugin",
"aprsd.plugin.TimePlugin", "aprsd.plugin.TimePlugin",
"aprsd.plugin.WeatherPlugin", "aprsd.plugin.WeatherPlugin",
"aprsd.plugin.VersionPlugin", "aprsd.plugin.VersionPlugin",
@ -353,6 +354,22 @@ class PingPlugin(APRSDPluginBase):
return reply.rstrip() return reply.rstrip()
class QueryPlugin(APRSDPluginBase):
"""Query command."""
version = "1.0"
command_regex = r"^\?.*"
command_name = "query"
def command(self, fromcall, message, ack):
LOG.info("Query COMMAND")
tracker = messaging.MsgTrack()
reply = "Pending Messages ({})".format(len(tracker))
return reply
class TimePlugin(APRSDPluginBase): class TimePlugin(APRSDPluginBase):
"""Time command.""" """Time command."""