wesnoth_addon_manager: added new --terms flag (prints the server upload terms)
This commit is contained in:
parent
2b01dd8d74
commit
390f21c872
3 changed files with 18 additions and 0 deletions
|
@ -18,6 +18,7 @@
|
|||
### Miscellaneous and Bug Fixes
|
||||
* wesnoth_addon_manager now supports SSL/TLS connection (using the `--secure` flag)
|
||||
* wesnoth_addon_manager now supports IPv6 connection (using the `--ipv6` flag)
|
||||
* Added new command line flag `--terms` to wesnoth_addon_manager (retrieves and prints the add-ons server upload terms)
|
||||
|
||||
## Version 1.17.13
|
||||
### Add-ons client
|
||||
|
|
|
@ -535,4 +535,9 @@ class CampaignClient:
|
|||
sys.stderr.write(i * " " + name + "\n")
|
||||
self.unpackdir(dir, os.path.join(path, name), i + 2, verbose)
|
||||
|
||||
def get_terms(self):
|
||||
request = append_tag(None, "request_terms")
|
||||
self.send_packet(self.make_packet(request))
|
||||
return self.decode(self.read_packet())
|
||||
|
||||
# vim: tabstop=4: shiftwidth=4: expandtab: softtabstop=4: autoindent:
|
||||
|
|
|
@ -94,6 +94,10 @@ if __name__ == "__main__":
|
|||
argumentparser.add_argument("--change-passphrase", nargs=3,
|
||||
metavar=("ADD-ON","OLD","NEW"),
|
||||
help="Change the passphrase for ADD-ON from OLD to NEW")
|
||||
argumentparser.add_argument("--terms", # no short option here
|
||||
action="store_true",
|
||||
help="Retrieves and prints the upload terms from the server "+
|
||||
"(without formatting).")
|
||||
argumentparser.add_argument("-S", "--secure",
|
||||
action="store_true",
|
||||
help="Connect to the add-ons server using SSL/TLS encryption.")
|
||||
|
@ -426,6 +430,14 @@ if __name__ == "__main__":
|
|||
else:
|
||||
sys.stdout.write(" - %s - is installed but not on server.\n" %
|
||||
dirname)
|
||||
elif args.terms:
|
||||
cs = CampaignClient(address, secure=args.secure, ipv6=args.ipv6)
|
||||
data = cs.get_terms()
|
||||
text = data.get_all(tag = "message")[0].get_text_val("message", "")
|
||||
# remove Pango markup
|
||||
text = re.sub(r"<.*?>", "", text)
|
||||
sys.stdout.write(text + "\n")
|
||||
|
||||
elif args.html:
|
||||
pass
|
||||
else:
|
||||
|
|
Loading…
Add table
Reference in a new issue