From 28f3daf6d07e82ccb77ebd985726790ebc4cd854 Mon Sep 17 00:00:00 2001 From: Hemna Date: Wed, 30 Dec 2020 08:13:26 -0500 Subject: [PATCH] Added QueryPlugin Query Plugin looks for ^/?.* and currently only responds with the list of pending messages in the MsgTrack queue. --- aprsd/plugin.py | 17 +++++++++++++++++ 1 file changed, 17 insertions(+) diff --git a/aprsd/plugin.py b/aprsd/plugin.py index 1969af2..9e69103 100644 --- a/aprsd/plugin.py +++ b/aprsd/plugin.py @@ -31,6 +31,7 @@ CORE_PLUGINS = [ "aprsd.plugin.FortunePlugin", "aprsd.plugin.LocationPlugin", "aprsd.plugin.PingPlugin", + "aprsd.plugin.QueryPlugin", "aprsd.plugin.TimePlugin", "aprsd.plugin.WeatherPlugin", "aprsd.plugin.VersionPlugin", @@ -353,6 +354,22 @@ class PingPlugin(APRSDPluginBase): 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): """Time command."""