# HG changeset patch # User Paul Boddie # Date 1389134912 -3600 # Node ID b032cd91ba36abe43653f038f2750ea260eb1a57 # Parent a046e82a4f573582e5e269f4f01fd98995c8996f Added metadata to sent files for proper MoinMessage compliance. Added copyright and licensing information. diff -r a046e82a4f57 -r b032cd91ba36 scripts/getfiles.py --- a/scripts/getfiles.py Tue Jan 07 23:47:15 2014 +0100 +++ b/scripts/getfiles.py Tue Jan 07 23:48:32 2014 +0100 @@ -1,4 +1,10 @@ -#!/usr/bin/env python +# -*- coding: iso-8859-1 -*- +""" + getfiles - Obtain files using MoinMessage + + @copyright: 2013, 2014 by Paul Boddie + @license: GNU GPL (v2 or later), see COPYING.txt for details. +""" from MoinMessage import * from email.mime.application import MIMEApplication diff -r a046e82a4f57 -r b032cd91ba36 scripts/sendfiles.py --- a/scripts/sendfiles.py Tue Jan 07 23:47:15 2014 +0100 +++ b/scripts/sendfiles.py Tue Jan 07 23:48:32 2014 +0100 @@ -1,6 +1,12 @@ -#!/usr/bin/env python +# -*- coding: iso-8859-1 -*- +""" + sendfiles - Send files using MoinMessage -from MoinMessage import Message, GPG, sendMessage + @copyright: 2013, 2014 by Paul Boddie + @license: GNU GPL (v2 or later), see COPYING.txt for details. +""" + +from MoinMessage import Message, GPG, sendMessage, timestamp from email.mime.application import MIMEApplication from os.path import split import sys @@ -40,14 +46,18 @@ # Get the e-mail message itself. - message = message.get_payload() + email_message = message.get_payload() # Encrypt, sign and send the message. gpg = GPG() - message = gpg.encryptMessage(message, recipient) - message = gpg.signMessage(message, signer) - resp = sendMessage(message, url) + encrypted_message = gpg.encryptMessage(email_message, recipient) + + timestamp(encrypted_message) + encrypted_message["Update-Action"] = "store" + message_to_send = gpg.signMessage(encrypted_message, signer) + + resp = sendMessage(message_to_send, url) print resp