From: <vi...@us...> - 2010-09-02 00:37:23
|
Revision: 12179 http://amsn.svn.sourceforge.net/amsn/?rev=12179&view=rev Author: vivia Date: 2010-09-02 00:37:16 +0000 (Thu, 02 Sep 2010) Log Message: ----------- Fixed WinWrites for canceled and rejected FTs and cams Modified Paths: -------------- branches/p2p/gui.tcl branches/p2p/msncam.tcl branches/p2p/msnp2p/filetransfer.tcl branches/p2p/msnp2p/session.tcl branches/p2p/msnp2p/webcam.tcl Modified: branches/p2p/gui.tcl =================================================================== --- branches/p2p/gui.tcl 2010-09-01 23:40:40 UTC (rev 12178) +++ branches/p2p/gui.tcl 2010-09-02 00:37:16 UTC (rev 12179) @@ -1241,6 +1241,7 @@ } ::MSNFT::cancelFTInvitation $chatid $cookie + $::ft_handler cancel_by_cookie $cookie DisableCancelText $cookie $chatid set txt [trans invitationcancelled] Modified: branches/p2p/msncam.tcl =================================================================== --- branches/p2p/msncam.tcl 2010-09-01 23:40:40 UTC (rev 12178) +++ branches/p2p/msncam.tcl 2010-09-02 00:37:16 UTC (rev 12179) @@ -127,7 +127,7 @@ #draw a notification in the window (gui) - ::CAMGUI::CamCanceled $chatid $sess_obj + ::CAMGUI::CamCanceled $chatid $sid if { [OnDarwin] } { set grabber .grabber.seq @@ -2579,7 +2579,7 @@ #} } - proc InvitationRejected {chatid sid branchuid uid} { + proc InvitationRejected {chatid sid } { #Get the chatwindow name set win_name [::ChatWindow::For $chatid] Modified: branches/p2p/msnp2p/filetransfer.tcl =================================================================== --- branches/p2p/msnp2p/filetransfer.tcl 2010-09-01 23:40:40 UTC (rev 12178) +++ branches/p2p/msnp2p/filetransfer.tcl 2010-09-02 00:37:16 UTC (rev 12179) @@ -35,7 +35,7 @@ } - set handlers { p2pBridgeSelected On_bridge_selected p2pOutgoingSessionTransferCompleted On_transfer_completed p2pChunkReceived2 On_chunk_received p2pAccepted On_session_accepted p2pChunkSent2 On_chunk_sent p2pTransreqReceived On_transreq_received p2pConnecting On_connecting p2pListening On_listening p2pIdentifying On_identifying p2pTimeout On_timeout p2pByeReceived On_bye_received } + set handlers { p2pBridgeSelected On_bridge_selected p2pOutgoingSessionTransferCompleted On_transfer_completed p2pChunkReceived2 On_chunk_received p2pAccepted On_session_accepted p2pRejected On_session_rejected p2pChunkSent2 On_chunk_sent p2pTransreqReceived On_transreq_received p2pConnecting On_connecting p2pListening On_listening p2pIdentifying On_identifying p2pTimeout On_timeout p2pByeReceived On_bye_received } foreach { event callback } $handlers { ::Event::registerEvent $event all [list $self $callback] @@ -113,6 +113,7 @@ } ::amsn::RejectFT [$p2pSession cget -peer] -1 [$p2pSession cget -id] $self Respond "603" + $::ft_handler remove_session $self } @@ -125,6 +126,7 @@ ::amsn::FTProgress ca $self $options(-localpath) set chatid [$p2pSession cget -peer] $self WinWriteText $chatid [trans filetransfercancelled] + $::ft_handler remove_session $self } method On_bye_received { event session } { @@ -132,7 +134,10 @@ if { $session != $p2pSession } { return } ::amsn::FTProgress ca $self $options(-localpath) set chatid [$p2pSession cget -peer] - $self WinWriteText $chatid [trans filetransfercancelled] + set sid [$self cget -id] + ::amsn::RejectFT $chatid "-2" $sid + $::ft_handler remove_session $self + #$self WinWriteText $chatid [trans filetransfercancelled] } @@ -314,6 +319,14 @@ } + method On_session_rejected { event session message } { + + if { $session != $p2pSession } { return } + set chatid [$p2pSession cget -peer] + SendMessageFIFO [list ::amsn::rejectedFT $chatid "" $options(-filename)] "::amsn::messages_stack($chatid)" "::amsn::messages_flushing($chatid)" + + } + method On_transreq_received { event msg } { if { [$msg cget -call_id] != [$self cget -call_id] } { return } @@ -353,6 +366,7 @@ ::amsn::FTProgress s $self $options(-localpath) [$blob cget -current_size] [$blob cget -blob_size] } else { ::amsn::FTProgress fs $self $options(-localpath) + $::ft_handler remove_session $self $self WinWriteText [$p2pSession cget -peer] [trans filetransfercomplete] close [$p2pSession cget -fd] } @@ -375,6 +389,7 @@ close [$p2pSession cget -fd] set filename [$self cget -localpath] file rename $filename.incomplete $filename + $::ft_handler remove_session $self } @@ -385,6 +400,8 @@ option -client "" variable incoming_sessions -array {} + variable outgoing_sessions -array {} + variable out_sessions {} constructor { args } { @@ -429,10 +446,30 @@ if { $callback != "" } { set outgoing_sessions([$session p2p_session]) [list $handles $callback $errback] } + lappend out_sessions $session $session invite $filename $size } + method cancel_by_cookie { cookie } { + + foreach session $out_sessions { + if { [$session cget -cookie] == $cookie } { + $session cancel + $self remove_session $session + return + } + } + + } + + method remove_session { session } { + + set ind [lsearch $out_sessions $session] + lreplace $out_sessions $ind $ind + + } + method Outgoing_session_transfer_completed { event session data } { status_log "Outgoing session transfer completed!!!!!!!" Modified: branches/p2p/msnp2p/session.tcl =================================================================== --- branches/p2p/msnp2p/session.tcl 2010-09-01 23:40:40 UTC (rev 12178) +++ branches/p2p/msnp2p/session.tcl 2010-09-02 00:37:16 UTC (rev 12179) @@ -418,7 +418,7 @@ method On_bye_received { msg } { - ::Event::fireEvent p2pByeReceived p2p $self + ::Event::fireEvent p2pByeReceived p2p $self } Modified: branches/p2p/msnp2p/webcam.tcl =================================================================== --- branches/p2p/msnp2p/webcam.tcl 2010-09-01 23:40:40 UTC (rev 12178) +++ branches/p2p/msnp2p/webcam.tcl 2010-09-02 00:37:16 UTC (rev 12179) @@ -176,6 +176,7 @@ ::Event::registerEvent p2pOutgoingSessionTransferCompleted all [list $self On_data_blob_received] ;#not really completed, just a blob received ::Event::registerEvent p2pAccepted all [list $self On_session_accepted] ::Event::registerEvent p2pRejected all [list $self On_session_rejected] + ::Event::registerEvent p2pByeReceived all [list $self On_bye_received] } @@ -225,7 +226,7 @@ } else { set context "\x74\x03\x00\x81" $self Close $context "" - ::MSNCAM::CamCanceled $options(-chatid) $self + ::MSNCAM::CamCanceled $options(-chatid) $self } $self configure -canceled 1 destroy $self @@ -267,9 +268,11 @@ } - method On_bye_received { message } { + method On_bye_received { event session } { + if { $session != $p2pSession } { return } $self configure -canceled 1 + ::CAMGUI::CamCanceled $options(-chatid) [$self cget -id] destroy $self } This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |