TclApps Library Source Code
Check-in [546e09da5d]
Not logged in
Bounty program for improvements to Tcl and certain Tcl packages.

Many hyperlinks are disabled.
Use anonymous login to enable hyperlinks.

Overview
Comment:Applied patch 2913790 to add an option not to get queried when exiting and enable /quit when not logged in. Provided by Stuart Cassoff.
Timelines: family | ancestors | descendants | both | trunk
Files: files | file ages | folders
SHA1: 546e09da5db26b7f09849d8aaba5a50f53bede2c
User & Date: patthoyts 2010-01-12 20:30:28
Context
2010-01-12
20:46
Do not show the browser fields on the preferences dialog on Windows as we do not use this field on that platform. check-in: 41caf41dfe user: patthoyts tags: trunk
20:30
Applied patch 2913790 to add an option not to get queried when exiting and enable /quit when not logged in. Provided by Stuart Cassoff. check-in: 546e09da5d user: patthoyts tags: trunk
01:45
Fix initialization of the browser list (ferrieux) check-in: bdd206fbe7 user: patthoyts tags: trunk
Changes
Hide Diffs Unified Diffs Ignore Whitespace Patch

Changes to apps/tkchat/ChangeLog.






1
2
3
4
5
6
7




2010-01-11  Pat Thoyts  <[email protected]>

	* tkchat.tcl: Fix buggy initialization of the browser list
	when nothing specified. Problem spotted by ferrieux.

2009-12-13  Pat Thoyts  <[email protected]>

>
>
>
>
>







1
2
3
4
5
6
7
8
9
10
11
12
2010-01-12  Pat Thoyts  <[email protected]>

	* tkchat.tcl: Applied patch 2913790 to add an option not to get
	queried when exiting and enable /quit when not logged in (stu)

2010-01-11  Pat Thoyts  <[email protected]>

	* tkchat.tcl: Fix buggy initialization of the browser list
	when nothing specified. Problem spotted by ferrieux.

2009-12-13  Pat Thoyts  <[email protected]>

Changes to apps/tkchat/tkchat.tcl.

275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
....
4180
4181
4182
4183
4184
4185
4186



4187
4188
4189
4190
4191
4192
4193
....
4402
4403
4404
4405
4406
4407
4408
4409
4410
4411
4412
4413
4414
4415
4416
4417
4418
....
5452
5453
5454
5455
5456
5457
5458



5459
5460
5461
5462

5463
5464
5465
5466
5467
5468
5469
5470
5471
5472
....
5505
5506
5507
5508
5509
5510
5511
5512
5513
5514
5515
5516
5517
5518
5519
5520
5521
....
6203
6204
6205
6206
6207
6208
6209

6210
6211
6212
6213
6214
6215
6216
....
6994
6995
6996
6997
6998
6999
7000

7001
7002
7003
7004
7005
7006
7007
....
7025
7026
7027
7028
7029
7030
7031


7032
7033
7034
7035
7036
7037
7038
....
7050
7051
7052
7053
7054
7055
7056


7057
7058
7059
7060
7061
7062
7063
7064
7065
7066
7067
7068

7069
7070
7071
7072
7073
7074
7075
....
7174
7175
7176
7177
7178
7179
7180
7181
7182
7183
7184
7185
7186
7187
7188
    }
}

namespace eval ::tkchat {
    variable chatWindowTitle "The Tcler's Chat"

    variable HEADUrl {http://tcllib.cvs.sourceforge.net/*checkout*/tcllib/tclapps/apps/tkchat/tkchat.tcl?revision=HEAD}
    variable rcsid   {$Id: tkchat.tcl,v 1.478 2010/01/12 01:45:26 patthoyts Exp $}

    variable MSGS
    set MSGS(entered) [list \
	    "%user% has entered the chat!" \
	    "Out of a cloud of smoke, %user% appears!" \
	    "%user% saunters in." \
	    "%user% wanders in." \
................................................................................

proc ::tkchat::checkCommand { msg } {
    global Options

    # check against commands that can be used while logged off
    set moreToGo 0
    switch -re -- $msg {



	{^/smiley?s?$} {
	    ShowSmiles
	}
	{^/colou?rs?$} {
	    ChangeColors
	}
	{^/(font)?size -?[0-9]+} {
................................................................................
	    ::tkjabber::away $status dnd
	}
	{^/back} {
            set status ""
	    regexp {^/back\s*(.*)$} $msg -> status
	    ::tkjabber::back $status
	}
        {^/quit$} {
            ::tkchat::quit
        }
        {^/kick\s}   -
        {^/mute\s}   -
        {^/unmute\s} -
        {^/op\s}     -
        {^/deop\s}   {
            if {[regexp {^/((?:kick)|(?:mute)|(?:unmute)|(?:op)|(?:deop))\s+(\S+)(?:\s+(.*))?} $msg -> op nick reason]} {
                switch -exact -- $op {
................................................................................
		}
	    }
	}
    }
}

proc ::tkchat::quit {} {



    set q [mc "Are you sure you want to quit?"]
    set a [tk_messageBox -type yesno -default yes \
               -title [mc "Tkchat confirm quit"] \
               -message $q]

    if { $a eq "yes" } {
	::tkchat::saveRC
	exit
    }
}

proc ::tkchat::saveRC {} {
    global Options Images
    variable useTile
    # Exit early if there is no home directory to save to
................................................................................
	} else {
	    set Options(Pane) [.pane sash coord 0]
	}
    }

    # Save these options to resource file
    set keep {
	Alert,* AnimEmoticons AutoAway AutoAwayMsg AutoBookmark AutoConnect
	AutoFade AutoFadeLimit Browser BrowserTab ChatLogFile 
	ChatLogOff Color,* DisplayUsers ClickFocusEntry
	Emoticons EnableWhiteboard EntryMessageColor errLog ExitMessageColor
	Font,* Fullname FunkyTraffic Geometry HistoryLines JabberConference
	JabberPort JabberResource JabberServer Khim HateLolcatz
	LogFile LogLevel LogPrivateChat LogStderr MyColor Nickname
	OneToOne Pane Password ProxyHost ProxyPort ProxyUsername SavePW
	ServerLogging ShowNormalInline Style Subjects Theme Transparency
        UseBabelfish UseJabberSSL UseProxy Username UseTkOnly ValidateSSLChain
................................................................................
	Alert,ALL		0
	Alert,ME		1
	Alert,NORMAL		1
	Alert,RAISE		1
	Alert,SOUND		0
	Alert,TOPIC		1
	AnimEmoticons		0

	AutoAway		-1
        AutoAwayMsg		"no activity"
	AutoBookmark		0
	AutoConnect		0
	AutoFade		0
	AutoFadeLimit		80
	AutoScroll		0
................................................................................
    variable NS
    variable useTile

    variable EditOptions
    set EditOptions(Browser)         $Options(Browser)
    set EditOptions(BrowserTab)      $Options(BrowserTab)
    set EditOptions(Style)           $Options(Style)

    set EditOptions(AutoFade)        $Options(AutoFade)
    set EditOptions(AutoFadeLimit)   $Options(AutoFadeLimit)
    set EditOptions(Transparency)    $Options(Transparency)
    set EditOptions(UseTkOnly)       $Options(UseTkOnly)
    set EditOptions(AutoAwayMsg)     $Options(AutoAwayMsg)
    set EditOptions(HateLolcatz)     $Options(HateLolcatz)
    set EditOptions(FunkyTraffic)    $Options(FunkyTraffic)
................................................................................
        -variable ::tkchat::EditOptions(FunkyTraffic) -onvalue 1
    ${NS}::checkbutton $af.catz -text "I hate LOLCATZ"  -offvalue 0 \
        -variable ::tkchat::EditOptions(HateLolcatz) -onvalue 1
    ${NS}::checkbutton $af.cfe -text "Keep focus on entry"  -offvalue 0 \
        -variable ::tkchat::EditOptions(ClickFocusEntry) -onvalue 1
    ${NS}::checkbutton $af.lpc -text "Log private chat" -offvalue 0 \
        -variable ::tkchat::EditOptions(LogPrivateChat) -onvalue 1


    ${NS}::label $af.aal -text "Inactive message" -underline 0 \
        -anchor ne
    ${NS}::entry $af.aae -textvariable ::tkchat::EditOptions(AutoAwayMsg)
    if {!$useTile} {
        foreach w [list $af.store $af.norminline $af.traffic $af.catz \
                       $af.cfe $af.lpc] {
            $w configure -anchor nw
................................................................................
            you are automatically made inactive."
        tooltip::tooltip $af.catz "Toggle display of a LOLCATZ message in\
            the statusbar after checking the current version."
        tooltip::tooltip $af.cfe "Unset this option to permit setting focus\
            on the main chat widget."
        tooltip::tooltip $af.lpc "Enable logging of private chat conversations\
            to a per-remote-user file in ~/.tkchat_logs."


    }
    
    bind $dlg <Alt-s> [list $af.store invoke]
    bind $dlg <Alt-o> [list $af.norminline invoke]
    bind $dlg <Alt-h> [list $af.traffic invoke]
    bind $dlg <Alt-i> [list focus $af.aae]
    grid $af.store   -   -sticky ew -padx 2
    grid $af.norminline - -sticky ew -padx 2
    grid $af.traffic -   -sticky ew -padx 2
    grid $af.catz    -   -sticky ew -padx 2
    grid $af.cfe     -   -sticky ew -padx 2
    grid $af.lpc     -   -sticky ew -padx 2

    grid $af.aal $af.aae -sticky ew -padx 2
    grid columnconfigure $af 1 -weight 1

    set bf [${NS}::labelframe $page.bf -text "Preferred browser"]
    if {$useTile} { $bf configure -underline 10 }

    ${NS}::label $bf.m -anchor nw -wraplength 4i -justify left \
................................................................................
    if {$gimmicks} { grid $gf - -sticky news -padx 2 -pady 2 }

    bind $page <<TkchatOptionsAccept>> [namespace code {
        global Options ; variable EditOptions
	set Options(Browser) $EditOptions(Browser)
	set Options(BrowserTab) $EditOptions(BrowserTab)
	foreach property {Style AutoFade AutoFadeLimit UseTkOnly
            AutoAwayMsg HateLolcatz FunkyTraffic StoreMessages 
            ClickFocusEntry LogPrivateChat ShowNormalInline} {
	    if { $Options($property) ne $EditOptions($property) } {
		set Options($property) $EditOptions($property)
	    }
	}
        unset EditOptions
    }]






|







 







>
>
>







 







<
<
<







 







>
>
>
|
|
|
|
>

|
|







 







|
|
|







 







>







 







>







 







>
>







 







>
>












>







 







|







275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
....
4180
4181
4182
4183
4184
4185
4186
4187
4188
4189
4190
4191
4192
4193
4194
4195
4196
....
4405
4406
4407
4408
4409
4410
4411



4412
4413
4414
4415
4416
4417
4418
....
5452
5453
5454
5455
5456
5457
5458
5459
5460
5461
5462
5463
5464
5465
5466
5467
5468
5469
5470
5471
5472
5473
5474
5475
5476
....
5509
5510
5511
5512
5513
5514
5515
5516
5517
5518
5519
5520
5521
5522
5523
5524
5525
....
6207
6208
6209
6210
6211
6212
6213
6214
6215
6216
6217
6218
6219
6220
6221
....
6999
7000
7001
7002
7003
7004
7005
7006
7007
7008
7009
7010
7011
7012
7013
....
7031
7032
7033
7034
7035
7036
7037
7038
7039
7040
7041
7042
7043
7044
7045
7046
....
7058
7059
7060
7061
7062
7063
7064
7065
7066
7067
7068
7069
7070
7071
7072
7073
7074
7075
7076
7077
7078
7079
7080
7081
7082
7083
7084
7085
7086
....
7185
7186
7187
7188
7189
7190
7191
7192
7193
7194
7195
7196
7197
7198
7199
    }
}

namespace eval ::tkchat {
    variable chatWindowTitle "The Tcler's Chat"

    variable HEADUrl {http://tcllib.cvs.sourceforge.net/*checkout*/tcllib/tclapps/apps/tkchat/tkchat.tcl?revision=HEAD}
    variable rcsid   {$Id: tkchat.tcl,v 1.479 2010/01/12 20:30:28 patthoyts Exp $}

    variable MSGS
    set MSGS(entered) [list \
	    "%user% has entered the chat!" \
	    "Out of a cloud of smoke, %user% appears!" \
	    "%user% saunters in." \
	    "%user% wanders in." \
................................................................................

proc ::tkchat::checkCommand { msg } {
    global Options

    # check against commands that can be used while logged off
    set moreToGo 0
    switch -re -- $msg {
        {^/quit$} {
            ::tkchat::quit
        }
	{^/smiley?s?$} {
	    ShowSmiles
	}
	{^/colou?rs?$} {
	    ChangeColors
	}
	{^/(font)?size -?[0-9]+} {
................................................................................
	    ::tkjabber::away $status dnd
	}
	{^/back} {
            set status ""
	    regexp {^/back\s*(.*)$} $msg -> status
	    ::tkjabber::back $status
	}



        {^/kick\s}   -
        {^/mute\s}   -
        {^/unmute\s} -
        {^/op\s}     -
        {^/deop\s}   {
            if {[regexp {^/((?:kick)|(?:mute)|(?:unmute)|(?:op)|(?:deop))\s+(\S+)(?:\s+(.*))?} $msg -> op nick reason]} {
                switch -exact -- $op {
................................................................................
		}
	    }
	}
    }
}

proc ::tkchat::quit {} {
    global Options
    set a "yes"
    if {$Options(AskBeforeQuit)} {
        set q [mc "Are you sure you want to quit?"]
        set a [tk_messageBox -type yesno -default yes \
                   -title [mc "Tkchat confirm quit"] \
                   -message $q]
    }
    if { $a eq "yes" } {
        ::tkchat::saveRC
        exit
    }
}

proc ::tkchat::saveRC {} {
    global Options Images
    variable useTile
    # Exit early if there is no home directory to save to
................................................................................
	} else {
	    set Options(Pane) [.pane sash coord 0]
	}
    }

    # Save these options to resource file
    set keep {
	Alert,* AnimEmoticons AskBeforeQuit AutoAway AutoAwayMsg
	AutoBookmark AutoConnect AutoFade AutoFadeLimit Browser BrowserTab
	ChatLogFile ChatLogOff Color,* DisplayUsers ClickFocusEntry
	Emoticons EnableWhiteboard EntryMessageColor errLog ExitMessageColor
	Font,* Fullname FunkyTraffic Geometry HistoryLines JabberConference
	JabberPort JabberResource JabberServer Khim HateLolcatz
	LogFile LogLevel LogPrivateChat LogStderr MyColor Nickname
	OneToOne Pane Password ProxyHost ProxyPort ProxyUsername SavePW
	ServerLogging ShowNormalInline Style Subjects Theme Transparency
        UseBabelfish UseJabberSSL UseProxy Username UseTkOnly ValidateSSLChain
................................................................................
	Alert,ALL		0
	Alert,ME		1
	Alert,NORMAL		1
	Alert,RAISE		1
	Alert,SOUND		0
	Alert,TOPIC		1
	AnimEmoticons		0
	AskBeforeQuit		1
	AutoAway		-1
        AutoAwayMsg		"no activity"
	AutoBookmark		0
	AutoConnect		0
	AutoFade		0
	AutoFadeLimit		80
	AutoScroll		0
................................................................................
    variable NS
    variable useTile

    variable EditOptions
    set EditOptions(Browser)         $Options(Browser)
    set EditOptions(BrowserTab)      $Options(BrowserTab)
    set EditOptions(Style)           $Options(Style)
    set EditOptions(AskBeforeQuit)   $Options(AskBeforeQuit)
    set EditOptions(AutoFade)        $Options(AutoFade)
    set EditOptions(AutoFadeLimit)   $Options(AutoFadeLimit)
    set EditOptions(Transparency)    $Options(Transparency)
    set EditOptions(UseTkOnly)       $Options(UseTkOnly)
    set EditOptions(AutoAwayMsg)     $Options(AutoAwayMsg)
    set EditOptions(HateLolcatz)     $Options(HateLolcatz)
    set EditOptions(FunkyTraffic)    $Options(FunkyTraffic)
................................................................................
        -variable ::tkchat::EditOptions(FunkyTraffic) -onvalue 1
    ${NS}::checkbutton $af.catz -text "I hate LOLCATZ"  -offvalue 0 \
        -variable ::tkchat::EditOptions(HateLolcatz) -onvalue 1
    ${NS}::checkbutton $af.cfe -text "Keep focus on entry"  -offvalue 0 \
        -variable ::tkchat::EditOptions(ClickFocusEntry) -onvalue 1
    ${NS}::checkbutton $af.lpc -text "Log private chat" -offvalue 0 \
        -variable ::tkchat::EditOptions(LogPrivateChat) -onvalue 1
    ${NS}::checkbutton $af.abq -text "Ask before exiting" -offvalue 0 \
        -variable ::tkchat::EditOptions(AskBeforeQuit) -onvalue 1
    ${NS}::label $af.aal -text "Inactive message" -underline 0 \
        -anchor ne
    ${NS}::entry $af.aae -textvariable ::tkchat::EditOptions(AutoAwayMsg)
    if {!$useTile} {
        foreach w [list $af.store $af.norminline $af.traffic $af.catz \
                       $af.cfe $af.lpc] {
            $w configure -anchor nw
................................................................................
            you are automatically made inactive."
        tooltip::tooltip $af.catz "Toggle display of a LOLCATZ message in\
            the statusbar after checking the current version."
        tooltip::tooltip $af.cfe "Unset this option to permit setting focus\
            on the main chat widget."
        tooltip::tooltip $af.lpc "Enable logging of private chat conversations\
            to a per-remote-user file in ~/.tkchat_logs."
        tooltip::tooltip $af.abq "Display a confirmation dialog before\
            exiting to permit the user to cancel an accidental quit."
    }
    
    bind $dlg <Alt-s> [list $af.store invoke]
    bind $dlg <Alt-o> [list $af.norminline invoke]
    bind $dlg <Alt-h> [list $af.traffic invoke]
    bind $dlg <Alt-i> [list focus $af.aae]
    grid $af.store   -   -sticky ew -padx 2
    grid $af.norminline - -sticky ew -padx 2
    grid $af.traffic -   -sticky ew -padx 2
    grid $af.catz    -   -sticky ew -padx 2
    grid $af.cfe     -   -sticky ew -padx 2
    grid $af.lpc     -   -sticky ew -padx 2
    grid $af.abq     -   -sticky ew -padx 2
    grid $af.aal $af.aae -sticky ew -padx 2
    grid columnconfigure $af 1 -weight 1

    set bf [${NS}::labelframe $page.bf -text "Preferred browser"]
    if {$useTile} { $bf configure -underline 10 }

    ${NS}::label $bf.m -anchor nw -wraplength 4i -justify left \
................................................................................
    if {$gimmicks} { grid $gf - -sticky news -padx 2 -pady 2 }

    bind $page <<TkchatOptionsAccept>> [namespace code {
        global Options ; variable EditOptions
	set Options(Browser) $EditOptions(Browser)
	set Options(BrowserTab) $EditOptions(BrowserTab)
	foreach property {Style AutoFade AutoFadeLimit UseTkOnly
            AskBeforeQuit AutoAwayMsg HateLolcatz FunkyTraffic StoreMessages
            ClickFocusEntry LogPrivateChat ShowNormalInline} {
	    if { $Options($property) ne $EditOptions($property) } {
		set Options($property) $EditOptions($property)
	    }
	}
        unset EditOptions
    }]