Browse Source

Zulip to reference the word 'stream' and not 'channel' (#330)

pull/334/head
Chris Caron 4 years ago committed by GitHub
parent
commit
f68c414801
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
  1. 2
      README.md
  2. 18
      apprise/plugins/NotifyZulip.py
  3. 4
      test/test_rest_plugins.py

2
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<br />xbmc://user@hostname<br />xbmc://user:password@hostname:port
| [XMPP](https://github.com/caronc/apprise/wiki/Notify_xmpp) | xmpp:// or xmpps:// | (TCP) 5222 or 5223 | xmpp://password@hostname<br />xmpp://user:password@hostname<br />xmpps://user:password@hostname:port?jid=user@hostname/resource<br/>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<br />zulip://botname@Organization/Token/Channel<br />zulip://botname@Organization/Token/Email
| [Zulip Chat](https://github.com/caronc/apprise/wiki/Notify_zulip) | zulip:// | (TCP) 443 | zulip://botname@Organization/Token<br />zulip://botname@Organization/Token/Stream<br />zulip://botname@Organization/Token/Email
### SMS Notification Support

18
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<channel>[A-Z0-9_]{1,32})', re.I)
r'#?(?P<stream>[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):
"""

4
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,
}),

Loading…
Cancel
Save