DoctorD90

Adfly.tcl

May 7th, 2013
354
0
Never
1
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
TCL 3.09 KB | None | 0 0
  1. ### Adfly.tcl 1.8.1 gD6AWkhd
  2.  
  3. #REQUIREMENTS
  4. # WebPFix.tcl mNct0SYj
  5.  
  6. #SUGGESTED
  7. # PBinSrc.tcl fMrtKqyq
  8. # TCLLoader.tcl smApj15u
  9.  
  10. #LICENSE
  11. # Copyright © 2013 Alberto Dietze "DoctorD90"
  12. #
  13. #    This program is free software: you can redistribute it and/or modify
  14. #    it under the terms of the GNU General Public License as published by
  15. #    the Free Software Foundation, either version 3 of the License, or
  16. #    (at your option) any later version.
  17. #
  18. #    This program is distributed in the hope that it will be useful,
  19. #    but WITHOUT ANY WARRANTY; without even the implied warranty of
  20. #    MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
  21. #    GNU General Public License for more details.
  22. #
  23. #    You should have received a copy of the GNU General Public License
  24. #    along with this program.  If not, see <http://www.gnu.org/licenses/>.
  25. #
  26. # Full GPLv3 Text: http://www.gnu.org/licenses/gpl.txt
  27.  
  28. #PATERNITY
  29. #Coder: DoctorD90
  30. #Network: irc.OnlineGamesNet.net
  31. #Chan: #eHito
  32. #Script's List: www.EggTcl.tk
  33.  
  34. #PURPOSE
  35. #Allow use of Adfly system trougth eggdrop.
  36.  
  37. #USAGE
  38. #Use commands that you set in SETTINGS section.
  39.  
  40. #SETTINGS
  41. #Get next 2 settings from link that you get from Adfly Personal Page.
  42. set adfly(key) "&&&&&&&&&&&&&&"
  43. set adfly(uid) "0000000"
  44. #Set default domain: 0=adf.ly | 1=q.gs
  45. set adfly(dmn) "0"
  46. #Set default type: 0=Banner | 1=Interstitial
  47. set adfly(typ) "0"
  48. #Allow NOT shrinked links in cases of returned errors.
  49. set adfly(err) "1"
  50. #Set flag of people can use public command.
  51. set adfly(pflag) "-"
  52. #Set flag of allowed people to use query command.
  53. set adfly(qflag) "-"
  54. #Set public command to shrink links.
  55. set adfly(padd) ".Shrink"
  56. #Set query command to shrink links.
  57. set adfly(qadd) ".Shrink"
  58.  
  59.  
  60. ### DON'T EDIT ANYTHING BELOW ###
  61.  
  62. package require html
  63.  
  64. proc adfly {link {dmn ""} {typ ""}} {
  65.   if {![string length [string trim $dmn]]} {
  66.     set dmn "$::adfly(dmn)"
  67.   }
  68.   if {$dmn == "0"} {
  69.     set dmn "adf.ly"
  70.   } else {
  71.     set dmn "q.gs"
  72.   }
  73.   if {![string length [string trim $typ]]} {
  74.     set typ "$::adfly(typ)"
  75.   }
  76.   if {$typ == "0"} {
  77.     set ads0 "banner"
  78.     set ads1 "banner/"
  79.   } else {
  80.     set ads0 "int"
  81.     set ads1 ""
  82.   }
  83.   set link [webpfix_adder $link]
  84.   set plink "http://api.adf.ly/api.php?key=${::adfly(key)}&uid=${::adfly(uid)}&advert_type=${ads0}&domain=${dmn}&url=${link}"
  85.   set code [lindex [split [http::data [set Token [http::geturl "$plink" -timeout "30000"]]]] 0]
  86.   http::cleanup $Token
  87.   if {[string tolower $code] == "error" && $::adfly(err)} {
  88.     set code "http://adf.ly/${::adfly(uid)}/${ads1}$link"
  89.   }
  90.   return $code
  91. }
  92.  
  93. bind pub $adfly(pflag) $adfly(padd) pub_adfly
  94. proc pub_adfly {nick uhost hand chan text} {
  95.   msg_adfly $nick $uhost $hand $text
  96. }
  97.  
  98. bind msg $adfly(qflag) $adfly(qadd) msg_adfly
  99. proc msg_adfly {nick uhost hand text} {
  100.   if {![string length [string length $text]]} {
  101.     putserv "NOTICE $nick :\002Shrinker:\002 Link required."
  102.     return
  103.   }
  104.   set link [adfly [lindex [split $text] 0]]
  105.   putserv "NOTICE $nick :\002Shrinker:\002 $link"
  106. }
  107.  
  108. ###
  109. putlog "Adfly.tcl LOADED"
Comments
  • User was banned
Add Comment
Please, Sign In to add comment