📄 gui.tcl
字号:
set filename [chooseFileDialog "" [trans sendfile] $win_name] status_log $filename } if { $filename == "" } { return } #Remember last directory set starting_dir [file dirname $filename] if {![file readable $filename]} { msg_box "[trans invalidfile [trans filename] $filename]" return } #if {[::config::getKey autoftip] == 0 } { # ::config::setKey myip [ $w.top.fields.ip get ] # set ipaddr [ $w.top.fields.ip get ] # destroy $w #} else { # set ipaddr [ $w.top.fields.ip get ] # destroy $w # if { $ipaddr != [::config::getKey myip] } { # set ipaddr [ ::abook::getDemographicField clientip ] # } #} if { [::config::getKey autoftip] } { set ipaddr [::config::getKey myip] } else { set ipaddr [::config::getKey manualip] } if { [catch {set filesize [file size $filename]} res]} { ::amsn::errorMsg "[trans filedoesnotexist]" #::amsn::fileTransferProgress c $cookie -1 -1 return 1 } set chatid [::ChatWindow::Name $win_name] status_log "chatid:=$chatid" red set users [::MSN::usersInChat $chatid] foreach chatid $users { chatUser $chatid #Calculate a random cookie set cookie [expr {([clock clicks]) % (65536 * 8)}] set txt "[trans ftsendinvitation [::abook::getDisplayNick $chatid] $filename [::amsn::sizeconvert $filesize]]" status_log "Random generated cookie: $cookie\n" SendMessageFIFO [list ::amsn::WinWriteFTSend $chatid $txt $cookie] "::amsn::messages_stack($chatid)" "::amsn::messages_flushing($chatid)" ::MSN::ChatQueue $chatid [list ::MSNFT::sendFTInvitation $chatid $filename $filesize $ipaddr $cookie] #::MSNFT::sendFTInvitation $chatid $filename $filesize $ipaddr $cookie ::log::ftlog $chatid $txt } return 0 } proc WinWriteFTSend { chatid txt cookie } { WinWrite $chatid "\n" green WinWriteIcon $chatid greyline 3 WinWrite $chatid "\n" green WinWriteIcon $chatid fticon 3 2 WinWrite $chatid "$txt " green WinWriteClickable $chatid "[trans cancel]" \ "::amsn::CancelFTInvitation $chatid $cookie" ftno$cookie WinWrite $chatid "\n" green WinWriteIcon $chatid greyline 3 } proc CancelFTInvitation { chatid cookie } { #::MSNFT::acceptFT $chatid $cookie set win_name [::ChatWindow::For $chatid] if { [::ChatWindow::For $chatid] == 0} { return 0 } ::MSNFT::cancelFTInvitation $chatid $cookie [::ChatWindow::GetOutText ${win_name}] tag configure ftno$cookie \ -foreground #808080 -font bplainf -underline false [::ChatWindow::GetOutText ${win_name}] tag bind ftno$cookie <Enter> "" [::ChatWindow::GetOutText ${win_name}] tag bind ftno$cookie <Leave> "" [::ChatWindow::GetOutText ${win_name}] tag bind ftno$cookie <Button1-ButtonRelease> "" [::ChatWindow::GetOutText ${win_name}] conf -cursor xterm set txt [trans invitationcancelled] SendMessageFIFO [list ::amsn::WinWriteCancelFT $chatid $txt] "::amsn::messages_stack($chatid)" "::amsn::messages_flushing($chatid)" set email [::MSN::usersInChat $chatid] ::log::ftlog $email $txt } proc WinWriteCancelFT {chatid txt} { WinWrite $chatid "\n" green WinWriteIcon $chatid greyline 3 WinWrite $chatid "\n" green WinWriteIcon $chatid ftreject 3 2 WinWrite $chatid " $txt\n" green WinWriteIcon $chatid greyline 3 } proc acceptedFT { chatid who filename } { set win_name [::ChatWindow::For $chatid] if { [::ChatWindow::For $chatid] == 0} { return 0 } set txt [trans ftacceptedby [::abook::getDisplayNick $chatid] $filename] WinWrite $chatid "\n" green WinWriteIcon $chatid greyline 3 WinWrite $chatid "\n" green WinWriteIcon $chatid fticon 3 2 WinWrite $chatid " $txt\n" green WinWriteIcon $chatid greyline 3 set email [::MSN::usersInChat $chatid] ::log::ftlog $email $txt } proc rejectedFT { chatid who filename } { set win_name [::ChatWindow::For $chatid] if { [::ChatWindow::For $chatid] == 0} { return 0 } set txt [trans ftrejectedby [::abook::getDisplayNick $chatid] $filename] WinWrite $chatid "\n" green WinWriteIcon $chatid greyline 3 WinWrite $chatid "\n" green WinWriteIcon $chatid ftreject 3 2 WinWrite $chatid " $txt\n" green WinWriteIcon $chatid greyline 3 set email [::MSN::usersInChat $chatid] ::log::ftlog $email $txt } #//////////////////////////////////////////////////////////////////////////////// # GotFileTransferRequest ( chatid dest branchuid cseq uid sid filename filesize) # This procedure is called when we receive an MSN6 File Transfer Request proc GotFileTransferRequest { chatid dest branchuid cseq uid sid filename filesize} { set win_name [::ChatWindow::For $chatid] if { [::ChatWindow::For $chatid] == 0} { return 0 } set fromname [::abook::getDisplayNick $dest] set txt [trans ftgotinvitation $fromname '$filename' [::amsn::sizeconvert $filesize] [::config::getKey receiveddir]] set win_name [::ChatWindow::MakeFor $chatid $txt $dest] WinWrite $chatid "\n" green WinWriteIcon $chatid greyline 3 WinWrite $chatid "\n" green if { [::skin::loadPixmap "FT_preview_${sid}"] != "" } { WinWriteIcon $chatid FT_preview_${sid} 5 5 WinWrite $chatid "\n" green } WinWriteIcon $chatid fticon 3 2 WinWrite $chatid $txt green WinWrite $chatid " - (" green WinWriteClickable $chatid "[trans accept]" [list ::amsn::AcceptFT $chatid -1 [list $dest $branchuid $cseq $uid $sid $filename]] ftyes$sid WinWrite $chatid " / " green WinWriteClickable $chatid "[trans saveas]" [list ::amsn::SaveAsFT $chatid -1 [list $dest $branchuid $cseq $uid $sid $filename]] ftsaveas$sid WinWrite $chatid " / " green WinWriteClickable $chatid "[trans reject]" [list ::amsn::RejectFT $chatid -1 [list $sid $branchuid $uid]] ftno$sid WinWrite $chatid ")\n" green WinWriteIcon $chatid greyline 3 ::log::ftlog $dest $txt if { ![file writable [::config::getKey receiveddir]]} { WinWrite $chatid "\n[trans readonlywarn [::config::getKey receiveddir]]\n" red WinWriteIcon $chatid greyline 3 } if { [::config::getKey ftautoaccept] == 1 } { WinWrite $chatid "\n[trans autoaccepted]" green ::amsn::AcceptFT $chatid -1 [list $dest $branchuid $cseq $uid $sid $filename] } } #Message shown when receiving a file proc fileTransferRecv {filename filesize cookie chatid fromlogin} { set win_name [::ChatWindow::For $chatid] if { [::ChatWindow::For $chatid] == 0} { return 0 } set fromname [::abook::getDisplayNick $fromlogin] set txt [trans ftgotinvitation $fromname '$filename' [::amsn::sizeconvert $filesize] [::config::getKey receiveddir]] set win_name [::ChatWindow::MakeFor $chatid $txt $fromlogin] WinWrite $chatid "\n" green WinWriteIcon $chatid greyline 3 WinWrite $chatid "\n" green WinWriteIcon $chatid fticon 3 2 WinWrite $chatid $txt green WinWrite $chatid " - (" green WinWriteClickable $chatid "[trans accept]" \ "::amsn::AcceptFT $chatid $cookie" ftyes$cookie WinWrite $chatid " / " green WinWriteClickable $chatid "[trans saveas]" \ "::amsn::SaveAsFT $chatid $cookie" ftsaveas$cookie WinWrite $chatid " / " green WinWriteClickable $chatid "[trans reject]" \ "::amsn::RejectFT $chatid $cookie" ftno$cookie WinWrite $chatid ")\n" green WinWriteIcon $chatid greyline 3 ::log::ftlog $fromlogin $txt if { ![file writable [::config::getKey receiveddir]]} { WinWrite $chatid "\n[trans readonlywarn [::config::getKey receiveddir]]\n" red WinWriteIcon $chatid greyline 3 } if { [::config::getKey ftautoaccept] == 1 } { WinWrite $chatid "\n[trans autoaccepted]" green ::amsn::AcceptFT $chatid $cookie } } proc AcceptFTOpenSB { chatid cookie {varlist ""} } { #::amsn::RecvWin $cookie if { $cookie != -1 } { ::MSNFT::acceptFT $chatid $cookie } else { ::MSN6FT::AcceptFT $chatid [lindex $varlist 0] [lindex $varlist 1] [lindex $varlist 2] [lindex $varlist 3] [lindex $varlist 4] [lindex $varlist 5] set cookie [lindex $varlist 4] } } proc AcceptFT { chatid cookie {varlist ""} } { foreach var $varlist { status_log "Var: $var\n" red } set chatid [::MSN::chatTo $chatid] ::MSN::ChatQueue $chatid [list ::amsn::AcceptFTOpenSB $chatid $cookie $varlist] set win_name [::ChatWindow::For $chatid] if { [::ChatWindow::For $chatid] == 0} { return 0 } if { $cookie == -1 } { set cookie [lindex $varlist 4] } [::ChatWindow::GetOutText ${win_name}] tag configure ftyes$cookie \ -foreground #808080 -font bplainf -underline false [::ChatWindow::GetOutText ${win_name}] tag bind ftyes$cookie <Enter> "" [::ChatWindow::GetOutText ${win_name}] tag bind ftyes$cookie <Leave> "" [::ChatWindow::GetOutText ${win_name}] tag bind ftyes$cookie <Button1-ButtonRelease> "" [::ChatWindow::GetOutText ${win_name}] tag configure ftsaveas$cookie \ -foreground #808080 -font bplainf -underline false [::ChatWindow::GetOutText ${win_name}] tag bind ftsaveas$cookie <Enter> "" [::ChatWindow::GetOutText ${win_name}] tag bind ftsaveas$cookie <Leave> "" [::ChatWindow::GetOutText ${win_name}] tag bind ftsaveas$cookie <Button1-ButtonRelease> "" [::ChatWindow::GetOutText ${win_name}] tag configure ftno$cookie \ -foreground #808080 -font bplainf -underline false [::ChatWindow::GetOutText ${win_name}] tag bind ftno$cookie <Enter> "" [::ChatWindow::GetOutText ${win_name}] tag bind ftno$cookie <Leave> "" [::ChatWindow::GetOutText ${win_name}] tag bind ftno$cookie <Button1-ButtonRelease> "" [::ChatWindow::GetOutText ${win_name}] conf -cursor xterm set txt [trans ftaccepted] SendMessageFIFO [list ::amsn::WinWriteAcceptFT $chatid $txt] "::amsn::messages_stack($chatid)" "::amsn::messages_flushing($chatid)" set email [::MSN::usersInChat $chatid] ::log::ftlog $email $txt } proc WinWriteAcceptFT {chatid txt} { WinWrite $chatid "\n" green WinWriteIcon $chatid greyline 3 WinWrite $chatid "\n" green WinWriteIcon $chatid fticon 3 2 WinWrite $chatid " $txt\n" green WinWriteIcon $chatid greyline 3 } proc SaveAsFT {chatid cookie {varlist ""} } { if {$cookie != -1} { set initialfile [::MSNFT::getFilename $cookie] } { set initialfile [lindex $varlist 5] } if {[catch {set filename [tk_getSaveFile -initialfile $initialfile -initialdir [::config::getKey receiveddir]]} res]} { status_log "Error in SaveAsFT: $res \n" set filename [tk_getSaveFile -initialfile $initialfile -initialdir [set ::HOME]] } if {$filename != ""} { AcceptFT $chatid $cookie [list [lindex $varlist 0] [lindex $varlist 1] [lindex $varlist 2] [lindex $varlist 3] [lindex $varlist 4] "$filename"] } {return} } proc RejectFT {chatid cookie {varlist ""} } { if { $cookie != -1 && $cookie != -2 } { ::MSNFT::rejectFT $chatid $cookie } elseif { $cookie == - 1 } { ::MSN6FT::RejectFT $chatid [lindex $varlist 0] [lindex $varlist 1] [lindex $varlist 2] set cookie [lindex $varlist 0] } elseif { $cookie == -2 } { set cookie [lindex $varlist 0] set txt [trans filetransfercancelled] } set win_name [::ChatWindow::For $chatid] if { [::ChatWindow::For $chatid] == 0} { return 0 } [::ChatWindow::GetOutText ${win_name}] tag configure ftyes$cookie \ -foreground #808080 -font bplainf -underline false [::ChatWindow::GetOutText ${win_name}] tag bind ftyes$cookie <Enter> "" [::ChatWindow::GetOutText ${win_name}] tag bind ftyes$cookie <Leave> "" [::ChatWindow::GetOutText ${win_name}] tag bind ftyes$cookie <Button1-ButtonRelease> "" [::ChatWindow::GetOutText ${win_name}] tag configure ftsaveas$cookie \ -foreground #808080 -font bplainf -underline false [::ChatWindow::GetOutText ${win_name}] tag bind ftsaveas$cookie <Enter> "" [::ChatWindow::GetOutText ${win_name}] tag bind ftsaveas$cookie <Leave> "" [::ChatWindow::GetOutText ${win_name}] tag bind ftsaveas$cookie <Button1-ButtonRelease> "" [::ChatWindow::GetOutText ${win_name}] tag configure ftno$cookie \ -foreground #808080 -font bplainf -underline false [::ChatWindow::GetOutText ${win_name}] tag bind ftno$cookie <Enter> "" [::ChatWindow::GetOutText ${win_name}] tag bind ftno$cookie <Leave> "" [::ChatWindow::GetOutText ${win_name}] tag bind ftno$cookie <Button1-ButtonRelease> "" [::ChatWindow::GetOutText ${win_name}] conf -cursor xterm if { [info exists txt] == 0 } { set txt [trans ftrejected] } SendMessageFIFO [list ::amsn::WinWriteRejectFT $chatid $txt] "::amsn::messages_stack($chatid)" "::amsn::messages_flushing($chatid)" set email [::MSN::usersInChat $chatid] ::log::ftlog $email $txt } proc WinWriteRejectFT {chatid txt} { WinWrite $chatid "\n" green WinWriteIcon $chatid greyline 3 WinWrite $chatid "\n" green WinWriteIcon $chatid ftreject 3 2 WinWrite $chatid "$txt\n" green WinWriteIcon $chatid greyline 3 } #PRIVATE: Opens Receiving Window
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -