decoding file names of MIME attachments

2010-10-12 Thread Dan Drake
Hello,

I'm wondering if there's any way to get Mutt to decode the filenames of
attachments. Here's a bit from an attachment I received today:

Content-Type: application/octet-stream; 
name="=?EUC-KR?B?MjAxMbq9ILCzvLOxs7D6uPEoRSkueGxz?="
Content-Transfer-Encoding: base64
Content-Disposition: attachment; 
filename="=?EUC-KR?B?MjAxMbq9ILCzvLOxs7D6uPEoRSkueGxz?="

Here's the actual filename, which you can find using Python:

>>> from email.header import decode_header
>>> decode_header('=?EUC-KR?B?MjAxMbq9ILCzvLOxs7D6uPEoRSkueGxz?=')
[('2011\xba\xbd \xb0\xb3\xbc\xb3\xb1\xb3\xb0\xfa\xb8\xf1(E).xls',
'euc-kr')]
>>> unicode('2011\xba\xbd
>>> \xb0\xb3\xbc\xb3\xb1\xb3\xb0\xfa\xb8\xf1(E).xls', 'euc-kr')
u'2011\ubd04 \uac1c\uc124\uad50\uacfc\ubaa9(E).xls'

Mutt seems to think that the filename is literally =?EUC-KR?B...=, so it
can't guess to open the file with a spreadsheet program. Also, if I try
to save the attachment, it doesn't decode the filename, and I wind up
saving a file literally named =?EUC-KR... which isn't very useful.

Mutt already decodes such things in the headers of emails -- how can I
get Mutt to do that decoding of the file name of an attachment?

Thanks,

Dan

--
---  Dan Drake
-  http://mathsci.kaist.ac.kr/~drake
---


signature.asc
Description: Digital signature


Re: decoding file names of MIME attachments

2010-10-12 Thread Dan Drake
On Wed, 13 Oct 2010 at 10:41AM +0900, Dan Drake wrote:
> I'm wondering if there's any way to get Mutt to decode the filenames of
> attachments. Here's a bit from an attachment I received today:

Whoops...I just looked in the archives for this list, and noticed that just
yesterday there was a message answering my question (the "Strange
Attachment Names" thread). Putting

set rfc2047_parameters=yes

into my .muttrc does exactly what I want.

Sorry for the noise.

Dan

--
---  Dan Drake
-  http://mathsci.kaist.ac.kr/~drake
---


signature.asc
Description: Digital signature


header cache not so useful when new messages added to Maildir?

2010-10-25 Thread Dan Drake
Hello,

I use mailfilter to, well, filter my mail, and it puts a copy of
(much of) my incoming mail into a Maildir mailbox called "received".
Right now, this mailbox has nearly 700 messages, and opening it takes a
long time.

I started using the headercache feature to speed this up, and was
initially delighted at how fast it was. But I've discovered that when
the mailbox gets new messages, Mutt ignores the outdated header cache and
rereads everything. Since this mailbox gets new mail often, the header
cache is almost always out of date (unless I visit the mailbox twice in
one session) and is actually not very helpful.

Is there any way to optimize this? It seems a bit silly to need to
reread all 700 messages when a single new message has been added. Is
there a way to make this work better, or to get Mutt to intelligently
combine the existing cache while reading in the small number of new
messages?

Thanks,

Dan

--
---  Dan Drake
-  http://mathsci.kaist.ac.kr/~drake
---


signature.asc
Description: Digital signature


Re: header cache not so useful when new messages added to Maildir?

2010-10-26 Thread Dan Drake
On Tue, 26 Oct 2010 at 10:48AM +0530, Raghavendra Prabhu wrote:
> I have also seen similar behavior. To alleviate it, I started using
> tokyo cabinet as the default backend (from gdbm). Speedup is/was truly
> surprising for me. For initial cache file buildup it took nearly the
> same time, however for subsequent updates (the case you are
> describing), I noticed a lot of difference, that I think distro
> maintainers should also start using it in their builds .

I don't think the backend is the problem here. When I wasn't using the
header cache, loading the mailbox would take several seconds, while Mutt
read in all the messages. Now, with the cache, when opening the mailbox
after messages have been added, the behavior appears exactly the same. I
think Mutt figures out that the cache is outdated and completely ignores
it.

I'd like Mutt to use cache for the 99% of the messages which haven't
changed, and to read in only the new ones. Is this possible?

> Another reason which  I heard on #mutt, was that using sidebar can
> significant slowdown in maildir reading. I am not sure of the reasons
> behind this but would be happy if someone clears it (or better patches
> it  :-)).

I'm not using the sidebar, so this can't be it. I use the Ubuntu
package. (I'm using Ubuntu 10.10.)

Dan

--
---  Dan Drake
-  http://mathsci.kaist.ac.kr/~drake
---


signature.asc
Description: Digital signature


Re: Hashcash

2011-03-21 Thread Dan Drake
On Mon, 21 Mar 2011 at 09:19AM -0600, Aaron Toponce wrote:
> I've set "edit_headers=yes" in my ~/.muttrc so I can edit the headers
> with Vim, my preferred editor. I can select a new line, then from
> command mode, run "! hashcash -m resource -X -Z 2" to add the line to
> the header, as I've done with this message. Then, I can continue to
> compose my message, save, quit and send.
> 
> Rather than calling the external command manually, I would like to
> automate the process with a macro. So, the macro should be able to
> parse the "To:", "Cc:" and "Bcc:" lines, which would contain a
> comma-separated list of addresses, and run the hashcash command for
> each address, putting each result on its own line. I'm not sure how
> to handle Bcc: addresses, so we can ignore that for the time being.

One idea: write a script (shell, Python, etc) that parses the temp file,
adds the hashcash stuff, and then spawns vim. Then in Mutt, you set your
editor to be that script:

   set editor = my_hashcash_script

The nice thing about that is you can write it using whatever you like,
instead of Vim's scripting language, and perhaps use email parsing
libraries and so on.

Oh, and I love your .signature!

Dan

--
---  Dan Drake
-  http://mathsci.kaist.ac.kr/~drake
---


signature.asc
Description: Digital signature