Skip to Content.
Sympa Menu

devel - Re: [sympa-developpers] [sympa-commits] r12706 - in branches/sympa-6.2-branch/src/lib/Sympa: . Tools

Subject: Developers of Sympa

List archive

Chronological Thread  
  • From: David Verdin <address@concealed>
  • To: address@concealed
  • Subject: Re: [sympa-developpers] [sympa-commits] r12706 - in branches/sympa-6.2-branch/src/lib/Sympa: . Tools
  • Date: Fri, 26 Feb 2016 11:12:20 +0100

Hi Soji,

Thanks for these fixes !

As we had a few annoying bugs in this version I think we should tag a version today.
Would you be ready to release your work now or do ytou still need to commit something?

Best regards,

DAvid

Le 26/02/2016 09:45, address@concealed a écrit :
Author: sikeda
Date: 2016-02-26 08:45:25 +0000 (Fri, 26 Feb 2016)
New Revision: 12706

Modified:
   branches/sympa-6.2-branch/src/lib/Sympa/Template.pm
   branches/sympa-6.2-branch/src/lib/Sympa/Tools/Text.pm
Log:
[-dev] escape_url() was deprecated.


Modified: branches/sympa-6.2-branch/src/lib/Sympa/Template.pm
===================================================================
--- branches/sympa-6.2-branch/src/lib/Sympa/Template.pm	2016-02-26 08:17:34 UTC (rev 12705)
+++ branches/sympa-6.2-branch/src/lib/Sympa/Template.pm	2016-02-26 08:45:25 UTC (rev 12706)
@@ -67,6 +67,24 @@
 }
 
 # OBSOLETED.  This is kept only for backward compatibility.
+# Old name: tt2::escape_url().
+sub _escape_url {
+    my $string = shift;
+
+    $string =~ s/([\s+])/sprintf('%%%02x', ord $1)/eg;
+    # Some MUAs aren't able to decode ``%40'' (escaped ``@'') in e-mail
+    # address of mailto: URL, or take ``@'' in query component for a
+    # delimiter to separate URL from the rest.
+    my ($body, $query) = split(/\?/, $string, 2);
+    if (defined $query) {
+        $query =~ s/(\@)/sprintf('%%%02x', ord $1)/eg;
+        $string = $body . '?' . $query;
+    }
+
+    return $string;
+}
+
+# OBSOLETED.  This is kept only for backward compatibility.
 # Old name:: tt2::escape_xml().
 sub _escape_xml {
     my $string = shift;
@@ -259,17 +277,17 @@
             loc      => [\&maketext, 1],
             helploc  => [\&maketext, 1],
             locdt    => [\&locdatetime, 1],
-            wrap         => [\&wrap,                           1],
-            mailto       => [\&_mailto,                        1],
-            mailtourl    => [\&_mailtourl,                     1],
-            obfuscate    => [\&_obfuscate,                     1],
-            optdesc      => [\&optdesc,                        1],
-            qencode      => [\&qencode,                        0],
-            escape_xml   => [\&_escape_xml,                    0],
-            escape_url   => [\&Sympa::Tools::Text::escape_url, 0],
-            escape_quote => [\&_escape_quote,                  0],
-            decode_utf8  => [\&decode_utf8,                    0],
-            encode_utf8  => [\&encode_utf8,                    0]
+            wrap         => [\&wrap,          1],
+            mailto       => [\&_mailto,       1],
+            mailtourl    => [\&_mailtourl,    1],
+            obfuscate    => [\&_obfuscate,    1],
+            optdesc      => [\&optdesc,       1],
+            qencode      => [\&qencode,       0],
+            escape_xml   => [\&_escape_xml,   0],
+            escape_url   => [\&_escape_url,   0],
+            escape_quote => [\&_escape_quote, 0],
+            decode_utf8  => [\&decode_utf8,   0],
+            encode_utf8  => [\&encode_utf8,   0]
         }
     };
 

Modified: branches/sympa-6.2-branch/src/lib/Sympa/Tools/Text.pm
===================================================================
--- branches/sympa-6.2-branch/src/lib/Sympa/Tools/Text.pm	2016-02-26 08:17:34 UTC (rev 12705)
+++ branches/sympa-6.2-branch/src/lib/Sympa/Tools/Text.pm	2016-02-26 08:45:25 UTC (rev 12706)
@@ -27,7 +27,7 @@
 use strict;
 use warnings;
 use Encode qw();
-use English;                 # FIXME: drop $MATCH usage
+use English qw(-no_match_vars);
 use Encode::MIME::Header;    # 'MIME-Q' encoding.
 use HTML::Entities qw();
 use MIME::EncWords;
@@ -201,24 +201,10 @@
 }
 
 # Old name: tt2::escape_url().
-# Not recommended.  Use Sympa::Tools::Text::escape_uri() or
+# DEPRECATED.  Use Sympa::Tools::Text::escape_uri() or
 # Sympa::Tools::Text::mailtourl().
-sub escape_url {
-    my $string = shift;
+#sub escape_url;
 
-    $string =~ s/[\s+]/sprintf('%%%02x', ord($MATCH))/eg;
-    # Some MUAs aren't able to decode ``%40'' (escaped ``@'') in e-mail
-    # address of mailto: URL, or take ``@'' in query component for a
-    # delimiter to separate URL from the rest.
-    my ($body, $query) = split(/\?/, $string, 2);
-    if (defined $query) {
-        $query =~ s/\@/sprintf('%%%02x', ord($MATCH))/eg;
-        $string = $body . '?' . $query;
-    }
-
-    return $string;
-}
-
 sub foldcase {
     my $str = shift;
     return '' unless defined $str and length $str;
@@ -548,10 +534,7 @@
 
 =item escape_url ( $str )
 
-Escapes string using URL encoding.
-
-Note:
-This is not recommended.
+DEPRECATED.
 Would be better to use L</"encode_uri"> or L</"mailtourl">.
 
 =item foldcase ( $str )
@@ -577,6 +560,33 @@
 
 =back
 
+=item mailtourl ( $email, [ decode_html =E<gt> 1 ],
+[ query =E<gt> {key =E<gt> val, ...} ] )
+
+Constructs a C<mailto:> URL for given e-mail.
+
+Parameters:
+
+=over
+
+=item $email
+
+E-mail address.
+
+=item decode_html =E<gt> 1
+
+If set, arguments are assumed to include HTML entities.
+
+=item query =E<gt> {key =E<gt> val, ...}
+
+Optional query.
+
+=back
+
+Returns:
+
+Constructed URL.
+
 =item qdecode_filename ( $filename )
 
 Q-Decodes web file name.
@@ -614,6 +624,6 @@
 on Sympa 6.2.10.
 
 decode_html(), encode_html(), encode_uri() and mailtourl()
-were added on Sympa 6.2.14.
+were added on Sympa 6.2.14, and escape_url() was deprecated.
 
 =cut


--
A bug in Sympa? Quick! To the bug tracker!

 
David Verdin
Études et projets applicatifs
 
Tél : +33 2 23 23 69 71
Fax : +33 2 23 23 71 21
 
www.renater.fr
RENATER
263 Avenue du Gal Leclerc
35042 Rennes Cedex



PNG image

Attachment: smime.p7s
Description: Signature cryptographique S/MIME




Archive powered by MHonArc 2.6.19+.

Top of Page