Fossil SCM

Merger w/fossil chat update (5e3f)

jnc 2007-09-25 19:32 trunk merge
Commit e6d1cd96793dcbf7e3ea27b81d35196cf45b047d
1 file changed +6 -22
--- tools/fossil_chat.tcl
+++ tools/fossil_chat.tcl
@@ -11,12 +11,10 @@
1111
1212
# Setup the user interface
1313
wm title . Fossil-Chat
1414
wm iconname . [wm title .]
1515
16
-set ::PRIVATE 0
17
-
1816
menu .mb -type menubar
1917
if {$tcl_platform(platform)=="unix" && $tcl_platform(os)!="Darwin"} {
2018
pack .mb -side top -fill x
2119
} else {
2220
. config -menu .mb
@@ -23,11 +21,10 @@
2321
}
2422
.mb add cascade -label File -underline 0 -menu .mb.file
2523
menu .mb.file -tearoff 0
2624
.mb.file add command -label Send -command send_message
2725
.mb.file add command -label {Remove older messages} -command cleanup_record
28
-.mb.file add checkbutton -label {Private} -variable PRIVATE
2926
.mb.file add separator
3027
.mb.file add command -label {Exit} -command exit
3128
3229
frame .who
3330
pack .who -side right -anchor n -fill y
@@ -37,14 +34,12 @@
3734
pack .who.list -side top -anchor nw -expand 1 -padx 5
3835
label .who.time -text {} -justify right
3936
proc update_time {} {
4037
after 1000 update_time
4138
set now [clock seconds]
42
- set time1 [clock format [expr {$now-4*3600}] -format {%H:%M} -gmt 1]
43
- set time2 [clock format [expr {$now+10*3600}] -format {%H:%M} -gmt 1]
44
- set time3 [clock format $now -format %H:%M -gmt 1]
45
- .who.time config -text "AEST: $time2\nUTC: $time3\nEST: $time1"
39
+ set time [clock format $now -format %H:%M -gmt 1]
40
+ .who.time config -text "UTC: $time"
4641
}
4742
update_time
4843
pack .who.time -side bottom -anchor sw
4944
5045
frame .input
@@ -105,15 +100,11 @@
105100
set txt [.input.t get 1.0 end]
106101
.input.t delete 1.0 end
107102
regsub -all "\[ \t\n\f\r\]+" [string trim $txt] { } txt
108103
if {$txt==""} return
109104
global SOCKET
110
- if {$::PRIVATE} {
111
- puts $SOCKET [list private_message $txt [list dan drh]]
112
- } else {
113
- puts $SOCKET [list message $txt]
114
- }
105
+ puts $SOCKET [list message $txt]
115106
flush $SOCKET
116107
}
117108
118109
.mb add cascade -label "Transfer" -underline 0 -menu .mb.files
119110
menu .mb.files -tearoff 0
@@ -154,16 +145,11 @@
154145
if {$openfile==""} return
155146
set f [open $openfile]
156147
fconfigure $f -translation binary
157148
set data [read $f]
158149
close $f
159
- if {$::PRIVATE} {
160
- puts $SOCKET [list private_file [file tail $openfile] [encode $data] \
161
- [list dan drh]]
162
- } else {
163
- puts $SOCKET [list file [file tail $openfile] [encode $data]]
164
- }
150
+ puts $SOCKET [list file [file tail $openfile] [encode $data]]
165151
flush $SOCKET
166152
set time [clock format [clock seconds] -format {%H:%M} -gmt 1]
167153
.msg.t insert end "\[$time\] sent file [file tail $openfile]\
168154
- [string length $data] bytes\n" meta
169155
.msg.t see end
@@ -214,29 +200,27 @@
214200
set ulist {}
215201
foreach u [lrange $line 1 end] {
216202
append ulist $u\n
217203
}
218204
.who.list config -text [string trim $ulist]
219
- } elseif {$cmd=="message"||$cmd=="private_message"} {
205
+ } elseif {$cmd=="message"} {
220206
set time [clock format [clock seconds] -format {%H:%M} -gmt 1]
221207
set from [lindex $line 1]
222208
.msg.t insert end "\[$time $from\] " meta [lindex $line 2]\n norm
223209
.msg.t see end
224
- set current_focus [focus]
225210
bell
226211
wm deiconify .
227212
update
228213
raise .
229
- focus $current_focus
230214
} elseif {$cmd=="noop"} {
231215
# do nothing
232216
} elseif {$cmd=="meta"} {
233217
set now [clock seconds]
234218
set time [clock format $now -format {%H:%M} -gmt 1]
235219
.msg.t insert end "\[$time\] [lindex $line 1]\n" meta
236220
.msg.t see end
237
- } elseif {$cmd=="file"||$cmd=="private_file"} {
221
+ } elseif {$cmd=="file"} {
238222
if {[info commands handle_file]=="handle_file"} {
239223
handle_file [lindex $line 1] [lindex $line 2] [lindex $line 3]
240224
}
241225
}
242226
}
243227
--- tools/fossil_chat.tcl
+++ tools/fossil_chat.tcl
@@ -11,12 +11,10 @@
11
12 # Setup the user interface
13 wm title . Fossil-Chat
14 wm iconname . [wm title .]
15
16 set ::PRIVATE 0
17
18 menu .mb -type menubar
19 if {$tcl_platform(platform)=="unix" && $tcl_platform(os)!="Darwin"} {
20 pack .mb -side top -fill x
21 } else {
22 . config -menu .mb
@@ -23,11 +21,10 @@
23 }
24 .mb add cascade -label File -underline 0 -menu .mb.file
25 menu .mb.file -tearoff 0
26 .mb.file add command -label Send -command send_message
27 .mb.file add command -label {Remove older messages} -command cleanup_record
28 .mb.file add checkbutton -label {Private} -variable PRIVATE
29 .mb.file add separator
30 .mb.file add command -label {Exit} -command exit
31
32 frame .who
33 pack .who -side right -anchor n -fill y
@@ -37,14 +34,12 @@
37 pack .who.list -side top -anchor nw -expand 1 -padx 5
38 label .who.time -text {} -justify right
39 proc update_time {} {
40 after 1000 update_time
41 set now [clock seconds]
42 set time1 [clock format [expr {$now-4*3600}] -format {%H:%M} -gmt 1]
43 set time2 [clock format [expr {$now+10*3600}] -format {%H:%M} -gmt 1]
44 set time3 [clock format $now -format %H:%M -gmt 1]
45 .who.time config -text "AEST: $time2\nUTC: $time3\nEST: $time1"
46 }
47 update_time
48 pack .who.time -side bottom -anchor sw
49
50 frame .input
@@ -105,15 +100,11 @@
105 set txt [.input.t get 1.0 end]
106 .input.t delete 1.0 end
107 regsub -all "\[ \t\n\f\r\]+" [string trim $txt] { } txt
108 if {$txt==""} return
109 global SOCKET
110 if {$::PRIVATE} {
111 puts $SOCKET [list private_message $txt [list dan drh]]
112 } else {
113 puts $SOCKET [list message $txt]
114 }
115 flush $SOCKET
116 }
117
118 .mb add cascade -label "Transfer" -underline 0 -menu .mb.files
119 menu .mb.files -tearoff 0
@@ -154,16 +145,11 @@
154 if {$openfile==""} return
155 set f [open $openfile]
156 fconfigure $f -translation binary
157 set data [read $f]
158 close $f
159 if {$::PRIVATE} {
160 puts $SOCKET [list private_file [file tail $openfile] [encode $data] \
161 [list dan drh]]
162 } else {
163 puts $SOCKET [list file [file tail $openfile] [encode $data]]
164 }
165 flush $SOCKET
166 set time [clock format [clock seconds] -format {%H:%M} -gmt 1]
167 .msg.t insert end "\[$time\] sent file [file tail $openfile]\
168 - [string length $data] bytes\n" meta
169 .msg.t see end
@@ -214,29 +200,27 @@
214 set ulist {}
215 foreach u [lrange $line 1 end] {
216 append ulist $u\n
217 }
218 .who.list config -text [string trim $ulist]
219 } elseif {$cmd=="message"||$cmd=="private_message"} {
220 set time [clock format [clock seconds] -format {%H:%M} -gmt 1]
221 set from [lindex $line 1]
222 .msg.t insert end "\[$time $from\] " meta [lindex $line 2]\n norm
223 .msg.t see end
224 set current_focus [focus]
225 bell
226 wm deiconify .
227 update
228 raise .
229 focus $current_focus
230 } elseif {$cmd=="noop"} {
231 # do nothing
232 } elseif {$cmd=="meta"} {
233 set now [clock seconds]
234 set time [clock format $now -format {%H:%M} -gmt 1]
235 .msg.t insert end "\[$time\] [lindex $line 1]\n" meta
236 .msg.t see end
237 } elseif {$cmd=="file"||$cmd=="private_file"} {
238 if {[info commands handle_file]=="handle_file"} {
239 handle_file [lindex $line 1] [lindex $line 2] [lindex $line 3]
240 }
241 }
242 }
243
--- tools/fossil_chat.tcl
+++ tools/fossil_chat.tcl
@@ -11,12 +11,10 @@
11
12 # Setup the user interface
13 wm title . Fossil-Chat
14 wm iconname . [wm title .]
15
 
 
16 menu .mb -type menubar
17 if {$tcl_platform(platform)=="unix" && $tcl_platform(os)!="Darwin"} {
18 pack .mb -side top -fill x
19 } else {
20 . config -menu .mb
@@ -23,11 +21,10 @@
21 }
22 .mb add cascade -label File -underline 0 -menu .mb.file
23 menu .mb.file -tearoff 0
24 .mb.file add command -label Send -command send_message
25 .mb.file add command -label {Remove older messages} -command cleanup_record
 
26 .mb.file add separator
27 .mb.file add command -label {Exit} -command exit
28
29 frame .who
30 pack .who -side right -anchor n -fill y
@@ -37,14 +34,12 @@
34 pack .who.list -side top -anchor nw -expand 1 -padx 5
35 label .who.time -text {} -justify right
36 proc update_time {} {
37 after 1000 update_time
38 set now [clock seconds]
39 set time [clock format $now -format %H:%M -gmt 1]
40 .who.time config -text "UTC: $time"
 
 
41 }
42 update_time
43 pack .who.time -side bottom -anchor sw
44
45 frame .input
@@ -105,15 +100,11 @@
100 set txt [.input.t get 1.0 end]
101 .input.t delete 1.0 end
102 regsub -all "\[ \t\n\f\r\]+" [string trim $txt] { } txt
103 if {$txt==""} return
104 global SOCKET
105 puts $SOCKET [list message $txt]
 
 
 
 
106 flush $SOCKET
107 }
108
109 .mb add cascade -label "Transfer" -underline 0 -menu .mb.files
110 menu .mb.files -tearoff 0
@@ -154,16 +145,11 @@
145 if {$openfile==""} return
146 set f [open $openfile]
147 fconfigure $f -translation binary
148 set data [read $f]
149 close $f
150 puts $SOCKET [list file [file tail $openfile] [encode $data]]
 
 
 
 
 
151 flush $SOCKET
152 set time [clock format [clock seconds] -format {%H:%M} -gmt 1]
153 .msg.t insert end "\[$time\] sent file [file tail $openfile]\
154 - [string length $data] bytes\n" meta
155 .msg.t see end
@@ -214,29 +200,27 @@
200 set ulist {}
201 foreach u [lrange $line 1 end] {
202 append ulist $u\n
203 }
204 .who.list config -text [string trim $ulist]
205 } elseif {$cmd=="message"} {
206 set time [clock format [clock seconds] -format {%H:%M} -gmt 1]
207 set from [lindex $line 1]
208 .msg.t insert end "\[$time $from\] " meta [lindex $line 2]\n norm
209 .msg.t see end
 
210 bell
211 wm deiconify .
212 update
213 raise .
 
214 } elseif {$cmd=="noop"} {
215 # do nothing
216 } elseif {$cmd=="meta"} {
217 set now [clock seconds]
218 set time [clock format $now -format {%H:%M} -gmt 1]
219 .msg.t insert end "\[$time\] [lindex $line 1]\n" meta
220 .msg.t see end
221 } elseif {$cmd=="file"} {
222 if {[info commands handle_file]=="handle_file"} {
223 handle_file [lindex $line 1] [lindex $line 2] [lindex $line 3]
224 }
225 }
226 }
227

Keyboard Shortcuts

Open search /
Next entry (timeline) j
Previous entry (timeline) k
Open focused entry Enter
Show this help ?
Toggle theme Top nav button