summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorGluzskiy Alexandr <sss123next@list.ru>2010-10-11 23:54:53 +0300
committerGluzskiy Alexandr <sss123next@list.ru>2010-10-11 23:54:53 +0300
commit3945a304e5162f3bf39347615254a746feb2eb0f (patch)
tree9c9d5edef2ce690a0a7d5fcf6db322e3215f4bda
parentf0bca208f1d668f0ad3d51afdafbb9d30ec8555b (diff)
now it must be secure, but only one encrypted filetransfer will work at same time, other will wait for it's done.
-rw-r--r--init.cpp8
-rw-r--r--utilities.cpp13
2 files changed, 4 insertions, 17 deletions
diff --git a/init.cpp b/init.cpp
index 768736c..654370e 100644
--- a/init.cpp
+++ b/init.cpp
@@ -136,10 +136,6 @@ int AddContact(WPARAM w, LPARAM l)
return 0;
}
-void temp_cleaner_thread();
-boost::thread cleaner(boost::bind(temp_cleaner_thread));
-
-
static int OnModulesLoaded(WPARAM wParam,LPARAM lParam)
{
@@ -229,9 +225,6 @@ static int OnModulesLoaded(WPARAM wParam,LPARAM lParam)
HookEvent(ME_DB_CONTACT_ADDED,AddContact);
- cleaner.detach();
-
-
return 0;
}
@@ -247,6 +240,5 @@ extern "C" int __declspec(dllexport) Unload(void)
mir_free(outclosetag);
if(password)
delete [] password;
- cleaner.~thread();
return 0;
}
diff --git a/utilities.cpp b/utilities.cpp
index 0d51010..6d7fb58 100644
--- a/utilities.cpp
+++ b/utilities.cpp
@@ -278,6 +278,8 @@ struct file_in_transfer
list <file_in_transfer*> transfers;
+boost::mutex filetransfer_mutex; //currently safe to use only one encrypted fletransfers at same time
+
int onProtoAck(WPARAM w, LPARAM l)
{
ACKDATA *ack=(ACKDATA*)l;
@@ -309,6 +311,7 @@ int onProtoAck(WPARAM w, LPARAM l)
// if((*i)->thread == ccs)
DeleteFile((*i)->file.c_str());
transfers.clear();
+ filetransfer_mutex.unlock();
}
// if(_tcsstr(f->tszCurrentFile, _T(".gpg"))) //ok, succesfuly sent, delete temporary file
// DeleteFile(f->tszCurrentFile);
@@ -365,6 +368,7 @@ int onSendFile(WPARAM w, LPARAM l)
CCSDATA *ccs=(CCSDATA*)l;
if(isContactSecured(ccs->hContact))
{
+ filetransfer_mutex.lock();
TCHAR **file=(TCHAR **)ccs->lParam;
int i;
for(i = 0; file[i]; i++)
@@ -428,15 +432,6 @@ int onSendFile(WPARAM w, LPARAM l)
return CallService(PSS_FILE, w, l);
}
-void temp_cleaner_thread()
-{
- while(true)
- {
- list<list<file_in_transfer*>::iterator> elements_to_del;
- Sleep(10000);
- }
-}
-
void storeOutput(HANDLE ahandle, string *output)
{
BOOL success;