From f68c4148019e0bb909cb2f86e2a534daa3a01174 Mon Sep 17 00:00:00 2001 From: Chris Caron Date: Mon, 14 Dec 2020 18:45:54 -0500 Subject: [PATCH] Zulip to reference the word 'stream' and not 'channel' (#330) --- README.md | 2 +- apprise/plugins/NotifyZulip.py | 18 +++++++++--------- test/test_rest_plugins.py | 4 ++-- 3 files changed, 12 insertions(+), 12 deletions(-) diff --git a/README.md b/README.md index 1e2aca82..d48aee16 100644 --- a/README.md +++ b/README.md @@ -79,7 +79,7 @@ The table below identifies the services this tool supports and some example serv | [XBMC](https://github.com/caronc/apprise/wiki/Notify_xbmc) | xbmc:// or xbmcs:// | (TCP) 8080 or 443 | xbmc://hostname
xbmc://user@hostname
xbmc://user:password@hostname:port | [XMPP](https://github.com/caronc/apprise/wiki/Notify_xmpp) | xmpp:// or xmpps:// | (TCP) 5222 or 5223 | xmpp://password@hostname
xmpp://user:password@hostname
xmpps://user:password@hostname:port?jid=user@hostname/resource
xmpps://password@hostname/target@myhost, target2@myhost/resource | [Webex Teams (Cisco)](https://github.com/caronc/apprise/wiki/Notify_wxteams) | wxteams:// | (TCP) 443 | wxteams://Token -| [Zulip Chat](https://github.com/caronc/apprise/wiki/Notify_zulip) | zulip:// | (TCP) 443 | zulip://botname@Organization/Token
zulip://botname@Organization/Token/Channel
zulip://botname@Organization/Token/Email +| [Zulip Chat](https://github.com/caronc/apprise/wiki/Notify_zulip) | zulip:// | (TCP) 443 | zulip://botname@Organization/Token
zulip://botname@Organization/Token/Stream
zulip://botname@Organization/Token/Email ### SMS Notification Support diff --git a/apprise/plugins/NotifyZulip.py b/apprise/plugins/NotifyZulip.py index 2290efb0..80ca9422 100644 --- a/apprise/plugins/NotifyZulip.py +++ b/apprise/plugins/NotifyZulip.py @@ -77,12 +77,12 @@ ZULIP_HTTP_ERROR_MAP = { 401: 'Unauthorized - Invalid Token.', } -# Used to break path apart into list of channels +# Used to break path apart into list of streams TARGET_LIST_DELIM = re.compile(r'[ \t\r\n,#\\/]+') -# Used to detect a channel +# Used to detect a streams IS_VALID_TARGET_RE = re.compile( - r'#?(?P[A-Z0-9_]{1,32})', re.I) + r'#?(?P[A-Z0-9_]{1,32})', re.I) class NotifyZulip(NotifyBase): @@ -142,8 +142,8 @@ class NotifyZulip(NotifyBase): 'type': 'string', 'map_to': 'targets', }, - 'target_channel': { - 'name': _('Target Channel'), + 'target_stream': { + 'name': _('Target Stream'), 'type': 'string', 'map_to': 'targets', }, @@ -164,8 +164,8 @@ class NotifyZulip(NotifyBase): # if one isn't defined in the apprise url default_hostname = 'zulipchat.com' - # The default channel to notify if no targets are specified - default_notification_channel = 'general' + # The default stream to notify if no targets are specified + default_notification_stream = 'general' def __init__(self, botname, organization, token, targets=None, **kwargs): """ @@ -218,8 +218,8 @@ class NotifyZulip(NotifyBase): self.targets = parse_list(targets) if len(self.targets) == 0: - # No channels identified, use default - self.targets.append(self.default_notification_channel) + # No streams identified, use default + self.targets.append(self.default_notification_stream) def send(self, body, title='', notify_type=NotifyType.INFO, **kwargs): """ diff --git a/test/test_rest_plugins.py b/test/test_rest_plugins.py index 02d4ab93..d5f88fcc 100644 --- a/test/test_rest_plugins.py +++ b/test/test_rest_plugins.py @@ -4825,11 +4825,11 @@ TEST_URLS = ( ('zulip://botname@apprise.zulipchat.com/{}'.format('a' * 32), { 'instance': plugins.NotifyZulip, }), - # Valid everything - 2 channels specified + # Valid everything - 2 streams specified ('zulip://botname@apprise/{}/channel1/channel2'.format('a' * 32), { 'instance': plugins.NotifyZulip, }), - # Valid everything - 2 channels specified (using to=) + # Valid everything - 2 streams specified (using to=) ('zulip://botname@apprise/{}/?to=channel1/channel2'.format('a' * 32), { 'instance': plugins.NotifyZulip, }),