Fossil SCM
Merger w/fossil chat update (5e3f)
Commit
e6d1cd96793dcbf7e3ea27b81d35196cf45b047d
Parent
99eabf9b0c1d241…
1 file changed
+6
-22
+6
-22
| --- tools/fossil_chat.tcl | ||
| +++ tools/fossil_chat.tcl | ||
| @@ -11,12 +11,10 @@ | ||
| 11 | 11 | |
| 12 | 12 | # Setup the user interface |
| 13 | 13 | wm title . Fossil-Chat |
| 14 | 14 | wm iconname . [wm title .] |
| 15 | 15 | |
| 16 | -set ::PRIVATE 0 | |
| 17 | - | |
| 18 | 16 | menu .mb -type menubar |
| 19 | 17 | if {$tcl_platform(platform)=="unix" && $tcl_platform(os)!="Darwin"} { |
| 20 | 18 | pack .mb -side top -fill x |
| 21 | 19 | } else { |
| 22 | 20 | . config -menu .mb |
| @@ -23,11 +21,10 @@ | ||
| 23 | 21 | } |
| 24 | 22 | .mb add cascade -label File -underline 0 -menu .mb.file |
| 25 | 23 | menu .mb.file -tearoff 0 |
| 26 | 24 | .mb.file add command -label Send -command send_message |
| 27 | 25 | .mb.file add command -label {Remove older messages} -command cleanup_record |
| 28 | -.mb.file add checkbutton -label {Private} -variable PRIVATE | |
| 29 | 26 | .mb.file add separator |
| 30 | 27 | .mb.file add command -label {Exit} -command exit |
| 31 | 28 | |
| 32 | 29 | frame .who |
| 33 | 30 | pack .who -side right -anchor n -fill y |
| @@ -37,14 +34,12 @@ | ||
| 37 | 34 | pack .who.list -side top -anchor nw -expand 1 -padx 5 |
| 38 | 35 | label .who.time -text {} -justify right |
| 39 | 36 | proc update_time {} { |
| 40 | 37 | after 1000 update_time |
| 41 | 38 | 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" | |
| 46 | 41 | } |
| 47 | 42 | update_time |
| 48 | 43 | pack .who.time -side bottom -anchor sw |
| 49 | 44 | |
| 50 | 45 | frame .input |
| @@ -105,15 +100,11 @@ | ||
| 105 | 100 | set txt [.input.t get 1.0 end] |
| 106 | 101 | .input.t delete 1.0 end |
| 107 | 102 | regsub -all "\[ \t\n\f\r\]+" [string trim $txt] { } txt |
| 108 | 103 | if {$txt==""} return |
| 109 | 104 | 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] | |
| 115 | 106 | flush $SOCKET |
| 116 | 107 | } |
| 117 | 108 | |
| 118 | 109 | .mb add cascade -label "Transfer" -underline 0 -menu .mb.files |
| 119 | 110 | menu .mb.files -tearoff 0 |
| @@ -154,16 +145,11 @@ | ||
| 154 | 145 | if {$openfile==""} return |
| 155 | 146 | set f [open $openfile] |
| 156 | 147 | fconfigure $f -translation binary |
| 157 | 148 | set data [read $f] |
| 158 | 149 | 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]] | |
| 165 | 151 | flush $SOCKET |
| 166 | 152 | set time [clock format [clock seconds] -format {%H:%M} -gmt 1] |
| 167 | 153 | .msg.t insert end "\[$time\] sent file [file tail $openfile]\ |
| 168 | 154 | - [string length $data] bytes\n" meta |
| 169 | 155 | .msg.t see end |
| @@ -214,29 +200,27 @@ | ||
| 214 | 200 | set ulist {} |
| 215 | 201 | foreach u [lrange $line 1 end] { |
| 216 | 202 | append ulist $u\n |
| 217 | 203 | } |
| 218 | 204 | .who.list config -text [string trim $ulist] |
| 219 | - } elseif {$cmd=="message"||$cmd=="private_message"} { | |
| 205 | + } elseif {$cmd=="message"} { | |
| 220 | 206 | set time [clock format [clock seconds] -format {%H:%M} -gmt 1] |
| 221 | 207 | set from [lindex $line 1] |
| 222 | 208 | .msg.t insert end "\[$time $from\] " meta [lindex $line 2]\n norm |
| 223 | 209 | .msg.t see end |
| 224 | - set current_focus [focus] | |
| 225 | 210 | bell |
| 226 | 211 | wm deiconify . |
| 227 | 212 | update |
| 228 | 213 | raise . |
| 229 | - focus $current_focus | |
| 230 | 214 | } elseif {$cmd=="noop"} { |
| 231 | 215 | # do nothing |
| 232 | 216 | } elseif {$cmd=="meta"} { |
| 233 | 217 | set now [clock seconds] |
| 234 | 218 | set time [clock format $now -format {%H:%M} -gmt 1] |
| 235 | 219 | .msg.t insert end "\[$time\] [lindex $line 1]\n" meta |
| 236 | 220 | .msg.t see end |
| 237 | - } elseif {$cmd=="file"||$cmd=="private_file"} { | |
| 221 | + } elseif {$cmd=="file"} { | |
| 238 | 222 | if {[info commands handle_file]=="handle_file"} { |
| 239 | 223 | handle_file [lindex $line 1] [lindex $line 2] [lindex $line 3] |
| 240 | 224 | } |
| 241 | 225 | } |
| 242 | 226 | } |
| 243 | 227 |
| --- 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 |