Turn quote-level highlighting and signature dimming into user prefs
Marcus I. Ryan
marcus@riboflavin.net
Thu, 21 Mar 2002 16:06:58 -0600
Here's a patch...see subject. Basically it adds the preferences to
prefs.php.dist and then encloses the appropriate code in text.php in if
statements...
diff -ru imp.orig/config/prefs.php.dist imp/config/prefs.php.dist
--- imp.orig/config/prefs.php.dist Thu Mar 21 09:53:13 2002
+++ imp/config/prefs.php.dist Thu Mar 21 16:04:30 2002
@@ -68,7 +68,8 @@
'label' => _("Display Options"),
'desc' => _("Change display options such as the color scheme, how
many messages you see on each page and how messages are sorted."),
'members' => array('sortby', 'sortdir', 'max_msgs', 'num_words',
- 'nav_expanded', 'show_legend', 'theme')
+ 'nav_expanded', 'show_legend', 'theme',
+ 'highlight_text', 'dim_signature')
);
$prefGroups['compose'] = array(
@@ -551,6 +552,24 @@
'lightblue' => _("Light Blue"),
'orange' => _("Orange")),
'desc' => _("Select your color scheme.")
+);
+
+// should we try to mark different conversations with different colors?
+$_prefs['highlight_text'] = array(
+ 'value' => 1,
+ 'locked' => false,
+ 'shared' => false,
+ 'type' => 'checkbox',
+ 'desc' => _("Mark different levels of quoting with different colors?")
+);
+
+// should we dim signatures?
+$_prefs['dim_signature'] = array(
+ 'value' => 1,
+ 'locked' => false,
+ 'shared' => false,
+ 'type' => 'checkbox',
+ 'desc' => _("Dim signatures?")
);
// list of folders to expand by default
diff -ru imp.orig/lib/MIME/Viewer/text.php imp/lib/MIME/Viewer/text.php
--- imp.orig/lib/MIME/Viewer/text.php Thu Mar 21 16:00:57 2002
+++ imp/lib/MIME/Viewer/text.php Thu Mar 21 15:38:53 2002
@@ -48,20 +48,24 @@
$text = str_replace('</A>', '</a>', $text); // only
reconvert capital /A tags - the ones we generated
// highlight quoted parts of an email
- $text = implode("\r\n", preg_replace('|^(\s*>.+)$|', '<span
class="quoted1">\1</span>', explode("\r\n", $text)));
- $indent = 1;
- while (preg_match('|>(\s?>){' . $indent . '}|', $text)) {
- $text = implode("\r\n", preg_replace('|^<span
class="quoted' . ((($indent - 1) % 5) + 1) . '">(\s*>(\s?>){' .
$indent . '}.+)$|', '<span class="quoted' . (($indent % 5) + 1) .
'">\1', explode("\r\n", $text)));
- $indent++;
+ if ($prefs->getValue('highlight_text')) {
+ $text = implode("\r\n", preg_replace('|^(\s*>.+)$|',
'<span class="quoted1">\1</span>', explode("\r\n", $text)));
+ $indent = 1;
+ while (preg_match('|>(\s?>){' . $indent . '}|', $text)) {
+ $text = implode("\r\n", preg_replace('|^<span
class="quoted' . ((($indent - 1) % 5) + 1) . '">(\s*>(\s?>){' .
$indent . '}.+)$|', '<span class="quoted' . (($indent % 5) + 1) .
'">\1', explode("\r\n", $text)));
+ $indent++;
+ }
}
// dim signatures
- $parts = preg_split('|(\r\n--\s*\r\n)|', $text, 2,
PREG_SPLIT_DELIM_CAPTURE);
- $text = array_shift($parts);
- if (count($parts)) {
- $text .= '<span class="signature">' . $parts[0];
- $text .= preg_replace('|class="[^"]+"|',
'class="signature-fixed"', $parts[1]);
- $text .= '</span>';
+ if ($prefs->getValue('dim_signature')) {
+ $parts = preg_split('|(\r\n--\s*\r\n)|', $text, 2,
PREG_SPLIT_DELIM_CAPTURE);
+ $text = array_shift($parts);
+ if (count($parts)) {
+ $text .= '<span class="signature">' . $parts[0];
+ $text .= preg_replace('|class="[^"]+"|',
'class="signature-fixed"', $parts[1]);
+ $text .= '</span>';
+ }
}
// filter bad language
--
Marcus I. Ryan, marcus@riboflavin.net
-----------------------------------------------------------------------
"Love is a snowmobile racing across the tundra and then suddenly it
flips over, pinning you underneath. At night, the ice weasels come."
-- Matt Groening
-----------------------------------------------------------------------