1.1 --- a/README.txt Sat May 18 01:00:16 2013 +0200
1.2 +++ b/README.txt Thu May 30 21:12:30 2013 +0200
1.3 @@ -118,12 +118,22 @@
1.4 by the MoinMessageRecipientsDict page is a WikiDict having the following
1.5 general format:
1.6
1.7 - recipient:: URL fingerprint
1.8 + recipient:: location ... [ fingerprint ]
1.9 +
1.10 +Locations are specified as follows:
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
1.16 -Each URL must refer to a resource that can accept MoinMessage content.
1.17 +Where the type is "url", the accompanying value must be a URL that must itself
1.18 +refer to a resource that can accept MoinMessage content.
1.19
1.20 -Each fingerprint corresponds to a key used by the remote site (as identified
1.21 -by the URL) for the decryption of messages.
1.22 +Where a location of type "url" has been given, a fingerprint must accompany
1.23 +this information in order to encrypt messages sent to the specified resource.
1.24 +
1.25 +Each fingerprint corresponds to a key used by the Wiki to encrypt messages and
1.26 +by the remote site (as identified by the URL) to decrypt messages.
1.27
1.28 Quick Start: Signing, Encrypting and Sending Messages
1.29 -----------------------------------------------------
2.1 --- a/actions/SendMessage.py Sat May 18 01:00:16 2013 +0200
2.2 +++ b/actions/SendMessage.py Thu May 30 21:12:30 2013 +0200
2.3 @@ -9,6 +9,7 @@
2.4 from MoinMoin.action import ActionBase, AttachFile
2.5 from MoinMoin.formatter import text_html
2.6 from MoinMoin.log import getLogger
2.7 +from MoinMoin.Page import Page
2.8 from MoinMoin import config
2.9 from MoinMessage import GPG, MoinMessageError, Message, sendMessage
2.10 from MoinSupport import *
2.11 @@ -207,27 +208,37 @@
2.12 if not recipient_details:
2.13 return 0, _("The specified recipient is not present in the list of known contacts.")
2.14
2.15 - try:
2.16 - url, fingerprint = recipient_details.split()
2.17 - except ValueError:
2.18 - return 0, _("The recipient details were not in the correct format: url, fingerprint.")
2.19 + parameters = parseDictEntry(recipient_details, ("fingerprint",))
2.20 +
2.21 + if not parameters.has_key("page") and not parameters.has_key("url"):
2.22 + return 0, _("The recipient details are missing a location for sent messages.")
2.23 +
2.24 + if parameters.has_key("url") and not parameters.has_key("fingerprint"):
2.25 + return 0, _("The recipient details are missing a fingerprint for sending messages.")
2.26
2.27 # Sign, encrypt and send the message.
2.28
2.29 message = message.get_payload()
2.30
2.31 - if not queue:
2.32 + if not queue and parameters.has_key("url"):
2.33 try:
2.34 if signer:
2.35 message = gpg.signMessage(message, signer)
2.36
2.37 - message = gpg.encryptMessage(message, fingerprint)
2.38 - sendMessage(message, url)
2.39 + message = gpg.encryptMessage(message, parameters["fingerprint"])
2.40 + sendMessage(message, parameters["url"])
2.41
2.42 except MoinMessageError, exc:
2.43 return 0, "%s: %s" % (_("The message could not be prepared and sent:"), exc)
2.44
2.45 - # Or queue the message.
2.46 + # Or queue the message on the specified page.
2.47 +
2.48 + elif parameters.has_key("page"):
2.49 + page = Page(request, parameters["page"])
2.50 + outbox = ItemStore(page, "messages", "message-locks")
2.51 + outbox.append(message.as_string())
2.52 +
2.53 + # Or queue the message in a special outbox.
2.54
2.55 else:
2.56 outbox = ItemStore(request.page, "outgoing-messages", "outgoing-message-locks")