[imp] PATCH: compose.php: quote name, remove signature, show date in
quote
Steve Stavropoulos
steve@math.upatras.gr
Sat Nov 9 22:05:13 2002
The following patch is for imp-3.1/compose.php. I tried to make the
smallest/cleanest possible modifications. The patch does the following:
1) When you reply to a message instead of "Quoting Name <email@domain>:"
it says "Quoting Name:" or if Name doesn't exist "Quoting
<email@domain>:". This is very usefull a) if you reply to a person and
cc a mailing list because the email of the other person doesn't appear
in the body of the mailing list (waiting for the spammers to get it from
the archive) and b) because it doesn't put unnecessary info in the
email.
This is common practice in other mailers, like pine / kmail / mutt /
mozilla mail / ...
2) Removes the signature from the quoted text when replying. A VERY
useful thing which keeps the total length of a mail to sane size. (just
thing of 10-15 succesive replys to a mail with the 3-4 or more lines sig
intact (=30+lines of garbage))
Again, this is common practice in all the mailers I have seen.
3) Prints the date that a message is sent in the reply. The actual quote
line becomes something like this:
On Saturday, 5 November 2002, Steve Stavropoulos wrote:
Extra care has been taken so imp will get to recognize almost any date
format provided in the mail and get only the relevant parts from it.
Also, the localization of this line has been removed! A patch will
follow which will remove the localization of all the lines that
shouldn't be localized... Let me explain that:
Email is about communication between people. People from every corner
of the world, people with different languages. The one language that is
chosen to be the one language that everyone should speak is english, so
when an imp user wants to sent an email we _shouldn't_ assume that he
wants to sent it in the language that he has chosen for the imp
interface. For example Jan Schneider's replies start with a line like
this:
Zitat von Chuck Hagenbuch <chuck@horde.org>:
How many people in here know what "Zitat von" means? I don't. In general
I think that ALL the lines that get put in an email by imp when a user
chooses to compose a mail should be in english, so they can be
understood by all.
Localization is a very good thing, but there are limits! (I will repeat
the localization stuff in the next patch which will be for this)
Please don't reply to this mail about what I say for the localization.
I will repeat it in the next mail with the relevant patch attached.
And now the (small) patch, which is heavily tested in the last months
by my 1000+ users.
--- /home/adm/steve/.//webmail/horde/imp/compose.php Thu Jun 6
01:49:02 2002
+++ imp/compose.php Sat Nov 9 23:12:02 2002
@@ -565,6 +565,9 @@
if (isset($h->from)) {
$qfrom = IMP::addrArray2String($h->from);
+ // Show only the name if there is one
+ if($from_name = rtrim(ereg_replace('([^<]*)<.*>','\\1',$qfrom)))
+ $qfrom = $from_name;
} else {
$qfrom = '<>';
}
@@ -576,12 +579,24 @@
if ($prefs->getValue('reply_quote')) {
$quote_str = "\n" . rtrim($prefs->getValue('quote_prefix')) . ' ';
$msg = findBody($attachments);
+
+ // Remove the signature
+ $parts = preg_split('|(\r\n--\s*\r\n)|', $msg, 2);
+ $msg = $parts[0];
+
$wrap_width = $prefs->getValue('wrap_width') - strlen($quote_str);
if ($wrap_width < 20) {
$wrap_width = 20;
}
$msg = Text::wrap($msg, $wrap_width, $quote_str);
- $msg = _("Quoting") . ' ' . $qfrom . ":\n$quote_str$msg";
+ if (isset($h->date) && $h->date)
+ if(($qdate = strtotime(MIME::decode($h->date)))===-1){
+ $qdate = MIME::decode($h->date);
+ } else {
+ $date_array = getdate($qdate);
+ $qdate = $date_array['weekday'].", ".$date_array['mday']." ".$date_array['month']." ".$date_array['year'];
+ }
+ $msg = "On " . $qdate . ", " . $qfrom . " wrote:\n$quote_str$msg";
$msg .= "\n";
}
More information about the imp
mailing list