Commit Graph

54 Commits

Author SHA1 Message Date
Hemna d09a66006b Created plugin.py for Command Plugins
This patch adds the new APRSD Command Plugin architecture.
All Comand plugins must implement the same object API, which includes
plugin object is subclass of APRSDPluginBase
version attribute
command_regex attribute
command method

When an APRS command is detected, then the regex is run against
the command.  If the command_regex matches, then the plugin's
command() method will be called.   If the command() method returns
a string, then that string is sent as a reply to the APRS caller.

A new aprs.yml config section is added to support selecting
which plugins to enable.

If you want all plugins enabled, then omit "enabled_plugins" entirely
from the aprs section of the config.

To load custom plugins:
1) create a directory with an __init__.py file
2) Add a plugin.py file that contains your plugin

Look at the exmaples directory for an example plugin.
2020-12-13 20:57:30 -05:00
Hemna 00d99bc2c4 Refactor networking and commands
This patch refactors the socket management
to use select, as well as refactor all of the
commands into a COMMAND_ENVELOPE dictionary.

This patch also adds the Dockerfile and
docker-compose.yml files
2020-12-11 19:29:18 -05:00
Craig Lamparter 43509ea9e6 get rid of some debug statements 2020-12-11 10:23:14 -08:00
Craig Lamparter bb1a2ee61a yet another unicode problem, in resend_email fixed 2020-12-11 09:49:26 -08:00
Craig Lamparter d3bb44feec reset default email check delay to 60, fix a few comments 2020-12-11 06:53:38 -08:00
Hemna 53b8f21535 Update tox environment to fix formatting python errors
This patch includes lots of changes to tox environment for
automatically detecting pep8 failures, which can cause python2 vs
python3 failures after install.

The following tox commands have been added
tox -efmt-check  - This checks the python syntax and formatting
tox -efmt        - Automatically fixes python syntax formatting that
                   fmt-check complains about.
tox -etype-check - check on types
tox -elint       - flake8 run

This patch also changes where the default config file is located.
The new location is ~/.config/aprsd/aprsd.yml

You can now also specify a custom config file on the command line
with the -c or --config option as well.
2020-12-11 08:47:56 -05:00
Craig Lamparter 2bebd83449 fixed fortune. yet another unicode issue, tested in py3 and py2 2020-12-10 15:54:38 -08:00
Craig Lamparter c5517a7cb5 lose some logging statements 2020-12-10 15:29:29 -08:00
Craig Lamparter 86bf42802c completely off urllib now, tested locate/weather in py2 and py3 2020-12-10 15:15:19 -08:00
Craig Lamparter b38f561b84 add urllib import back until i replace all calls with requests 2020-12-10 12:19:40 -08:00
Craig Lamparter ad0f96d1aa cleaned up weather code after switch to requests ... from urllib. works on py2 and py3 2020-12-10 10:21:31 -08:00
Craig Lamparter 00432cf5bb switch from urlib to requests for weather, tested in py3 and py2. still need to update locate, and all other http calls 2020-12-10 10:11:35 -08:00
Craig Lamparter 4b09fad876 imap tags are unicode in py3. .decode tags 2020-12-10 09:10:59 -08:00
Hemna 50fb090557 Initial conversion to click 2020-12-09 09:47:37 -05:00
craigerl b553987350 Reconnect on socket timeout 2020-12-09 09:40:23 -05:00
Craig Lamparter 735cb3a557 clean up code around closed_socket and reconnect 2020-12-09 09:34:34 -05:00
Hemna 51832ea75e Fixed all pep8 errors and some py3 errors
This introduced the six lib which can translate common
py2 vs py3 incompatibilities.
https://six.readthedocs.io/
2020-12-09 09:31:36 -05:00
craigerl b552f9611f fix check_email_thread to do proper threading, take delay as arg 2020-12-09 09:27:44 -05:00
Craig Lamparter f69f9a2027 found another .decode that didn't include errors='ignore' 2020-12-08 17:07:23 -08:00
Craig Lamparter 90fcb9973b some failed attempts at getting the first txt or html from a multipart message, currently sends the last 2020-12-08 15:31:56 -08:00
Craig Lamparter 3c16149e71 fix parse_email unicode probs by using body.decode(errors='ignore').. again 2020-12-08 15:01:07 -08:00
Craig Lamparter 44228c63b3 fix parse_email unicode probs by using body.decode(errors='ignore') 2020-12-08 14:59:28 -08:00
Craig Lamparter 371a7a08ac clean up code around closed_socket and reconnect 2020-12-08 09:27:24 -08:00
Craig Lamparter e6995c3605 socket timeout 5 minutes 2020-12-07 10:08:21 -08:00
Craig Lamparter 4b67df2907 Detect closed socket, reconnect, with a bit more grace 2020-12-06 12:01:32 -08:00
Craig Lamparter b8f37fac6e can detect closed socket and reconnect now 2020-12-06 11:54:11 -08:00
craigerl 3d7e3a4e54 more debugging messages trying to find rare tight loop in main 2020-12-06 08:59:33 -08:00
craigerl a4faa7614c main loop went into tight loop, more debug prints 2020-12-05 19:23:17 -08:00
craigerl b597228719 main loop went into tight loop, added debug print before every continue 2020-12-05 18:59:58 -08:00
craigerl 3ae7a056b6 George Carlin profanity filter 2020-12-05 12:50:08 -08:00
craigerl cf73add2db added decaying email check timer which resets with activity 2020-12-05 11:30:31 -08:00
Walter A. Boring IV a3813eaf3a
Merge branch 'master' into py3 2020-12-04 16:48:28 -05:00
Hemna 4084ddfe31 Fixed all pep8 errors and some py3 errors
This introduced the six lib which can translate common
py2 vs py3 incompatibilities.
https://six.readthedocs.io/
2020-12-04 16:46:34 -05:00
Hemna 06a63f541e Fixed all pep8 errors and some py3 errors
This introduced the six lib which can translate common
py2 vs py3 incompatibilities.
https://six.readthedocs.io/
2020-12-04 16:43:30 -05:00
craigerl ecd0e8f95e Reconnect on socket timeout 2020-12-04 16:43:12 -05:00
craigerl 5e96706f7a socket reconnect on timeout testing 2020-12-04 16:42:45 -05:00
craigerl 32e146d105 socket timeout of 300 instead of 60 2020-12-04 13:37:29 -08:00
craigerl 766acbb777 Reconnect on socket timeout 2020-12-04 09:43:11 -08:00
craigerl 712d66c389 socket reconnect on timeout testing 2020-12-04 07:21:37 -08:00
Hemna 0c40689743 Fixed all pep8 errors and some py3 errors
This introduced the six lib which can translate common
py2 vs py3 incompatibilities.
https://six.readthedocs.io/
2020-12-04 09:07:32 -05:00
craigerl e171e16854 fix check_email_thread to do proper threading, take delay as arg 2020-12-03 14:48:27 -08:00
craigerl abc63791f1 fix bugs after beautification and yaml config additions. Convert to sockets. case insensitive commands 2020-12-02 12:25:39 -08:00
craigerl 78add91f3c fix INBOX 2020-12-02 09:42:23 -08:00
Walter A. Boring IV d1a50c6559 Added tox support
This patch adds support for tox.  Tox is used to run various
python compliance tests.  This enables pep8 tests, as well as python2
and python3 compatibility as well as coverage and documentation
building.
2019-05-15 20:12:59 +00:00
Walter A. Boring IV da153b64f6 Fixed SMTP settings
This patch reads the SMTP settings from the config.yml now.
Also added a logfile entry to the aprs: section of the config.yml
so the logfile can be placed anywhere.
2018-11-29 14:19:52 -05:00
Walter A. Boring IV bd47a2bdea Created fake_aprs.py
Moved the config parsing to utils, so it's shared with
main.py (aprs) and fake_aprs.py
2018-11-29 13:20:53 -05:00
Walter A. Boring IV 7abc47098b select inbox if gmail server 2018-11-29 10:01:30 -05:00
Walter A. Boring IV a9eb1714c2 removed ASS 2018-11-29 09:33:24 -05:00
Walter A. Boring IV 89d038e93d Added a try block around imap login 2018-11-29 09:30:51 -05:00
Walter A. Boring IV 81d01c3bc6 Added port and fixed telnet user
This patch adds the port to the aprs: section of the config.yml
as well as fixes a possible issue with the user telnet auth command
where the user is a string and the port is an int.  python can't
concatonate a string with an int.
2018-11-29 09:20:15 -05:00