GNOME Bugzilla – Bug 403797
RFE: allow save path to be based on subject line
Last modified: 2011-02-19 18:23:38 UTC
I would like to see the ability to save attachments to a pathname based on the subject line, eg. a %s option similar to %g and %G substitutions in the save dialog. This is a bit trickier than it sounds, given the variety of software and subject-line conventions used by posters. This could be a reasonable approach for cutting down the subject line into something that's useful as a pathname component: - Strip out the attachment filename (i suspect this could be the hardest part, as we don't yet have the yEnc header when path expansion is done) - Strip out anything resembling multi-part info (File X of Y, [X/Y], [XofY], etc.) - Replace any illegal characters
Created attachment 81872 [details] [review] proof of concept patch against 0.122 Here is an extremely rough patch against 0.122. I don't think anyone could get this approach to work 100% reliably. Would a reasonable approximation be considered good enough? It works well for me, but i guess it depends which groups you frequent. You'll need to add -lpcrecpp to pan_LDADD in pan/gui/Makefile. I'm not messing with autotools for a lousy PoC. :-)
Not a bad start. I guess maybe the thing to do would be to move this up into a higher library like usenet-utils so that we could make unit tests that throw a lot of Subject headers at it to see where it breaks.
As an aside, I'm trying to keep Pan's prerequisite list as short as possible. It would be nicer to do this in pcre without requiring the c++ bindings...
Hi, I'm using this patch, too, presently with Pan svn r207 running on Darwin/OSX (will get it up to r211 asap). I specify <blah>/%s/%g in the download dir string, and it does a decent job at separating & grouping the attachments. I found that this patch didn't handle the filenames coming from NZBs. Such files were literally downloaded to the <blah>/%s/%g subdirs, creating them verbatimly. ;) The main reason to support the % substitutions in this regard comes from several NZB-generating services such as http://binsearch.info/ , which can insert many collections of Usenet postings, even unrelated ones, into a single (large) .nzb file. It'd be nice if Pan could separate & group these, too, in the same manner. Thank you for spending time on these kinds of enhancements, they will give several Mac newsreaders some serious competition. :)
I've put a modified version of this into my repo at github. I've moved the main function into text-massager.cc and I added a few test subject lines to text-massager-test.cc. Currently the 'tests' are just outputting the input & output of the function.
Merged into GNOME master. This problem has been fixed in our software repository. The fix will go into the next software release. Thank you for your bug report.