# HG changeset patch # User Paul Boddie # Date 1371859695 -7200 # Node ID 7ddc1c5c0c727d512f69d84e4bd517322f33f11e # Parent 9faccbc450fd73a9e2b927319d7e7cb6bb56e8a3 Reverted to a single location per recipient. diff -r 9faccbc450fd -r 7ddc1c5c0c72 README.txt --- a/README.txt Fri Jun 14 01:27:02 2013 +0200 +++ b/README.txt Sat Jun 22 02:08:15 2013 +0200 @@ -142,20 +142,16 @@ by the MoinMessageRecipientsDict page is a WikiDict having the following general format: - recipient:: location ... [ fingerprint ] - -Locations are specified as follows: + recipient:: type location [ fingerprint ] - type=value - -Where the type is "page", the accompanying value must be a page name +Where the type is "page", the accompanying location must be a page name indicating a page that provides a message store that will accept messages. -Where the type is "url", the accompanying value must be a URL that must itself -refer to a resource that can accept MoinMessage content. +Where the type is "url", the accompanying location must be a URL that must +itself refer to a resource that can accept MoinMessage content. -Where a location of type "url" has been given, a fingerprint must accompany -this information in order to encrypt messages sent to the specified resource. +Where a type of "url" has been given, a fingerprint must accompany this +information in order to encrypt messages sent to the specified resource. Each fingerprint corresponds to a key used by the Wiki to encrypt messages and by the remote site (as identified by the URL) to decrypt messages. diff -r 9faccbc450fd -r 7ddc1c5c0c72 actions/SendMessage.py --- a/actions/SendMessage.py Fri Jun 14 01:27:02 2013 +0200 +++ b/actions/SendMessage.py Sat Jun 22 02:08:15 2013 +0200 @@ -272,33 +272,37 @@ if not recipient_details: return 0, _("The specified recipient is not present in the list of known contacts.") - parameters = parseDictEntry(recipient_details, ("fingerprint",)) + parameters = parseDictEntry(recipient_details, ("type", "location", "fingerprint",)) - if not parameters.has_key("page") and not parameters.has_key("url"): + if not parameters.has_key("type"): + return 0, _("The recipient details are missing a destination type.") + + if not parameters.has_key("location"): return 0, _("The recipient details are missing a location for sent messages.") - if parameters.has_key("url") and not parameters.has_key("fingerprint"): + if parameters.get("type") == "url" and not parameters.has_key("fingerprint"): return 0, _("The recipient details are missing a fingerprint for sending messages.") # Sign, encrypt and send the message. message = message.get_payload() + type = parameters["type"] - if not queue and parameters.has_key("url"): + if not queue and type == "url": try: if signer: message = gpg.signMessage(message, signer) message = gpg.encryptMessage(message, parameters["fingerprint"]) - sendMessage(message, parameters["url"]) + sendMessage(message, parameters["location"]) except MoinMessageError, exc: return 0, "%s: %s" % (_("The message could not be prepared and sent"), exc) # Or queue the message on the specified page. - elif parameters.has_key("page"): - page = Page(request, parameters["page"]) + elif type == "page": + page = Page(request, parameters["location"]) outbox = ItemStore(page, "messages", "message-locks") outbox.append(message.as_string())