Hi,
I have attached the script I came up with. I noticed the same problem with
broken links. So I make a call to mairix to re-index after I am done. This
makes it slightly sluggish. Currently the script only syncs the 'F' flag. Also
it works only for maildirs (both search folder and original).
On Thu, 18 Oct 2007 12:46:02 -0700, David Reiss wrote:
> The one downside is that the renamed files will appear to be missing
> until the next re-index. If you do rewrite this in a reasonable
> language, please post it here.
--
Regards,
Ajeet
#! /usr/bin/python
import os,sys,re
from stat import *
def matchFlag(filename, flag):
p = re.compile('^.*:2,.*'+flag+'.*')
m = p.match(filename)
if m:
return True
else:
return False
print "Syncing message flags with search results"
base = "/home/ajeet/Mail/mairix-search/"
dirs = [base+"cur/", base+"new/"]
for dir in dirs:
files = os.listdir(dir)
for fil in files:
linkpath = dir+fil;
if os.path.islink(dir+fil):
realpath = os.path.realpath(dir+fil);
rm = os.stat(realpath)[ST_CTIME];
lm = os.lstat(dir+fil)[ST_CTIME];
if (rm < lm):
if (matchFlag(realpath, 'F') and not
matchFlag(linkpath, 'F')):
i = realpath.rfind('F')
renamepath = realpath[:i]+realpath[i+1:]
print ' Changing ' + realpath + ' to '
+ renamepath
os.rename(realpath, renamepath)
os.unlink(linkpath)
os.symlink(renamepath, linkpath)
elif (not matchFlag(realpath, 'F') and
matchFlag(linkpath, 'F')):
renamepath = realpath+'F'
print ' Changing ' + realpath + ' to '
+ renamepath
os.rename(realpath, renamepath)
os.unlink(linkpath)
os.symlink(renamepath, linkpath)
os.system('mairix -F');
-------------------------------------------------------------------------
This SF.net email is sponsored by: Splunk Inc.
Still grepping through log files to find problems? Stop.
Now Search log events and configuration files using AJAX and a browser.
Download your FREE copy of Splunk now >> http://get.splunk.com/
_______________________________________________
Mairix-users mailing list
Mairix-users@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/mairix-users