From 7c9a26f4a33ad2176759c81c45757f4cd10898f0 Mon Sep 17 00:00:00 2001 From: Bob Mottram Date: Sun, 14 Mar 2021 10:28:48 +0000 Subject: [PATCH] Can send DMs to multiple handles --- notifications_client.py | 30 ++++++++++++++++++++++++++++++ 1 file changed, 30 insertions(+) diff --git a/notifications_client.py b/notifications_client.py index 2e9712a86..3b6198e6a 100644 --- a/notifications_client.py +++ b/notifications_client.py @@ -410,6 +410,36 @@ def _notificationNewDM(session, toHandle: str, screenreader: str, systemLanguage: str, espeak) -> None: """Use the notification client to create a new direct message + which can include multiple destination handles + """ + if ' ' in toHandle: + handlesList = toHandle.split(' ') + elif ',' in toHandle: + handlesList = toHandle.split(',') + elif ';' in toHandle: + handlesList = toHandle.split(';') + else: + handlesList = [toHandle] + + for handle in handlesList: + handle = handle.strip() + _notificationNewDMbase(session, handle, + baseDir, nickname, password, + domain, port, httpPrefix, + cachedWebfingers, personCache, + debug, + screenreader, systemLanguage, + espeak) + + +def _notificationNewDMbase(session, toHandle: str, + baseDir: str, nickname: str, password: str, + domain: str, port: int, httpPrefix: str, + cachedWebfingers: {}, personCache: {}, + debug: bool, + screenreader: str, systemLanguage: str, + espeak) -> None: + """Use the notification client to create a new direct message """ toPort = port if '://' in toHandle: