summaryrefslogtreecommitdiffstats
path: root/compat.tcl
blob: 1093da87fb0f497c15eb92af50bd4642216617b4 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
# compat.tcl
#   This script just quickly maps old Tcl commands to the new ones.
#   Use this if you are too lazy to get off your butt and update your scripts :D
#
# Copyright (C) 2002 - 2010 Eggheads Development Team
#
# Wiktor    31Mar2000: added binds and chnick proc
# Tothwolf  25May1999: cleanup
# Tothwolf  06Oct1999: optimized
# rtc       10Oct1999: added [set|get][dn|up]loads functions
# pseudo    04Oct2009: added putdccraw
# Pixelz    08Apr2010: changed [time] to be compatible with Tcl [time]
#
# $Id: compat.tcl,v 1.19 2010/07/02 21:56:44 pseudo Exp $

proc gethosts {hand} {
  getuser $hand HOSTS
}

proc addhost {hand host} {
  setuser $hand HOSTS $host
}

proc chpass {hand pass} {
  setuser $hand PASS $pass
}


proc chnick {oldnick newnick} { 
  chhandle $oldnick $newnick
}

# setxtra is no longer relevant 

proc getxtra {hand} {
  getuser $hand XTRA
}

proc setinfo {hand info} {
  setuser $hand INFO $info
}

proc getinfo {hand} {
  getuser $hand INFO
}

proc getaddr {hand} {
  getuser $hand BOTADDR
}

proc setaddr {hand addr} {
  setuser $hand BOTADDR $addr
}

proc getdccdir {hand} {
  getuser $hand DCCDIR
}

proc setdccdir {hand dccdir} {
  setuser $hand DCCDIR $dccdir
}

proc getcomment {hand} {
  getuser $hand COMMENT
}

proc setcomment {hand comment} {
  setuser $hand COMMENT $comment
}

proc getemail {hand} {
  getuser $hand XTRA email
}

proc setemail {hand email} {
  setuser $hand XTRA EMAIL $email
}

proc getchanlaston {hand} {
  lindex [getuser $hand LASTON] 1
}

if {![llength [info commands {TCLTIME}]] && [llength [info commands {time}]]} {
  rename time TCLTIME
}

proc time {args} {
  if {([llength $args] != 0) && [llength [info commands {TCLTIME}]]} {
    if {[llength [info commands {uplevel}]]} {
      uplevel 1 TCLTIME $args
    } else {
      eval TCLTIME $args
    }
  } else {
    strftime "%H:%M"
  }
}

proc date {} {
  strftime "%d %b %Y"
}

proc setdnloads {hand {c 0} {k 0}} {
  setuser $hand FSTAT d $c $k
}

proc getdnloads {hand} {
  getuser $hand FSTAT d
}

proc setuploads {hand {c 0} {k 0}} {
  setuser $hand FSTAT u $c $k
}

proc getuploads {hand} {
  getuser $hand FSTAT u
}

proc putdccraw {idx size text} {
  if {!$idx} {
    putloglev o * "Warning! putdccraw is deprecated. Use putnow instead!"
    putnow $text
    return -code ok
  }
  putloglev o * "Warning! putdccraw is deprecated. Use putdcc instead!"
  if {![valididx $idx]} {return -code error "invalid idx"}
  putdcc $idx $text -raw
}

# as you can see it takes a lot of effort to simulate all the old commands
# and adapting your scripts will take such an effort you better include
# this file forever and a day :D

# Following are some TCL global variables that are obsolete now and have been removed
# but are still defined here so not to break older scripts

set strict-servernames 0