View difference between Paste ID: zcL64ZTA and gD6AWkhd
SHOW: | | - or go back to the newest paste.
1-
### Adfly.tcl 1.8.1 gD6AWkhd
1+
### Adfly.tcl 1.8.0 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
14+
#    it under the terms oe 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
#Mail: [email protected]
33
#Script's List: www.EggTcl.tk
34
35
#PURPOSE
36
#Allow use of Adfly system trougth eggdrop.
37
38
#USAGE
39
#Use commands that you set in SETTINGS section.
40
41
#SETTINGS
42
#Get next 2 settings from link that you get from Adfly Personal Page.
43
set adfly(key) "&&&&&&&&&&&&&&"
44
set adfly(uid) "0000000"
45
#Set default domain: 0=adf.ly | 1=q.gs
46
set adfly(dmn) "0"
47
#Set default type: 0=Banner | 1=Interstitial
48
set adfly(typ) "0"
49
#Allow NOT shrinked links in cases of returned errors.
50
set adfly(err) "1"
51
#Set flag of people can use public command.
52
set adfly(pflag) "-"
53-
#Set flag of allowed people to use query command.
53+
#Set flag of people can use query command.
54
set adfly(qflag) "-"
55
#Set public command to shrink links.
56
set adfly(padd) ".Shrink"
57
#Set query command to shrink links.
58
set adfly(qadd) ".Shrink"
59
60
61
### DON'T EDIT ANYTHING BELOW ###
62
63
package require html
64
65
proc adfly {link {dmn ""} {typ ""}} {
66
  if {![string length [string trim $dmn]]} {
67
    set dmn "$::adfly(dmn)"
68
  }
69
  if {$dmn == "0"} {
70
	set dmn "adf.ly"
71
  } else {
72
	set dmn "q.gs"
73
  }
74
  if {![string length [string trim $typ]]} {
75
    set typ "$::adfly(typ)"
76
  }
77
  if {$typ == "0"} {
78
	set ads0 "banner"
79
	set ads1 "banner/"
80
  } else {
81
	set ads0 "int"
82
	set ads1 ""
83
  }
84
  set link [webpfix_adder $link]
85
  set plink "http://api.adf.ly/api.php?key=${::adfly(key)}&uid=${::adfly(uid)}&advert_type=${ads0}&domain=${dmn}&url=${link}"
86-
  set code [lindex [split [http::data [set Token [http::geturl "$plink" -timeout "30000"]]]] 0]
86+
  set code [lindex [split [http::data [set Token [http::geturl "$plink"]]]] 0]
87
  http::cleanup $Token
88
  if {[string tolower $code] == "error" && $::adfly(err)} {
89
	set code "http://adf.ly/${::adfly(uid)}/${ads1}$link"
90
  }
91
  return $code
92
}
93
94
bind pub $adfly(pflag) $adfly(padd) pub_adfly
95
proc pub_adfly {nick uhost hand chan text} {
96
  msg_adfly $nick $uhost $hand $text
97
}
98
99
bind msg $adfly(qflag) $adfly(qadd) msg_adfly
100
proc msg_adfly {nick uhost hand text} {
101
  if {![string length [string length $text]]} {
102-
    putserv "NOTICE $nick :\002Shrinker:\002 Link required."
102+
    notice $nick "\002Shrinker:\002 Link required."
103
    return
104
  }
105
  set link [adfly [lindex [split $text] 0]]
106-
  putserv "NOTICE $nick :\002Shrinker:\002 $link"
106+
  notice $nick "\002Shrinker:\002 $link"
107
}
108
109
###
110
putlog "Adfly.tcl LOADED"