From: timriker Date: Mon, 7 Feb 2011 18:22:47 +0000 (+0000) Subject: urlchannel X-Git-Url: https://git.donarmstrong.com/?p=infobot.git;a=commitdiff_plain;h=e029359714e3bff3e6d4e816cb16695bacd79f59 urlchannel git-svn-id: https://svn.code.sf.net/p/infobot/code/trunk@1898 c11ca15a-4712-0410-83d8-924469b57eb5 --- diff --git a/files/infobot.help b/files/infobot.help index 14b1697..cace7d1 100644 --- a/files/infobot.help +++ b/files/infobot.help @@ -156,6 +156,7 @@ dollar variables: $randnick - random nick dollar variables: $startTime - start time dollar variables: $time - current time (GMT) dollar variables: $uptime - ... +dollar variables: $urlchannel - html encoded channel from which the factoid was requested dollar variables: $user - username of factoid requester dollar variables: $who - nick of factoid requester diff --git a/src/Factoids/Reply.pl b/src/Factoids/Reply.pl index 89faac2..b892a5e 100644 --- a/src/Factoids/Reply.pl +++ b/src/Factoids/Reply.pl @@ -314,6 +314,11 @@ sub substVars { $reply =~ s/\$host(name)?/$hostname/g; } $reply =~ s/\$chan(nel)?/$talkchannel/g; + if ( $reply =~ /\$urlchannel/ ) { + my $urlchannel = $talkchannel; + $urlchannel =~ s/([^\w])/sprintf("%%%02x",ord($1))/gie; + $reply =~ s/\$urlchannel?/$urlchannel/g; + } if ( $msgType =~ /public/ ) { $reply =~ s/\$lastspeaker/$lastWho{$talkchannel}/g; }