From c20623b841469fd4f778671942b20c90477487a5 Mon Sep 17 00:00:00 2001 From: Tim Abbott Date: Sat, 19 Sep 2015 18:12:02 -0700 Subject: [PATCH] Change API example usernames to use example.com domain. (imported from commit 41b7be58735df0ea3d3a3daf23bc0f78606abc0d) --- bots/irc-mirror.py | 14 ++++++++------ examples/list-subscriptions | 2 +- examples/print-events | 2 +- examples/print-messages | 2 +- examples/print-next-message | 2 +- examples/subscribe | 4 ++-- examples/unsubscribe | 4 ++-- 7 files changed, 16 insertions(+), 14 deletions(-) diff --git a/bots/irc-mirror.py b/bots/irc-mirror.py index 9742969..b5102ad 100644 --- a/bots/irc-mirror.py +++ b/bots/irc-mirror.py @@ -12,9 +12,11 @@ from irc.client import ip_numstr_to_quad, ip_quad_to_numstr import zulip import optparse +IRC_DOMAIN = "irc.example.com" + def zulip_sender(sender_string): nick = sender_string.split("!")[0] - return nick + "@irc.zulip.com" + return nick + "@" + IRC_DOMAIN class IRCBot(irc.bot.SingleServerIRCBot): def __init__(self, channel, nickname, server, port=6667): @@ -47,14 +49,14 @@ class IRCBot(irc.bot.SingleServerIRCBot): def on_privmsg(self, c, e): content = e.arguments[0] sender = zulip_sender(e.source) - if sender.endswith("_zulip@irc.zulip.com"): + if sender.endswith("_zulip@" + IRC_DOMAIN): return # Forward the PM to Zulip print zulip_client.send_message({ "sender": sender, "type": "private", - "to": "tabbott@zulip.com", + "to": "username@example.com", "content": content, }) @@ -62,7 +64,7 @@ class IRCBot(irc.bot.SingleServerIRCBot): content = e.arguments[0] stream = e.target sender = zulip_sender(e.source) - if sender.endswith("_zulip@irc.zulip.com"): + if sender.endswith("_zulip@" + IRC_DOMAIN): return # Forward the stream message to Zulip @@ -94,8 +96,8 @@ usage = """python irc-mirror.py --server=IRC_SERVER --channel= --nick-p Example: -python irc-mirror.py --irc-server=127.0.0.1 --channel='#test' --nick-prefix=tabbott - --site=https://staging.zulip.com --user=irc-bot@zulip.com +python irc-mirror.py --irc-server=127.0.0.1 --channel='#test' --nick-prefix=username + --site=https://zulip.example.com --user=irc-bot@example.com --api-key=xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx Note that "_zulip" will be automatically appended to the IRC nick provided diff --git a/examples/list-subscriptions b/examples/list-subscriptions index 4d674fc..67d26b9 100755 --- a/examples/list-subscriptions +++ b/examples/list-subscriptions @@ -29,7 +29,7 @@ usage = """list-subscriptions --user= --api-key= --api-key= [ Prints out certain events received by the indicated bot or user matching the filter below. -Example: print-events --user=tabbott@zulip.com --api-key=a0b1c2d3e4f5a6b7c8d9e0f1a2b3c4d5 +Example: print-events --user=username@example.com --api-key=a0b1c2d3e4f5a6b7c8d9e0f1a2b3c4d5 You can omit --user and --api-key arguments if you have a properly set up ~/.zuliprc """ diff --git a/examples/print-messages b/examples/print-messages index d8077ff..eda3503 100755 --- a/examples/print-messages +++ b/examples/print-messages @@ -29,7 +29,7 @@ usage = """print-messages --user= --api-key= Prints out each message received by the indicated bot or user. -Example: print-messages --user=tabbott@zulip.com --api-key=a0b1c2d3e4f5a6b7c8d9e0f1a2b3c4d5 +Example: print-messages --user=username@example.com --api-key=a0b1c2d3e4f5a6b7c8d9e0f1a2b3c4d5 You can omit --user and --api-key arguments if you have a properly set up ~/.zuliprc """ diff --git a/examples/print-next-message b/examples/print-next-message index e6334a3..901a19a 100755 --- a/examples/print-next-message +++ b/examples/print-next-message @@ -29,7 +29,7 @@ usage = """print-next-message --user= --api-key= --api-key= [opt Ensures the user is subscribed to the listed streams. -Examples: subscribe --user=tabbott@zulip.com --api-key=a0b1c2d3e4f5a6b7c8d9e0f1a2b3c4d5 --streams=foo - subscribe --user=tabbott@zulip.com --api-key=a0b1c2d3e4f5a6b7c8d9e0f1a2b3c4d5 --streams='foo bar' +Examples: subscribe --user=username@example.com --api-key=a0b1c2d3e4f5a6b7c8d9e0f1a2b3c4d5 --streams=foo + subscribe --user=username@example.com --api-key=a0b1c2d3e4f5a6b7c8d9e0f1a2b3c4d5 --streams='foo bar' You can omit --user and --api-key arguments if you have a properly set up ~/.zuliprc """ diff --git a/examples/unsubscribe b/examples/unsubscribe index d2e1b86..4e9d69a 100755 --- a/examples/unsubscribe +++ b/examples/unsubscribe @@ -29,8 +29,8 @@ usage = """unsubscribe --user= --api-key= [ Ensures the user is not subscribed to the listed streams. -Examples: unsubscribe --user=tabbott@zulip.com --api-key=a0b1c2d3e4f5a6b7c8d9e0f1a2b3c4d5 --streams=foo - unsubscribe --user=tabbott@zulip.com --api-key=a0b1c2d3e4f5a6b7c8d9e0f1a2b3c4d5 --streams='foo bar' +Examples: unsubscribe --user=username@example.com --api-key=a0b1c2d3e4f5a6b7c8d9e0f1a2b3c4d5 --streams=foo + unsubscribe --user=username@example.com --api-key=a0b1c2d3e4f5a6b7c8d9e0f1a2b3c4d5 --streams='foo bar' You can omit --user and --api-key arguments if you have a properly set up ~/.zuliprc """