check welcome message 'send' too

This commit is contained in:
Brian Warner 2015-11-23 16:33:09 -08:00
parent 1db485d493
commit 82cdadae80
2 changed files with 7 additions and 0 deletions

View File

@ -68,6 +68,8 @@ class Channel:
timeout=self._timeout)
r.raise_for_status()
resp = r.json()
if "welcome" in resp:
self._handle_welcome(resp["welcome"])
self._add_inbound_messages(resp["messages"])
def get_first_of(self, phases):

View File

@ -106,6 +106,11 @@ class Channel:
"phase": phase,
"body": hexlify(msg).decode("ascii")}
d = post_json(self._agent, self._relay_url+"add", payload)
def _maybe_handle_welcome(resp):
if "welcome" in resp:
self._handle_welcome(resp["welcome"])
return resp
d.addCallback(_maybe_handle_welcome)
d.addCallback(lambda resp: self._add_inbound_messages(resp["messages"]))
return d