On 10/18/07, Ajeet <[EMAIL PROTECTED]> wrote:
> Hi All,
>
> I have just joined the list and I apologize if this is a repost.
>
> I just finished setting up mairix, and it seems pretty good. In particular, I
> like the feature that I can view flagged messages from all the mailboxes in
> one list. One feature that I think would be nice to have, is the ability to
> make the changes to the flag stick to the original mailbox. For example, if I
> unflag/ flag a message in the search result (which is a temp mailbox), the
> corresponding changes should be visible in the original mailbox.
>
> Does anyone know if there is some existing script that does this?
I have an extremely ugly script to do this. It deserves to be written
in something other than bash, but it evolved from something smaller.
The interesting part is:
out=$tmpdir/results.$$
mkdir $out
cd $out
trap "cd / ; rm -rf $out" EXIT
mairix -f $HOME/.mairixrc.search $flags -o $out $args 2>&1 | grep
-v "^Created directory"
# .before contains "[EMAIL PROTECTED]@targetname"
find -type l -printf '[EMAIL PROTECTED]@%l\n' | sort > .before
mutt -n -e "bind index q quit; bind index,pager s noop" -f $out
if [ $? -eq 0 ]; then
# after contains "[EMAIL PROTECTED]"
# for status changes, we want to apply the difference between the
# status field of oldlinkname and newlinkname to targetname.
# for deletions, after will be empty, and we'll just get before. in
# that case, we want to delete targetname.
# the first line handles cur->cur status changes, the second
# new->cur, and the third deletions. files shouldn't move from cur
# to new, and we ignore new files.
find -type l -printf '[EMAIL PROTECTED]' | sort | \
join -t@ -a1 .before - | \
sed -ne '
[EMAIL PROTECTED](\./cur/[^:]*\):\([EMAIL
PROTECTED])@\(.*\)/cur/\([^:]*\):[EMAIL PROTECTED]:\(.*\)$+cd
\3 \&\& mv cur/\4:\2 cur/\4:\5+p
[EMAIL PROTECTED]/new/\([EMAIL PROTECTED])@\(.*\)/new/\([EMAIL
PROTECTED])@\./cur/\1:\(.*\)$+cd
\2 \&\& mv new/\3 cur/\3:\4+p
[EMAIL PROTECTED]@[EMAIL PROTECTED]([EMAIL PROTECTED])$+rm \1+p
' | \
grep -v ' mv \(.*\) \1$' > .cmds
if [ -s .cmds ]; then
echo -n "You made `grep -c '^cd' .cmds` status changes and "
echo "`grep -c '^rm' .cmds` deletions."
d=''
while [ -z "$d" ]; do
read -p "Apply [a]ll/[s]tatus changes/[n]one? " -n1 yn
echo
case $yn in
a) sh -v .cmds ; d=1;;
s) grep '^cd' .cmds | sh -v ; d=1;;
n) d=1 ;;
esac
done
fi
fi
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.
--David
-------------------------------------------------------------------------
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
[email protected]
https://lists.sourceforge.net/lists/listinfo/mairix-users