diff options
author | Alexander Lantsev <aunsane@gmail.com> | 2014-08-25 18:32:33 +0000 |
---|---|---|
committer | Alexander Lantsev <aunsane@gmail.com> | 2014-08-25 18:32:33 +0000 |
commit | 0a776a22a99c20a23763aac28209a00a36126b7b (patch) | |
tree | 57f77054ea993310d92c54448f2896d008a9800c /protocols/Tox/src/tox_proto.cpp | |
parent | 9afd590f4fd860d3d023203137129c8870bb8579 (diff) |
Tox:
- updated tox core
- fixdd contacts adding
- some code for file sending
git-svn-id: http://svn.miranda-ng.org/main/trunk@10320 1316c22d-e87f-b044-9b9b-93d7a3e3ba9c
Diffstat (limited to 'protocols/Tox/src/tox_proto.cpp')
-rw-r--r-- | protocols/Tox/src/tox_proto.cpp | 24 |
1 files changed, 20 insertions, 4 deletions
diff --git a/protocols/Tox/src/tox_proto.cpp b/protocols/Tox/src/tox_proto.cpp index 769679cdf8..9547b33f90 100644 --- a/protocols/Tox/src/tox_proto.cpp +++ b/protocols/Tox/src/tox_proto.cpp @@ -1,7 +1,9 @@ #include "common.h"
CToxProto::CToxProto(const char* protoName, const TCHAR* userName) :
-PROTO<CToxProto>(protoName, userName)
+ PROTO<CToxProto>(protoName, userName),
+ fileSendQueue(1, NumericKeySortT),
+ hFileProcess(0)
{
InitToxCore();
@@ -61,7 +63,7 @@ MCONTACT __cdecl CToxProto::AddToList(int flags, PROTOSEARCHRESULT* psr) std::string address(mir_t2a(psr->id));
std::string id = ToxAddressToId(address);
std::string myId = ToxAddressToId(getStringA(TOX_SETTINGS_ID));
- if (myId.compare(id))
+ if (myId == id)
{
debugLogA("CToxProto::AddToList: you cannot add yourself to friend list");
return NULL;
@@ -215,7 +217,16 @@ int __cdecl CToxProto::RecvMsg(MCONTACT hContact, PROTORECVEVENT *pre) int __cdecl CToxProto::RecvUrl(MCONTACT hContact, PROTORECVEVENT*) { return 0; }
int __cdecl CToxProto::SendContacts(MCONTACT hContact, int flags, int nContacts, MCONTACT* hContactsList) { return 0; }
-HANDLE __cdecl CToxProto::SendFile(MCONTACT hContact, const PROTOCHAR* szDescription, PROTOCHAR** ppszFiles) { return 0; }
+
+HANDLE __cdecl CToxProto::SendFile(MCONTACT hContact, const PROTOCHAR* szDescription, PROTOCHAR** ppszFiles)
+{
+ CFileTransfer *transfer = new CFileSendTransfer(hContact, InterlockedIncrement(&hFileProcess));
+ transfer->ProcessTransferedFiles(ppszFiles);
+
+ ForkThread(&CToxProto::SendFilesAsync, transfer);
+
+ return transfer->GetTransferHandler();
+}
int __cdecl CToxProto::SendMsg(MCONTACT hContact, int flags, const char* msg)
{
@@ -257,10 +268,15 @@ int __cdecl CToxProto::SetStatus(int iNewStatus) SetAllContactsStatus(ID_STATUS_OFFLINE);
}
- m_iStatus = ID_STATUS_OFFLINE;
+ m_iStatus = m_iDesiredStatus = ID_STATUS_OFFLINE;
}
else
{
+ if (old_status == ID_STATUS_CONNECTING)
+ {
+ return 0;
+ }
+
if (old_status == ID_STATUS_OFFLINE && !IsOnline())
{
m_iStatus = ID_STATUS_CONNECTING;
|