From 8412effa6daecbc1c0613a9eb5bb0787fc057448 Mon Sep 17 00:00:00 2001 From: Morgan McMillian Date: Tue, 3 Jan 2023 15:01:01 -0800 Subject: [PATCH] fixed enabled field type for services table --- clacksme/clacksme.py | 10 ++++------ clacksme/model.py | 2 +- 2 files changed, 5 insertions(+), 7 deletions(-) diff --git a/clacksme/clacksme.py b/clacksme/clacksme.py index 47783bd..fe65cf0 100644 --- a/clacksme/clacksme.py +++ b/clacksme/clacksme.py @@ -96,19 +96,16 @@ class MailboxNotifier(object): def on_notify(self): self.log.info("Triggering notifications") - text = f"New messages have been recieved at {self.mailbox.imap_user}" + text = f"New messages have been received at {self.mailbox.imap_user}" targets = Services.select().where(Services.user == self.mailbox.user) for target in targets: if target.service == "pushover" and target.enabled: self.send_pushover(target.target, text) - elif target.service == "mattermost" and target.enabled: + if target.service == "mattermost" and target.enabled: self.send_mattermost(target.target, text) - else: - self.log.info("unknown notifiaction service") - def send_pushover(self, po_user, text): notifier = Notifier.get(Notifier.service == "pushover") url = "https://api.pushover.net/1/messages.json" @@ -179,7 +176,8 @@ def main(): for mailbox in Mailbox.select(): imap_process = MailboxNotifier(mailbox) p = Process( - target=imap_process.start, name=mailbox.user, args=(log_queue,event_queue,)) + target=imap_process.start, name=mailbox.user, + args=(log_queue,event_queue,)) processes.append(p) p.daemon = True p.start() diff --git a/clacksme/model.py b/clacksme/model.py index cca1996..a26593c 100644 --- a/clacksme/model.py +++ b/clacksme/model.py @@ -37,7 +37,7 @@ class Services(BaseModel): user = CharField() service = CharField() target = CharField() - enabled = CharField(default=True) + enabled = BooleanField(default=True) def create_tables(): tables = [System, Mailbox, Events, Notifier, Services]