summaryrefslogtreecommitdiff
path: root/plugins/FTPFileYM
diff options
context:
space:
mode:
Diffstat (limited to 'plugins/FTPFileYM')
-rw-r--r--plugins/FTPFileYM/src/dbentry.cpp4
-rw-r--r--plugins/FTPFileYM/src/ftpfile.cpp24
-rw-r--r--plugins/FTPFileYM/src/options.cpp44
-rw-r--r--plugins/FTPFileYM/src/serverlist.cpp50
-rw-r--r--plugins/FTPFileYM/src/stdafx.h12
-rw-r--r--plugins/FTPFileYM/src/utils.cpp6
6 files changed, 72 insertions, 68 deletions
diff --git a/plugins/FTPFileYM/src/dbentry.cpp b/plugins/FTPFileYM/src/dbentry.cpp
index 79f74005f4..f9c39ae5b4 100644
--- a/plugins/FTPFileYM/src/dbentry.cpp
+++ b/plugins/FTPFileYM/src/dbentry.cpp
@@ -48,7 +48,7 @@ DBEntry *DBEntry::getNext(DBEntry *entry)
for (; entryID < count; entryID++) {
int ftpNum = DB::getByteF(0, MODULE_FILES, "Ftp%d", entryID, -1);
if (ftpNum != -1) {
- ptrA Value(db_get_sa(NULL, MODULE, frmt.Format("Filename%d", entryID)));
+ ptrA Value(db_get_sa(NULL, MODULENAME, frmt.Format("Filename%d", entryID)));
if (Value) {
strncpy_s(szValue, Value, _TRUNCATE);
entry->m_fileID = entryID;
@@ -90,7 +90,7 @@ DBEntry* DBEntry::get(int fileID)
int ftpNum = DB::getByteF(0, MODULE_FILES, "Ftp%d", fileID, -1);
if (ftpNum != -1) {
- ptrA Value(db_get_sa(NULL, MODULE, CMStringA(FORMAT, "Filename%d", fileID)));
+ ptrA Value(db_get_sa(NULL, MODULENAME, CMStringA(FORMAT, "Filename%d", fileID)));
if (Value) {
strncpy_s(szValue, Value, _TRUNCATE);
entry->m_fileID = fileID;
diff --git a/plugins/FTPFileYM/src/ftpfile.cpp b/plugins/FTPFileYM/src/ftpfile.cpp
index 0df76f1e23..40071b7914 100644
--- a/plugins/FTPFileYM/src/ftpfile.cpp
+++ b/plugins/FTPFileYM/src/ftpfile.cpp
@@ -35,6 +35,8 @@ void PrebuildMainMenu();
int TabsrmmButtonPressed(WPARAM wParam, LPARAM lParam);
int UploadFile(MCONTACT hContact, int m_iFtpNum, UploadJob::EMode mode);
+/////////////////////////////////////////////////////////////////////////////////////////
+
static PLUGININFOEX pluginInfoEx =
{
sizeof(PLUGININFOEX),
@@ -49,14 +51,16 @@ static PLUGININFOEX pluginInfoEx =
{0x9502e511, 0x7e5d, 0x49a1, {0x8b, 0xa5, 0xb1, 0xae, 0xe7, 0xf, 0xa5, 0xbf}}
};
-//------------ BASIC STAFF ------------//
+CMPlugin::CMPlugin() :
+ PLUGIN<CMPlugin>(MODULENAME, pluginInfoEx)
+{}
extern "C" __declspec(dllexport) PLUGININFOEX* MirandaPluginInfoEx(DWORD)
{
return &pluginInfoEx;
}
-//------------ INIT FUNCTIONS ------------//
+/////////////////////////////////////////////////////////////////////////////////////////
static IconItem iconList[] =
{
@@ -75,7 +79,7 @@ static IconItem iconList[] =
static void InitIcolib()
{
- g_plugin.registerIcon(LPGEN("FTP File"), iconList, MODULE);
+ g_plugin.registerIcon(LPGEN("FTP File"), iconList, MODULENAME);
}
void InitMenuItems()
@@ -103,7 +107,7 @@ void InitMenuItems()
CMStringA frmt;
for (int i = 0; i < ServerList::FTP_COUNT; i++) {
- ptrA Name(db_get_sa(NULL, MODULE, frmt.Format("Name%d", i)));
+ ptrA Name(db_get_sa(NULL, MODULENAME, frmt.Format("Name%d", i)));
if (Name)
mir_snwprintf(stzName, TranslateT("FTP Server %d"), i + 1);
@@ -164,7 +168,7 @@ void InitMenuItems()
void InitHotkeys()
{
HOTKEYDESC hk = {};
- hk.szSection.a = MODULE;
+ hk.szSection.a = MODULENAME;
hk.szDescription.a = LPGEN("Show FTPFile manager");
hk.pszName = "FTP_ShowManager";
hk.pszService = MS_FTPFILE_SHOWMANAGER;
@@ -175,7 +179,7 @@ void InitTabsrmmButton()
{
BBButton btn = {};
btn.dwButtonID = 1;
- btn.pszModuleName = MODULE;
+ btn.pszModuleName = MODULENAME;
btn.dwDefPos = 105;
btn.hIcon = iconList[ServerList::FTP_COUNT].hIcolib;
btn.bbbFlags = BBBF_ISARROWBUTTON | BBBF_ISIMBUTTON | BBBF_CANBEHIDDEN;
@@ -217,7 +221,7 @@ int TabsrmmButtonPressed(WPARAM hContact, LPARAM lParam)
{
CustomButtonClickData *cbc = (CustomButtonClickData *)lParam;
- if (!strcmp(cbc->pszModule, MODULE) && cbc->dwButtonId == 1 && hContact) {
+ if (!strcmp(cbc->pszModule, MODULENAME) && cbc->dwButtonId == 1 && hContact) {
if (cbc->flags == BBCF_ARROWCLICKED) {
HMENU hPopupMenu = CreatePopupMenu();
if (hPopupMenu) {
@@ -341,7 +345,7 @@ INT_PTR MainMenuService(WPARAM wParam, LPARAM)
//------------ START & EXIT STUFF ------------//
-int ModulesLoaded(WPARAM, LPARAM)
+static int ModulesLoaded(WPARAM, LPARAM)
{
InitMenuItems();
InitTabsrmmButton();
@@ -354,7 +358,7 @@ int ModulesLoaded(WPARAM, LPARAM)
return 0;
}
-int Shutdown(WPARAM, LPARAM)
+static int Shutdown(WPARAM, LPARAM)
{
deleteTimer.deinit();
@@ -402,6 +406,8 @@ extern "C" int __declspec(dllexport) Load(void)
return 0;
}
+/////////////////////////////////////////////////////////////////////////////////////////
+
extern "C" int __declspec(dllexport) Unload(void)
{
return 0;
diff --git a/plugins/FTPFileYM/src/options.cpp b/plugins/FTPFileYM/src/options.cpp
index 922dfc15a5..e37e9bc84b 100644
--- a/plugins/FTPFileYM/src/options.cpp
+++ b/plugins/FTPFileYM/src/options.cpp
@@ -33,32 +33,32 @@ void Options::deinit()
void Options::loadOptions()
{
- selected = db_get_b(0, MODULE, "Selected", 0);
- defaultFTP = db_get_b(0, MODULE, "Default", 0);
- bAutosend = db_get_b(0, MODULE, "Autosend", 0) ? true : false;
- bCloseDlg = db_get_b(0, MODULE, "CloseDlg", 0) ? true : false;
- bCopyLink = db_get_b(0, MODULE, "CopyLink", 1) ? true : false;
- bUseSubmenu = db_get_b(0, MODULE, "UseSubmenu", 1) ? true : false;
- bHideInactive = db_get_b(0, MODULE, "HideInactive", 1) ? true : false;
- bAutoDelete = db_get_b(0, MODULE, "DeleteTimer", 0) ? true : false;
- iDeleteTime = db_get_dw(0, MODULE, "AutoDeleteTime", 60);
- timeRange = (ETimeRange)db_get_b(0, MODULE, "TimeRange", TR_MINUTES);
- iCompressionLevel = db_get_b(0, MODULE, "CompressionLevel", 6);
- bSetZipName = db_get_b(0, MODULE, "SetZipName", 0) ? true : false;
+ selected = db_get_b(0, MODULENAME, "Selected", 0);
+ defaultFTP = db_get_b(0, MODULENAME, "Default", 0);
+ bAutosend = db_get_b(0, MODULENAME, "Autosend", 0) ? true : false;
+ bCloseDlg = db_get_b(0, MODULENAME, "CloseDlg", 0) ? true : false;
+ bCopyLink = db_get_b(0, MODULENAME, "CopyLink", 1) ? true : false;
+ bUseSubmenu = db_get_b(0, MODULENAME, "UseSubmenu", 1) ? true : false;
+ bHideInactive = db_get_b(0, MODULENAME, "HideInactive", 1) ? true : false;
+ bAutoDelete = db_get_b(0, MODULENAME, "DeleteTimer", 0) ? true : false;
+ iDeleteTime = db_get_dw(0, MODULENAME, "AutoDeleteTime", 60);
+ timeRange = (ETimeRange)db_get_b(0, MODULENAME, "TimeRange", TR_MINUTES);
+ iCompressionLevel = db_get_b(0, MODULENAME, "CompressionLevel", 6);
+ bSetZipName = db_get_b(0, MODULENAME, "SetZipName", 0) ? true : false;
}
void Options::saveOptions() const
{
- db_set_b(0, MODULE, "Autosend", bAutosend ? 1 : 0);
- db_set_b(0, MODULE, "CopyLink", bCopyLink ? 1 : 0);
- db_set_b(0, MODULE, "UseSubmenu", bUseSubmenu ? 1 : 0);
- db_set_b(0, MODULE, "HideInactive", bHideInactive ? 1 : 0);
- db_set_b(0, MODULE, "CloseDlg", bCloseDlg ? 1 : 0);
- db_set_b(0, MODULE, "DeleteTimer", bAutoDelete ? 1 : 0);
- db_set_dw(0, MODULE, "AutoDeleteTime", iDeleteTime);
- db_set_b(0, MODULE, "TimeRange", (int)timeRange);
- db_set_b(0, MODULE, "CompressionLevel", iCompressionLevel);
- db_set_b(0, MODULE, "SetZipName", bSetZipName ? 1 : 0);
+ db_set_b(0, MODULENAME, "Autosend", bAutosend ? 1 : 0);
+ db_set_b(0, MODULENAME, "CopyLink", bCopyLink ? 1 : 0);
+ db_set_b(0, MODULENAME, "UseSubmenu", bUseSubmenu ? 1 : 0);
+ db_set_b(0, MODULENAME, "HideInactive", bHideInactive ? 1 : 0);
+ db_set_b(0, MODULENAME, "CloseDlg", bCloseDlg ? 1 : 0);
+ db_set_b(0, MODULENAME, "DeleteTimer", bAutoDelete ? 1 : 0);
+ db_set_dw(0, MODULENAME, "AutoDeleteTime", iDeleteTime);
+ db_set_b(0, MODULENAME, "TimeRange", (int)timeRange);
+ db_set_b(0, MODULENAME, "CompressionLevel", iCompressionLevel);
+ db_set_b(0, MODULENAME, "SetZipName", bSetZipName ? 1 : 0);
}
void Options::enableItems(HWND hwndDlg, bool state)
diff --git a/plugins/FTPFileYM/src/serverlist.cpp b/plugins/FTPFileYM/src/serverlist.cpp
index 6169b1f86b..b29c263aef 100644
--- a/plugins/FTPFileYM/src/serverlist.cpp
+++ b/plugins/FTPFileYM/src/serverlist.cpp
@@ -45,49 +45,49 @@ void ServerList::saveToDb() const
char buff[256];
mir_snprintf(buff, "Password%d", opt.selected);
- DB::setAStringF(0, MODULE, buff, opt.selected, ftp->m_szPass);
-
- DB::setStringF(0, MODULE, "Name%d", opt.selected, ftp->m_stzName);
- DB::setAStringF(0, MODULE, "Server%d", opt.selected, ftp->m_szServer);
- DB::setAStringF(0, MODULE, "User%d", opt.selected, ftp->m_szUser);
- DB::setAStringF(0, MODULE, "Url%d", opt.selected, ftp->m_szUrl);
- DB::setAStringF(0, MODULE, "Dir%d", opt.selected, ftp->m_szDir);
- DB::setAStringF(0, MODULE, "Chmod%d", opt.selected, ftp->m_szChmod);
- DB::setWordF(0, MODULE, "FtpProto%d", opt.selected, ftp->m_ftpProto);
- DB::setWordF(0, MODULE, "Port%d", opt.selected, ftp->m_iPort);
- DB::setByteF(0, MODULE, "Passive%d", opt.selected, ftp->m_bPassive);
- DB::setByteF(0, MODULE, "Enabled%d", opt.selected, ftp->m_bEnabled);
- db_set_b(0, MODULE, "Selected", opt.selected);
- db_set_b(0, MODULE, "Default", opt.defaultFTP);
+ DB::setAStringF(0, MODULENAME, buff, opt.selected, ftp->m_szPass);
+
+ DB::setStringF(0, MODULENAME, "Name%d", opt.selected, ftp->m_stzName);
+ DB::setAStringF(0, MODULENAME, "Server%d", opt.selected, ftp->m_szServer);
+ DB::setAStringF(0, MODULENAME, "User%d", opt.selected, ftp->m_szUser);
+ DB::setAStringF(0, MODULENAME, "Url%d", opt.selected, ftp->m_szUrl);
+ DB::setAStringF(0, MODULENAME, "Dir%d", opt.selected, ftp->m_szDir);
+ DB::setAStringF(0, MODULENAME, "Chmod%d", opt.selected, ftp->m_szChmod);
+ DB::setWordF(0, MODULENAME, "FtpProto%d", opt.selected, ftp->m_ftpProto);
+ DB::setWordF(0, MODULENAME, "Port%d", opt.selected, ftp->m_iPort);
+ DB::setByteF(0, MODULENAME, "Passive%d", opt.selected, ftp->m_bPassive);
+ DB::setByteF(0, MODULENAME, "Enabled%d", opt.selected, ftp->m_bEnabled);
+ db_set_b(0, MODULENAME, "Selected", opt.selected);
+ db_set_b(0, MODULENAME, "Default", opt.defaultFTP);
}
ServerList::FTP::FTP(int index)
{
- ptrA Name(db_get_sa(NULL, MODULE, CMStringA(FORMAT, "Name%d", index)));
+ ptrA Name(db_get_sa(NULL, MODULENAME, CMStringA(FORMAT, "Name%d", index)));
if (Name)
mir_snwprintf(m_stzName, TranslateT("FTP Server %d"), index + 1);
- ptrA Pass(db_get_sa(NULL, MODULE, CMStringA(FORMAT, "Password%d", index)));
+ ptrA Pass(db_get_sa(NULL, MODULENAME, CMStringA(FORMAT, "Password%d", index)));
if (Pass)
strncpy_s(m_szPass, Pass, _TRUNCATE);
- ptrA Server(db_get_sa(NULL, MODULE, CMStringA(FORMAT, "Server%d", index)));
+ ptrA Server(db_get_sa(NULL, MODULENAME, CMStringA(FORMAT, "Server%d", index)));
if (Server)
strncpy_s(m_szServer, Server, _TRUNCATE);
- ptrA User(db_get_sa(NULL, MODULE, CMStringA(FORMAT, "User%d", index)));
+ ptrA User(db_get_sa(NULL, MODULENAME, CMStringA(FORMAT, "User%d", index)));
if (User)
strncpy_s(m_szUser, User, _TRUNCATE);
- ptrA Url(db_get_sa(NULL, MODULE, CMStringA(FORMAT, "Url%d", index)));
+ ptrA Url(db_get_sa(NULL, MODULENAME, CMStringA(FORMAT, "Url%d", index)));
if (Url)
strncpy_s(m_szUrl, Url, _TRUNCATE);
- ptrA Dir(db_get_sa(NULL, MODULE, CMStringA(FORMAT, "Dir%d", index)));
+ ptrA Dir(db_get_sa(NULL, MODULENAME, CMStringA(FORMAT, "Dir%d", index)));
if (Dir)
strncpy_s(m_szDir, Dir, _TRUNCATE);
- ptrA Chmod(db_get_sa(NULL, MODULE, CMStringA(FORMAT, "Chmod%d", index)));
+ ptrA Chmod(db_get_sa(NULL, MODULENAME, CMStringA(FORMAT, "Chmod%d", index)));
if (Chmod)
strncpy_s(m_szChmod, Chmod, _TRUNCATE);
- m_ftpProto = (FTP::EProtoType)DB::getWordF(0, MODULE, "FtpProto%d", index, FTP::FT_STANDARD);
- m_iPort = DB::getWordF(0, MODULE, "Port%d", index, 21);
- m_bPassive = DB::getByteF(0, MODULE, "Passive%d", index, 0) ? true : false;
- m_bEnabled = DB::getByteF(0, MODULE, "Enabled%d", index, 0) ? true : false;
+ m_ftpProto = (FTP::EProtoType)DB::getWordF(0, MODULENAME, "FtpProto%d", index, FTP::FT_STANDARD);
+ m_iPort = DB::getWordF(0, MODULENAME, "Port%d", index, 21);
+ m_bPassive = DB::getByteF(0, MODULENAME, "Passive%d", index, 0) ? true : false;
+ m_bEnabled = DB::getByteF(0, MODULENAME, "Enabled%d", index, 0) ? true : false;
}
ServerList::FTP* ServerList::getSelected() const
diff --git a/plugins/FTPFileYM/src/stdafx.h b/plugins/FTPFileYM/src/stdafx.h
index 02cd27330b..8bcb15e909 100644
--- a/plugins/FTPFileYM/src/stdafx.h
+++ b/plugins/FTPFileYM/src/stdafx.h
@@ -75,15 +75,13 @@ using namespace std;
#define MS_FTPFILE_CONTACTMENU "FTPFile/ContactMenu"
#define MS_FTPFILE_MAINMENU "FTPFile/MainMenu"
-#define MODULE "FTPFile"
-#define MODULE_FILES "FTPFile_Files"
+#define MODULENAME "FTPFile"
+#define MODULE_FILES "FTPFile_Files"
-#define SOUND_UPCOMPLETE "ftpfile_upcomplete"
-#define SOUND_CANCEL "ftpfile_cancel"
+#define SOUND_UPCOMPLETE "ftpfile_upcomplete"
+#define SOUND_CANCEL "ftpfile_cancel"
struct CMPlugin : public PLUGIN<CMPlugin>
{
- CMPlugin() :
- PLUGIN<CMPlugin>(MODULE)
- {}
+ CMPlugin();
};
diff --git a/plugins/FTPFileYM/src/utils.cpp b/plugins/FTPFileYM/src/utils.cpp
index e6d7c020d6..e866115cd6 100644
--- a/plugins/FTPFileYM/src/utils.cpp
+++ b/plugins/FTPFileYM/src/utils.cpp
@@ -47,14 +47,14 @@ int Utils::msgBoxA(char *szMsg, UINT uType)
HICON Utils::loadIconEx(const char *szName)
{
char buff[100];
- mir_snprintf(buff, "%s_%s", MODULE, szName);
+ mir_snprintf(buff, "%s_%s", MODULENAME, szName);
return IcoLib_GetIcon(buff);
}
HANDLE Utils::getIconHandle(const char *szName)
{
char buff[100];
- mir_snprintf(buff, "%s_%s", MODULE, szName);
+ mir_snprintf(buff, "%s_%s", MODULENAME, szName);
return IcoLib_GetIconHandle(buff);
}
@@ -111,7 +111,7 @@ void Utils::curlSetOpt(CURL *hCurl, ServerList::FTP *ftp, char *url, struct curl
if (ftp->m_bPassive)
curl_easy_setopt(hCurl, CURLOPT_FTPPORT, 0);
else {
- ptrA localip(db_get_sa(NULL, MODULE, "LocalIP"));
+ ptrA localip(db_get_sa(NULL, MODULENAME, "LocalIP"));
if (localip)
curl_easy_setopt(hCurl, CURLOPT_FTPPORT, localip);
else