mirror of
				https://github.com/craigerl/aprsd.git
				synced 2025-10-31 12:50:30 -04:00 
			
		
		
		
	Merge pull request #44 from craigerl/optional_email
Allow email to be disabled.
This commit is contained in:
		
						commit
						c686543323
					
				| @ -417,12 +417,17 @@ def server( | ||||
|     setup_logging(config, loglevel, quiet) | ||||
|     LOG.info("APRSD Started version: {}".format(aprsd.__version__)) | ||||
| 
 | ||||
|     # TODO(walt): Make email processing/checking optional? | ||||
|     # Maybe someone only wants this to process messages with plugins only. | ||||
|     valid = email.validate_email_config(config, disable_validation) | ||||
|     if not valid: | ||||
|         LOG.error("Failed to validate email config options") | ||||
|         sys.exit(-1) | ||||
|     email_enabled = config["aprsd"]["email"].get("enabled", False) | ||||
| 
 | ||||
|     if email_enabled: | ||||
|         # TODO(walt): Make email processing/checking optional? | ||||
|         # Maybe someone only wants this to process messages with plugins only. | ||||
|         valid = email.validate_email_config(config, disable_validation) | ||||
|         if not valid: | ||||
|             LOG.error("Failed to validate email config options") | ||||
|             sys.exit(-1) | ||||
|     else: | ||||
|         LOG.info("Email services not enabled.") | ||||
| 
 | ||||
|     # Create the initial PM singleton and Register plugins | ||||
|     plugin_manager = plugin.PluginManager(config) | ||||
| @ -448,8 +453,11 @@ def server( | ||||
| 
 | ||||
|     rx_thread = threads.APRSDRXThread(msg_queues=msg_queues, config=config) | ||||
|     tx_thread = threads.APRSDTXThread(msg_queues=msg_queues, config=config) | ||||
|     email_thread = email.APRSDEmailThread(msg_queues=msg_queues, config=config) | ||||
|     email_thread.start() | ||||
| 
 | ||||
|     if email_enabled: | ||||
|         email_thread = email.APRSDEmailThread(msg_queues=msg_queues, config=config) | ||||
|         email_thread.start() | ||||
| 
 | ||||
|     rx_thread.start() | ||||
|     tx_thread.start() | ||||
| 
 | ||||
|  | ||||
| @ -21,6 +21,9 @@ class EmailPlugin(plugin.APRSDPluginBase): | ||||
|     def command(self, fromcall, message, ack): | ||||
|         LOG.info("Email COMMAND") | ||||
|         reply = None | ||||
|         if not self.config["aprsd"]["email"].get("enabled", False): | ||||
|             LOG.debug("Email is not enabled in config file ignoring.") | ||||
|             return "Email not enabled." | ||||
| 
 | ||||
|         searchstring = "^" + self.config["ham"]["callsign"] + ".*" | ||||
|         # only I can do email | ||||
|  | ||||
		Loading…
	
	
			
			x
			
			
		
	
		Reference in New Issue
	
	Block a user