summaryrefslogtreecommitdiff
path: root/plugins/FTPFileYM/job_delete.cpp
diff options
context:
space:
mode:
authorVadim Dashevskiy <watcherhd@gmail.com>2012-10-12 11:29:22 +0000
committerVadim Dashevskiy <watcherhd@gmail.com>2012-10-12 11:29:22 +0000
commit8473fb7c85680042038cc0ad40d4e22bb6a639e7 (patch)
tree3c0e0d3ddd863528e60dd98421d2129a22bd8e0d /plugins/FTPFileYM/job_delete.cpp
parent557f2816f5cd30705dec989c97a8a67c026d36d1 (diff)
FTPFileYM: folders restructurization
git-svn-id: http://svn.miranda-ng.org/main/trunk@1885 1316c22d-e87f-b044-9b9b-93d7a3e3ba9c
Diffstat (limited to 'plugins/FTPFileYM/job_delete.cpp')
-rw-r--r--plugins/FTPFileYM/job_delete.cpp124
1 files changed, 0 insertions, 124 deletions
diff --git a/plugins/FTPFileYM/job_delete.cpp b/plugins/FTPFileYM/job_delete.cpp
deleted file mode 100644
index f7d2c7c64b..0000000000
--- a/plugins/FTPFileYM/job_delete.cpp
+++ /dev/null
@@ -1,124 +0,0 @@
-/*
-FTP File YM plugin
-Copyright (C) 2007-2010 Jan Holub
-
-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 version 2
-of the License.
-
-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 <http://www.gnu.org/licenses/>.
-*/
-
-#include "common.h"
-#include "job_delete.h"
-
-Event DeleteJob::jobDone;
-Mutex DeleteJob::mutexJobCount;
-int DeleteJob::iRunningJobCount = 0;
-
-extern ServerList &ftpList;
-extern Manager *manDlg;
-extern LibCurl &curl;
-
-DeleteJob::DeleteJob(DBEntry *_entry, Manager::TreeItem *_item)
-:entry(_entry),treeItem(_item),ftp(ftpList[entry->iFtpNum])
-{ }
-
-DeleteJob::~DeleteJob()
-{
- delete this->entry;
-}
-
-void DeleteJob::waitingThread(void *arg)
-{
- DeleteJob *job = (DeleteJob *)arg;
-
- while(!Miranda_Terminated())
- {
- Lock *lock = new Lock(mutexJobCount);
- if (iRunningJobCount < MAX_RUNNING_JOBS)
- {
- iRunningJobCount++;
- delete lock;
- job->run();
- delete job;
-
- Lock *lock = new Lock(mutexJobCount);
- iRunningJobCount--;
- delete lock;
-
- jobDone.release();
- return;
- }
-
- delete lock;
- jobDone.wait();
- }
-
- delete job;
-}
-
-void DeleteJob::start()
-{
- mir_forkthread(&DeleteJob::waitingThread, this);
-}
-
-void DeleteJob::run()
-{
- char szError[1024];
-
- CURL *hCurl = curl.easy_init();
- if (hCurl)
- {
- struct curl_slist *headerList = NULL;
- headerList = curl.slist_append(headerList, getDelFileString());
-
- Utils::curlSetOpt(hCurl, this->ftp, getDelUrlString(), headerList, szError);
-
- int result = curl.easy_perform(hCurl);
- if (result == CURLE_OK)
- {
- if (manDlg != NULL && this->treeItem)
- this->treeItem->remove();
- else
- DBEntry::remove(entry->fileID);
- }
- else if (manDlg != NULL && this->treeItem)
- {
- TCHAR *error = mir_a2t(szError);
- _tcscpy(this->treeItem->stzToolTip, error);
- this->treeItem->setState(Manager::TreeItem::_ERROR());
- FREE(error);
- }
-
- curl.slist_free_all(headerList);
- curl.easy_cleanup(hCurl);
- }
-}
-
-char *DeleteJob::getDelFileString()
-{
- if (ftp->ftpProto == ServerList::FTP::FT_SSH)
- mir_snprintf(buff, sizeof(buff), "rm \"%s/%s\"", ftp->szDir, entry->szFileName);
- else
- mir_snprintf(buff, sizeof(buff), "DELE %s", entry->szFileName);
-
- return buff;
-}
-
-char *DeleteJob::getDelUrlString()
-{
- if (ftp->szDir[0] && ftp->ftpProto != ServerList::FTP::FT_SSH)
- mir_snprintf(buff, sizeof(buff), "%s%s/%s/", ftp->getProtoString(), ftp->szServer, ftp->szDir);
- else
- mir_snprintf(buff, sizeof(buff), "%s%s/", ftp->getProtoString(), ftp->szServer);
-
- return buff;
-} \ No newline at end of file