| Commit message (Collapse) | Author | Age | Files | Lines |
| |
|
|
|
|
|
| |
Added Command and Message classes, and use new flexibility in
send_pgp_mime.py.
|
| |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
Now send_pgp_mime.py passes it's unittests again, and it should be
easier to use from be-handle-mail :).
Renamed Mail -> EncryptedMessageFactory, since its role is to generate
message bodies of various types (plain, signed, encrypted, ...)
Separated the header processing from Mail, now you need to
header_from_text()
your header text to create an email.Message which you can use in
EncrypedMessageFactory.sign(), .encrypt(), ... Once you've created
the body message you want, you can attach it to the header with
attach_root(header, root_part)
where both header and root_part are email.Message instances.
Made EncryptedMessageFactory doctests more robust, through the use of
# doctest: +ELLIPSIS, +NORMALIZE_WHITESPACE
which removed the need for the .strip*() methods.
Also added the configurable from_addr and to_addr, which allows you
to run the doctests with successful gpg calls. Just set them to
some address from your private keyring, and pass the passphrase for
that key in to your test via a file (or gpg-agent...)
python send_pgp_mime.py -tP path/to/pasphrase/file
|
|
|
|
|
| |
The goal being to make handling commands differently easier, rather
than just passing off the whole interface to becommands.
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
Also removed "commit after every message" from be-handle-mail,
because
a) not implemented yet
b) don't want to commit spam, since we'd have to find a way to
remove it later.
Suggested future workflow:
* "bzr diff" to poll for activity, blank output = no activity.
* on activity:
1) look at changes
2) remove whatever
3) commit email-interface repo.
4) merge changes into your private repo
* on private repo changes:
* if activity in email-interface repo:
1) deal with email activity as above
* push your private repo onto the email-interface repo
(and update the email repos' working tree, if required)
|
|
|
|
|
|
|
|
|
|
|
|
| |
This required replacing both the codec-wrapped sys.stdin _and_ the raw
sys.__stdin__ with StringIO(stdin). becommands/comment will use only
one or the other depending on the comment's content type.
Caveat: Get_body_type only grabs the body and type of the first
non-mulitpart section, which may not be what the user expects.
Todo: Add multiple comments for each part of a multipart message, like
we do in interfaces/xml/be-mbox-to-xml.
|
|
|
|
| |
This fixes problems with StringIO(None).
|
|
|
|
|
|
| |
Fixes incorrect implementation of _comment_ bodies via stdin in my
wking@drexel.edu-20090718143517-mkd6toxmcoij3qwk
commit.
|
|
|
|
|
| |
This avoids decode-recode issues inside libbe.cmdutil.execute(), as
well as problems due to large comment bodies.
|
| |
|
|
|
|
|
| |
Also restored Makefile target to home (from local), which I'd
accidentally committed two commits ago...
|
|
|
|
|
|
| |
The previous procmail encoding fix failed, because the becommand
execution checks libbe.encoding.get_encoding() on it's own, and got
the procmail encoding. This one works.
|
| |
|
|
|
|
|
|
|
| |
When run by procmail, the encoding returned by
libbe.encoding.get_encoding is ANSI_X3.4-1968, which chokes on unicode
output. I can't think of a more elegant solution than hardcoding in
the default encoding.
|
|
|
|
|
|
|
|
|
|
|
| |
be-handle-mail wants unicode output, since all it's internal
processing is done with unicode. However, the flatten calls in
send_pgp_mime work with the encoded binary string output, and
execute(sendmail, stdin=flatten(msg, to_unicode=True)) fails
with
Exception: u
while executing /usr/sbin/sendmail -t
sendmail: fatal: wking(1001): No recipient addresses found in message header
|
|
|
|
|
|
| |
This keeps the transfer-encoding out of base64 if possible.
Also added a "help" example to interafaces/email/interactive/examples.
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
Now be-handle-mail handles examples/unicode without crashing
cat examples/unicode | ./be-handle-mail -o -l -
But the output email is encoded in base64:
MIME-Version: 1.0
Content-Type: text/plain; charset="utf-8"
Content-Transfer-Encoding: base64
From: BE Bugs <wking@thor.physics.drexel.edu>
To: John Doe <jdoe@example.com>
Date: Sat, 18 Jul 2009 12:22:05 +0000
Subject: [be-bug] Re: show
In-reply-to: <abcd@example.com>
UmVzdWx0cyBvZiBydW5uaW5nOiAoZXhpdCBjb2RlIDApCiAgc2hvdyAKCnN0ZG91dDoKCjw/eG1s
IHZlcnNpb249IjEuMCIgZW5jb2Rpbmc9IlVURi04IiA/Pgo8YnVnPgogIDx1dWlkPmY3Y2NkOTE2
LWI1YzctNDg5MC1hMmUzLThjOGFjZTE3YWUzYTwvdXVpZD4KICA8c2hvcnQtbmFtZT5mN2M8L3No
b3J0LW5hbWU+CiAgPHNldmVyaXR5Pm1pbm9yPC9zZXZlcml0eT4KICA8c3RhdHVzPmZpeGVkPC9z
...
This is perhaps the best we can get out of python < 3.1/2.7, see
http://bugs.python.org/issue1368247
|
| |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
be-handle-mail now gets a bit further on
cat examples/unicode | ./be-handle-mail -o -l - 2>&1 1>/dev/null
It successfully reads in unicode output from the command execution and
successfully prints that output to the log ("-l - 2>&1 1>/dev/null" sets
up the log to be printed to the terminal's stdout). However, it chokes
later on with
responding to John Doe <jdoe@example.com>: show
Traceback (most recent call last):
File "./be-handle-mail", line 274, in <module>
main()
File "./be-handle-mail", line 266, in main
response_email = compose_response(ret, out_text, err_text, info).plain()
File "./be-handle-mail", line 210, in compose_response
LOGFILE.write("\n%s\n\n" % send_pgp_mime.flatten(response_email.plain()))
File "/home/wking/src/fun/be/be.email/interfaces/email/interactive/send_pgp_mime.py", line 165, in flatten
g.flatten(msg)
File "/usr/lib/python2.5/email/generator.py" ...
...
UnicodeEncodeError: 'ascii' codec can't encode character u'\ufffd' in position 2581: ordinal not in
range(128)
|
| |
|
|
|
|
| |
Indeed, be-handle-mail chokes... :(
|
|
|
|
|
| |
The previous setup had been pretty wimpy; now there's a degree of
flexibility.
|
|
|
|
|
| |
With this set-up, be-handle-mail run from its own directory will load
your working-state BE setup, not your system-wide BE installation.
|
|
|
|
|
|
|
| |
At least, it points to the directory where be-handle-mail lives. If
you haven't moved it, that will be somewhere inside the BE repository.
This removes my hardcoded BE_DIR.
|
| |
|
|
|
|
| |
Everything seems to be working now. On to the remote tests ;).
|
| |
|
| |
|
| |
|
|
|
|
|
| |
Even though I convert to ascii in send_pgp_mime.Mail.__init__(), it's
still good to be consistent inside each module ;).
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
Although I'm not catching stdout/stderr yet, so the replies aren't
very useful ;). Still it the send_pgp_mime.py interface is working :).
I've added rudimentary logging (via LOGFILE) to keep track of what
be-handle-mail is up to. There's also BE_DIR, which sets the
directory that BE lives in (important ;).
The author handling got more consistent, thanks to
send_pgp_mime.source_email (using the new return_realname option) and
email.utils.formataddr(). Now author_addr should look the same
regardless of which phrasing you use to set it (e.g. "NAME <ADDR>" vs
"ADDR (NAME)", and possibly others.)
|
|
|
|
| |
You might want to keep the output to read later ;).
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
Also:
Switched
email.message_from_string()
to
email.parser.Parser().parsestr()
for parsing the header, for access to the headersonly option.
Adjusted module import order to alphebetize non-mime email modules.
Added return_realname to source_email(), which makes it more useful to
be-handle-mail (currently uncommitted).
Added a doctest for the plain() output and removed redundant
Content-Type line from the doctests (which we'd removed from the
output with the last commit).
Note that many doctests _will_fail_ unless me@big.edu and you@big.edu
are in your gpg keyring. At some point I should make those addresses
options to --test...
|
|
|
|
|
| |
* No reason to set maxheaderlen to something other than the default.
* MIMEText sets content-type and charset automatically.
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
Also a few more tweaks to get things working. I think be-handle-mail
is parsing the incoming messages correctly now, but I'm not getting
replies back for some reason. Some of the adjustments:
* Moved send_pgp_mime -> send_pgp_mime.py, otherwise Python doesn't
recognize it as an importable module.
* I use postfix now instead of msmtp, so send_pgp_mime.sendmail now
points to postfix's sendmail-compatable frontend.
* Added "--mode=plain" option to send_pgp_mime.py, so I can test
my procmail rules and send_pgp_mime itself without worrying about
be-handle-mail.
* Fixed some typos in be-handle-mail.
|
| |
|
| |
|
|
|
|
|
| |
Todo: generate a real response email to replace the current dummy
email.
|
| |
|
|
|
|
|
|
|
|
|
| |
This is a bit of a shameless plug, since there's not much motivation
for encrypting bug emails. However, I've already written it, and it
does send emails, so I'm using it ;). Perhaps some company will want
to keep the bug submitter's contact information securely in a BE
database. Anyhow, there's very little reason to _not_ use PGP, and
the module certainly doesn't force you to encrypt anything. ;)
|
|
|
|
|
|
| |
So far, it parses the emails and executes the specified task.
Todo: email the sender back with the output/errors/exit-status/etc.
|
| |
|
|
|
|
|
|
|
|
|
|
|
| |
The beginnings of an interactive email interface to BE.
With a working procmail setup, copying _procmailrc to ~/.procmailrc
should sort through incoming email to that user, passing all messages
with subjects starting with [be-mail] on to the script be-handle-mail
and deleting the rest.
Now I just need to write be-handle-mail ;).
|
|
one place and make things clearer to the uninitiated. Here's my
current understanding:
.
|-- libbe (the guts of BE)
|-- becommands (plugins for all "be *" commands)
|-- doc (documentation, currently just the man page)
|-- interfaces (non-commandline interface implementations)
| |-- web
| | |-- Bugs-Everywhere-Web (in Turbogears)
| |-- gui
| | |-- beg (in Tkinter)
| | `-- wxbe (in WX)
| |-- email
| `-- xml (xml <-> whatever conversion)
`-- misc (random odds and ends)
`-- completion (shell completion scripts)
Note that I haven't attempted to use the web or gui interfaces in a
while, so I'm not sure how well they're holding vs the core
development.
|