1.1 --- a/README.txt Fri Jun 14 01:27:02 2013 +0200
1.2 +++ b/README.txt Sat Jun 22 02:08:15 2013 +0200
1.3 @@ -142,20 +142,16 @@
1.4 by the MoinMessageRecipientsDict page is a WikiDict having the following
1.5 general format:
1.6
1.7 - recipient:: location ... [ fingerprint ]
1.8 -
1.9 -Locations are specified as follows:
1.10 + recipient:: type location [ fingerprint ]
1.11
1.12 - type=value
1.13 -
1.14 -Where the type is "page", the accompanying value must be a page name
1.15 +Where the type is "page", the accompanying location must be a page name
1.16 indicating a page that provides a message store that will accept messages.
1.17
1.18 -Where the type is "url", the accompanying value must be a URL that must itself
1.19 -refer to a resource that can accept MoinMessage content.
1.20 +Where the type is "url", the accompanying location must be a URL that must
1.21 +itself refer to a resource that can accept MoinMessage content.
1.22
1.23 -Where a location of type "url" has been given, a fingerprint must accompany
1.24 -this information in order to encrypt messages sent to the specified resource.
1.25 +Where a type of "url" has been given, a fingerprint must accompany this
1.26 +information in order to encrypt messages sent to the specified resource.
1.27
1.28 Each fingerprint corresponds to a key used by the Wiki to encrypt messages and
1.29 by the remote site (as identified by the URL) to decrypt messages.
2.1 --- a/actions/SendMessage.py Fri Jun 14 01:27:02 2013 +0200
2.2 +++ b/actions/SendMessage.py Sat Jun 22 02:08:15 2013 +0200
2.3 @@ -272,33 +272,37 @@
2.4 if not recipient_details:
2.5 return 0, _("The specified recipient is not present in the list of known contacts.")
2.6
2.7 - parameters = parseDictEntry(recipient_details, ("fingerprint",))
2.8 + parameters = parseDictEntry(recipient_details, ("type", "location", "fingerprint",))
2.9
2.10 - if not parameters.has_key("page") and not parameters.has_key("url"):
2.11 + if not parameters.has_key("type"):
2.12 + return 0, _("The recipient details are missing a destination type.")
2.13 +
2.14 + if not parameters.has_key("location"):
2.15 return 0, _("The recipient details are missing a location for sent messages.")
2.16
2.17 - if parameters.has_key("url") and not parameters.has_key("fingerprint"):
2.18 + if parameters.get("type") == "url" and not parameters.has_key("fingerprint"):
2.19 return 0, _("The recipient details are missing a fingerprint for sending messages.")
2.20
2.21 # Sign, encrypt and send the message.
2.22
2.23 message = message.get_payload()
2.24 + type = parameters["type"]
2.25
2.26 - if not queue and parameters.has_key("url"):
2.27 + if not queue and type == "url":
2.28 try:
2.29 if signer:
2.30 message = gpg.signMessage(message, signer)
2.31
2.32 message = gpg.encryptMessage(message, parameters["fingerprint"])
2.33 - sendMessage(message, parameters["url"])
2.34 + sendMessage(message, parameters["location"])
2.35
2.36 except MoinMessageError, exc:
2.37 return 0, "%s: %s" % (_("The message could not be prepared and sent"), exc)
2.38
2.39 # Or queue the message on the specified page.
2.40
2.41 - elif parameters.has_key("page"):
2.42 - page = Page(request, parameters["page"])
2.43 + elif type == "page":
2.44 + page = Page(request, parameters["location"])
2.45 outbox = ItemStore(page, "messages", "message-locks")
2.46 outbox.append(message.as_string())
2.47