Commit Graph

26 Commits

Author SHA1 Message Date
Hemna e13ca0061a Convert config to oslo_config
This patch is the initial conversion of the custom config
and config file yaml format to oslo_config's configuration mechanism.

The resulting config format is now an ini type file.

The default location is ~/.config/aprsd/aprsd.conf

This is a backwards incompatible change.  You will have to rebuild
the config file and edit it.

Also any aprsd plugins can now define config options in code and
add an setup.cfg entry_point definition
oslo_config.opts  =
  foo.conf = foo.conf:list_opts
2022-12-24 16:51:40 -05:00
Hemna 4a65f52939 Removed Packet.send()
This patch decouples sending a message from the internals of
the Packet classes.  This allows the rest of the code to use
Packet objects as type hints in methods to enforce Packets
in the plugins.

The send method was moved to a single place in the threads.tx.send()
2022-12-21 16:26:36 -05:00
Hemna 9fc5356456 Removed unused threading code 2022-12-18 09:14:12 -05:00
Hemna bfc0a5a1e9 Cleaned out all references to messaging
The messaging.py now is nothing but a shell that
contains a link to packets.NULL_MESSAGE to help maintain
some backwards compatibility with plugins.

Packets dataclass has fully replaced messaging objects.
2022-12-16 15:58:02 -05:00
Hemna 67a441d443 Updated plugins and plugin interfaces for Packet
This patch updates unit tests as well as the Plugin filter()
interface to accept a packets.Packet object instead of a
packet dictionary.
2022-12-16 15:58:02 -05:00
Hemna d4bf0f1e3c Remove email validation
The package/library being used for email validation is basically
defunct now.
2022-11-25 09:29:41 -05:00
Hemna a62843920a Moved trace.py to utils
This patch moves trace.py to the utils directory
2022-11-23 13:00:36 -05:00
Hemna 6257c9ea90 FIX: logging exceptions
This patch fixes the logging of exceptions in the email
plugin.
2022-01-26 14:39:14 -05:00
Hemna 446484e631 Added new list-plugins command
This patch adds the new list-plugins command that shows the
list of built in plugins for APRSD.
2021-11-12 11:36:22 -05:00
Hemna c8c23e6185 Fixed email connecting to smtp server
Fixed an issue with not passing config in the smtp_connect
2021-10-25 11:12:29 -04:00
Hemna fdc8c0cd66 Increase email delay to +10
This patch updates the increasing of the email check delay to += 10
seconds instead of +1.
2021-10-06 12:12:49 -04:00
Hemna 491644ece6 Added new Config object.
The config object now has builtin dot notation getter with default

config.get("some.path.here", default="Not found")
2021-10-04 15:37:14 -04:00
Hemna a6ed7b894b Fixed email plugin's use of globals
The email plugin was still using globals for tracking
the check_email_delay as well as the config.  This
patch creates a new singleton thread safe mechanism for
check_email_delay with the EmailInfo class.
2021-10-04 11:36:13 -04:00
Hemna 558710d348 Remove some noisy trace in email plugin
This removes the trace decorators from the email login
functions.  They have been stable for a while now.
2021-09-02 10:03:43 -04:00
Hemna 0f6df5fc05 Fixed email validation
This patch adjusts the py3-email-validation usage.  Since we
upgraded to 1.0.2, the signature has changed.  This patch adjusts
the signature usage so it works again.
2021-09-02 09:43:33 -04:00
Hemna ec92b07e31 Silence some log noise
Removed an email thread log at the start of the loop.
Also bumped the Keepalivethread time to 60 seconds
2021-08-25 08:25:36 -04:00
Hemna 61967b5fe8 Removed TXThread
Since all outbound messages have a send() method that starts
a separate there, there really is no reason for the transmit queue
thread at all.  All it did was get a message from the queue and then
call send on it, which would start another thread.  This removes that
intermediate TXThread.   When you want to send a message just call
send() on the message object.
2021-08-24 15:22:50 -04:00
Hemna 8b5f21eece Rebase from master and run gray
This patch is a rebase of master after the introduction
of switching from black to gray code formatting.
2021-08-23 14:08:14 -04:00
Hemna 86777d838c Added threads functions to APRSDPluginBase
This patch updates the APRSDPluginBase class to include
standard methods for allowing plugins to create, start, stop
threads that the plugin might need/use.  Also update the aprsd-dev
to correctly start the threads and stop them for testing plugin
functionality.
Also added more unit tests and fake objects for unit tests.
2021-08-23 13:44:58 -04:00
Hemna 5f4cf89733 Refactor Message processing and MORE
This patch refactors how the recieved message processing happens.
We now handle all incoming packets the same.  Removed the notification
thread to handle the watchlist packets.  This is now done with a
unified plugins architecture that allows different capabilities
via the new plugin structure.  All packets sent to us will be
sent through all of the plugins.  It's the plugins job to decide what to
do with that packet or ignore it.

Email is no longer a special case for the most part.  All email
functions have been migrated to the EmailPlugin, including starting the
EmailThread, which works in the background to check for new emails and
send those to the registered callsign.   The EmailPlugin now starts the
EmailThread itself.

All plugins are now build on the new APRSDPluginBase which has a common
set of features.  The APRSDPluginBase calls self.setup() upon creation,
which allows all plugins to do whatever they want for initiali startup.
The EmailPlugin uses setup() to start the EmailThread if email is
enabled.
2021-08-23 13:43:53 -04:00
Hemna e175f77347 Use Gray instead of Black for code formatting.
The Black code formatter sucks with respect to function
declarations with a lot of params.  Completely unreadable.
2021-08-23 13:32:09 -04:00
Hemna 1a1fcba1c4 Add new watchlist feature
This patch adds a new optional feature called Watch list.
Aprsd will filter IN all aprs packets from a list of callsigns.
APRSD will keep track of the last time a callsign has been seen.
When the configured timeout value has been reached, the next time
a callsign is seen, APRSD will send the next packet from that callsign
through the new notification plugins list.

The new BaseNotifyPlugin is the default core APRSD notify based plugin.
When it gets a packet it will construct a reply message to be sent
to the configured alert callsign to alert them that the seen callsign
is now on the APRS network.

This basically acts as a notification that your watched callsign list is
available on APRS.

The new configuration options:
aprsd:
    watch_list:
        # The callsign to send a message to once a watch list callsign
        # is now seen on APRS-IS
        alert_callsign: NOCALL
        # The time in seconds to wait for notification.
        # The default is 12 hours.
        alert_time_seconds: 43200
        # The list of callsigns to watch for
        callsigns:
          - WB4BOR
          - KFART
        # Enable/disable this feature
        enabled: false
        # The list of notify based plugins to load for
        # processing a new seen packet from a callsign.
        enabled_plugins:
        - aprsd.plugins.notify.BaseNotifyPlugin

This patch also adds a new section in the Admin UI for showing the
watch list and the age of the last seen packet for each callsing since
APRSD startup.
2021-07-16 08:31:38 -04:00
Hemna af48c43eb2 Added tracing facility
You can enable debug tracing iff loglevel == DEBUG AND
config file has aprsd:trace:True
2021-01-29 10:07:49 -05:00
Craig Lamparter 57d768e010 duplicate email messages from RF would generate usage response 2021-01-26 09:18:43 -08:00
Hemna 982f24c5f5 Allow email to be disabled.
The config file defaults to email being off now.  This requires
the user to set the email settings anyway, so the default is off.
2021-01-21 13:50:19 -05:00
Hemna d5a34b4d11 refactor Plugin objects to plugins directory
This patch moves all of the plugins out of plugin.py
into their own separate plugins/<plugin>.py file.  This
makes it easier to maintain each plugin.

NOTE:  You will have to update your ~/.config/aprsd/aprsd.yml

to change the python location path for each plugin enabled.

For example:
OLD:
  enabled_plugins:
   - aprsd.plugin.EmailPlugin

TO NEW
  enabled_plugins:
   - aprsd.plugins.email.EmailPlugin
2021-01-09 10:00:37 -05:00