mirror of
https://github.com/craigerl/aprsd.git
synced 2024-11-26 18:08:36 -05:00
Merge 1334eded62
into f265e8f354
This commit is contained in:
commit
c0e17c1f1e
@ -136,6 +136,11 @@ aprsd_opts = [
|
|||||||
default=True,
|
default=True,
|
||||||
help="Set this to False, to disable logging of packets to the log file.",
|
help="Set this to False, to disable logging of packets to the log file.",
|
||||||
),
|
),
|
||||||
|
cfg.BoolOpt(
|
||||||
|
"load_help_plugin",
|
||||||
|
default=True,
|
||||||
|
help="Set this to False to disable the help plugin.",
|
||||||
|
),
|
||||||
]
|
]
|
||||||
|
|
||||||
watch_list_opts = [
|
watch_list_opts = [
|
||||||
|
@ -472,9 +472,13 @@ class PluginManager:
|
|||||||
del self._pluggy_pm
|
del self._pluggy_pm
|
||||||
self.setup_plugins()
|
self.setup_plugins()
|
||||||
|
|
||||||
def setup_plugins(self, load_help_plugin=True):
|
def setup_plugins(self, load_help_plugin=None):
|
||||||
"""Create the plugin manager and register plugins."""
|
"""Create the plugin manager and register plugins."""
|
||||||
|
|
||||||
|
# If load_help_plugin is not specified, load it from the config
|
||||||
|
if load_help_plugin is None:
|
||||||
|
load_help_plugin = CONF.load_help_plugin
|
||||||
|
|
||||||
LOG.info("Loading APRSD Plugins")
|
LOG.info("Loading APRSD Plugins")
|
||||||
# Help plugin is always enabled.
|
# Help plugin is always enabled.
|
||||||
if load_help_plugin:
|
if load_help_plugin:
|
||||||
|
@ -328,8 +328,22 @@ class APRSDPluginProcessPacketThread(APRSDProcessPacketThread):
|
|||||||
# If the message was for us and we didn't have a
|
# If the message was for us and we didn't have a
|
||||||
# response, then we send a usage statement.
|
# response, then we send a usage statement.
|
||||||
if to_call == CONF.callsign and not replied:
|
if to_call == CONF.callsign and not replied:
|
||||||
LOG.warning("Sending help!")
|
|
||||||
message_text = "Unknown command! Send 'help' message for help"
|
# Is the help plugin installed?
|
||||||
|
help_available = False
|
||||||
|
for p in pm.get_message_plugins():
|
||||||
|
if isinstance(p, plugin.HelpPlugin):
|
||||||
|
help_available = True
|
||||||
|
break
|
||||||
|
|
||||||
|
# Tailor the messages accordingly
|
||||||
|
if help_available:
|
||||||
|
LOG.warning("Sending help!")
|
||||||
|
message_text = "Unknown command! Send 'help' message for help"
|
||||||
|
else:
|
||||||
|
LOG.warning("Unknown command!")
|
||||||
|
message_text = "Unknown command!"
|
||||||
|
|
||||||
tx.send(
|
tx.send(
|
||||||
packets.MessagePacket(
|
packets.MessagePacket(
|
||||||
from_call=CONF.callsign,
|
from_call=CONF.callsign,
|
||||||
|
Loading…
Reference in New Issue
Block a user