Only in drupal/modules/bbcode: .bbcode-filter.inc.swp
Only in drupal/modules/bbcode: .bbcode.module.swp
diff -r -u drupal_orig/modules/bbcode/README drupal/modules/bbcode/README
--- drupal_orig/modules/bbcode/README	2004-08-16 21:26:37.000000000 +0200
+++ drupal/modules/bbcode/README	2004-08-30 11:07:55.000000000 +0200
@@ -22,11 +22,12 @@
 Configuration
 ------------------------------------------------------------------------------
 
-This module needs no configuration. When enabled it filters all text
-displayed - you can turn it off by disabling the module. If you would
-like to use BBCode as a replacement for HTML, you should set Drupal to
-use the "Escape HTML" filter such that no HTML tags are allowed in posts,
-only BBCode tags.
+  - You can enable javascript encoding of emails in the configuration page
+    of the module.
+  - You can use bbcode filter by enabling it in an input format
+  - If you would like to use BBCode as a replacement for HTML, you should
+    set Drupal to use the "Filtered HTML" with escape tags setting along
+    with bbcode filter.
 
 Credits / Contact
 ------------------------------------------------------------------------------
@@ -34,6 +35,7 @@
 The original author of this module is Alastair Maw, who can be reached at
 drupal-bbcode[at]almaw.com. Gabor Hojtsy (goba[at]php.net) also contributed
 to the module and is the active maintainer.
+Javascript encoding of emails by László Bácsi (lackac[at]math.bme.hu).
 
 TODO
 ------------------------------------------------------------------------------
diff -r -u drupal_orig/modules/bbcode/bbcode-filter.inc drupal/modules/bbcode/bbcode-filter.inc
--- drupal_orig/modules/bbcode/bbcode-filter.inc	2004-08-30 11:09:51.000000000 +0200
+++ drupal/modules/bbcode/bbcode-filter.inc	2004-08-30 10:46:51.000000000 +0200
@@ -7,7 +7,7 @@
   $quote_user = t('Quote \\1');
 
   $preg = array(
-    
+
     // Font, text and alignment
     '#\[color=(.*?)(?::\w+)?\](.*?)\[/color(?::\w+)?\]#si'   => '<span style="color:\\1">\\2</span>',
     '#\[size=(.*?)(?::\w+)?\](.*?)\[/size(?::\w+)?\]#si'     => '<span style="font-size:\\1">\\2</span>',
@@ -20,24 +20,20 @@
     '#\[center(?::\w+)?\](.*?)\[/center(?::\w+)?\]#si'       => '<div style="text-align:center">\\1</div>',
     '#\[left(?::\w+)?\](.*?)\[/left(?::\w+)?\]#si'           => '<div style="text-align:left">\\1</div>',
     '#\[right(?::\w+)?\](.*?)\[/right(?::\w+)?\]#si'         => '<div style="text-align:right">\\1</div>',
-    
-    // Email addresses without and with good looking text
-    '#\[email(?::\w+)?\](.*?)\[/email(?::\w+)?\]#si'         => '<a href="mailto:\\1" class="bb-email">\\1</a>',
-    '#\[email=(.*?)(?::\w+)?\](.*?)\[/email(?::\w+)?\]#si'   => '<a href="mailto:\\1" class="bb-email">\\2</a>',
-    
+
     // Links without a protocol, with a protocol and with good looking text
     '#\[url(?::\w+)?\]www\.(.*?)\[/url(?::\w+)?\]#si'        => '<a href="http://www.\\1" class="bb-url">\\1</a>',
     '#\[url(?::\w+)?\](.*?)\[/url(?::\w+)?\]#si'             => '<a href="\\1" class="bb-url">\\1</a>',
     '#\[url=(.*?)(?::\w+)?\](.*?)\[/url(?::\w+)?\]#si'       => '<a href="\\1" class="bb-url">\\2</a>',
-    
+
     // Images without or with client-side sizing
     '#\[img(?::\w+)?\](.*?)\[/img(?::\w+)?\]#si'             => '<img src="\\1" class="bb-image" />',
     '#\[img=(.*?)x(.*?)(?::\w+)?\](.*?)\[/img(?::\w+)?\]#si' => '<img width="\\1" height="\\2" src="\\3" class="bb-image" />',
-    
+
     // Quoting with or without specifying the source
     '#\[quote(?::\w+)?\](?:[\r\n])*(.*?)\[/quote(?::\w+)?\]#si'         => '<div class="bb-quote">'.$quote_text.':<div class="bb-quote-body">\\1</div></div>',
     '#\[quote=(?:&quot;|"|\')?(.*?)["\']?(?:&quot;|"|\')?\](?:[\r\n])*(.*?)\[/quote(?::\w+)?\]#si'   => '<div class="bb-quote">'.$quote_user.':<div class="bb-quote-body">\\2</div></div>',
-    
+
     // Different kinds of lists and list items
     '#\[\*(?::\w+)?\](.+)(?=\[\*(?::\w+)?\]|\[/list)#Usi'    => '<li>\\1</li>',
     '#\[list(?::\w+)?\](.*?)\[/list(?::\w+)?\]#si'           => _bbcode_list_tag(),
@@ -48,13 +44,17 @@
     '#\[list=I(?::\w+)?\](.*?)\[/list(?::\w+)?\]#s'          => _bbcode_list_tag('upper-roman'),
     '#\[list=a(?::\w+)?\](.*?)\[/list(?::\w+)?\]#s'          => _bbcode_list_tag('lower-alpha'),
     '#\[list=A(?::\w+)?\](.*?)\[/list(?::\w+)?\]#s'          => _bbcode_list_tag('upper-alpha'),
-    
+
     // Clean up the list output a bit
     '#<ol(.*?)>(?:.*?)<li(.*?)>#si'         => '<ol\\1><li\\2>',
     '#<ul(.*?)>(?:.*?)<li(.*?)>#si'         => '<ul\\1><li\\2>'
   );
   $body = preg_replace(array_keys($preg), array_values($preg), $body);
-  
+
+  // Replacing email addresses with encoded html
+  $body = preg_replace_callback('#\[email(?::\w+)?\](.*?)\[/email(?::\w+)?\]#si', '_bbcode_encode_mailto', $body);
+  $body = preg_replace_callback('#\[email=(.*?)(?::\w+)?\](.*?)\[/email(?::\w+)?\]#si', '_bbcode_encode_mailto', $body);
+    
   // Horizontal delimiter
   $body = str_replace("[hr]", '<hr class="bb-hr" />', $body);
 
@@ -117,3 +117,20 @@
     return '<ul class="bb-list">\\1</ul>';
   }
 }
+
+function _bbcode_encode_mailto($matches) {
+  $link = '<a href="mailto:' . $matches[1] . '" class="bb-email">' . (isset($matches[2]) ? $matches[2] : $matches[1]) . '</a>';
+
+  if (variable_get("bbcode_encode_mail", 1)) {
+    $link = 'document.write(\'' . $link . '</a>\');';
+
+    $js_encode = '';
+    for ($x = 0; $x < strlen($link); $x++) {
+      $js_encode .= '%' . bin2hex($link{$x});
+    }
+
+    $link = '<script type="text/javascript" language="javascript">eval(unescape(\''.$js_encode.'\'))</script>';
+  }
+
+  return $link;
+}
diff -r -u drupal_orig/modules/bbcode/bbcode.module drupal/modules/bbcode/bbcode.module
--- drupal_orig/modules/bbcode/bbcode.module	2004-08-30 11:09:51.000000000 +0200
+++ drupal/modules/bbcode/bbcode.module	2004-08-30 10:57:20.000000000 +0200
@@ -36,4 +36,15 @@
       return $text;
   }
 }
+
+function bbcode_settings() {
+  $output = "";
+  $output .= form_select(
+    t("Email address encoding"),
+    "bbcode_encode_mail", variable_get("bbcode_encode_mail", 1),
+    array(t("Disabled"), t("Enabled")),
+    t("Whether to encode email addresses with javascript. With this method you will have clickable mailto links, but it will be a bit harder for spam robots to collect the addresses."));
+  return $output;
+}
+
 ?>
