int __cdecl CMsnProto::FileCancel(HANDLE hContact, HANDLE hTransfer) { filetransfer* ft = (filetransfer*)hTransfer; if (!msnLoggedIn || !p2p_sessionRegistered(ft)) return 0; if (!(ft->std.flags & PFTS_SENDING) && ft->fileId == -1) { if (ft->p2p_appID != 0) p2p_sendStatus(ft, 603); else msnftp_sendAcceptReject (ft, false); } else { ft->bCanceled = true; if (ft->p2p_appID != 0) { p2p_sendCancel(ft); if (!(ft->std.flags & PFTS_SENDING) && ft->p2p_isV2) p2p_sessionComplete(ft); } } ft->std.ptszFiles = NULL; ft->std.totalFiles = 0; return 0; }
// MsnFileDeny - rejects the file transfer request int __cdecl CMsnProto::FileDeny(MCONTACT, HANDLE hTransfer, const TCHAR* /*szReason*/) { filetransfer* ft = (filetransfer*)hTransfer; if (ft->tType == SERVER_HTTP) delete ft; #ifdef OBSOLETE else { if (!msnLoggedIn || !p2p_sessionRegistered(ft)) return 1; if (!(ft->std.flags & PFTS_SENDING) && ft->fileId == -1) { if (ft->p2p_appID != 0) p2p_sendStatus(ft, 603); else msnftp_sendAcceptReject(ft, false); } else { ft->bCanceled = true; if (ft->p2p_appID != 0) p2p_sendCancel(ft); } } #endif return 0; }
void CMsnProto::p2p_cancelAllSessions(void) { mir_cslock lck(m_csSessions); for (int i = 0; i < m_arSessions.getCount(); i++) { m_arSessions[i].bCanceled = true; p2p_sendCancel(&m_arSessions[i]); } }
void CMsnProto::p2p_cancelAllSessions(void) { EnterCriticalSection(&sessionLock); for (int i=0; i < sessionList.getCount(); i++) { sessionList[i].bCanceled = true; p2p_sendCancel(&sessionList[i]); } LeaveCriticalSection(&sessionLock); }
void CMsnProto::p2p_clearThreadSessions(MCONTACT hContact, TInfoType mType) { mir_cslock lck(m_csSessions); for (int i = 0; i < m_arSessions.getCount(); i++) { filetransfer* ft = &m_arSessions[i]; if (ft->std.hContact == hContact && ft->tType == mType) { ft->bCanceled = true; ft->tType = SERVER_NOTIFICATION; p2p_sendCancel(ft); } } }
void CMsnProto::p2p_clearThreadSessions(HANDLE hContact, TInfoType mType) { EnterCriticalSection(&sessionLock); for (int i=0; i < sessionList.getCount(); i++) { filetransfer* ft = &sessionList[i]; if (ft->std.hContact == hContact && ft->tType == mType) { ft->bCanceled = true; ft->tType = SERVER_NOTIFICATION; p2p_sendCancel(ft); } } LeaveCriticalSection(&sessionLock); }
void CMsnProto::p2p_clearDormantSessions(void) { mir_cslockfull lck(m_csSessions); time_t ts = time(NULL); for (int i = 0; i < m_arSessions.getCount(); i++) { filetransfer* FT = &m_arSessions[i]; if (!FT->p2p_sessionid && !MSN_GetUnconnectedThread(FT->p2p_dest, SERVER_P2P_DIRECT)) p2p_invite(FT->p2p_type, FT, NULL); else if (FT->p2p_waitack && (ts - FT->ts) > 120) { FT->bCanceled = true; p2p_sendCancel(FT); lck.unlock(); p2p_unregisterSession(FT); lck.lock(); i = 0; } } }
int __cdecl CMsnProto::FileDeny(HANDLE hContact, HANDLE hTransfer, const PROTOCHAR* /*szReason*/) { filetransfer* ft = (filetransfer*)hTransfer; if (!msnLoggedIn || !p2p_sessionRegistered(ft)) return 1; if (!(ft->std.flags & PFTS_SENDING) && ft->fileId == -1) { if (ft->p2p_appID != 0) p2p_sendStatus(ft, 603); else msnftp_sendAcceptReject (ft, false); } else { ft->bCanceled = true; if (ft->p2p_appID != 0) p2p_sendCancel(ft); } return 0; }
void CMsnProto::p2p_clearDormantSessions(void) { EnterCriticalSection(&sessionLock); time_t ts = time(NULL); for (int i=0; i < sessionList.getCount(); i++) { filetransfer* FT = &sessionList[i]; if (!FT->p2p_sessionid && !MSN_GetUnconnectedThread(FT->p2p_dest, SERVER_P2P_DIRECT)) p2p_invite(FT->p2p_type, FT, NULL); else if (FT->p2p_waitack && (ts - FT->ts) > 120) { FT->bCanceled = true; p2p_sendCancel(FT); LeaveCriticalSection(&sessionLock); p2p_unregisterSession(FT); EnterCriticalSection(&sessionLock); i = 0; } } LeaveCriticalSection(&sessionLock); }