/* smlnk.irc by william rockwood * December 16, 2001 * * basically, when someone posts a smlnk to a channel on IRC, * this script will query the smlnk bot for the real URL and * display it on your screen, so you know what it is but can * click on the smlnk for convenience sake. it will also * convert URLs longer than 65 characters to short links. * ************************************************************ * mv smlnk.irc lnks.irc * edited by gavin hanover to work in * multiple channels and work for lnks.us */ # lnks's userhost @lnkshst = [lnks@bot.lnks.us] # these 2 ONs will convert lnks to real urls # so you know what you are about to go to. on #-public 65 "% % *http://lnks.us/*" { @chan=[$1] @hashkey = after(http://lnks.us/ $pattern(http://lnks.us/% $1-)) @url = pattern(http://* $1-) ^userhost lnks -cmd if ([$3@$4]==[$lnkshst]) { ^stack push on msg ^on ^msg "lnks *" { quote privmsg $chan :*** Actual URL: $1- ^stack pop on msg } quote privmsg lnks :$url } { echo *** lnks is not online } } on #-public_other 65 "% % *http://lnks.us/*" { @chan=[$1] @hashkey = after(http://lnks.us/ $pattern(http://lnks.us/% $1-)) @url = pattern(http://* $1-) ^userhost lnks -cmd if ([$3@$4]==[$lnkshst]) { ^stack push on msg ^on ^msg "lnks *" { quote privmsg $chan :*** Actual URL: $1- ^stack pop on msg } quote privmsg lnks :$url } { echo *** lnks is not online } } # these 2 ONs will convert URLs longer than 65 characters # to lnks. on #-public 65 "% % *http://*" { @chan=[$1] @url = pattern(http://* $1-) ^userhost lnks -cmd if ([$3@$4]==[$lnkshst]) { if ((url !~ [*lnks*]) && (strlen($url) > 65)) { ^stack push on msg ^on ^msg "lnks *" { quote privmsg $chan :*** lnks: $1- ^stack pop on msg } quote privmsg lnks :$url } } { echo *** lnks is not online } } on #-public_other 65 "% % *http://*" { @chan=[$1] @url = pattern(http://* $1-) ^userhost lnks -cmd if ([$3@$4]==[$lnkshst]) { if ((url !~ [*lnks*]) && (strlen($url) > 65 )) { ^stack push on msg ^on ^msg "lnks *" { quote privmsg $chan :*** lnks: $1- ^stack pop on msg } quote privmsg lnks :$url } } { echo *** lnks is not online } } # the /lnks alias! alias lnks { @chan=[$1] if (![$0]) { echo *** Error: Not enough arguments echo *** Usage: /lnks } { @url = [$0] ^userhost lnks -cmd if ([$3@$4]==[$lnkshst]) { if (strlen($url) > 26) { ^stack push on msg ^on ^msg "lnks *" { quote privmsg $chan: $1- echo *** Sending URL to $chan: $1- ^stack pop on msg } quote privmsg lnks :$url } { echo *** Error: Invalid arguments echo *** Usage: /lnks echo *** Usage: URL must be 27 characters or longer } } { echo *** lnks is not online. } } } echo *** lnks.irc loaded!