summaryrefslogtreecommitdiff
path: root/protocols/MSN/src/msn_p2ps.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'protocols/MSN/src/msn_p2ps.cpp')
-rw-r--r--protocols/MSN/src/msn_p2ps.cpp62
1 files changed, 32 insertions, 30 deletions
diff --git a/protocols/MSN/src/msn_p2ps.cpp b/protocols/MSN/src/msn_p2ps.cpp
index 58edbc2d05..4bfb86d1ee 100644
--- a/protocols/MSN/src/msn_p2ps.cpp
+++ b/protocols/MSN/src/msn_p2ps.cpp
@@ -1,5 +1,7 @@
/*
Plugin of Miranda IM for communicating with users of the MSN Messenger protocol.
+
+Copyright (c) 2012-2013 Miranda NG Team
Copyright (c) 2006-2012 Boris Krasnovskiy.
Copyright (c) 2003-2005 George Hazan.
Copyright (c) 2002-2003 Richard Hughes (original version).
@@ -38,7 +40,7 @@ void CMsnProto::p2p_unregisterSession(filetransfer* ft)
{
EnterCriticalSection(&sessionLock);
// int idx = sessionList.getIndex(ft);
-// if (idx > -1)
+// if (idx > -1)
sessionList.remove(ft);
LeaveCriticalSection(&sessionLock);
}
@@ -54,14 +56,14 @@ filetransfer* CMsnProto::p2p_getSessionByID(unsigned id)
filetransfer* ft = NULL;
EnterCriticalSection(&sessionLock);
- for (int i=0; i < sessionList.getCount(); i++)
+ for (int i=0; i < sessionList.getCount(); i++)
{
filetransfer* FT = &sessionList[i];
- if (FT->p2p_sessionid == id)
+ if (FT->p2p_sessionid == id)
{
ft = FT;
break;
- }
+ }
}
LeaveCriticalSection(&sessionLock);
@@ -79,14 +81,14 @@ filetransfer* CMsnProto::p2p_getSessionByUniqueID(unsigned id)
filetransfer* ft = NULL;
EnterCriticalSection(&sessionLock);
- for (int i=0; i < sessionList.getCount(); i++)
+ for (int i=0; i < sessionList.getCount(); i++)
{
filetransfer* FT = &sessionList[i];
- if (FT->p2p_acksessid == id)
+ if (FT->p2p_acksessid == id)
{
ft = FT;
break;
- }
+ }
}
LeaveCriticalSection(&sessionLock);
@@ -113,14 +115,14 @@ filetransfer* CMsnProto::p2p_getThreadSession(HANDLE hContact, TInfoType mType)
EnterCriticalSection(&sessionLock);
filetransfer* result = NULL;
- for (int i=0; i < sessionList.getCount(); i++)
+ for (int i=0; i < sessionList.getCount(); i++)
{
filetransfer* FT = &sessionList[i];
- if (FT->std.hContact == hContact && FT->tType == mType)
+ if (FT->std.hContact == hContact && FT->tType == mType)
{
result = FT;
break;
- }
+ }
}
LeaveCriticalSection(&sessionLock);
@@ -131,15 +133,15 @@ void CMsnProto::p2p_clearThreadSessions(HANDLE hContact, TInfoType mType)
{
EnterCriticalSection(&sessionLock);
- for (int i=0; i < sessionList.getCount(); i++)
+ for (int i=0; i < sessionList.getCount(); i++)
{
filetransfer* ft = &sessionList[i];
- if (ft->std.hContact == hContact && ft->tType == mType)
+ if (ft->std.hContact == hContact && ft->tType == mType)
{
ft->bCanceled = true;
ft->tType = SERVER_NOTIFICATION;
p2p_sendCancel(ft);
- }
+ }
}
LeaveCriticalSection(&sessionLock);
@@ -150,13 +152,13 @@ filetransfer* CMsnProto::p2p_getAvatarSession(HANDLE hContact)
EnterCriticalSection(&sessionLock);
filetransfer* result = NULL;
- for (int i=0; i < sessionList.getCount(); i++)
+ 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) {
result = FT;
break;
- }
+ }
}
LeaveCriticalSection(&sessionLock);
@@ -168,7 +170,7 @@ bool CMsnProto::p2p_isAvatarOnly(HANDLE hContact)
EnterCriticalSection(&sessionLock);
bool result = true;
- for (int i=0; i < sessionList.getCount(); i++)
+ for (int i=0; i < sessionList.getCount(); i++)
{
filetransfer* FT = &sessionList[i];
result &= FT->std.hContact != hContact || FT->p2p_type != MSN_APPID_FILE;
@@ -183,12 +185,12 @@ void CMsnProto::p2p_clearDormantSessions(void)
EnterCriticalSection(&sessionLock);
time_t ts = time(NULL);
- for (int i=0; i < sessionList.getCount(); i++)
+ 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)
+ else if (FT->p2p_waitack && (ts - FT->ts) > 120)
{
FT->bCanceled = true;
p2p_sendCancel(FT);
@@ -196,7 +198,7 @@ void CMsnProto::p2p_clearDormantSessions(void)
p2p_unregisterSession(FT);
EnterCriticalSection(&sessionLock);
i = 0;
- }
+ }
}
LeaveCriticalSection(&sessionLock);
@@ -207,10 +209,10 @@ void CMsnProto::p2p_redirectSessions(const char *wlid)
EnterCriticalSection(&sessionLock);
ThreadData* T = MSN_GetP2PThreadByContact(wlid);
- for (int i=0; i < sessionList.getCount(); i++)
+ for (int i=0; i < sessionList.getCount(); i++)
{
filetransfer* FT = &sessionList[i];
- if (_stricmp(FT->p2p_dest, wlid) == 0 &&
+ if (_stricmp(FT->p2p_dest, wlid) == 0 &&
FT->std.currentFileProgress < FT->std.currentFileSize &&
(T == NULL || (FT->tType != T->mType && FT->tType != 0)))
{
@@ -221,7 +223,7 @@ void CMsnProto::p2p_redirectSessions(const char *wlid)
}
else
{
- if (!(FT->std.flags & PFTS_SENDING))
+ if (!(FT->std.flags & PFTS_SENDING))
p2p_sendRedirect(FT);
}
}
@@ -237,7 +239,7 @@ void CMsnProto::p2p_startSessions(const char* wlid)
char* szEmail;
parseWLID(NEWSTR_ALLOCA(wlid), NULL, &szEmail, NULL);
- for (int i=0; i < sessionList.getCount(); i++)
+ for (int i=0; i < sessionList.getCount(); i++)
{
filetransfer* FT = &sessionList[i];
if (!FT->bAccepted && !_stricmp(FT->p2p_dest, szEmail))
@@ -256,7 +258,7 @@ void CMsnProto::p2p_cancelAllSessions(void)
{
EnterCriticalSection(&sessionLock);
- for (int i=0; i < sessionList.getCount(); i++)
+ for (int i=0; i < sessionList.getCount(); i++)
{
sessionList[i].bCanceled = true;
p2p_sendCancel(&sessionList[i]);
@@ -274,10 +276,10 @@ filetransfer* CMsnProto::p2p_getSessionByCallID(const char* CallID, const char*
filetransfer* ft = NULL;
char* szEmail = NULL;
- for (int i=0; i < sessionList.getCount(); i++)
+ for (int i=0; i < sessionList.getCount(); i++)
{
filetransfer* FT = &sessionList[i];
- if (FT->p2p_callID && !_stricmp(FT->p2p_callID, CallID))
+ if (FT->p2p_callID && !_stricmp(FT->p2p_callID, CallID))
{
if (_stricmp(FT->p2p_dest, wlid))
{
@@ -288,7 +290,7 @@ filetransfer* CMsnProto::p2p_getSessionByCallID(const char* CallID, const char*
}
ft = FT;
break;
- }
+ }
}
LeaveCriticalSection(&sessionLock);
@@ -321,14 +323,14 @@ directconnection* CMsnProto::p2p_getDCByCallID(const char* CallID, const char*
EnterCriticalSection(&sessionLock);
directconnection* dc = NULL;
- for (int i=0; i < dcList.getCount(); i++)
+ for (int i=0; i < dcList.getCount(); i++)
{
directconnection* DC = &dcList[i];
- if (DC->callId != NULL && !strcmp(DC->callId, CallID) && !strcmp(DC->wlid, wlid))
+ if (DC->callId != NULL && !strcmp(DC->callId, CallID) && !strcmp(DC->wlid, wlid))
{
dc = DC;
break;
- }
+ }
}
LeaveCriticalSection(&sessionLock);