[prev in list] [next in list] [prev in thread] [next in thread]
List: evolution
Subject: [Evolution] Changing quotation character.
From: B S Srinidhi <srinidhi-evo () deeproot ! co ! in>
Date: 2005-10-26 11:15:35
Message-ID: 1130324615.17533.3.camel () srinidhi ! com
[Download RAW message or body]
Hello all,
For a long time, I wanted to change the quote character '>', with
something else. I waited for the support to come, but now I decided to
come up with a script that would do this for me.
I've attached a small script that changes the quote character to '|--'
if its a new message. If the message is a reply, then this script
changes the quote character to the first eight characters of the
sender's name (picked from the citation :)
Setup:
~~~~~~
This is what I've done for one of the accounts. I've set the "Server
Type" in "Sending Options", to "Sendmail". I then
(sym)linked /usr/sbin/sendmail to point to this script.
Assumptions:
~~~~~~~~~~~~
* mess822 package [1] is installed. A couple of (careful) grep
statements should take care of this.
* qmail is installed. Changing the 'qmail-inject' line should
solve the problem.
:)
Things to do:
~~~~~~~~~~~~~
I'm still learning shell scripting. Need to improve on the following
things:
* I'm assuming that any first character that is '>' should be
replaced. This is not a 'cool' solution. You could have that
symbol in the first column in your message (or reply) or
attachment (???) too.
* I'm using DJBs mess822 package [1] to get the "From:" address. I
don't know how to grep only the headers of the email.
* I need to find a better way to find the name from the citation.
Please comment on this script and help me in fixing the above. :)
Hope this script proves to be helpful for someone else too. :)
Srinidhi.
[1] http://cr.yp.to/mess822.html
~~~
Why do they call a fast a fast, when it goes so slow?
~~~
Now listening to Title: Chuck Berry - My Ding-A-Ling [live]
["change_quote.sh" (change_quote.sh)]
#!/bin/sh
FILE=`mktemp /tmp/evo.XXXXXX`
cat > $FILE
# Is this message a reply?
name=`cat $FILE | grep "^On" | grep "wrote:$" | cut -d',' -f3 | cut -b2-8`
if [ -z "$name" ]
then
# No? Then just replace '>' with '|--'
sed -i -e s/^\>/\|\-\-/g $FILE
else
# Replace '>' with the name of the sender
quote="`echo $name\>`"
sed -i -e s/^\>/"$quote"/g $FILE
fi
# Extract the 'From:' field
email_id=`cat $FILE | 822field "From:"`
# Now figure out the envelope sender. I know it looks ugly, but works.
# Didn't want to use 'cut' ;)
INDEX=`expr index "$email_id" '<'`
STRLEN=`expr index "$email_id" '>'`
INDEX=`expr $INDEX + 1`
LENGTH=`expr $STRLEN - $INDEX`
MAIL_FROM=`expr substr "$email_id" $INDEX $LENGTH`
cat $FILE | /var/qmail/bin/qmail-inject -f"$MAIL_FROM"
_______________________________________________
Evolution-list mailing list
Evolution-list@gnome.org
http://mail.gnome.org/mailman/listinfo/evolution-list
[prev in list] [next in list] [prev in thread] [next in thread]
Configure |
About |
News |
Add a list |
Sponsored by KoreLogic