MoinMessage

Change of actions/SendMessage.py

43:7ddc1c5c0c72
actions/SendMessage.py
     1.1 --- a/actions/SendMessage.py	Fri Jun 14 01:27:02 2013 +0200
     1.2 +++ b/actions/SendMessage.py	Sat Jun 22 02:08:15 2013 +0200
     1.3 @@ -272,33 +272,37 @@
     1.4          if not recipient_details:
     1.5              return 0, _("The specified recipient is not present in the list of known contacts.")
     1.6  
     1.7 -        parameters = parseDictEntry(recipient_details, ("fingerprint",))
     1.8 +        parameters = parseDictEntry(recipient_details, ("type", "location", "fingerprint",))
     1.9  
    1.10 -        if not parameters.has_key("page") and not parameters.has_key("url"):
    1.11 +        if not parameters.has_key("type"):
    1.12 +            return 0, _("The recipient details are missing a destination type.")
    1.13 +
    1.14 +        if not parameters.has_key("location"):
    1.15              return 0, _("The recipient details are missing a location for sent messages.")
    1.16  
    1.17 -        if parameters.has_key("url") and not parameters.has_key("fingerprint"):
    1.18 +        if parameters.get("type") == "url" and not parameters.has_key("fingerprint"):
    1.19              return 0, _("The recipient details are missing a fingerprint for sending messages.")
    1.20  
    1.21          # Sign, encrypt and send the message.
    1.22  
    1.23          message = message.get_payload()
    1.24 +        type = parameters["type"]
    1.25  
    1.26 -        if not queue and parameters.has_key("url"):
    1.27 +        if not queue and type == "url":
    1.28              try:
    1.29                  if signer:
    1.30                      message = gpg.signMessage(message, signer)
    1.31  
    1.32                  message = gpg.encryptMessage(message, parameters["fingerprint"])
    1.33 -                sendMessage(message, parameters["url"])
    1.34 +                sendMessage(message, parameters["location"])
    1.35  
    1.36              except MoinMessageError, exc:
    1.37                  return 0, "%s: %s" % (_("The message could not be prepared and sent"), exc)
    1.38  
    1.39          # Or queue the message on the specified page.
    1.40  
    1.41 -        elif parameters.has_key("page"):
    1.42 -            page = Page(request, parameters["page"])
    1.43 +        elif type == "page":
    1.44 +            page = Page(request, parameters["location"])
    1.45              outbox = ItemStore(page, "messages", "message-locks")
    1.46              outbox.append(message.as_string())
    1.47