2018-04-21 07:30:08 +00:00
|
|
|
from __future__ import absolute_import, print_function, unicode_literals
|
|
|
|
|
2017-04-03 21:23:03 +00:00
|
|
|
|
2017-05-12 20:12:36 +00:00
|
|
|
def handle_welcome(welcome, relay_url, my_version, stderr):
|
|
|
|
if "motd" in welcome:
|
|
|
|
motd_lines = welcome["motd"].splitlines()
|
|
|
|
motd_formatted = "\n ".join(motd_lines)
|
2018-04-21 07:30:08 +00:00
|
|
|
print(
|
|
|
|
"Server (at %s) says:\n %s" % (relay_url, motd_formatted),
|
|
|
|
file=stderr)
|
2017-04-03 21:23:03 +00:00
|
|
|
|
2017-05-12 20:12:36 +00:00
|
|
|
# Only warn if we're running a release version (e.g. 0.0.6, not
|
|
|
|
# 0.0.6+DISTANCE.gHASH). Only warn once.
|
2018-06-16 23:22:14 +00:00
|
|
|
if (("current_cli_version" in welcome and
|
|
|
|
"+" not in my_version and
|
|
|
|
welcome["current_cli_version"] != my_version)):
|
2018-04-21 07:30:08 +00:00
|
|
|
print(
|
|
|
|
("Warning: errors may occur unless both sides are running the"
|
|
|
|
" same version"),
|
|
|
|
file=stderr)
|
|
|
|
print(
|
|
|
|
"Server claims %s is current, but ours is %s" %
|
|
|
|
(welcome["current_cli_version"], my_version),
|
|
|
|
file=stderr)
|