From 2d043179f4723b15eb63df92d6cdb031511f10ee Mon Sep 17 00:00:00 2001 From: Vadim Dashevskiy Date: Sun, 2 Nov 2014 10:29:30 +0000 Subject: MSN protocol stopped working (R.I.P), moved to deprecated, banned by the core, delete mask in PluginUpdater was created git-svn-id: http://svn.miranda-ng.org/main/trunk@10896 1316c22d-e87f-b044-9b9b-93d7a3e3ba9c --- protocols/MSN/src/msn_p2ps.cpp | 292 ----------------------------------------- 1 file changed, 292 deletions(-) delete mode 100644 protocols/MSN/src/msn_p2ps.cpp (limited to 'protocols/MSN/src/msn_p2ps.cpp') diff --git a/protocols/MSN/src/msn_p2ps.cpp b/protocols/MSN/src/msn_p2ps.cpp deleted file mode 100644 index 07d8f80d5a..0000000000 --- a/protocols/MSN/src/msn_p2ps.cpp +++ /dev/null @@ -1,292 +0,0 @@ -/* -Plugin of Miranda IM for communicating with users of the MSN Messenger protocol. - -Copyright (c) 2012-2014 Miranda NG Team -Copyright (c) 2006-2012 Boris Krasnovskiy. -Copyright (c) 2003-2005 George Hazan. -Copyright (c) 2002-2003 Richard Hughes (original version). - -This program is free software; you can redistribute it and/or -modify it under the terms of the GNU General Public License -as published by the Free Software Foundation; either version 2 -of the License, or (at your option) any later version. - -This program is distributed in the hope that it will be useful, -but WITHOUT ANY WARRANTY; without even the implied warranty of -MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -GNU General Public License for more details. - -You should have received a copy of the GNU General Public License -along with this program. If not, see . -*/ - -#include "msn_global.h" -#include "msn_proto.h" - -///////////////////////////////////////////////////////////////////////////////////////// -// add file session to a list - -void CMsnProto::p2p_registerSession(filetransfer* ft) -{ - mir_cslock lck(sessionLock); - sessionList.insert(ft); -} - -///////////////////////////////////////////////////////////////////////////////////////// -// remove file session from a list - -void CMsnProto::p2p_unregisterSession(filetransfer* ft) -{ - mir_cslock lck(sessionLock); - sessionList.remove(ft); -} - -///////////////////////////////////////////////////////////////////////////////////////// -// get session by some parameter - -filetransfer* CMsnProto::p2p_getSessionByID(unsigned id) -{ - if (id == 0) - return NULL; - - mir_cslock lck(sessionLock); - - for (int i=0; i < sessionList.getCount(); i++) { - filetransfer* FT = &sessionList[i]; - if (FT->p2p_sessionid == id) - return FT; - } - - return NULL; -} - -filetransfer* CMsnProto::p2p_getSessionByUniqueID(unsigned id) -{ - if (id == 0) - return NULL; - - mir_cslock lck(sessionLock); - - for (int i=0; i < sessionList.getCount(); i++) - { - filetransfer* FT = &sessionList[i]; - if (FT->p2p_acksessid == id) - return FT; - } - - return NULL; -} - - -bool CMsnProto::p2p_sessionRegistered(filetransfer* ft) -{ - if (ft != NULL && ft->p2p_appID == 0) - return true; - - mir_cslock lck(sessionLock); - return sessionList.getIndex(ft) > -1; -} - -filetransfer* CMsnProto::p2p_getThreadSession(MCONTACT hContact, TInfoType mType) -{ - mir_cslock lck(sessionLock); - - for (int i=0; i < sessionList.getCount(); i++) - { - filetransfer* FT = &sessionList[i]; - if (FT->std.hContact == hContact && FT->tType == mType) - return FT; - } - - return NULL; -} - -void CMsnProto::p2p_clearThreadSessions(MCONTACT hContact, TInfoType mType) -{ - mir_cslock lck(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); - } - } -} - -filetransfer* CMsnProto::p2p_getAvatarSession(MCONTACT hContact) -{ - mir_cslock lck(sessionLock); - - for (int i=0; i < sessionList.getCount(); i++) - { - filetransfer* FT = &sessionList[i]; - if (FT->std.hContact == hContact && !(FT->std.flags & PFTS_SENDING) && FT->p2p_type == MSN_APPID_AVATAR) - return FT; - } - - return NULL; -} - -bool CMsnProto::p2p_isAvatarOnly(MCONTACT hContact) -{ - mir_cslock lck(sessionLock); - - bool result = true; - for (int i=0; i < sessionList.getCount(); i++) - { - filetransfer* FT = &sessionList[i]; - result &= FT->std.hContact != hContact || FT->p2p_type != MSN_APPID_FILE; - } - - return result; -} - -void CMsnProto::p2p_clearDormantSessions(void) -{ - mir_cslockfull lck(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); - lck.unlock(); - p2p_unregisterSession(FT); - lck.lock(); - i = 0; - } - } -} - -void CMsnProto::p2p_redirectSessions(const char *wlid) -{ - mir_cslock lck(sessionLock); - - ThreadData* T = MSN_GetP2PThreadByContact(wlid); - for (int i=0; i < sessionList.getCount(); i++) - { - filetransfer* FT = &sessionList[i]; - if (_stricmp(FT->p2p_dest, wlid) == 0 && - FT->std.currentFileProgress < FT->std.currentFileSize && - (T == NULL || (FT->tType != T->mType && FT->tType != 0))) - { - if (FT->p2p_isV2) - { - if ((FT->std.flags & PFTS_SENDING) && T) - FT->tType = T->mType; - } - else - { - if (!(FT->std.flags & PFTS_SENDING)) - p2p_sendRedirect(FT); - } - } - } -} - -void CMsnProto::p2p_startSessions(const char* wlid) -{ - mir_cslock lck(sessionLock); - - char* szEmail; - parseWLID(NEWSTR_ALLOCA(wlid), NULL, &szEmail, NULL); - - for (int i=0; i < sessionList.getCount(); i++) - { - filetransfer* FT = &sessionList[i]; - if (!FT->bAccepted && !_stricmp(FT->p2p_dest, szEmail)) - { - if (FT->p2p_appID == MSN_APPID_FILE && (FT->std.flags & PFTS_SENDING)) - p2p_invite(FT->p2p_type, FT, wlid); - else if (FT->p2p_appID != MSN_APPID_FILE && !(FT->std.flags & PFTS_SENDING)) - p2p_invite(FT->p2p_type, FT, wlid); - } - } -} - -void CMsnProto::p2p_cancelAllSessions(void) -{ - mir_cslock lck(sessionLock); - - for (int i=0; i < sessionList.getCount(); i++) - { - sessionList[i].bCanceled = true; - p2p_sendCancel(&sessionList[i]); - } -} - -filetransfer* CMsnProto::p2p_getSessionByCallID(const char* CallID, const char* wlid) -{ - if (CallID == NULL) - return NULL; - - mir_cslock lck(sessionLock); - - char* szEmail = NULL; - for (int i=0; i < sessionList.getCount(); i++) - { - filetransfer* FT = &sessionList[i]; - if (FT->p2p_callID && !_stricmp(FT->p2p_callID, CallID)) - { - if (_stricmp(FT->p2p_dest, wlid)) - { - if (!szEmail) - parseWLID(NEWSTR_ALLOCA(wlid), NULL, &szEmail, NULL); - if (_stricmp(FT->p2p_dest, szEmail)) - continue; - } - return FT; - } - } - - return NULL; -} - - -void CMsnProto::p2p_registerDC(directconnection* dc) -{ - mir_cslock lck(sessionLock); - dcList.insert(dc); -} - -void CMsnProto::p2p_unregisterDC(directconnection* dc) -{ - mir_cslock lck(sessionLock); - dcList.remove(dc); -} - -directconnection* CMsnProto::p2p_getDCByCallID(const char* CallID, const char* wlid) -{ - if (CallID == NULL) - return NULL; - - mir_cslock lck(sessionLock); - - for (int i=0; i < dcList.getCount(); i++) - { - directconnection* DC = &dcList[i]; - if (DC->callId != NULL && !strcmp(DC->callId, CallID) && !strcmp(DC->wlid, wlid)) - return DC; - } - - return NULL; -} - -///////////////////////////////////////////////////////////////////////////////////////// -// external functions - -void CMsnProto::P2pSessions_Uninit(void) -{ - mir_cslock lck(sessionLock); - sessionList.destroy(); - dcList.destroy(); -} -- cgit v1.2.3