From 6727e9dbd9b79077111ad394b8d5fdc66e32a291 Mon Sep 17 00:00:00 2001 From: Tim Abbott Date: Wed, 14 Nov 2012 17:21:46 -0500 Subject: [PATCH] [manual] send_message: Rename recipient/stream fields to 'to'. This commit changes APIs and requires and update of all zephyr mirroring bots to deploy properly. (imported from commit 2672d2d07269379f7a865644aaeb6796d54183e1) --- bots/check-mirroring | 4 ++-- bots/feedback-bot | 2 +- bots/gcal-bot | 2 +- bots/humbug_trac.py | 2 +- bots/zephyr_mirror.py | 10 +++++----- examples/curl-examples | 2 +- examples/send-message | 2 +- 7 files changed, 12 insertions(+), 12 deletions(-) diff --git a/bots/check-mirroring b/bots/check-mirroring index f1352a7..9cbc12a 100755 --- a/bots/check-mirroring +++ b/bots/check-mirroring @@ -59,14 +59,14 @@ if child_pid == 0: humbug_client.send_message({ "type": "private", "content": str(hzkey1), - "recipient": humbug_user, + "to": humbug_user, }); time.sleep(0.2) humbug_client.send_message({ "type": "stream", "subject": "test", "content": str(hzkey2), - "stream": "tabbott-nagios-test", + "to": "tabbott-nagios-test", }); if options.verbose: print "Sent Humbug messages!" diff --git a/bots/feedback-bot b/bots/feedback-bot index 1b2bc85..1845d28 100755 --- a/bots/feedback-bot +++ b/bots/feedback-bot @@ -19,7 +19,7 @@ def forward_message(message): return forwarded_message = { "type": "stream", - "stream": "support", + "to": "support", "subject": "feedback from %s" % message["sender_email"], "content": message["content"], } diff --git a/bots/gcal-bot b/bots/gcal-bot index f48d863..8447caa 100755 --- a/bots/gcal-bot +++ b/bots/gcal-bot @@ -139,7 +139,7 @@ def send_reminders(): humbug.send_message(dict( type = 'private', - recipient = options.user, + to = options.user, content = message)) sent |= keys diff --git a/bots/humbug_trac.py b/bots/humbug_trac.py index 835b2e4..c45df8c 100644 --- a/bots/humbug_trac.py +++ b/bots/humbug_trac.py @@ -41,7 +41,7 @@ def trac_subject(ticket): def send_update(ticket, content): client.send_message({ "type": "stream", - "stream": "trac", + "to": "trac", "content": content, "subject": trac_subject(ticket) }) diff --git a/bots/zephyr_mirror.py b/bots/zephyr_mirror.py index 55e71fa..43b1287 100755 --- a/bots/zephyr_mirror.py +++ b/bots/zephyr_mirror.py @@ -89,15 +89,15 @@ def send_humbug(zeph): if zeph['type'] == 'stream': # Forward messages sent to -c foo -i bar to stream bar subject "instance" if zeph["stream"] == "message": - message['stream'] = zeph['subject'].lower() + message['to'] = zeph['subject'].lower() message['subject'] = "instance %s" % (zeph['subject'],) elif zeph["stream"] == "tabbott-test5": - message['stream'] = zeph['subject'].lower() + message['to'] = zeph['subject'].lower() message['subject'] = "test instance %s" % (zeph['subject'],) else: - message["stream"] = zeph["stream"] + message["to"] = zeph["stream"] else: - message["recipient"] = zeph["recipient"] + message["to"] = zeph["recipient"] message['content'] = unwrap_lines(zeph['content']) if options.test_mode and options.site == DEFAULT_SITE: @@ -109,7 +109,7 @@ def send_humbug(zeph): def send_error_humbug(error_msg): humbug = {"type": "private", "sender": options.user + "@mit.edu", - "recipient": options.user + "@mit.edu", + "to": options.user + "@mit.edu", "content": error_msg, } humbug_client.send_message(humbug) diff --git a/examples/curl-examples b/examples/curl-examples index 3bf35f3..0b3b982 100755 --- a/examples/curl-examples +++ b/examples/curl-examples @@ -5,7 +5,7 @@ curl https://humbughq.com/api/v1/send_message \ -d "api-key=xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx" \ -d "email=tabbott@humbughq.com" \ -d "type=private" -d "content=test" \ - -d "recipient=tabbott@humbughq.com" + -d "to=tabbott@humbughq.com" curl https://humbughq.com/api/v1/get_messages \ -d "api-key=xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx" \ diff --git a/examples/send-message b/examples/send-message index 60276ff..9b434bc 100755 --- a/examples/send-message +++ b/examples/send-message @@ -40,6 +40,6 @@ client = api.common.HumbugAPI(email=options.sender, message_data = { "type": "private", "content": "test", - "recipient": args[0] + "to": args[0], } print client.send_message(message_data)