mirror of
https://github.com/craigerl/aprsd.git
synced 2025-08-05 14:52:28 -04:00
Merge pull request #68 from craigerl/plugins_multiple_msgs
Enable multiple replies for plugins
This commit is contained in:
commit
911730b28a
@ -253,21 +253,35 @@ class APRSDRXThread(APRSDThread):
|
|||||||
try:
|
try:
|
||||||
results = pm.run(packet)
|
results = pm.run(packet)
|
||||||
for reply in results:
|
for reply in results:
|
||||||
found_command = True
|
if isinstance(reply, list):
|
||||||
# A plugin can return a null message flag which signals
|
# one of the plugins wants to send multiple messages
|
||||||
# us that they processed the message correctly, but have
|
found_command = True
|
||||||
# nothing to reply with, so we avoid replying with a usage string
|
for subreply in reply:
|
||||||
if reply is not messaging.NULL_MESSAGE:
|
LOG.debug("Sending '{}'".format(subreply))
|
||||||
LOG.debug("Sending '{}'".format(reply))
|
|
||||||
|
msg = messaging.TextMessage(
|
||||||
|
self.config["aprs"]["login"],
|
||||||
|
fromcall,
|
||||||
|
subreply,
|
||||||
|
)
|
||||||
|
self.msg_queues["tx"].put(msg)
|
||||||
|
|
||||||
msg = messaging.TextMessage(
|
|
||||||
self.config["aprs"]["login"],
|
|
||||||
fromcall,
|
|
||||||
reply,
|
|
||||||
)
|
|
||||||
self.msg_queues["tx"].put(msg)
|
|
||||||
else:
|
else:
|
||||||
LOG.debug("Got NULL MESSAGE from plugin")
|
found_command = True
|
||||||
|
# A plugin can return a null message flag which signals
|
||||||
|
# us that they processed the message correctly, but have
|
||||||
|
# nothing to reply with, so we avoid replying with a usage string
|
||||||
|
if reply is not messaging.NULL_MESSAGE:
|
||||||
|
LOG.debug("Sending '{}'".format(reply))
|
||||||
|
|
||||||
|
msg = messaging.TextMessage(
|
||||||
|
self.config["aprs"]["login"],
|
||||||
|
fromcall,
|
||||||
|
reply,
|
||||||
|
)
|
||||||
|
self.msg_queues["tx"].put(msg)
|
||||||
|
else:
|
||||||
|
LOG.debug("Got NULL MESSAGE from plugin")
|
||||||
|
|
||||||
if not found_command:
|
if not found_command:
|
||||||
plugins = pm.get_msg_plugins()
|
plugins = pm.get_msg_plugins()
|
||||||
|
Loading…
x
Reference in New Issue
Block a user