[Dovecot] Retrieve Physical Message Filename

Tony Rutherford tony at bluetie.com
Wed Dec 30 22:08:41 EET 2009


Timo,

Wow..very strange on the linefeeds.

I implemented your suggestion with no problems easy enough.  Thanks for chiming in, I just didn't want to reinvent the wheel if it already existed.

Regards,
Tony



-----Original Message-----
From: dovecot-bounces+tony=bluetie.com at dovecot.org [mailto:dovecot-bounces+tony=bluetie.com at dovecot.org] On Behalf Of Timo Sirainen
Sent: Wednesday, December 30, 2009 11:47 AM
To: Tony Rutherford
Cc: dovecot at dovecot.org
Subject: Re: [Dovecot] Retrieve Physical Message Filename

On Wed, 2009-12-30 at 09:23 -0500, Tony Rutherford wrote:
> Thanks for the reply.  I won't be changing any files, or even accessing them, i'll simply be passing the filename along to "another system".  I'm not allowed to change this other system or any of its interfaces.  The other system has been in place and is "off limits" as far as changes go (I'm told). To make it simple, this other system needs to be notified of any flag changes on emails.  So, when we detect a flag change (in our plugin), we need to pass the message filename along to this other system.  I hope this makes sense...and again...i'm not justifying the need for it, but I have to play the hand i'm dealt....Tony RutherfordSoftware EngineerBlueTie Inc.arutherford at bluetie.com(585) 586-2000 x1040-----Original Message-----From: "Timo Sirainen" [tss at iki.fi]Date: 12/29/2009 04:02 PMTo: "Tony Rutherford" CC: dovecot at dovecot.orgSubject: Re: [Dovecot] Retrieve Physical Message FilenameOn Tue, 2009-12-29 at 15:50 -0500, Tony Rutherford wrote: > Hi,Using Dovecot 1.2.9 with Maildir and Layout=FS.In a plugin, i'm > overriding "update_flags":void my_mail_update_flags(struct mail > *_mail, enum modify_type modify_type, enum mail_flags flags)For this > email which is having its flags updated, I need to retrieve the > physical filename of the message.  I see where > using:mail_get_special(_mail, MAIL_FETCH_UIDL_FILE_NAME,  &fname);...I > can retrieve part of the filename, but without the ":2" and the flags > part.Is there a method I can use to get the whole filename (without > having to reassemble it myself).  I've looked around, and I'm guessing > it exists, but I don't see it offhand.  The problem is that by the time you're trying to access the file, its flags may have already changed, which also means its filename could have changed. So even if you got it, your code would probably randomly fail.  What exactly are you going to do with the filename? Maybe you should instead be opening the file with mail_get_stream() and doing something with the fd.  

Something's really screwed up in your linefeeds. That whole thing shows up in a single line.

Anyway, there's really no good way to get the current filename. I think the best way to handle it would be to just generate the flags and add them to the base filename.





More information about the dovecot mailing list