From 62ce84b3157968bd3b54a80870f6508d0f15d643 Mon Sep 17 00:00:00 2001 From: Hemna Date: Thu, 2 Sep 2021 11:17:15 -0400 Subject: [PATCH] Allow passing in aprsis_client When the admin user users the web ui to send a message a new client instance is created with login credentials for that particular message. This patch ensures that send_direct uses that client. --- aprsd/flask.py | 1 - aprsd/messaging.py | 10 ++++++++-- 2 files changed, 8 insertions(+), 3 deletions(-) diff --git a/aprsd/flask.py b/aprsd/flask.py index 62b8fa9..017b6eb 100644 --- a/aprsd/flask.py +++ b/aprsd/flask.py @@ -162,7 +162,6 @@ class SendMessageThread(threads.APRSDThread): def run(self): LOG.debug("Starting") from_call = self.request["from"] - self.request["password"] to_call = self.request["to"] message = self.request["message"] LOG.info( diff --git a/aprsd/messaging.py b/aprsd/messaging.py index 0fe54f6..751272f 100644 --- a/aprsd/messaging.py +++ b/aprsd/messaging.py @@ -381,7 +381,10 @@ class TextMessage(Message): def send_direct(self, aprsis_client=None): """Send a message without a separate thread.""" - cl = self.get_transport() + if aprsis_client: + cl = aprsis_client + else: + cl = self.get_transport() log_message( "Sending Message Direct", str(self).rstrip("\n"), @@ -501,7 +504,10 @@ class AckMessage(Message): def send_direct(self, aprsis_client=None): """Send an ack message without a separate thread.""" - cl = self.get_transport() + if aprsis_client: + cl = aprsis_client + else: + cl = self.get_transport() log_message( "Sending ack", str(self).rstrip("\n"),