]> git.donarmstrong.com Git - infobot.git/commitdiff
URL patch.
authorsimonraven <simonraven@c11ca15a-4712-0410-83d8-924469b57eb5>
Tue, 15 Feb 2005 14:16:44 +0000 (14:16 +0000)
committersimonraven <simonraven@c11ca15a-4712-0410-83d8-924469b57eb5>
Tue, 15 Feb 2005 14:16:44 +0000 (14:16 +0000)
submitted by jethro. what it does is something like:

jethro | cocogivre: literal cmd: bar (.*?)
cocogivre | "CMD: bar (.*?)" is "($1): $1 a une ptite bite -> <URL>http://www.lala.com/sa?q=$1</URL>"
jethro | !bar test test1 test2
cocogivre | test test1 test2 a une ptite bite -> http://www.lala.com/sa?q=test%20test1%20test2

(the <url></url> is case insensitive)

git-svn-id: https://svn.code.sf.net/p/infobot/code/trunk/blootbot@1115 c11ca15a-4712-0410-83d8-924469b57eb5

src/Factoids/Reply.pl

index 8235bb5898544fe47b89f3dc46f4f8316d73d5e8..b06347dc0e5c436ae10ac2ec4c027c239e76de69 100644 (file)
@@ -250,6 +250,19 @@ sub SARit {
     }
     &status("Reply.pl: $done SARs done.") if ($done);
 
+    # <URL></URL> type
+    #
+    while ($txt =~ /<URL>(.*)<\/URL>/){
+       &status("we have to norm this <URL></URL> stuff, SARing");
+       my $foobar = $1;
+       if ($foobar =~ m/(http:\/\/[^?]+)\?(.*)/){
+           my ($pig1,$pig2) = ($1,$2);
+           &status("SARing using URLencode");
+           $pig2=~s/([^\w])/sprintf("%%%02x",ord($1))/gie;
+           $foobar=$pig1."?".$pig2;
+       }
+       $txt =~ s/<URL>(.*)<\/URL>/$foobar/;
+    }
     return $txt;
 }