mirror of
https://github.com/craigerl/aprsd.git
synced 2025-06-25 21:45:25 -04:00
Merge pull request #7 from hemna/master
Added port and fixed telnet user
This commit is contained in:
commit
3a9fd024aa
@ -89,11 +89,12 @@ args = parser.parse_args()
|
|||||||
def setup_connection():
|
def setup_connection():
|
||||||
global tn
|
global tn
|
||||||
host = CONFIG['aprs']['host']
|
host = CONFIG['aprs']['host']
|
||||||
LOG.debug("Setting up telnet connection to '%s'" % host)
|
port = CONFIG['aprs']['port']
|
||||||
|
LOG.debug("Setting up telnet connection to '%s:%s'" % (host, port))
|
||||||
try:
|
try:
|
||||||
tn = telnetlib.Telnet(host, 14580)
|
tn = telnetlib.Telnet(host, port)
|
||||||
except Exception, e:
|
except Exception, e:
|
||||||
LOG.critical("Telnet session failed.\n", e)
|
LOG.exception("Telnet session failed.")
|
||||||
sys.exit(-1)
|
sys.exit(-1)
|
||||||
|
|
||||||
|
|
||||||
@ -213,8 +214,13 @@ def check_email_thread():
|
|||||||
(CONFIG['imap']['host'],
|
(CONFIG['imap']['host'],
|
||||||
CONFIG['imap']['login']))
|
CONFIG['imap']['login']))
|
||||||
|
|
||||||
server = IMAPClient(CONFIG['imap']['host'], use_uid=True)
|
try:
|
||||||
|
server = IMAPClient(CONFIG['imap']['host'], use_uid=True, timeout=5)
|
||||||
server.login(CONFIG['imap']['login'], CONFIG['imap']['password'])
|
server.login(CONFIG['imap']['login'], CONFIG['imap']['password'])
|
||||||
|
except Exception:
|
||||||
|
LOG.exception("Failed to login with IMAP server")
|
||||||
|
return
|
||||||
|
|
||||||
# select_info = server.select_folder('INBOX')
|
# select_info = server.select_folder('INBOX')
|
||||||
|
|
||||||
messages = server.search(['SINCE', today])
|
messages = server.search(['SINCE', today])
|
||||||
@ -430,6 +436,7 @@ def parse_config(args):
|
|||||||
check_option(config, 'aprs', 'login')
|
check_option(config, 'aprs', 'login')
|
||||||
check_option(config, 'aprs', 'password')
|
check_option(config, 'aprs', 'password')
|
||||||
check_option(config, 'aprs', 'host')
|
check_option(config, 'aprs', 'host')
|
||||||
|
check_option(config, 'aprs', 'port')
|
||||||
check_option(config, 'imap', 'host')
|
check_option(config, 'imap', 'host')
|
||||||
check_option(config, 'imap', 'login')
|
check_option(config, 'imap', 'login')
|
||||||
check_option(config, 'imap', 'password')
|
check_option(config, 'imap', 'password')
|
||||||
@ -453,17 +460,19 @@ def main(args=args):
|
|||||||
user = CONFIG['aprs']['login']
|
user = CONFIG['aprs']['login']
|
||||||
password = CONFIG['aprs']['password']
|
password = CONFIG['aprs']['password']
|
||||||
LOG.info("LOGIN to APRSD with user '%s'" % user)
|
LOG.info("LOGIN to APRSD with user '%s'" % user)
|
||||||
tn.write("user " + user + " pass " + password + " vers aprsd 0.99\n" )
|
tn.write("user %s pass %s vers aprsd 0.99\n" % (user, password) )
|
||||||
time.sleep(2)
|
time.sleep(2)
|
||||||
|
|
||||||
check_email_thread() # start email reader thread
|
check_email_thread() # start email reader thread
|
||||||
|
|
||||||
|
LOG.info("Start main loop")
|
||||||
while True:
|
while True:
|
||||||
line = ""
|
line = ""
|
||||||
try:
|
try:
|
||||||
for char in tn.read_until("\n",100):
|
for char in tn.read_until("\n",100):
|
||||||
line = line + char
|
line = line + char
|
||||||
line = line.replace('\n', '')
|
line = line.replace('\n', '')
|
||||||
|
print("ASS LINE %s" % line)
|
||||||
LOG.info(line)
|
LOG.info(line)
|
||||||
searchstring = '::' + user
|
searchstring = '::' + user
|
||||||
# is aprs message to us, not beacon, status, etc
|
# is aprs message to us, not beacon, status, etc
|
||||||
|
@ -14,6 +14,7 @@ aprs:
|
|||||||
login: someusername
|
login: someusername
|
||||||
password: password
|
password: password
|
||||||
host: noam.aprs2.net
|
host: noam.aprs2.net
|
||||||
|
port: 14580
|
||||||
|
|
||||||
shortcuts:
|
shortcuts:
|
||||||
'aa': '5551239999@vtext.com'
|
'aa': '5551239999@vtext.com'
|
||||||
|
Loading…
x
Reference in New Issue
Block a user