mirror of
https://github.com/craigerl/aprsd.git
synced 2024-11-17 22:01:49 -05:00
Enable multiple replies for plugins
This patch adds the ability for plugins to send multiple messages back in response to a command/message. The plugin simple needs to return a list of messages (Strings). Each string in that list will result in a separate message being sent back to the originator of the message.
This commit is contained in:
parent
840c8a990e
commit
349250685b
@ -253,6 +253,20 @@ class APRSDRXThread(APRSDThread):
|
||||
try:
|
||||
results = pm.run(packet)
|
||||
for reply in results:
|
||||
if isinstance(reply, list):
|
||||
# one of the plugins wants to send multiple messages
|
||||
found_command = True
|
||||
for subreply in reply:
|
||||
LOG.debug("Sending '{}'".format(subreply))
|
||||
|
||||
msg = messaging.TextMessage(
|
||||
self.config["aprs"]["login"],
|
||||
fromcall,
|
||||
subreply,
|
||||
)
|
||||
self.msg_queues["tx"].put(msg)
|
||||
|
||||
else:
|
||||
found_command = True
|
||||
# A plugin can return a null message flag which signals
|
||||
# us that they processed the message correctly, but have
|
||||
|
Loading…
Reference in New Issue
Block a user