mirror of
				https://github.com/craigerl/aprsd.git
				synced 2025-11-03 21:20:23 -05:00 
			
		
		
		
	Enabled some emailthread messages and added timestamp
This patch re-enables some log.debug messages for email, to ensure we can see emailthread is running correctly. Also adds a timestamp to the query pending messages, so radios don't think it's a duplicate message.
This commit is contained in:
		
							parent
							
								
									7486770bdc
								
							
						
					
					
						commit
						d81bfd6fd5
					
				@ -343,6 +343,8 @@ class APRSDEmailThread(threads.APRSDThread):
 | 
				
			|||||||
    def run(self):
 | 
					    def run(self):
 | 
				
			||||||
        global check_email_delay
 | 
					        global check_email_delay
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					        LOG.debug("Starting")
 | 
				
			||||||
 | 
					
 | 
				
			||||||
        check_email_delay = 60
 | 
					        check_email_delay = 60
 | 
				
			||||||
        past = datetime.datetime.now()
 | 
					        past = datetime.datetime.now()
 | 
				
			||||||
        while not self.thread_stop:
 | 
					        while not self.thread_stop:
 | 
				
			||||||
@ -358,7 +360,7 @@ class APRSDEmailThread(threads.APRSDThread):
 | 
				
			|||||||
                # any send/receive/resend activity will reset this to 60 seconds
 | 
					                # any send/receive/resend activity will reset this to 60 seconds
 | 
				
			||||||
                if check_email_delay < 300:
 | 
					                if check_email_delay < 300:
 | 
				
			||||||
                    check_email_delay += 1
 | 
					                    check_email_delay += 1
 | 
				
			||||||
                # LOG.debug("check_email_delay is " + str(check_email_delay) + " seconds")
 | 
					                LOG.debug("check_email_delay is " + str(check_email_delay) + " seconds")
 | 
				
			||||||
 | 
					
 | 
				
			||||||
                shortcuts = CONFIG["shortcuts"]
 | 
					                shortcuts = CONFIG["shortcuts"]
 | 
				
			||||||
                # swap key/value
 | 
					                # swap key/value
 | 
				
			||||||
@ -380,7 +382,7 @@ class APRSDEmailThread(threads.APRSDThread):
 | 
				
			|||||||
                    continue
 | 
					                    continue
 | 
				
			||||||
 | 
					
 | 
				
			||||||
                messages = server.search(["SINCE", today])
 | 
					                messages = server.search(["SINCE", today])
 | 
				
			||||||
                # LOG.debug("{} messages received today".format(len(messages)))
 | 
					                LOG.debug("{} messages received today".format(len(messages)))
 | 
				
			||||||
 | 
					
 | 
				
			||||||
                for msgid, data in server.fetch(messages, ["ENVELOPE"]).items():
 | 
					                for msgid, data in server.fetch(messages, ["ENVELOPE"]).items():
 | 
				
			||||||
                    envelope = data[b"ENVELOPE"]
 | 
					                    envelope = data[b"ENVELOPE"]
 | 
				
			||||||
@ -413,7 +415,6 @@ class APRSDEmailThread(threads.APRSDThread):
 | 
				
			|||||||
                            from_addr = shortcuts_inverted[from_addr]
 | 
					                            from_addr = shortcuts_inverted[from_addr]
 | 
				
			||||||
 | 
					
 | 
				
			||||||
                        reply = "-" + from_addr + " " + body.decode(errors="ignore")
 | 
					                        reply = "-" + from_addr + " " + body.decode(errors="ignore")
 | 
				
			||||||
                        # messaging.send_message(CONFIG["ham"]["callsign"], reply)
 | 
					 | 
				
			||||||
                        msg = messaging.TextMessage(
 | 
					                        msg = messaging.TextMessage(
 | 
				
			||||||
                            self.config["aprs"]["login"],
 | 
					                            self.config["aprs"]["login"],
 | 
				
			||||||
                            self.config["ham"]["callsign"],
 | 
					                            self.config["ham"]["callsign"],
 | 
				
			||||||
 | 
				
			|||||||
@ -1,3 +1,4 @@
 | 
				
			|||||||
 | 
					import datetime
 | 
				
			||||||
import logging
 | 
					import logging
 | 
				
			||||||
import re
 | 
					import re
 | 
				
			||||||
 | 
					
 | 
				
			||||||
@ -17,7 +18,11 @@ class QueryPlugin(plugin.APRSDPluginBase):
 | 
				
			|||||||
        LOG.info("Query COMMAND")
 | 
					        LOG.info("Query COMMAND")
 | 
				
			||||||
 | 
					
 | 
				
			||||||
        tracker = messaging.MsgTrack()
 | 
					        tracker = messaging.MsgTrack()
 | 
				
			||||||
        reply = "Pending messages ({})".format(len(tracker))
 | 
					        now = datetime.datetime.now()
 | 
				
			||||||
 | 
					        reply = "Pending messages ({}) {}".format(
 | 
				
			||||||
 | 
					            len(tracker),
 | 
				
			||||||
 | 
					            now.strftime("%H:%M:%S"),
 | 
				
			||||||
 | 
					        )
 | 
				
			||||||
 | 
					
 | 
				
			||||||
        searchstring = "^" + self.config["ham"]["callsign"] + ".*"
 | 
					        searchstring = "^" + self.config["ham"]["callsign"] + ".*"
 | 
				
			||||||
        # only I can do admin commands
 | 
					        # only I can do admin commands
 | 
				
			||||||
 | 
				
			|||||||
		Loading…
	
	
			
			x
			
			
		
	
		Reference in New Issue
	
	Block a user