diff options
Diffstat (limited to 'plugins')
-rw-r--r-- | plugins/Svc_vi/CVersionInfo.cpp | 711 | ||||
-rw-r--r-- | plugins/Svc_vi/CVersionInfo.h | 1 | ||||
-rw-r--r-- | plugins/Svc_vi/dlgHandlers.cpp | 989 | ||||
-rw-r--r-- | plugins/Svc_vi/hooked_events.cpp | 3 | ||||
-rw-r--r-- | plugins/Svc_vi/main.cpp | 18 | ||||
-rw-r--r-- | plugins/Svc_vi/utils.cpp | 105 | ||||
-rw-r--r-- | plugins/Svc_vi/utils.h | 11 | ||||
-rw-r--r-- | plugins/Svc_vi/version.h | 18 |
8 files changed, 722 insertions, 1134 deletions
diff --git a/plugins/Svc_vi/CVersionInfo.cpp b/plugins/Svc_vi/CVersionInfo.cpp index b68c5c1832..9a29a010a4 100644 --- a/plugins/Svc_vi/CVersionInfo.cpp +++ b/plugins/Svc_vi/CVersionInfo.cpp @@ -23,6 +23,7 @@ Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. //#include "AggressiveOptimize.h"
#include "common.h"
+#include "resource.h"
//using namespace std;
@@ -37,63 +38,13 @@ LANGID (WINAPI *MyGetSystemDefaultUILanguage)() = NULL; static int ValidExtension(TCHAR *fileName, TCHAR *extension)
{
TCHAR *dot = _tcschr(fileName, '.');
- if ((dot != NULL) && (lstrcmpi(dot + 1, extension) == 0))
- {
+ if ( dot != NULL && !lstrcmpi(dot + 1, extension))
if (dot[lstrlen(extension) + 1] == 0)
- {
return 1;
- }
- }
return 0;
}
-/*
-int EnumSettings(const char *setting, LPARAM lParam)
-{
- char *name = (char *) lParam;
- char *tmp = _strdup(setting);
- _strlwr(tmp);
-
- int res = 0;
-
- if (strcmp(tmp, name) == 0)
- {
- strcpy((char *) lParam, setting);
- res = 1;
- }
-
- free(tmp);
-
- return res;
-}
-
-int IsPluginDisabled(char *fileName)
-{
- char *name = _strdup(fileName);
- _strlwr(name);
- DBCONTACTENUMSETTINGS dbEnum = {0};
- dbEnum.pfnEnumProc = EnumSettings;
- dbEnum.lParam = (LPARAM) name;
- dbEnum.szModule = "PluginDisable";
-
- int res = -1;
-
- CallService(MS_DB_CONTACT_ENUMSETTINGS, NULL, (LPARAM) &dbEnum);
- DBVARIANT dbv = {0};
- dbv.type = DBVT_BYTE;
-
- int exists = !(DBGetContactSetting(NULL, "PluginDisable", name, &dbv));
- if (exists)
- {
- res = dbv.bVal;
- }
- free(name);
-
- return res;
-}
-*/
-
void FillLocalTime(std::tstring &output, FILETIME *fileTime)
{
TIME_ZONE_INFORMATION tzInfo = {0};
@@ -115,41 +66,33 @@ void FillLocalTime(std::tstring &output, FILETIME *fileTime) int offset = 0;
switch (res) {
case TIME_ZONE_ID_DAYLIGHT:
- {
- offset = -(tzInfo.Bias + tzInfo.DaylightBias);
- WideCharToMultiByte(CP_ACP, 0, tzInfo.DaylightName, -1, tzName, SIZEOF(tzName), NULL, NULL);
-
- break;
- }
+ offset = -(tzInfo.Bias + tzInfo.DaylightBias);
+ WideCharToMultiByte(CP_ACP, 0, tzInfo.DaylightName, -1, tzName, SIZEOF(tzName), NULL, NULL);
+ break;
case TIME_ZONE_ID_STANDARD:
- {
- WideCharToMultiByte(CP_ACP, 0, tzInfo.StandardName, -1, tzName, SIZEOF(tzName), NULL, NULL);
- offset = -(tzInfo.Bias + tzInfo.StandardBias);
-
- break;
- }
+ WideCharToMultiByte(CP_ACP, 0, tzInfo.StandardName, -1, tzName, SIZEOF(tzName), NULL, NULL);
+ offset = -(tzInfo.Bias + tzInfo.StandardBias);
+ break;
case TIME_ZONE_ID_UNKNOWN:
- {
- WideCharToMultiByte(CP_ACP, 0, tzInfo.StandardName, -1, tzName, SIZEOF(tzName), NULL, NULL);
- offset = -tzInfo.Bias;
-
- break;
- }
+ WideCharToMultiByte(CP_ACP, 0, tzInfo.StandardName, -1, tzName, SIZEOF(tzName), NULL, NULL);
+ offset = -tzInfo.Bias;
+ break;
}
wsprintf(tzOffset, _T("UTC %+02d:%02d"), offset / 60, offset % 60);
output += _T(" (") + std::tstring(tzOffset) + _T(")");
}
-CVersionInfo::CVersionInfo() {
+CVersionInfo::CVersionInfo()
+{
luiFreeDiskSpace = 0;
bDEPEnabled = 0;
-};
-
-CVersionInfo::~CVersionInfo() {
+}
+CVersionInfo::~CVersionInfo()
+{
listInactivePlugins.clear();
listActivePlugins.clear();
listUnloadablePlugins.clear();
@@ -164,7 +107,8 @@ CVersionInfo::~CVersionInfo() { lpzCPUIdentifier.~basic_string();
};
-void CVersionInfo::Initialize() {
+void CVersionInfo::Initialize()
+{
#ifdef _DEBUG
if (verbose) PUShowMessage("Before GetMirandaVersion().", SM_NOTIFY);
#endif
@@ -253,8 +197,8 @@ bool CVersionInfo::GetOSVersion() lpzCPUIdentifier = aux;
delete[] aux;
}
- else{
- NotifyError(GetLastError(), "RegQueryValueEx()", __LINE__);
+ else {
+ NotifyError(GetLastError(), _T("RegQueryValueEx()"), __LINE__);
lpzCPUIdentifier = _T("<Error in RegQueryValueEx()>");
}
@@ -356,36 +300,32 @@ end: delete[] aux;
}
else {
- NotifyError(GetLastError(), "RegQueryValueEx()", __LINE__);
+ NotifyError(GetLastError(), _T("RegQueryValueEx()"), __LINE__);
lpzOSName = _T("<Error in RegQueryValueEx()>");
}
}
else {
- NotifyError(GetLastError(), "RegOpenKeyEx()", __LINE__);
+ NotifyError(GetLastError(), _T("RegOpenKeyEx()"), __LINE__);
lpzOSName = _T("<Error in RegOpenKeyEx()>");
}
//Now we can improve it if we can.
switch (LOWORD(osvi.dwBuildNumber)) {
- case 950: lpzOSName = _T("Microsoft Windows 95"); break;
- case 1111: lpzOSName = _T("Microsoft Windows 95 OSR2"); break;
- case 1998: lpzOSName = _T("Microsoft Windows 98"); break;
- case 2222: lpzOSName = _T("Microsoft Windows 98 SE"); break;
- case 3000: lpzOSName = _T("Microsoft Windows ME"); break; //Even if this is wrong, we have already read it in the registry.
- case 1381: lpzOSName = _T("Microsoft Windows NT"); break; //What about service packs?
- case 2195: lpzOSName = _T("Microsoft Windows 2000"); break; //What about service packs?
- case 2600: lpzOSName = _T("Microsoft Windows XP"); break;
- case 3790:
- {
- if (GetSystemMetrics(89)) { //R2 ?
- lpzOSName = _T("Microsoft Windows 2003 R2");
- }
- else{
- lpzOSName = _T("Microsoft Windows 2003");
- }
+ case 950: lpzOSName = _T("Microsoft Windows 95"); break;
+ case 1111: lpzOSName = _T("Microsoft Windows 95 OSR2"); break;
+ case 1998: lpzOSName = _T("Microsoft Windows 98"); break;
+ case 2222: lpzOSName = _T("Microsoft Windows 98 SE"); break;
+ case 3000: lpzOSName = _T("Microsoft Windows ME"); break; //Even if this is wrong, we have already read it in the registry.
+ case 1381: lpzOSName = _T("Microsoft Windows NT"); break; //What about service packs?
+ case 2195: lpzOSName = _T("Microsoft Windows 2000"); break; //What about service packs?
+ case 2600: lpzOSName = _T("Microsoft Windows XP"); break;
+ case 3790:
+ if ( GetSystemMetrics( 89 )) //R2 ?
+ lpzOSName = _T("Microsoft Windows 2003 R2");
+ else
+ lpzOSName = _T("Microsoft Windows 2003");
- break; //added windows 2003 info
- }
+ break; //added windows 2003 info
}
return TRUE;
@@ -411,14 +351,12 @@ bool CVersionInfo::GetHWSettings() { MyIsWow64Process = (BOOL (WINAPI *) (HANDLE, PBOOL)) GetProcAddress(hKernel32, "IsWow64Process");
MyGetSystemInfo = (void (WINAPI *) (LPSYSTEM_INFO)) GetProcAddress(hKernel32, "GetNativeSystemInfo");
MyGlobalMemoryStatusEx = (BOOL (WINAPI *) (LPMEMORYSTATUSEX)) GetProcAddress(hKernel32, "GlobalMemoryStatusEx");
- if (!MyGetSystemInfo)
- {
+ if ( !MyGetSystemInfo )
MyGetSystemInfo = GetSystemInfo;
- }
FreeLibrary(hKernel32);
}
- if (MyGetDiskFreeSpaceEx) {
+ if ( MyGetDiskFreeSpaceEx ) {
ULARGE_INTEGER FreeBytes, a, b;
MyGetDiskFreeSpaceEx(szMirandaPath, &FreeBytes, &a, &b);
//Now we need to convert it.
@@ -426,9 +364,7 @@ bool CVersionInfo::GetHWSettings() { aux /= (1024*1024);
luiFreeDiskSpace = (unsigned long int)aux;
}
- else {
- luiFreeDiskSpace = 0;
- }
+ else luiFreeDiskSpace = 0;
TCHAR szInfo[1024];
GetWindowsShell(szInfo, SIZEOF(szInfo));
@@ -449,14 +385,13 @@ bool CVersionInfo::GetHWSettings() { luiProcessors = sysInfo.dwNumberOfProcessors;
//Installed RAM
- if (MyGlobalMemoryStatusEx) //windows 2000+
- {
+ if (MyGlobalMemoryStatusEx) { //windows 2000+
MEMORYSTATUSEX ms = {0};
ms.dwLength = sizeof(ms);
MyGlobalMemoryStatusEx(&ms);
luiRAM = (unsigned int) ((ms.ullTotalPhys / (1024 * 1024)) + 1);
}
- else{
+ else {
MEMORYSTATUS ms = {0};
ms.dwLength = sizeof(ms);
GlobalMemoryStatus(&ms);
@@ -499,8 +434,7 @@ BOOL CALLBACK EnumSystemLocalesProc(TCHAR *szLocale) {
DWORD locale = _ttoi(szLocale);
TCHAR *name = GetLanguageName(locale);
- if (!_tcsstr(szSystemLocales, name))
- {
+ if ( !_tcsstr(szSystemLocales, name)) {
_tcscat(szSystemLocales, name);
_tcscat(szSystemLocales, _T(", "));
}
@@ -528,100 +462,79 @@ bool CVersionInfo::GetOSLanguages() OSVERSIONINFO os = {0};
os.dwOSVersionInfoSize = sizeof(os);
GetVersionEx(&os);
- switch (os.dwMajorVersion)
- {
- case 4: //Win 95-Me, NT
- {
- if (os.dwPlatformId == VER_PLATFORM_WIN32_NT) //Win NT
- {
- HMODULE hLib = LoadLibraryA("ntdll.dll");
+ if (os.dwMajorVersion == 4) {
+ if (os.dwPlatformId == VER_PLATFORM_WIN32_NT) { //Win NT
+ HMODULE hLib = LoadLibraryA("ntdll.dll");
- if (hLib)
- {
- EnumResourceLanguages(hLib, RT_VERSION, MAKEINTRESOURCE(1), EnumResLangProc, NULL);
+ if (hLib) {
+ EnumResourceLanguages(hLib, RT_VERSION, MAKEINTRESOURCE(1), EnumResLangProc, NULL);
+
+ FreeLibrary(hLib);
- FreeLibrary(hLib);
+ if (systemLangID == US_LANG_ID) {
+ UINT uiACP;
- if (systemLangID == US_LANG_ID)
+ uiACP = GetACP();
+ switch (uiACP)
{
- UINT uiACP;
-
- uiACP = GetACP();
- switch (uiACP)
- {
- case 874: // Thai code page activated, it's a Thai enabled system
- systemLangID = MAKELANGID(LANG_THAI, SUBLANG_DEFAULT);
- break;
-
- case 1255: // Hebrew code page activated, it's a Hebrew enabled system
- systemLangID = MAKELANGID(LANG_HEBREW, SUBLANG_DEFAULT);
- break;
-
- case 1256: // Arabic code page activated, it's a Arabic enabled system
- systemLangID = MAKELANGID(LANG_ARABIC, SUBLANG_ARABIC_SAUDI_ARABIA);
- break;
+ case 874: // Thai code page activated, it's a Thai enabled system
+ systemLangID = MAKELANGID(LANG_THAI, SUBLANG_DEFAULT);
+ break;
+
+ case 1255: // Hebrew code page activated, it's a Hebrew enabled system
+ systemLangID = MAKELANGID(LANG_HEBREW, SUBLANG_DEFAULT);
+ break;
+
+ case 1256: // Arabic code page activated, it's a Arabic enabled system
+ systemLangID = MAKELANGID(LANG_ARABIC, SUBLANG_ARABIC_SAUDI_ARABIA);
+ break;
- default:
- break;
- }
+ default:
+ break;
}
}
}
- else{ //Win 95-Me
- HKEY hKey = NULL;
- TCHAR szLangID[128] = _T("0x");
- DWORD size = SIZEOF(szLangID) - 2;
- TCHAR err[512];
+ }
+ else { //Win 95-Me
+ HKEY hKey = NULL;
+ TCHAR szLangID[128] = _T("0x");
+ DWORD size = SIZEOF(szLangID) - 2;
+ TCHAR err[512];
- if (RegOpenKeyEx(HKEY_CURRENT_USER, _T("Control Panel\\Desktop\\ResourceLocale"), 0, KEY_QUERY_VALUE, &hKey) == ERROR_SUCCESS)
- {
- if (RegQueryValueEx(hKey, _T(""), 0, NULL, (LPBYTE) &szLangID + 2, &size) == ERROR_SUCCESS)
- {
- _tscanf(szLangID, _T("%lx"), &systemLangID);
- }
- else{
- FormatMessage(FORMAT_MESSAGE_FROM_SYSTEM, 0, GetLastError(), LANG_SYSTEM_DEFAULT, err, size, NULL);
- MessageBox(0, err, _T("Error at RegQueryValueEx()"), MB_OK);
- }
- RegCloseKey(hKey);
- }
- else{
+ if (RegOpenKeyEx(HKEY_CURRENT_USER, _T("Control Panel\\Desktop\\ResourceLocale"), 0, KEY_QUERY_VALUE, &hKey) == ERROR_SUCCESS) {
+ if (RegQueryValueEx(hKey, _T(""), 0, NULL, (LPBYTE) &szLangID + 2, &size) == ERROR_SUCCESS)
+ _tscanf(szLangID, _T("%lx"), &systemLangID);
+ else {
FormatMessage(FORMAT_MESSAGE_FROM_SYSTEM, 0, GetLastError(), LANG_SYSTEM_DEFAULT, err, size, NULL);
- MessageBox(0, err, _T("Error at RegOpenKeyEx()"), MB_OK);
+ MessageBox(0, err, _T("Error at RegQueryValueEx()"), MB_OK);
}
+ RegCloseKey(hKey);
+ }
+ else {
+ FormatMessage(FORMAT_MESSAGE_FROM_SYSTEM, 0, GetLastError(), LANG_SYSTEM_DEFAULT, err, size, NULL);
+ MessageBox(0, err, _T("Error at RegOpenKeyEx()"), MB_OK);
}
-
- lpzOSLanguages += GetLanguageName(systemLangID);
-
- break;
}
-
- case 5: //Win 2000, XP
- default:
- {
- HMODULE hKernel32 = LoadLibraryA("kernel32.dll");
- if (hKernel32)
- {
- MyGetUserDefaultUILanguage = (LANGID (WINAPI *)()) GetProcAddress(hKernel32, "GetUserDefaultUILanguage");
- MyGetSystemDefaultUILanguage = (LANGID (WINAPI *)()) GetProcAddress(hKernel32, "GetSystemDefaultUILanguage");
+
+ lpzOSLanguages += GetLanguageName(systemLangID);
+ }
+ else {
+ HMODULE hKernel32 = LoadLibraryA("kernel32.dll");
+ if (hKernel32) {
+ MyGetUserDefaultUILanguage = (LANGID (WINAPI *)()) GetProcAddress(hKernel32, "GetUserDefaultUILanguage");
+ MyGetSystemDefaultUILanguage = (LANGID (WINAPI *)()) GetProcAddress(hKernel32, "GetSystemDefaultUILanguage");
- FreeLibrary(hKernel32);
- }
+ FreeLibrary(hKernel32);
+ }
- if ((MyGetUserDefaultUILanguage) && (MyGetSystemDefaultUILanguage))
- {
- UILang = MyGetUserDefaultUILanguage();
- lpzOSLanguages += GetLanguageName(UILang);
- lpzOSLanguages += _T("/");
- UILang = MyGetSystemDefaultUILanguage();
- lpzOSLanguages += GetLanguageName(UILang);
- }
- else{
- lpzOSLanguages += _T("Missing functions in kernel32.dll (GetUserDefaultUILanguage, GetSystemDefaultUILanguage)");
- }
-
- break;
+ if ((MyGetUserDefaultUILanguage) && (MyGetSystemDefaultUILanguage)) {
+ UILang = MyGetUserDefaultUILanguage();
+ lpzOSLanguages += GetLanguageName(UILang);
+ lpzOSLanguages += _T("/");
+ UILang = MyGetSystemDefaultUILanguage();
+ lpzOSLanguages += GetLanguageName(UILang);
}
+ else lpzOSLanguages += _T("Missing functions in kernel32.dll (GetUserDefaultUILanguage, GetSystemDefaultUILanguage)");
}
lpzOSLanguages += _T(" | ");
@@ -629,8 +542,7 @@ bool CVersionInfo::GetOSLanguages() lpzOSLanguages += _T("/");
lpzOSLanguages += GetLanguageName(LOCALE_SYSTEM_DEFAULT);
- if (DBGetContactSettingByte(NULL, ModuleName, "ShowInstalledLanguages", 0))
- {
+ if (DBGetContactSettingByte(NULL, ModuleName, "ShowInstalledLanguages", 0)) {
szSystemLocales[0] = '\0';
lpzOSLanguages += _T(" [");
EnumSystemLocales(EnumSystemLocalesProc, LCID_INSTALLED);
@@ -648,8 +560,7 @@ int SaveInfo(const char *data, const char *lwrData, const char *search, TCHAR *d {
const char *pos = strstr(lwrData, search);
int res = 1;
- if (pos == lwrData)
- {
+ if (pos == lwrData) {
_tcsncpy(dest, _A2T(&data[strlen(search)]), size);
res = 0;
}
@@ -665,8 +576,7 @@ bool CVersionInfo::GetLangpackInfo() lpzLangpackModifiedDate = _T("");
GetModuleFileName(GetModuleHandle(NULL), langpackPath, SIZEOF(langpackPath));
TCHAR* p = _tcsrchr(langpackPath, '\\');
- if (p)
- {
+ if (p) {
WIN32_FIND_DATA data = {0};
HANDLE hLangpack;
@@ -674,8 +584,7 @@ bool CVersionInfo::GetLangpackInfo() _tcscpy(search, langpackPath);
_tcscat(search, _T("langpack_*.txt"));
hLangpack = FindFirstFile(search, &data);
- if (hLangpack != INVALID_HANDLE_VALUE)
- {
+ if (hLangpack != INVALID_HANDLE_VALUE) {
char buffer[1024];
char temp[1024];
FillLocalTime(lpzLangpackModifiedDate, &data.ftLastWriteTime);
@@ -699,38 +608,25 @@ bool CVersionInfo::GetLangpackInfo() if (buffer[len - 1] == '\n') buffer[len - 1] = '\0';
strncpy(temp, buffer, SIZEOF(temp));
_strlwr(temp);
- if (SaveInfo(buffer, temp, "language: ", language, SIZEOF(language)))
- {
- if (SaveInfo(buffer, temp, "locale: ", locale, SIZEOF(locale)))
- {
+ if (SaveInfo(buffer, temp, "language: ", language, SIZEOF(language))) {
+ if (SaveInfo(buffer, temp, "locale: ", locale, SIZEOF(locale))) {
char* p = strstr(buffer, "; FLID: ");
- if (p)
- {
+ if (p) {
int ok = 1;
int i;
- for (i = 0; ((i < 3) && (ok)); i++)
- {
+ for (i = 0; ((i < 3) && (ok)); i++) {
p = strrchr(temp, '.');
if (p)
- {
p[0] = '\0';
- }
- else{
+ else
ok = 0;
- }
}
p = strrchr(temp, ' ');
if ((ok) && (p))
- {
_tcsncpy(version, _A2T(&buffer[p - temp + 1]), SIZEOF(version));
- }
- else{
+ else
_tcsncpy(version, _T("<unknown>"), SIZEOF(version));
- }
- }
- }
- }
- }
+ } } } }
lpzLangpackInfo = std::tstring(language) + _T(" [") + std::tstring(locale) + _T("]");
if ( version[0] )
@@ -738,7 +634,7 @@ bool CVersionInfo::GetLangpackInfo() fclose(fin);
}
- else{
+ else {
int err = GetLastError();
lpzLangpackInfo = _T("<error> Could not open file " + std::tstring(data.cFileName));
}
@@ -794,8 +690,7 @@ bool CVersionInfo::GetPluginLists() lstrcat(szMirandaPluginsPath, _T("\\Plugins\\"));
hFind=FindFirstFile(szSearchPath,&fd);
- LogToFile("Starting to load plugins");
- if(hFind != INVALID_HANDLE_VALUE) {
+ if ( hFind != INVALID_HANDLE_VALUE) {
do {
if (verbose) PUShowMessageT(fd.cFileName, SM_NOTIFY);
if (!ValidExtension(fd.cFileName, _T("dll")))
@@ -804,13 +699,9 @@ bool CVersionInfo::GetPluginLists() hInstPlugin = GetModuleHandle(fd.cFileName); //try to get the handle of the module
if (hInstPlugin) //if we got it then the dll is loaded (enabled)
- {
PluginIsEnabled = 1;
- LogToFile("Plugin '%s' is enabled and loaded", fd.cFileName);
- }
- else{
+ else {
PluginIsEnabled = 0;
- LogToFile("Plugin '%s' is not loaded, going to load it", fd.cFileName);
lstrcpyn(szPluginPath, szMirandaPluginsPath, MAX_PATH); // szPluginPath becomes "drive:\path\Miranda\Plugins\"
lstrcat(szPluginPath, fd.cFileName); // szPluginPath becomes "drive:\path\Miranda\Plugins\popup.dll"
hInstPlugin = LoadLibrary(szPluginPath);
@@ -826,18 +717,14 @@ bool CVersionInfo::GetPluginLists() lstrcpyn(szPluginPath, szMirandaPluginsPath, MAX_PATH); // szPluginPath becomes "drive:\path\Miranda\Plugins\"
lstrcat(szPluginPath, fd.cFileName); // szPluginPath becomes "drive:\path\Miranda\Plugins\popup.dll"
- if (GetLinkedModulesInfo(szPluginPath, linkedModules))
- {
- LogToFile("Plugin %s has unresolved dependencies, adding to unloadable list", szPluginPath);
+ if (GetLinkedModulesInfo(szPluginPath, linkedModules)) {
std::tstring time = GetPluginTimestamp(&fd.ftLastWriteTime);
CPlugin thePlugin(fd.cFileName, _T("<unknown>"), UUID_NULL, _T(""), 0, time.c_str(), linkedModules.c_str());
AddPlugin(thePlugin, listUnloadablePlugins);
bUnknownError = 0; //we know why the plugin didn't load
}
}
- if (bUnknownError) //if cause is unknown then report it
- {
- LogToFile("Plugin %s doesn't load", szPluginPath);
+ if (bUnknownError) { //if cause is unknown then report it
std::tstring time = GetPluginTimestamp(&fd.ftLastWriteTime);
TCHAR buffer[4096];
TCHAR error[2048];
@@ -849,45 +736,40 @@ bool CVersionInfo::GetPluginLists() }
}
else { //It was successfully loaded.
- LogToFile("Plugin '%s' was loaded successfully", fd.cFileName);
MirandaPluginInfo = (PLUGININFOEX *(*)(DWORD))GetProcAddress(hInstPlugin, "MirandaPluginInfoEx");
if (!MirandaPluginInfo)
- {
MirandaPluginInfo = (PLUGININFOEX *(*)(DWORD))GetProcAddress(hInstPlugin, "MirandaPluginInfo");
- }
- if (!MirandaPluginInfo) { //There is no function: it's not a valid plugin. Let's move on to the next file.
+
+ if (!MirandaPluginInfo) //There is no function: it's not a valid plugin. Let's move on to the next file.
continue;
- }
- else {
- //It's a valid plugin, since we could find MirandaPluginInfo
- #if (!defined(WIN64) && !defined(_WIN64))
- asmCheckOK = FALSE;
- __asm {
- push mirandaVersion
- push mirandaVersion
- call MirandaPluginInfo
- pop eax
- pop eax
- cmp eax, mirandaVersion
- jne a1
- mov asmCheckOK, 0xffffffff
- a1:
- }
- #else
- asmCheckOK = TRUE;
- #endif
- if (asmCheckOK)
- pluginInfo = CopyPluginInfo(MirandaPluginInfo(mirandaVersion));
- else {
- ZeroMemory(&pluginInfo, sizeof(pluginInfo));
- MessageBox(NULL, fd.cFileName, _T("Invalid plugin"), MB_OK);
+
+ //It's a valid plugin, since we could find MirandaPluginInfo
+ #if (!defined(WIN64) && !defined(_WIN64))
+ asmCheckOK = FALSE;
+ __asm {
+ push mirandaVersion
+ push mirandaVersion
+ call MirandaPluginInfo
+ pop eax
+ pop eax
+ cmp eax, mirandaVersion
+ jne a1
+ mov asmCheckOK, 0xffffffff
+ a1:
}
- }
- }
+ #else
+ asmCheckOK = TRUE;
+ #endif
+ if (asmCheckOK)
+ pluginInfo = CopyPluginInfo(MirandaPluginInfo(mirandaVersion));
+ else {
+ ZeroMemory(&pluginInfo, sizeof(pluginInfo));
+ MessageBox(NULL, fd.cFileName, _T("Invalid plugin"), MB_OK);
+ } }
+
//Let's get the info.
if (MirandaPluginInfo != NULL) {//a valid miranda plugin
if (pluginInfo != NULL) {
- LogToFile("Plugin '%s' is a miranda plugin", fd.cFileName);
//We have loaded the informations into pluginInfo.
std::tstring timedate = GetPluginTimestamp(&fd.ftLastWriteTime);
CPlugin thePlugin(fd.cFileName, _A2T(pluginInfo->shortName), pluginInfo->uuid, (pluginInfo->flags & 1) ? _T("Unicode aware") : _T(""), (DWORD) pluginInfo->version, timedate.c_str(), _T(""));
@@ -895,29 +777,25 @@ bool CVersionInfo::GetPluginLists() if (PluginIsEnabled)
AddPlugin(thePlugin, listActivePlugins);
else {
- if ((IsUUIDNull(pluginInfo->uuid)) && (mirandaVersion >= PLUGIN_MAKE_VERSION(0,8,0,9)))
- {
+ if ((IsUUIDNull(pluginInfo->uuid)) && (mirandaVersion >= PLUGIN_MAKE_VERSION(0,8,0,9))) {
thePlugin.SetErrorMessage( _T(" Plugin does not have an UUID and will not work with Miranda 0.8.\r\n"));
AddPlugin(thePlugin, listUnloadablePlugins);
}
- else{
- AddPlugin(thePlugin, listInactivePlugins);
- }
+ else AddPlugin(thePlugin, listInactivePlugins);
+
FreeLibrary(hInstPlugin); //We don't need it anymore.
}
FreePluginInfo(pluginInfo);
MirandaPluginInfo = NULL;
#ifdef _DEBUG
- if (verbose)
- {
+ if (verbose) {
TCHAR szMsg[4096] = { 0 };
wsprintf(szMsg, _T("Done with: %s"), fd.cFileName);
PUShowMessageT(szMsg, SM_NOTIFY);
}
#endif
}
- else{//pluginINFO == NULL
- LogToFile("Plugin '%s' refuses to load", fd.cFileName);
+ else { //pluginINFO == NULL
pluginInfo = CopyPluginInfo(MirandaPluginInfo(PLUGIN_MAKE_VERSION(9, 9, 9, 9))); //let's see if the plugin likes this miranda version
char *szShortName = "<unknown>";
std::tstring time = GetPluginTimestamp(&fd.ftLastWriteTime); //get the plugin timestamp;
@@ -931,15 +809,12 @@ bool CVersionInfo::GetPluginLists() AddPlugin(thePlugin, listUnloadablePlugins);
if (pluginInfo)
- {
FreePluginInfo(pluginInfo);
- }
- }
- }
- } while (FindNextFile(hFind,&fd));
+ } }
+ }
+ while (FindNextFile(hFind,&fd));
FindClose(hFind);
}
- LogToFile("Done loading plugins");
return TRUE;
}
@@ -958,11 +833,11 @@ bool CVersionInfo::AddPlugin(CPlugin &aPlugin, std::list<CPlugin> &aList) { aList.insert(pos, aPlugin);
return TRUE;
}
- else { //It's greater: we need to insert it.
- pos++;
- }
- }
- }
+
+ //It's greater: we need to insert it.
+ pos++;
+ } }
+
if (inserted == FALSE) {
aList.push_back(aPlugin);
return TRUE;
@@ -979,7 +854,6 @@ static char *GetStringFromRVA(DWORD RVA, const LOADED_IMAGE *image) bool CVersionInfo::GetLinkedModulesInfo(TCHAR *moduleName, std::tstring &linkedModules)
{
- LogToFile("Checking dll %s for unresolved dll dependencies ...", moduleName);
LOADED_IMAGE image;
ULONG importTableSize;
IMAGE_IMPORT_DESCRIPTOR *importData;
@@ -988,45 +862,30 @@ bool CVersionInfo::GetLinkedModulesInfo(TCHAR *moduleName, std::tstring &linkedM bool result = false;
TCHAR szError[20];
char* szModuleName = mir_t2a(moduleName);
- if (MapAndLoad(szModuleName, NULL, &image, TRUE, TRUE) == FALSE)
- {
+ if (MapAndLoad(szModuleName, NULL, &image, TRUE, TRUE) == FALSE) {
wsprintf(szError, _T("%d"), GetLastError());
- LogToFile(" MapAndLoad failed with error %S", szError);
mir_free( szModuleName );
linkedModules = _T("<error ") + std::tstring(szError) + _T(" at MapAndLoad()>\r\n");
return result;
}
mir_free( szModuleName );
- LogToFile(" Before ImageDirectoryEntryToData (base address %ld)", image.MappedAddress);
importData = (IMAGE_IMPORT_DESCRIPTOR *) ImageDirectoryEntryToData(image.MappedAddress, FALSE, IMAGE_DIRECTORY_ENTRY_IMPORT, &importTableSize);
- if (!importData)
- {
+ if (!importData) {
wsprintf(szError, _T("%d"), GetLastError());
- LogToFile(" ImageDirectoryEntryToData failed with error %s", szError);
linkedModules = _T("<error ") + std::tstring(szError) + _T(" at ImageDirectoryEntryToDataEx()>\r\n");
}
- else{
- LogToFile(" Checking dll dependencies");
- while (importData->Name)
- {
+ else {
+ while (importData->Name) {
char *moduleName;
moduleName = GetStringFromRVA(importData->Name, &image);
- LogToFile(" Checking link to dll %s", moduleName);
- if (!DoesDllExist(moduleName))
- {
- LogToFile(" Dll %s not found, adding to list", moduleName);
+ if (!DoesDllExist(moduleName)) {
linkedModules.append( _T(" Plugin statically links to missing dll file: ") + std::tstring(_A2T(moduleName)) + _T("\r\n"));
result = true;
}
- else{
- LogToFile(" Dll %s found", moduleName);
- }
- LogToFile(" Moving to next import entry");
+
importData++; //go to next record
- }
- }
- LogToFile(" Done checking dependencies");
- LogToFile(" Cleaning up; before {FreeLibrary()} and UnMapAndLoad");
+ } }
+
// FreeLibrary(dllModule);
UnMapAndLoad(&image); //unload the image
return result;
@@ -1041,19 +900,18 @@ std::tstring CVersionInfo::GetListAsString(std::list<CPlugin> &aList, DWORD flag TCHAR szHeader[32] = {0};
TCHAR szFooter[32] = {0};
- if ((((flags & VISF_FORUMSTYLE) == VISF_FORUMSTYLE) || beautify) && (DBGetContactSettingByte(NULL, ModuleName, "BoldVersionNumber", TRUE)))
- {
- GetStringFromDatabase("BoldBegin", _T("[b]"), szHeader, SIZEOF(szHeader));
- GetStringFromDatabase("BoldEnd", _T("[/b]"), szFooter, SIZEOF(szFooter));
- }
+ if ((((flags & VISF_FORUMSTYLE) == VISF_FORUMSTYLE) || beautify) && (DBGetContactSettingByte(NULL, ModuleName, "BoldVersionNumber", TRUE))) {
+ GetStringFromDatabase("BoldBegin", _T("[b]"), szHeader, SIZEOF(szHeader));
+ GetStringFromDatabase("BoldEnd", _T("[/b]"), szFooter, SIZEOF(szFooter));
+ }
while (pos != aList.end()) {
out.append(std::tstring((*pos).getInformations(flags, szHeader, szFooter)));
pos++;
}
-#ifdef _DEBUG
- if (verbose) PUShowMessage("CVersionInfo::GetListAsString, end.", SM_NOTIFY);
-#endif
+ #ifdef _DEBUG
+ if (verbose) PUShowMessage("CVersionInfo::GetListAsString, end.", SM_NOTIFY);
+ #endif
return out;
};
@@ -1067,8 +925,7 @@ void CVersionInfo::BeautifyReport(int beautify, LPCTSTR szBeautifyText, LPCTSTR void CVersionInfo::AddInfoHeader(int suppressHeader, int forumStyle, int beautify, std::tstring &out)
{
- if (forumStyle) //forum style
- {
+ if (forumStyle) { //forum style
TCHAR szSize[256], szQuote[256];
GetStringFromDatabase("SizeBegin", _T("[size=1]"), szSize, SIZEOF(szSize));
@@ -1078,28 +935,25 @@ void CVersionInfo::AddInfoHeader(int suppressHeader, int forumStyle, int beautif }
else out = _T("");
- if (!suppressHeader)
- {
+ if (!suppressHeader) {
out.append( _T("Miranda IM - VersionInformation plugin by Hrk, modified by Eblis\r\n"));
- if (!forumStyle)
- {
+ if (!forumStyle) {
out.append( _T("Miranda's homepage: http://www.miranda-im.org/\r\n")); //changed homepage
out.append( _T("Miranda tools: http://miranda-im.org/download/\r\n\r\n")); //was missing a / before download
- }
- }
+ } }
TCHAR buffer[1024]; //for beautification
GetStringFromDatabase("BeautifyHorizLine", _T("<hr />"), buffer, SIZEOF(buffer));
BeautifyReport(beautify, buffer, _T(""), out);
GetStringFromDatabase("BeautifyBlockStart", _T("<blockquote>"), buffer, SIZEOF(buffer));
BeautifyReport(beautify, buffer, _T(""), out);
- if (!suppressHeader)
- {
- //Time of report:
- TCHAR lpzTime[12]; GetTimeFormat(LOCALE_USER_DEFAULT, 0, NULL, _T("HH':'mm':'ss"), lpzTime, SIZEOF(lpzTime));
- TCHAR lpzDate[32]; GetDateFormat(EnglishLocale, 0, NULL, _T("dd' 'MMMM' 'yyyy"), lpzDate, SIZEOF(lpzDate));
- out.append( _T("Report generated at: ") + std::tstring(lpzTime) + _T(" on ") + std::tstring(lpzDate) + _T("\r\n\r\n"));
- }
+ if (!suppressHeader) {
+ //Time of report:
+ TCHAR lpzTime[12]; GetTimeFormat(LOCALE_USER_DEFAULT, 0, NULL, _T("HH':'mm':'ss"), lpzTime, SIZEOF(lpzTime));
+ TCHAR lpzDate[32]; GetDateFormat(EnglishLocale, 0, NULL, _T("dd' 'MMMM' 'yyyy"), lpzDate, SIZEOF(lpzDate));
+ out.append( _T("Report generated at: ") + std::tstring(lpzTime) + _T(" on ") + std::tstring(lpzDate) + _T("\r\n\r\n"));
+ }
+
//Operating system
out.append(_T("CPU: ") + lpzCPUName + _T(" [") + lpzCPUIdentifier + _T("]"));
if (bDEPEnabled)
@@ -1126,7 +980,6 @@ void CVersionInfo::AddInfoHeader(int suppressHeader, int forumStyle, int beautif //languages
out.append( _T("OS Languages: ") + lpzOSLanguages + _T("\r\n"));
-
//FreeDiskSpace
if (luiFreeDiskSpace) {
TCHAR szDiskSpace[64]; wsprintf(szDiskSpace, _T("%d"), luiFreeDiskSpace);
@@ -1277,189 +1130,67 @@ void CVersionInfo::PrintInformationsToFile(const TCHAR *info) fputs( "\xEF\xBB\xBF", fp);
fputs( utf, fp );
fclose(fp);
- char mex[512];
- mir_snprintf(mex, SIZEOF(mex), Translate("Information successfully written to file: \"%s\"."), outputFileName);
+
+ TCHAR mex[512];
+ mir_sntprintf(mex, SIZEOF(mex), TranslateT("Information successfully written to file: \"%s\"."), outputFileName);
Log(mex);
}
else {
- char mex[512];
- mir_snprintf(mex, SIZEOF(mex), Translate("Error during the creation of file \"%s\". Disk may be full or write protected."), outputFileName);
+ TCHAR mex[512];
+ mir_sntprintf(mex, SIZEOF(mex), TranslateT("Error during the creation of file \"%s\". Disk may be full or write protected."), outputFileName);
Log(mex);
}
}
-void CVersionInfo::PrintInformationsToFile() {
- PrintInformationsToFile((*this).GetInformationsAsString().c_str());
+void CVersionInfo::PrintInformationsToFile()
+{
+ PrintInformationsToFile( GetInformationsAsString().c_str());
}
-void CVersionInfo::PrintInformationsToMessageBox() {
- MessageBox(NULL, (*this).GetInformationsAsString().c_str(), _T("VersionInfo"), MB_OK);
- return;
+void CVersionInfo::PrintInformationsToMessageBox()
+{
+ MessageBox(NULL, GetInformationsAsString().c_str(), _T("VersionInfo"), MB_OK);
}
-void CVersionInfo::PrintInformationsToOutputDebugString() {
- OutputDebugString((*this).GetInformationsAsString().c_str());
- return;
+void CVersionInfo::PrintInformationsToOutputDebugString()
+{
+ OutputDebugString( GetInformationsAsString().c_str());
}
-#include "resource.h"
-//extern HINSTANCE hInst;
-void CVersionInfo::PrintInformationsToDialogBox() {
-// HWND parent = DBGetContactSettingByte(NULL, ModuleName, "ShowInTaskbar", TRUE)?GetDesktopWindow():NULL;
- HWND parent = NULL;
+void CVersionInfo::PrintInformationsToDialogBox()
+{
HWND DialogBox = CreateDialogParam(hInst,
MAKEINTRESOURCE(IDD_DIALOGINFO),
- parent, DialogBoxProc, (LPARAM) this);
+ NULL, DialogBoxProc, (LPARAM) this);
- SetDlgItemText(DialogBox, IDC_TEXT, (*this).GetInformationsAsString().c_str());
- return;
+ SetDlgItemText(DialogBox, IDC_TEXT, GetInformationsAsString().c_str());
}
-void CVersionInfo::PrintInformationsToClipboard(bool showLog) {
-
+void CVersionInfo::PrintInformationsToClipboard(bool showLog)
+{
if (GetOpenClipboardWindow()) {
- Log(Translate("The clipboard is not available, retry."));
+ Log( TranslateT("The clipboard is not available, retry."));
+ return;
}
- else {
- OpenClipboard(NULL);
- //Ok, let's begin, then.
- EmptyClipboard();
- //Storage data we'll use.
- LPTSTR lptstrCopy;
- std::tstring aux = GetInformationsAsString();
- size_t length = aux.length() + 1;
- HANDLE hData = GlobalAlloc(GMEM_MOVEABLE, length*sizeof(TCHAR) + 5);
- //Lock memory, copy it, release it.
- lptstrCopy = (LPTSTR)GlobalLock(hData);
- lstrcpy(lptstrCopy, aux.c_str());
- lptstrCopy[length] = '\0';
- GlobalUnlock(hData);
- //Now set the clipboard data.
- SetClipboardData(CF_TEXT, hData);
- //Remove the lock on the clipboard.
- CloseClipboard();
- if (showLog)
- {
- Log(Translate("Information successfully copied into clipboard."));
- }
- }
- return;
-}
-
-/*int MyReceive(SOCKET sClient, char *message, int size, int bShow)
-{
- int len = recv(sClient, message, size - 1, 0);
- int success = 0;
- if (len != SOCKET_ERROR)
- {
- message[len] = '\0';
- if (bShow)
- {
- PUShowMessage(message, SM_NOTIFY);
- }
- char *pos = message;
- while ((pos = strchr(pos + 1, '\n')))
- {
- success++;
- }
- if (success <= 0) success = 1; //make sure success is at least 1
- }
- else{
- success = 0;
- closesocket(sClient);
- }
- return success;
-}*/
-
-#define UPLOAD_ERROR() {PUShowMessage("Error while trying to upload data", SM_WARNING); return 1;}
-
-DWORD WINAPI UploadWorkerTread(LPVOID param)
-{
- //PUShowMessage("Uploading to site", SM_NOTIFY);
- /*
- char *text = (char *) param;
- char message[2048];
-
- char server[1024];
- int port;
- char user[512];
- char password[512];
- GetStringFromDatabase("UploadServer", "vi.cass.cz", server, sizeof(server));
- port = DBGetContactSettingWord(NULL, ModuleName, "UploadPort", DEFAULT_UPLOAD_PORT);
- GetStringFromDatabase("UploadUser", "", user, sizeof(user));
- GetStringFromDatabase("UploadPassword", "", password, sizeof(password));
- CallService(MS_DB_CRYPT_DECODESTRING, sizeof(password), (LPARAM) password);
-
- SOCKET sClient = socket(AF_INET, SOCK_STREAM, 0);
- if (!sClient)
- {
- MB("Could not create connection socket ...");
- return 1;
- }
-
- sockaddr_in addr = {0};
- hostent *localHost = gethostbyname(server);
- char *localIP = (localHost) ? inet_ntoa(*(struct in_addr *) *localHost->h_addr_list) : server;
-
- addr.sin_family = AF_INET;
- addr.sin_addr.s_addr = inet_addr(localIP);
- addr.sin_port = htons(port);
-
- int res = connect(sClient, (sockaddr *) &addr, sizeof(addr));
- if (res)
- {
- char buffer[1024];
- mir_snprintf(buffer, sizeof(buffer), "Could not connect to server '%s' on port %d", server, port);
- MB(buffer);
- return 1;
- }
- res = MyReceive(sClient, message, sizeof(message), TRUE); //get the welcome message
- switch (res)
- {
- case 1:
- if (!MyReceive(sClient, message, sizeof(message), 0)) UPLOAD_ERROR(); //get the enter username message
- break;
-
- case 2: //the enter user message was received already
- break;
-
- default: //assume error by default
- UPLOAD_ERROR();
- }
-
- send(sClient, user, strlen(user), 0);
- if (!MyReceive(sClient, message, sizeof(message), FALSE)) UPLOAD_ERROR(); //get the enter password message
- send(sClient, password, strlen(password), 0);
- if (!MyReceive(sClient, message, sizeof(message), FALSE)) UPLOAD_ERROR(); //get the upload data message
- send(sClient, text, strlen(text) + 1, 0); //data message needs to send \0 so the server knows when to stop.
- if (!MyReceive(sClient, message, sizeof(message), TRUE)) UPLOAD_ERROR();
- closesocket(sClient);
- //PUShowMessage("Done uploading to site", SM_NOTIFY);
-
- if (text)
- {
- free(text);
- }
- */
- return 0;
-}
-
-void CVersionInfo::UploadToSite(LPTSTR text)
-{
- DWORD threadID;
- HANDLE thread;
- char *data = NULL;
- if (!text)
- data = mir_utf8encodeT( GetInformationsAsString().c_str());
- else
- data = mir_utf8encodeT( text );
-
- thread = CreateThread(NULL, NULL, UploadWorkerTread, data, 0, &threadID); //the thread will free the buffer
- if (!thread)
- MB("Upload worker thread could not be created");
-
- if ( thread != NULL && thread != INVALID_HANDLE_VALUE)
- CloseHandle(thread);
+ OpenClipboard(NULL);
+ //Ok, let's begin, then.
+ EmptyClipboard();
+ //Storage data we'll use.
+ LPTSTR lptstrCopy;
+ std::tstring aux = GetInformationsAsString();
+ size_t length = aux.length() + 1;
+ HANDLE hData = GlobalAlloc(GMEM_MOVEABLE, length*sizeof(TCHAR) + 5);
+ //Lock memory, copy it, release it.
+ lptstrCopy = (LPTSTR)GlobalLock(hData);
+ lstrcpy(lptstrCopy, aux.c_str());
+ lptstrCopy[length] = '\0';
+ GlobalUnlock(hData);
+ //Now set the clipboard data.
+ SetClipboardData(CF_TEXT, hData);
+ //Remove the lock on the clipboard.
+ CloseClipboard();
+ if (showLog)
+ Log( TranslateT("Information successfully copied into clipboard."));
}
diff --git a/plugins/Svc_vi/CVersionInfo.h b/plugins/Svc_vi/CVersionInfo.h index aef6eb3256..eb55b808fc 100644 --- a/plugins/Svc_vi/CVersionInfo.h +++ b/plugins/Svc_vi/CVersionInfo.h @@ -104,7 +104,6 @@ class CVersionInfo void PrintInformationsToMessageBox();
void PrintInformationsToOutputDebugString();
void PrintInformationsToClipboard(bool);
- void UploadToSite(TCHAR *text = NULL);
std::tstring GetListAsString(std::list<CPlugin>&, DWORD flags, int beautify);
std::tstring GetInformationsAsString(int bDisableForumStyle = 0);
diff --git a/plugins/Svc_vi/dlgHandlers.cpp b/plugins/Svc_vi/dlgHandlers.cpp index 5d8e512854..520ee97ceb 100644 --- a/plugins/Svc_vi/dlgHandlers.cpp +++ b/plugins/Svc_vi/dlgHandlers.cpp @@ -60,131 +60,117 @@ INT_PTR CALLBACK AskDlgProc(HWND hWnd, UINT msg, WPARAM wParam, LPARAM lParam) static TCHAR oldSizeBegin[MAX_SIZE], oldSizeEnd[MAX_SIZE];
static TCHAR oldBoldBegin[MAX_SIZE], oldBoldEnd[MAX_SIZE];
- switch (msg)
+ switch (msg) {
+ case WM_INITDIALOG:
+ SendMessage(hWnd, WM_SETICON, ICON_BIG, (LPARAM) hiVIIcon);
+
+ TranslateDialogDefault(hWnd);
+
+ oldFSFValue = DBGetContactSettingByte(NULL, ModuleName, "ForumStyle", 1);
+
+ AddInfoToComboboxes(hWnd, IDC_ASK_QUOTECOMBOBOX, IDC_ASK_SIZECOMBOBOX, IDC_ASK_BOLDCOMBOBOX);
+
+ CheckDlgButton(hWnd, IDC_ASK_TODIALOGBOX, BST_CHECKED);
+
+ CheckDlgButton(hWnd, IDC_ASK_FORUMSTYLE, (oldFSFValue) ? BST_CHECKED : BST_UNCHECKED);
+ EnableAskComboboxes(hWnd, oldFSFValue);
{
- case WM_INITDIALOG:
- TCHAR buffer[1024];
-
- SendMessage(hWnd, WM_SETICON, ICON_BIG, (LPARAM) hiVIIcon);
-
- TranslateDialogDefault(hWnd);
-
- oldFSFValue = DBGetContactSettingByte(NULL, ModuleName, "ForumStyle", 1);
-
- AddInfoToComboboxes(hWnd, IDC_ASK_QUOTECOMBOBOX, IDC_ASK_SIZECOMBOBOX, IDC_ASK_BOLDCOMBOBOX);
-
- CheckDlgButton(hWnd, IDC_ASK_TODIALOGBOX, BST_CHECKED);
-
- CheckDlgButton(hWnd, IDC_ASK_FORUMSTYLE, (oldFSFValue) ? BST_CHECKED : BST_UNCHECKED);
- EnableAskComboboxes(hWnd, oldFSFValue);
-
- GetStringFromDatabase("QuoteBegin", _T("[quote]"), oldQuoteBegin, MAX_SIZE);
- GetStringFromDatabase("QuoteEnd", _T("[/quote]"), oldQuoteEnd, MAX_SIZE);
- mir_sntprintf(buffer, SIZEOF(buffer), _T("%s | %s"), oldQuoteBegin, oldQuoteEnd);
- SendDlgItemMessage(hWnd, IDC_ASK_QUOTECOMBOBOX, CB_SELECTSTRING, -1, (LPARAM) buffer);
-
- GetStringFromDatabase("SizeBegin", _T("[size=1]"), oldSizeBegin, MAX_SIZE);
- GetStringFromDatabase("SizeEnd", _T("[/size]"), oldSizeEnd, MAX_SIZE);
- mir_sntprintf(buffer, SIZEOF(buffer), _T("%s | %s"), oldSizeBegin, oldSizeEnd);
- SendDlgItemMessage(hWnd, IDC_ASK_SIZECOMBOBOX, CB_SELECTSTRING, -1, (LPARAM) buffer);
-
- GetStringFromDatabase("BoldBegin", _T("[b]"), oldBoldBegin, MAX_SIZE);
- GetStringFromDatabase("BoldEnd", _T("[/b]"), oldBoldEnd, MAX_SIZE);
- mir_sntprintf(buffer, SIZEOF(buffer), _T("%s | %s"), oldBoldBegin, oldBoldEnd);
- SendDlgItemMessage(hWnd, IDC_ASK_BOLDCOMBOBOX, CB_SELECTSTRING, -1, (LPARAM) buffer);
-
- return TRUE;
- break;
-
- case WM_CLOSE:
- DestroyWindow(hWnd);
-
- break;
-
- case WM_COMMAND:
- switch (LOWORD(wParam))
- {
- case IDC_ASK_FORUMSTYLE:
- EnableAskComboboxes(hWnd, IsDlgButtonChecked(hWnd, IDC_ASK_FORUMSTYLE));
-
- break;
-
- case IDC_ASK_CANCEL:
- DestroyWindow(hWnd);
-
- break;
-
- case IDC_ASK_OK:
- int debugTo = TO_DIALOGBOX; //just to be safe
- int newFSFValue = IsDlgButtonChecked(hWnd, IDC_ASK_FORUMSTYLE);
- TCHAR quoteBegin[MAX_SIZE], quoteEnd[MAX_SIZE];
- TCHAR sizeBegin[MAX_SIZE], sizeEnd[MAX_SIZE];
- TCHAR boldBegin[MAX_SIZE], boldEnd[MAX_SIZE];
- TCHAR buffer[1024];
-
- SendDlgItemMessage(hWnd, IDC_ASK_QUOTECOMBOBOX, WM_GETTEXT, SIZEOF(buffer), (LPARAM) buffer);
- SplitStringInfo(buffer, quoteBegin, quoteEnd);
- SendDlgItemMessage(hWnd, IDC_ASK_SIZECOMBOBOX, WM_GETTEXT, SIZEOF(buffer), (LPARAM) buffer);
- SplitStringInfo(buffer, sizeBegin, sizeEnd);
- SendDlgItemMessage(hWnd, IDC_ASK_BOLDCOMBOBOX, WM_GETTEXT, SIZEOF(buffer), (LPARAM) buffer);
- SplitStringInfo(buffer, boldBegin, boldEnd);
-
- if (newFSFValue != oldFSFValue)
- DBWriteContactSettingByte(NULL, ModuleName, "ForumStyle", newFSFValue); //temporary store the new value
-
- if (newFSFValue) {
- DBWriteContactSettingTString(NULL, ModuleName, "QuoteBegin", quoteBegin);
- DBWriteContactSettingTString(NULL, ModuleName, "QuoteEnd", quoteEnd);
-
- DBWriteContactSettingTString(NULL, ModuleName, "SizeBegin", sizeBegin);
- DBWriteContactSettingTString(NULL, ModuleName, "SizeEnd", sizeEnd);
-
- DBWriteContactSettingTString(NULL, ModuleName, "BoldBegin", boldBegin);
- DBWriteContactSettingTString(NULL, ModuleName, "BoldEnd", boldEnd);
- }
-
- if (IsDlgButtonChecked(hWnd, IDC_ASK_TOFILE))
- debugTo = TO_FILE;
- if (IsDlgButtonChecked(hWnd, IDC_ASK_TOMESSAGEBOX))
- debugTo = TO_MESSAGEBOX;
- if (IsDlgButtonChecked(hWnd, IDC_ASK_TODIALOGBOX))
- debugTo = TO_DIALOGBOX;
- if (IsDlgButtonChecked(hWnd, IDC_ASK_TOOUTPUTDEBUGSTRING))
- debugTo = TO_DEBUGSTRING;
- if (IsDlgButtonChecked(hWnd, IDC_ASK_TOCLIPBOARD))
- debugTo = TO_CLIPBOARD;
- if (IsDlgButtonChecked(hWnd, IDC_ASK_TOUPLOAD))
- debugTo = TO_UPLOAD;
-
- DoDebugTo(debugTo);
-
- if (newFSFValue != oldFSFValue)
- {
- DBWriteContactSettingByte(NULL, ModuleName, "ForumStyle", oldFSFValue);
- }
- if (newFSFValue)
- {
- DBWriteContactSettingTString(NULL, ModuleName, "QuoteBegin", oldQuoteBegin);
- DBWriteContactSettingTString(NULL, ModuleName, "QuoteEnd", oldQuoteEnd);
-
- DBWriteContactSettingTString(NULL, ModuleName, "SizeBegin", oldSizeBegin);
- DBWriteContactSettingTString(NULL, ModuleName, "SizeEnd", oldSizeEnd);
-
- DBWriteContactSettingTString(NULL, ModuleName, "BoldBegin", oldBoldBegin);
- DBWriteContactSettingTString(NULL, ModuleName, "BoldEnd", oldBoldEnd);
- }
-
- DestroyWindow(hWnd);
-
- break;
- }
-
- break;
-
- default:
-
- break;
+ TCHAR buffer[1024];
+ GetStringFromDatabase("QuoteBegin", _T("[quote]"), oldQuoteBegin, MAX_SIZE);
+ GetStringFromDatabase("QuoteEnd", _T("[/quote]"), oldQuoteEnd, MAX_SIZE);
+ mir_sntprintf(buffer, SIZEOF(buffer), _T("%s | %s"), oldQuoteBegin, oldQuoteEnd);
+ SendDlgItemMessage(hWnd, IDC_ASK_QUOTECOMBOBOX, CB_SELECTSTRING, -1, (LPARAM) buffer);
+
+ GetStringFromDatabase("SizeBegin", _T("[size=1]"), oldSizeBegin, MAX_SIZE);
+ GetStringFromDatabase("SizeEnd", _T("[/size]"), oldSizeEnd, MAX_SIZE);
+ mir_sntprintf(buffer, SIZEOF(buffer), _T("%s | %s"), oldSizeBegin, oldSizeEnd);
+ SendDlgItemMessage(hWnd, IDC_ASK_SIZECOMBOBOX, CB_SELECTSTRING, -1, (LPARAM) buffer);
+
+ GetStringFromDatabase("BoldBegin", _T("[b]"), oldBoldBegin, MAX_SIZE);
+ GetStringFromDatabase("BoldEnd", _T("[/b]"), oldBoldEnd, MAX_SIZE);
+ mir_sntprintf(buffer, SIZEOF(buffer), _T("%s | %s"), oldBoldBegin, oldBoldEnd);
+ SendDlgItemMessage(hWnd, IDC_ASK_BOLDCOMBOBOX, CB_SELECTSTRING, -1, (LPARAM) buffer);
}
+
+ return TRUE;
+
+ case WM_CLOSE:
+ DestroyWindow(hWnd);
+ break;
+
+ case WM_COMMAND:
+ switch (LOWORD(wParam)) {
+ case IDC_ASK_FORUMSTYLE:
+ EnableAskComboboxes(hWnd, IsDlgButtonChecked(hWnd, IDC_ASK_FORUMSTYLE));
+ break;
+
+ case IDC_ASK_CANCEL:
+ DestroyWindow(hWnd);
+ break;
+
+ case IDC_ASK_OK:
+ TCHAR quoteBegin[MAX_SIZE], quoteEnd[MAX_SIZE];
+ TCHAR sizeBegin[MAX_SIZE], sizeEnd[MAX_SIZE];
+ TCHAR boldBegin[MAX_SIZE], boldEnd[MAX_SIZE];
+ TCHAR buffer[1024];
+
+ SendDlgItemMessage(hWnd, IDC_ASK_QUOTECOMBOBOX, WM_GETTEXT, SIZEOF(buffer), (LPARAM) buffer);
+ SplitStringInfo(buffer, quoteBegin, quoteEnd);
+ SendDlgItemMessage(hWnd, IDC_ASK_SIZECOMBOBOX, WM_GETTEXT, SIZEOF(buffer), (LPARAM) buffer);
+ SplitStringInfo(buffer, sizeBegin, sizeEnd);
+ SendDlgItemMessage(hWnd, IDC_ASK_BOLDCOMBOBOX, WM_GETTEXT, SIZEOF(buffer), (LPARAM) buffer);
+ SplitStringInfo(buffer, boldBegin, boldEnd);
+
+ int newFSFValue = IsDlgButtonChecked(hWnd, IDC_ASK_FORUMSTYLE);
+ if (newFSFValue != oldFSFValue)
+ DBWriteContactSettingByte(NULL, ModuleName, "ForumStyle", newFSFValue); //temporary store the new value
+
+ if (newFSFValue) {
+ DBWriteContactSettingTString(NULL, ModuleName, "QuoteBegin", quoteBegin);
+ DBWriteContactSettingTString(NULL, ModuleName, "QuoteEnd", quoteEnd);
+
+ DBWriteContactSettingTString(NULL, ModuleName, "SizeBegin", sizeBegin);
+ DBWriteContactSettingTString(NULL, ModuleName, "SizeEnd", sizeEnd);
+
+ DBWriteContactSettingTString(NULL, ModuleName, "BoldBegin", boldBegin);
+ DBWriteContactSettingTString(NULL, ModuleName, "BoldEnd", boldEnd);
+ }
+
+ int debugTo = TO_DIALOGBOX; //just to be safe
+ if (IsDlgButtonChecked(hWnd, IDC_ASK_TOFILE))
+ debugTo = TO_FILE;
+ if (IsDlgButtonChecked(hWnd, IDC_ASK_TOMESSAGEBOX))
+ debugTo = TO_MESSAGEBOX;
+ if (IsDlgButtonChecked(hWnd, IDC_ASK_TODIALOGBOX))
+ debugTo = TO_DIALOGBOX;
+ if (IsDlgButtonChecked(hWnd, IDC_ASK_TOOUTPUTDEBUGSTRING))
+ debugTo = TO_DEBUGSTRING;
+ if (IsDlgButtonChecked(hWnd, IDC_ASK_TOCLIPBOARD))
+ debugTo = TO_CLIPBOARD;
+ if (IsDlgButtonChecked(hWnd, IDC_ASK_TOUPLOAD))
+ debugTo = TO_UPLOAD;
+
+ DoDebugTo(debugTo);
+
+ if (newFSFValue != oldFSFValue)
+ DBWriteContactSettingByte(NULL, ModuleName, "ForumStyle", oldFSFValue);
+
+ if (newFSFValue) {
+ DBWriteContactSettingTString(NULL, ModuleName, "QuoteBegin", oldQuoteBegin);
+ DBWriteContactSettingTString(NULL, ModuleName, "QuoteEnd", oldQuoteEnd);
+
+ DBWriteContactSettingTString(NULL, ModuleName, "SizeBegin", oldSizeBegin);
+ DBWriteContactSettingTString(NULL, ModuleName, "SizeEnd", oldSizeEnd);
+
+ DBWriteContactSettingTString(NULL, ModuleName, "BoldBegin", oldBoldBegin);
+ DBWriteContactSettingTString(NULL, ModuleName, "BoldEnd", oldBoldEnd);
+ }
+
+ DestroyWindow(hWnd);
+ break;
+ }
+ break;
+ }
return 0;
}
@@ -195,63 +181,46 @@ int DoDebugTo(int debugTo) CVersionInfo myInfo;// = CVersionInfo();
if (verbose) PUShowMessage("I am going to read the information.", SM_NOTIFY);
if (debugTo != TO_ASK)
- {
- myInfo.Initialize();
- }
+ myInfo.Initialize();
+
if (verbose) PUShowMessage("I have read the information, I will now print them.", SM_NOTIFY);
switch(debugTo) {
- case TO_ASK:
- askDialog = CreateDialog(hInst, MAKEINTRESOURCE(IDD_ASKDIALOG), parent, AskDlgProc);
- ShowWindow(askDialog, SW_SHOW);
-
- break;
-
- case TO_FILE:
- myInfo.PrintInformationsToFile();
-
- break;
-
- case TO_MESSAGEBOX:
- myInfo.PrintInformationsToMessageBox();
-
- break;
-
- case TO_DIALOGBOX:
- myInfo.PrintInformationsToDialogBox();
-
- break;
-
- case TO_DEBUGSTRING:
- myInfo.PrintInformationsToOutputDebugString();
-
- break;
-
- case TO_CLIPBOARD:
- myInfo.PrintInformationsToClipboard(true);
-
- break;
-
- case TO_UPLOAD:
- myInfo.UploadToSite();
-
- break;
-
- default:
- myInfo.PrintInformationsToFile();
-
- break;
-
+ case TO_ASK:
+ askDialog = CreateDialog(hInst, MAKEINTRESOURCE(IDD_ASKDIALOG), parent, AskDlgProc);
+ ShowWindow(askDialog, SW_SHOW);
+ break;
+
+ case TO_FILE:
+ myInfo.PrintInformationsToFile();
+ break;
+
+ case TO_MESSAGEBOX:
+ myInfo.PrintInformationsToMessageBox();
+ break;
+
+ case TO_DIALOGBOX:
+ myInfo.PrintInformationsToDialogBox();
+ break;
+
+ case TO_DEBUGSTRING:
+ myInfo.PrintInformationsToOutputDebugString();
+ break;
+
+ case TO_CLIPBOARD:
+ myInfo.PrintInformationsToClipboard(true);
+ break;
+
+ default:
+ myInfo.PrintInformationsToFile();
+ break;
}
+
if ((debugTo != TO_CLIPBOARD) && (DBGetContactSettingByte(NULL, ModuleName, "ClipboardAlways", FALSE)))
- {
myInfo.PrintInformationsToClipboard(false);
- }
if ((bServiceMode) && (debugTo != TO_DIALOGBOX) && (debugTo != TO_ASK)) //close miranda if in service mode and no dialog was shown
- {
PostQuitMessage(0);
- }
return 0;
}
@@ -268,395 +237,351 @@ INT_PTR CALLBACK DlgProcOpts(HWND hWnd, UINT msg, WPARAM wParam, LPARAM lParam) {
static int bOptionsInitializing = 0;
switch(msg) {
- case WM_INITDIALOG:
+ case WM_INITDIALOG:
+ bOptionsInitializing = 1;
+ TranslateDialogDefault(hWnd);
+ AddInfoToComboboxes(hWnd, IDC_QUOTECOMBOBOX, IDC_SIZECOMBOBOX, IDC_BOLDCOMBOBOX);
+
+ CheckDlgButton(hWnd, IDC_FORUMSTYLE, (BOOL) DBGetContactSettingByte(NULL, ModuleName, "ForumStyle", TRUE) ? BST_CHECKED : BST_UNCHECKED);
+ CheckDlgButton(hWnd, IDC_DISABLEDTOO, (BOOL) DBGetContactSettingByte(NULL, ModuleName, "ShowInactive", TRUE) ? BST_CHECKED : BST_UNCHECKED);
+ CheckDlgButton(hWnd, IDC_SHOWUUIDS, (BOOL) DBGetContactSettingByte(NULL, ModuleName, "ShowUUIDs", FALSE) ? BST_CHECKED : BST_UNCHECKED);
+ CheckDlgButton(hWnd, IDC_SHOWINSTALLEDLANGUAGES, (BOOL) DBGetContactSettingByte(NULL, ModuleName, "ShowInstalledLanguages", FALSE) ? BST_CHECKED : BST_UNCHECKED);
+ CheckDlgButton(hWnd, IDC_SUPPRESSHEADER, (BOOL) DBGetContactSettingByte(NULL, ModuleName, "SuppressHeader", TRUE) ? BST_CHECKED : BST_UNCHECKED);
+
+ CheckDlgButton(hWnd, IDC_SHOWINTASKBAR, (BOOL) DBGetContactSettingByte(NULL, ModuleName, "ShowInTaskbar", TRUE) ? BST_CHECKED : BST_UNCHECKED);
+ CheckDlgButton(hWnd, IDC_CLIPBOARDALSO, (BOOL) DBGetContactSettingByte(NULL, ModuleName, "ClipboardAlways", FALSE) ? BST_CHECKED : BST_UNCHECKED);
+ CheckDlgButton(hWnd, IDC_BOLDVERSION, (BOOL) DBGetContactSettingByte(NULL, ModuleName, "BoldVersionNumber", TRUE) ? BST_CHECKED : BST_UNCHECKED);
+ CheckDlgButton(hWnd, IDC_CHECKUNLOADABLE, (BOOL) DBGetContactSettingByte(NULL, ModuleName, "CheckForDependencies", TRUE) ? BST_CHECKED : BST_UNCHECKED);
+ SetFocus(GetDlgItem(hWnd, IDC_FORUMSTYLE));
{
+ DBVARIANT dbv = { 0 };
bOptionsInitializing = 1;
- TranslateDialogDefault(hWnd);
- AddInfoToComboboxes(hWnd, IDC_QUOTECOMBOBOX, IDC_SIZECOMBOBOX, IDC_BOLDCOMBOBOX);
-
- CheckDlgButton(hWnd, IDC_FORUMSTYLE, (BOOL) DBGetContactSettingByte(NULL, ModuleName, "ForumStyle", TRUE) ? BST_CHECKED : BST_UNCHECKED);
- CheckDlgButton(hWnd, IDC_DISABLEDTOO, (BOOL) DBGetContactSettingByte(NULL, ModuleName, "ShowInactive", TRUE) ? BST_CHECKED : BST_UNCHECKED);
- CheckDlgButton(hWnd, IDC_SHOWUUIDS, (BOOL) DBGetContactSettingByte(NULL, ModuleName, "ShowUUIDs", FALSE) ? BST_CHECKED : BST_UNCHECKED);
- CheckDlgButton(hWnd, IDC_SHOWINSTALLEDLANGUAGES, (BOOL) DBGetContactSettingByte(NULL, ModuleName, "ShowInstalledLanguages", FALSE) ? BST_CHECKED : BST_UNCHECKED);
- CheckDlgButton(hWnd, IDC_SUPPRESSHEADER, (BOOL) DBGetContactSettingByte(NULL, ModuleName, "SuppressHeader", TRUE) ? BST_CHECKED : BST_UNCHECKED);
-
- CheckDlgButton(hWnd, IDC_SHOWINTASKBAR, (BOOL) DBGetContactSettingByte(NULL, ModuleName, "ShowInTaskbar", TRUE) ? BST_CHECKED : BST_UNCHECKED);
- CheckDlgButton(hWnd, IDC_CLIPBOARDALSO, (BOOL) DBGetContactSettingByte(NULL, ModuleName, "ClipboardAlways", FALSE) ? BST_CHECKED : BST_UNCHECKED);
- CheckDlgButton(hWnd, IDC_BOLDVERSION, (BOOL) DBGetContactSettingByte(NULL, ModuleName, "BoldVersionNumber", TRUE) ? BST_CHECKED : BST_UNCHECKED);
- CheckDlgButton(hWnd, IDC_CHECKUNLOADABLE, (BOOL) DBGetContactSettingByte(NULL, ModuleName, "CheckForDependencies", TRUE) ? BST_CHECKED : BST_UNCHECKED);
- SetFocus(GetDlgItem(hWnd, IDC_FORUMSTYLE));
- {
- DBVARIANT dbv = { 0 };
- bOptionsInitializing = 1;
- TCHAR buffer[1024];
- TCHAR notFound[1024];
-
- if (DBGetContactSettingTString(NULL, ModuleName, "OutputFile", &dbv) == 0)
- RelativePathToAbsolute(dbv.ptszVal, notFound, SIZEOF(notFound));
- else
- RelativePathToAbsolute( _T("VersionInfo.txt"), notFound, SIZEOF(notFound));
-
- if (bFoldersAvailable)
- _tcscpy(buffer, TranslateT("Customize using folders plugin"));
- else
- _tcsncpy(buffer, notFound, SIZEOF(notFound));
-
- SetDlgItemText(hWnd, IDC_FILENAME, buffer);
-
- TCHAR start[256], end[256];
- GetStringFromDatabase("QuoteBegin", _T("[quote]"), start, SIZEOF(start));
- GetStringFromDatabase("QuoteEnd", _T("[/quote]"), end, SIZEOF(end));
- mir_sntprintf(buffer, SIZEOF(buffer), _T("%s | %s"), start, end);
- SendDlgItemMessage(hWnd, IDC_QUOTECOMBOBOX, CB_SELECTSTRING, -1, (LPARAM) buffer);
-
- GetStringFromDatabase("SizeBegin", _T("[size=1]"), start, SIZEOF(start));
- GetStringFromDatabase("SizeEnd", _T("[/size]"), end, SIZEOF(end));
- mir_sntprintf(buffer, SIZEOF(buffer), _T("%s | %s"), start, end);
- SendDlgItemMessage(hWnd, IDC_SIZECOMBOBOX, CB_SELECTSTRING, -1, (LPARAM) buffer);
-
- GetStringFromDatabase("BoldBegin", _T("[b]"), start, SIZEOF(start));
- GetStringFromDatabase("BoldEnd", _T("[/b]"), end, SIZEOF(end));
- mir_sntprintf(buffer, SIZEOF(buffer), _T("%s | %s"), start, end);
- SendDlgItemMessage(hWnd, IDC_BOLDCOMBOBOX, CB_SELECTSTRING, -1, (LPARAM) buffer);
- //to add stuff
-
- //upload server settings
- GetStringFromDatabase("UploadServer", _T("vi.cass.cz"), buffer, SIZEOF(buffer));
- SetWindowText(GetDlgItem(hWnd, IDC_UPLOAD_SERVER), buffer);
-
- int port = DBGetContactSettingWord(NULL, ModuleName, "UploadPort", DEFAULT_UPLOAD_PORT);
- _itot(port, buffer, 10);
- SetWindowText(GetDlgItem(hWnd, IDC_UPLOAD_PORT), buffer);
-
- GetStringFromDatabase("UploadUser", _T(""), buffer, SIZEOF(buffer));
- SetWindowText(GetDlgItem(hWnd, IDC_UPLOAD_USERNAME), buffer);
-
- GetStringFromDatabase("UploadPassword", _T(""), buffer, SIZEOF(buffer));
- CallService(MS_DB_CRYPT_DECODESTRING, SIZEOF(buffer), (LPARAM) buffer);
- SetWindowText(GetDlgItem(hWnd, IDC_UPLOAD_PASSWORD), buffer);
- }
-
- switch(DBGetContactSettingByte(NULL, ModuleName, "DebugTo", TO_DIALOGBOX)) {
- case TO_FILE:
- CheckDlgButton(hWnd, IDC_TOFILE, BST_CHECKED);
- break;
-
- case TO_MESSAGEBOX:
- CheckDlgButton(hWnd, IDC_TOMESSAGEBOX, BST_CHECKED);
- break;
-
- case TO_DIALOGBOX:
- CheckDlgButton(hWnd, IDC_TODIALOGBOX, BST_CHECKED);
- break;
-
- case TO_DEBUGSTRING:
- CheckDlgButton(hWnd, IDC_TODEBUGSTRING, BST_CHECKED);
- break;
-
- case TO_CLIPBOARD:
- CheckDlgButton(hWnd, IDC_TOCLIPBOARD, BST_CHECKED);
- break;
-
- case TO_UPLOAD:
- CheckDlgButton(hWnd, IDC_TOUPLOAD, BST_CHECKED);
- break;
-
- case TO_ASK:
- CheckDlgButton(hWnd, IDC_ASKEVERYTIME, BST_CHECKED);
- break;
-
- default:
- CheckDlgButton(hWnd, IDC_TODIALOGBOX, BST_CHECKED);
- break;
- }
+ TCHAR buffer[1024];
+ TCHAR notFound[1024];
+
+ if (DBGetContactSettingTString(NULL, ModuleName, "OutputFile", &dbv) == 0)
+ RelativePathToAbsolute(dbv.ptszVal, notFound, SIZEOF(notFound));
+ else
+ RelativePathToAbsolute( _T("VersionInfo.txt"), notFound, SIZEOF(notFound));
+
+ if (bFoldersAvailable)
+ _tcscpy(buffer, TranslateT("Customize using folders plugin"));
+ else
+ _tcsncpy(buffer, notFound, SIZEOF(notFound));
+
+ SetDlgItemText(hWnd, IDC_FILENAME, buffer);
+
+ TCHAR start[256], end[256];
+ GetStringFromDatabase("QuoteBegin", _T("[quote]"), start, SIZEOF(start));
+ GetStringFromDatabase("QuoteEnd", _T("[/quote]"), end, SIZEOF(end));
+ mir_sntprintf(buffer, SIZEOF(buffer), _T("%s | %s"), start, end);
+ SendDlgItemMessage(hWnd, IDC_QUOTECOMBOBOX, CB_SELECTSTRING, -1, (LPARAM) buffer);
+
+ GetStringFromDatabase("SizeBegin", _T("[size=1]"), start, SIZEOF(start));
+ GetStringFromDatabase("SizeEnd", _T("[/size]"), end, SIZEOF(end));
+ mir_sntprintf(buffer, SIZEOF(buffer), _T("%s | %s"), start, end);
+ SendDlgItemMessage(hWnd, IDC_SIZECOMBOBOX, CB_SELECTSTRING, -1, (LPARAM) buffer);
+
+ GetStringFromDatabase("BoldBegin", _T("[b]"), start, SIZEOF(start));
+ GetStringFromDatabase("BoldEnd", _T("[/b]"), end, SIZEOF(end));
+ mir_sntprintf(buffer, SIZEOF(buffer), _T("%s | %s"), start, end);
+ SendDlgItemMessage(hWnd, IDC_BOLDCOMBOBOX, CB_SELECTSTRING, -1, (LPARAM) buffer);
+ //to add stuff
+
+ //upload server settings
+ GetStringFromDatabase("UploadServer", _T("vi.cass.cz"), buffer, SIZEOF(buffer));
+ SetWindowText(GetDlgItem(hWnd, IDC_UPLOAD_SERVER), buffer);
+
+ int port = DBGetContactSettingWord(NULL, ModuleName, "UploadPort", DEFAULT_UPLOAD_PORT);
+ _itot(port, buffer, 10);
+ SetWindowText(GetDlgItem(hWnd, IDC_UPLOAD_PORT), buffer);
+
+ GetStringFromDatabase("UploadUser", _T(""), buffer, SIZEOF(buffer));
+ SetWindowText(GetDlgItem(hWnd, IDC_UPLOAD_USERNAME), buffer);
+
+ GetStringFromDatabase("UploadPassword", _T(""), buffer, SIZEOF(buffer));
+ CallService(MS_DB_CRYPT_DECODESTRING, SIZEOF(buffer), (LPARAM) buffer);
+ SetWindowText(GetDlgItem(hWnd, IDC_UPLOAD_PASSWORD), buffer);
+ }
+
+ switch(DBGetContactSettingByte(NULL, ModuleName, "DebugTo", TO_DIALOGBOX)) {
+ case TO_FILE:
+ CheckDlgButton(hWnd, IDC_TOFILE, BST_CHECKED);
+ break;
+
+ case TO_MESSAGEBOX:
+ CheckDlgButton(hWnd, IDC_TOMESSAGEBOX, BST_CHECKED);
+ break;
+
+ case TO_DIALOGBOX:
+ CheckDlgButton(hWnd, IDC_TODIALOGBOX, BST_CHECKED);
+ break;
+ case TO_DEBUGSTRING:
+ CheckDlgButton(hWnd, IDC_TODEBUGSTRING, BST_CHECKED);
+ break;
+
+ case TO_CLIPBOARD:
+ CheckDlgButton(hWnd, IDC_TOCLIPBOARD, BST_CHECKED);
+ break;
+
+ case TO_UPLOAD:
+ CheckDlgButton(hWnd, IDC_TOUPLOAD, BST_CHECKED);
+ break;
+
+ case TO_ASK:
+ CheckDlgButton(hWnd, IDC_ASKEVERYTIME, BST_CHECKED);
+ break;
+
+ default:
+ CheckDlgButton(hWnd, IDC_TODIALOGBOX, BST_CHECKED);
+ break;
+ }
+
+ EnableWindow(GetDlgItem(hWnd, IDC_QUOTECOMBOBOX), IsDlgButtonChecked(hWnd, IDC_FORUMSTYLE) ? TRUE : FALSE); //forum style only
+ EnableWindow(GetDlgItem(hWnd, IDC_SIZECOMBOBOX), IsDlgButtonChecked(hWnd, IDC_FORUMSTYLE) ? TRUE : FALSE); //forum style only
+ EnableWindow(GetDlgItem(hWnd, IDC_BOLDVERSION), IsDlgButtonChecked(hWnd, IDC_FORUMSTYLE) ? TRUE : FALSE); //forum style only
+ EnableWindow(GetDlgItem(hWnd, IDC_BOLDCOMBOBOX), (IsDlgButtonChecked(hWnd, IDC_BOLDVERSION) & IsDlgButtonChecked(hWnd, IDC_FORUMSTYLE)) ? TRUE : FALSE);//both forum style and bold version checked
+ EnableWindow(GetDlgItem(hWnd, IDC_SHOWINTASKBAR), IsDlgButtonChecked(hWnd, IDC_TODIALOGBOX) ? TRUE : FALSE); //only enable for to dialog box
+ EnableWindow(GetDlgItem(hWnd, IDC_DISABLEDTOO), IsDlgButtonChecked(hWnd, IDC_FORUMSTYLE) ? FALSE : TRUE); //if forum style disable show disabled plugins
+ EnableWindow(GetDlgItem(hWnd, IDC_CLIPBOARDALSO), IsDlgButtonChecked(hWnd, IDC_TOCLIPBOARD) ? FALSE : TRUE); //don't enable always clipboard if we're printing to clipboard
+ EnableWindow(GetDlgItem(hWnd, IDC_FILENAME), ((IsDlgButtonChecked(hWnd, IDC_TOFILE)) && (!bFoldersAvailable)) ? TRUE : FALSE);
+ EnableUploadSettings(hWnd, IsDlgButtonChecked(hWnd, IDC_TOUPLOAD) ? TRUE : FALSE);
+ {
+ OSVERSIONINFO osvi = { 0 };
+ osvi.dwOSVersionInfoSize = sizeof(osvi);
+ GetVersionEx(&osvi);
+
+ if (osvi.dwPlatformId == VER_PLATFORM_WIN32_WINDOWS)
+ EnableWindow(GetDlgItem(hWnd, IDC_CHECKUNLOADABLE), FALSE);
+ }
+
+ CheckDlgButton(hWnd, IDC_DEBUG, (BOOL) verbose == TRUE ? BST_CHECKED : BST_UNCHECKED);
+
+ SetFocus(GetDlgItem(hWnd, IDC_GETINFONOW));
+
+ bOptionsInitializing = 0;
+ break;
+
+ case WM_COMMAND:
+ switch(LOWORD(wParam)) {
+ case IDC_ASKEVERYTIME:
+ case IDC_TOFILE:
+ case IDC_TOMESSAGEBOX:
+ case IDC_TODIALOGBOX:
+ case IDC_TODEBUGSTRING:
+ case IDC_TOCLIPBOARD:
+ case IDC_TOUPLOAD:
+ case IDC_FORUMSTYLE:
+ case IDC_BOLDVERSION:
EnableWindow(GetDlgItem(hWnd, IDC_QUOTECOMBOBOX), IsDlgButtonChecked(hWnd, IDC_FORUMSTYLE) ? TRUE : FALSE); //forum style only
EnableWindow(GetDlgItem(hWnd, IDC_SIZECOMBOBOX), IsDlgButtonChecked(hWnd, IDC_FORUMSTYLE) ? TRUE : FALSE); //forum style only
EnableWindow(GetDlgItem(hWnd, IDC_BOLDVERSION), IsDlgButtonChecked(hWnd, IDC_FORUMSTYLE) ? TRUE : FALSE); //forum style only
- EnableWindow(GetDlgItem(hWnd, IDC_BOLDCOMBOBOX), (IsDlgButtonChecked(hWnd, IDC_BOLDVERSION) & IsDlgButtonChecked(hWnd, IDC_FORUMSTYLE)) ? TRUE : FALSE);//both forum style and bold version checked
+ EnableWindow(GetDlgItem(hWnd, IDC_BOLDCOMBOBOX), (IsDlgButtonChecked(hWnd, IDC_BOLDVERSION) & IsDlgButtonChecked(hWnd, IDC_FORUMSTYLE)) ? TRUE : FALSE); //both forum style and bold version checked
+ EnableWindow(GetDlgItem(hWnd, IDC_FILENAME), ((IsDlgButtonChecked(hWnd, IDC_TOFILE)) && (!bFoldersAvailable)) ? TRUE : FALSE);
EnableWindow(GetDlgItem(hWnd, IDC_SHOWINTASKBAR), IsDlgButtonChecked(hWnd, IDC_TODIALOGBOX) ? TRUE : FALSE); //only enable for to dialog box
EnableWindow(GetDlgItem(hWnd, IDC_DISABLEDTOO), IsDlgButtonChecked(hWnd, IDC_FORUMSTYLE) ? FALSE : TRUE); //if forum style disable show disabled plugins
EnableWindow(GetDlgItem(hWnd, IDC_CLIPBOARDALSO), IsDlgButtonChecked(hWnd, IDC_TOCLIPBOARD) ? FALSE : TRUE); //don't enable always clipboard if we're printing to clipboard
- EnableWindow(GetDlgItem(hWnd, IDC_FILENAME), ((IsDlgButtonChecked(hWnd, IDC_TOFILE)) && (!bFoldersAvailable)) ? TRUE : FALSE);
EnableUploadSettings(hWnd, IsDlgButtonChecked(hWnd, IDC_TOUPLOAD) ? TRUE : FALSE);
-
- OSVERSIONINFO osvi = { 0 };
- osvi.dwOSVersionInfoSize = sizeof(osvi);
- GetVersionEx(&osvi);
-
- if (osvi.dwPlatformId == VER_PLATFORM_WIN32_WINDOWS)
- EnableWindow(GetDlgItem(hWnd, IDC_CHECKUNLOADABLE), FALSE);
-
- CheckDlgButton(hWnd, IDC_DEBUG, (BOOL) verbose == TRUE ? BST_CHECKED : BST_UNCHECKED);
-
- SetFocus(GetDlgItem(hWnd, IDC_GETINFONOW));
-
- bOptionsInitializing = 0;
+
+ case IDC_SHOWUUIDS:
+ if (IsDlgButtonChecked(hWnd, IDC_SHOWUUIDS) && MessageBox(hWnd,
+ TranslateT("Are you sure you want to enable this option ?\nPlease only enable this option if you really know what you're doing and what the option is for or if someone asked you to do it."),
+ TranslateT("Show plugin UUIDs ?"), MB_YESNO | MB_ICONWARNING) == IDNO)
+ {
+ CheckDlgButton(hWnd, IDC_SHOWUUIDS, FALSE);
+
+ break;
+ }//else fallthrough
+ case IDC_DISABLEDTOO:
+ case IDC_SHOWINTASKBAR:
+ case IDC_CLIPBOARDALSO:
+ case IDC_CHECKUNLOADABLE:
+ case IDC_SUPPRESSHEADER:
+ case IDC_SHOWINSTALLEDLANGUAGES:
+ EnableWindow(GetDlgItem(hWnd, IDC_GETINFONOW), FALSE);
+
+ case IDC_QUOTECOMBOBOX:
+ case IDC_SIZECOMBOBOX:
+ case IDC_BOLDCOMBOBOX:
+ if (!bOptionsInitializing)
+ SendMessage(GetParent(hWnd), PSM_CHANGED,0,0);
break;
- }
-
- case WM_COMMAND:
- switch(LOWORD(wParam)) {
- case IDC_ASKEVERYTIME:
- case IDC_TOFILE:
- case IDC_TOMESSAGEBOX:
- case IDC_TODIALOGBOX:
- case IDC_TODEBUGSTRING:
- case IDC_TOCLIPBOARD:
- case IDC_TOUPLOAD:
- case IDC_FORUMSTYLE:
- case IDC_BOLDVERSION:
- EnableWindow(GetDlgItem(hWnd, IDC_QUOTECOMBOBOX), IsDlgButtonChecked(hWnd, IDC_FORUMSTYLE) ? TRUE : FALSE); //forum style only
- EnableWindow(GetDlgItem(hWnd, IDC_SIZECOMBOBOX), IsDlgButtonChecked(hWnd, IDC_FORUMSTYLE) ? TRUE : FALSE); //forum style only
- EnableWindow(GetDlgItem(hWnd, IDC_BOLDVERSION), IsDlgButtonChecked(hWnd, IDC_FORUMSTYLE) ? TRUE : FALSE); //forum style only
- EnableWindow(GetDlgItem(hWnd, IDC_BOLDCOMBOBOX), (IsDlgButtonChecked(hWnd, IDC_BOLDVERSION) & IsDlgButtonChecked(hWnd, IDC_FORUMSTYLE)) ? TRUE : FALSE); //both forum style and bold version checked
- EnableWindow(GetDlgItem(hWnd, IDC_FILENAME), ((IsDlgButtonChecked(hWnd, IDC_TOFILE)) && (!bFoldersAvailable)) ? TRUE : FALSE);
- EnableWindow(GetDlgItem(hWnd, IDC_SHOWINTASKBAR), IsDlgButtonChecked(hWnd, IDC_TODIALOGBOX) ? TRUE : FALSE); //only enable for to dialog box
- EnableWindow(GetDlgItem(hWnd, IDC_DISABLEDTOO), IsDlgButtonChecked(hWnd, IDC_FORUMSTYLE) ? FALSE : TRUE); //if forum style disable show disabled plugins
- EnableWindow(GetDlgItem(hWnd, IDC_CLIPBOARDALSO), IsDlgButtonChecked(hWnd, IDC_TOCLIPBOARD) ? FALSE : TRUE); //don't enable always clipboard if we're printing to clipboard
- EnableUploadSettings(hWnd, IsDlgButtonChecked(hWnd, IDC_TOUPLOAD) ? TRUE : FALSE);
-
- case IDC_SHOWUUIDS:
- if (IsDlgButtonChecked(hWnd, IDC_SHOWUUIDS) && MessageBox(hWnd,
- TranslateT("Are you sure you want to enable this option ?\nPlease only enable this option if you really know what you're doing and what the option is for or if someone asked you to do it."),
- TranslateT("Show plugin UUIDs ?"), MB_YESNO | MB_ICONWARNING) == IDNO)
- {
- CheckDlgButton(hWnd, IDC_SHOWUUIDS, FALSE);
-
- break;
- }//else fallthrough
- case IDC_DISABLEDTOO:
- case IDC_SHOWINTASKBAR:
- case IDC_CLIPBOARDALSO:
- case IDC_CHECKUNLOADABLE:
- case IDC_SUPPRESSHEADER:
- case IDC_SHOWINSTALLEDLANGUAGES:
- EnableWindow(GetDlgItem(hWnd, IDC_GETINFONOW), FALSE);
-
- case IDC_QUOTECOMBOBOX:
- case IDC_SIZECOMBOBOX:
- case IDC_BOLDCOMBOBOX:
- if (!bOptionsInitializing)
- {
- SendMessage(GetParent(hWnd), PSM_CHANGED,0,0);
- }
-
- break;
-
- case IDC_FILENAME:
- case IDC_UPLOAD_USERNAME:
- case IDC_UPLOAD_PASSWORD:
- case IDC_UPLOAD_PORT:
- case IDC_UPLOAD_SERVER:
- {
- if ((HIWORD(wParam) == EN_CHANGE))// || (HIWORD(wParam) == CBN_SELENDOK)) //CBN_EDITCHANGE
- {
- if (!bOptionsInitializing)
- {
- SendMessage(GetParent(hWnd), PSM_CHANGED, 0, 0);
- EnableWindow(GetDlgItem(hWnd, IDC_GETINFONOW), FALSE);
- }
- }
-
- break;
- }
-
- case IDC_GETINFONOW:
- //Call the plugin menu command routine.
- PluginMenuCommand(0,0);
-
- break;
-
- case IDC_DEBUG:
- verbose = !verbose;
-
- break;
+
+ case IDC_FILENAME:
+ case IDC_UPLOAD_USERNAME:
+ case IDC_UPLOAD_PASSWORD:
+ case IDC_UPLOAD_PORT:
+ case IDC_UPLOAD_SERVER:
+ if ( HIWORD(wParam) == EN_CHANGE && !bOptionsInitializing) {
+ SendMessage(GetParent(hWnd), PSM_CHANGED, 0, 0);
+ EnableWindow(GetDlgItem(hWnd, IDC_GETINFONOW), FALSE);
}
-
break;
-
- case WM_NOTIFY:
- switch(((LPNMHDR)lParam)->idFrom)
- {
- case 0:
- switch (((LPNMHDR)lParam)->code)
- {
- case PSN_APPLY:
- {
- {
- TCHAR buffer[1024];
- TCHAR start[256], end[256];
- SendDlgItemMessage(hWnd, IDC_QUOTECOMBOBOX, WM_GETTEXT, SIZEOF(buffer), (LPARAM) buffer);
- SplitStringInfo(buffer, start, end);
- DBWriteContactSettingTString(NULL, ModuleName, "QuoteBegin", start);
- DBWriteContactSettingTString(NULL, ModuleName, "QuoteEnd", end);
- SendDlgItemMessage(hWnd, IDC_SIZECOMBOBOX, WM_GETTEXT, SIZEOF(buffer), (LPARAM) buffer);
- SplitStringInfo(buffer, start, end);
- DBWriteContactSettingTString(NULL, ModuleName, "SizeBegin", start);
- DBWriteContactSettingTString(NULL, ModuleName, "SizeEnd", end);
- SendDlgItemMessage(hWnd, IDC_BOLDCOMBOBOX, WM_GETTEXT, SIZEOF(buffer), (LPARAM) buffer);
- SplitStringInfo(buffer, start, end);
- DBWriteContactSettingTString(NULL, ModuleName, "BoldBegin", start);
- DBWriteContactSettingTString(NULL, ModuleName, "BoldEnd", end);
- }
-
- DBWriteContactSettingByte(NULL, ModuleName, "CheckForDependencies", IsDlgButtonChecked(hWnd, IDC_CHECKUNLOADABLE) ? TRUE : FALSE);
- DBWriteContactSettingByte(NULL, ModuleName, "BoldVersionNumber", IsDlgButtonChecked(hWnd, IDC_BOLDVERSION) ? TRUE : FALSE);
- DBWriteContactSettingByte(NULL, ModuleName, "ForumStyle", IsDlgButtonChecked(hWnd, IDC_FORUMSTYLE) ? TRUE : FALSE);
- DBWriteContactSettingByte(NULL, ModuleName, "ClipboardAlways", IsDlgButtonChecked(hWnd, IDC_CLIPBOARDALSO) ? TRUE : FALSE);
- DBWriteContactSettingByte(NULL, ModuleName, "SuppressHeader", IsDlgButtonChecked(hWnd, IDC_SUPPRESSHEADER) ? TRUE : FALSE);
- DBWriteContactSettingByte(NULL, ModuleName, "ShowUUIDs", IsDlgButtonChecked(hWnd, IDC_SHOWUUIDS) ? TRUE : FALSE);
- DBWriteContactSettingByte(NULL, ModuleName, "ShowInstalledLanguages", IsDlgButtonChecked(hWnd, IDC_SHOWINSTALLEDLANGUAGES) ? TRUE : FALSE);
-
- TCHAR fileName[MAX_PATH]; //absolute
- TCHAR filePath[MAX_PATH]; //relative
- if (!bFoldersAvailable)
- {
- GetDlgItemText(hWnd, IDC_FILENAME, fileName, MAX_PATH);
- AbsolutePathToRelative(fileName, filePath, SIZEOF(filePath));
-
- DBWriteContactSettingTString(NULL, ModuleName, "OutputFile", filePath); //store relative path
- }
- DBWriteContactSettingByte(NULL, ModuleName, "ShowInTaskbar", IsDlgButtonChecked(hWnd, IDC_SHOWINTASKBAR) ? TRUE : FALSE);
- //Debug to:
- if (IsDlgButtonChecked(hWnd, IDC_TOFILE))
- DBWriteContactSettingByte(NULL, ModuleName, "DebugTo", TO_FILE);
- else if (IsDlgButtonChecked(hWnd, IDC_TOMESSAGEBOX))
- DBWriteContactSettingByte(NULL, ModuleName, "DebugTo", TO_MESSAGEBOX);
- else if (IsDlgButtonChecked(hWnd, IDC_TODIALOGBOX))
- DBWriteContactSettingByte(NULL, ModuleName, "DebugTo", TO_DIALOGBOX);
- else if (IsDlgButtonChecked(hWnd, IDC_TODEBUGSTRING))
- DBWriteContactSettingByte(NULL, ModuleName, "DebugTo", TO_DEBUGSTRING);
- else if (IsDlgButtonChecked(hWnd, IDC_TOCLIPBOARD))
- DBWriteContactSettingByte(NULL, ModuleName, "DebugTo", TO_CLIPBOARD);
- else if (IsDlgButtonChecked(hWnd, IDC_TOUPLOAD))
- DBWriteContactSettingByte(NULL, ModuleName, "DebugTo", TO_UPLOAD);
- else if (IsDlgButtonChecked(hWnd, IDC_ASKEVERYTIME))
- DBWriteContactSettingByte(NULL, ModuleName, "DebugTo", TO_ASK);
-
- EnableWindow(GetDlgItem(hWnd, IDC_GETINFONOW), TRUE);
- //Disabled plugins too?
- DBWriteContactSettingByte(NULL, ModuleName, "ShowInactive", IsDlgButtonChecked(hWnd, IDC_DISABLEDTOO)?TRUE:FALSE);
-
- GetStringFromDatabase("UUIDCharMark", _T(DEF_UUID_CHARMARK), PLUGIN_UUID_MARK, cPLUGIN_UUID_MARK);
- }
- }
- }
-
+
+ case IDC_GETINFONOW:
+ //Call the plugin menu command routine.
+ PluginMenuCommand(0,0);
break;
-
- default:
-
+
+ case IDC_DEBUG:
+ verbose = !verbose;
break;
+ }
+
+ break;
+
+ case WM_NOTIFY:
+ switch(((LPNMHDR)lParam)->idFrom) {
+ case 0:
+ switch (((LPNMHDR)lParam)->code) {
+ case PSN_APPLY:
+ {
+ TCHAR buffer[1024];
+ TCHAR start[256], end[256];
+ SendDlgItemMessage(hWnd, IDC_QUOTECOMBOBOX, WM_GETTEXT, SIZEOF(buffer), (LPARAM) buffer);
+ SplitStringInfo(buffer, start, end);
+ DBWriteContactSettingTString(NULL, ModuleName, "QuoteBegin", start);
+ DBWriteContactSettingTString(NULL, ModuleName, "QuoteEnd", end);
+ SendDlgItemMessage(hWnd, IDC_SIZECOMBOBOX, WM_GETTEXT, SIZEOF(buffer), (LPARAM) buffer);
+ SplitStringInfo(buffer, start, end);
+ DBWriteContactSettingTString(NULL, ModuleName, "SizeBegin", start);
+ DBWriteContactSettingTString(NULL, ModuleName, "SizeEnd", end);
+ SendDlgItemMessage(hWnd, IDC_BOLDCOMBOBOX, WM_GETTEXT, SIZEOF(buffer), (LPARAM) buffer);
+ SplitStringInfo(buffer, start, end);
+ DBWriteContactSettingTString(NULL, ModuleName, "BoldBegin", start);
+ DBWriteContactSettingTString(NULL, ModuleName, "BoldEnd", end);
+ }
+
+ DBWriteContactSettingByte(NULL, ModuleName, "CheckForDependencies", IsDlgButtonChecked(hWnd, IDC_CHECKUNLOADABLE) ? TRUE : FALSE);
+ DBWriteContactSettingByte(NULL, ModuleName, "BoldVersionNumber", IsDlgButtonChecked(hWnd, IDC_BOLDVERSION) ? TRUE : FALSE);
+ DBWriteContactSettingByte(NULL, ModuleName, "ForumStyle", IsDlgButtonChecked(hWnd, IDC_FORUMSTYLE) ? TRUE : FALSE);
+ DBWriteContactSettingByte(NULL, ModuleName, "ClipboardAlways", IsDlgButtonChecked(hWnd, IDC_CLIPBOARDALSO) ? TRUE : FALSE);
+ DBWriteContactSettingByte(NULL, ModuleName, "SuppressHeader", IsDlgButtonChecked(hWnd, IDC_SUPPRESSHEADER) ? TRUE : FALSE);
+ DBWriteContactSettingByte(NULL, ModuleName, "ShowUUIDs", IsDlgButtonChecked(hWnd, IDC_SHOWUUIDS) ? TRUE : FALSE);
+ DBWriteContactSettingByte(NULL, ModuleName, "ShowInstalledLanguages", IsDlgButtonChecked(hWnd, IDC_SHOWINSTALLEDLANGUAGES) ? TRUE : FALSE);
+
+ if (!bFoldersAvailable) {
+ TCHAR filePath[MAX_PATH], fileName[MAX_PATH];
+ GetDlgItemText(hWnd, IDC_FILENAME, fileName, MAX_PATH);
+ AbsolutePathToRelative(fileName, filePath, SIZEOF(filePath));
+
+ DBWriteContactSettingTString(NULL, ModuleName, "OutputFile", filePath); //store relative path
+ }
+ DBWriteContactSettingByte(NULL, ModuleName, "ShowInTaskbar", IsDlgButtonChecked(hWnd, IDC_SHOWINTASKBAR) ? TRUE : FALSE);
+ //Debug to:
+ if (IsDlgButtonChecked(hWnd, IDC_TOFILE))
+ DBWriteContactSettingByte(NULL, ModuleName, "DebugTo", TO_FILE);
+ else if (IsDlgButtonChecked(hWnd, IDC_TOMESSAGEBOX))
+ DBWriteContactSettingByte(NULL, ModuleName, "DebugTo", TO_MESSAGEBOX);
+ else if (IsDlgButtonChecked(hWnd, IDC_TODIALOGBOX))
+ DBWriteContactSettingByte(NULL, ModuleName, "DebugTo", TO_DIALOGBOX);
+ else if (IsDlgButtonChecked(hWnd, IDC_TODEBUGSTRING))
+ DBWriteContactSettingByte(NULL, ModuleName, "DebugTo", TO_DEBUGSTRING);
+ else if (IsDlgButtonChecked(hWnd, IDC_TOCLIPBOARD))
+ DBWriteContactSettingByte(NULL, ModuleName, "DebugTo", TO_CLIPBOARD);
+ else if (IsDlgButtonChecked(hWnd, IDC_TOUPLOAD))
+ DBWriteContactSettingByte(NULL, ModuleName, "DebugTo", TO_UPLOAD);
+ else if (IsDlgButtonChecked(hWnd, IDC_ASKEVERYTIME))
+ DBWriteContactSettingByte(NULL, ModuleName, "DebugTo", TO_ASK);
+
+ EnableWindow(GetDlgItem(hWnd, IDC_GETINFONOW), TRUE);
+ //Disabled plugins too?
+ DBWriteContactSettingByte(NULL, ModuleName, "ShowInactive", IsDlgButtonChecked(hWnd, IDC_DISABLEDTOO)?TRUE:FALSE);
+
+ GetStringFromDatabase("UUIDCharMark", _T(DEF_UUID_CHARMARK), PLUGIN_UUID_MARK, cPLUGIN_UUID_MARK);
+ } }
+
+ break;
}
return 0;
}
-INT_PTR CALLBACK DialogBoxProc(HWND hWnd, UINT msg, WPARAM wParam, LPARAM lParam) {
+INT_PTR CALLBACK DialogBoxProc(HWND hWnd, UINT msg, WPARAM wParam, LPARAM lParam)
+{
static CVersionInfo *myInfo = NULL;
switch(msg) {
- case WM_INITDIALOG:
- SendMessage(hWnd, WM_SETICON, ICON_BIG, (LPARAM) hiVIIcon);
-
- myInfo = (CVersionInfo *) lParam;
- if (DBGetContactSettingByte(NULL, ModuleName, "ShowInTaskbar", TRUE))
- {
- DWORD ws;
- ws = GetWindowLong(hWnd, GWL_EXSTYLE);
- SetWindowLong(hWnd, GWL_EXSTYLE, ws | WS_EX_APPWINDOW);
- //SetWindowLong(hWnd, GWL_STYLE, ws | WS_DLGFRAME | WS_POPUPWINDOW);
- }
+ case WM_INITDIALOG:
+ SendMessage(hWnd, WM_SETICON, ICON_BIG, (LPARAM) hiVIIcon);
- TranslateDialogDefault(hWnd);
- {
- DBVARIANT dbv = { 0 };
- LOGFONT lf = { 0 };
+ myInfo = (CVersionInfo *) lParam;
+ if (DBGetContactSettingByte(NULL, ModuleName, "ShowInTaskbar", TRUE)) {
+ DWORD ws;
+ ws = GetWindowLong(hWnd, GWL_EXSTYLE);
+ SetWindowLong(hWnd, GWL_EXSTYLE, ws | WS_EX_APPWINDOW);
+ //SetWindowLong(hWnd, GWL_STYLE, ws | WS_DLGFRAME | WS_POPUPWINDOW);
+ }
- dbv.type = DBVT_BLOB;
- if (DBGetContactSetting(NULL, "OptionFont", "Font", &dbv) == 0) {
- lf=*(LOGFONT*)dbv.pbVal;
- }
- else {
- HFONT hFont = (HFONT)SendDlgItemMessage(hWnd,IDC_CLOSE,WM_GETFONT,0,0);
- GetObject(hFont,sizeof(lf),&lf);
- }
- SendDlgItemMessage(hWnd,IDC_TEXT,WM_SETFONT,(WPARAM)CreateFontIndirect(&lf),0);
+ TranslateDialogDefault(hWnd);
+ {
+ DBVARIANT dbv = { 0 };
+ LOGFONT lf = { 0 };
+
+ dbv.type = DBVT_BLOB;
+ if (DBGetContactSetting(NULL, "OptionFont", "Font", &dbv) == 0)
+ lf=*(LOGFONT*)dbv.pbVal;
+ else {
+ HFONT hFont = (HFONT)SendDlgItemMessage(hWnd,IDC_CLOSE,WM_GETFONT,0,0);
+ GetObject(hFont,sizeof(lf),&lf);
}
-
- return TRUE;
-
- case WM_CLOSE:
+ SendDlgItemMessage(hWnd,IDC_TEXT,WM_SETFONT,(WPARAM)CreateFontIndirect(&lf),0);
+ }
+
+ return TRUE;
+
+ case WM_CLOSE:
+ DestroyWindow(hWnd);
+ break;
+
+ case WM_COMMAND: {
+ switch(LOWORD(wParam)) {
+ case IDC_CLOSE:
DestroyWindow(hWnd);
-
- break;
-
- case WM_COMMAND: {
- switch(LOWORD(wParam)) {
- case IDC_CLOSE:
- DestroyWindow(hWnd);
-
- break;
-
- case IDC_COPYTEXT:
- SetLastError(0);
- if (GetOpenClipboardWindow()) {
- Log(Translate("The clipboard is not available, retry."));
- }
- else {
- OpenClipboard(hWnd);
- //Ok, let's begin, then.
- EmptyClipboard();
- //Storage data we'll use.
- TCHAR text[MAX_TEXT];
- LPTSTR lptstrCopy;
- GetDlgItemText(hWnd, IDC_TEXT, text, MAX_TEXT);
- int length = lstrlen(text) + 1;
- HANDLE hData = GlobalAlloc(GMEM_MOVEABLE, (length + 5)*sizeof( TCHAR ));
- //Lock memory, copy it, release it.
- lptstrCopy = (LPTSTR)GlobalLock(hData);
- lstrcpyn(lptstrCopy, text, length);
- lptstrCopy[length] = '\0';
- GlobalUnlock(hData);
- //Now set the clipboard data.
- SetClipboardData(CF_TEXT, hData);
- //Remove the lock on the clipboard.
- CloseClipboard();
- }
-
- break;
-
- case IDC_SAVETOFILE:
- TCHAR text[MAX_TEXT];
- GetDlgItemText(hWnd, IDC_TEXT, text, MAX_TEXT);
- myInfo->PrintInformationsToFile(text);
- break;
-
- case IDC_UPLOAD:
- if (myInfo)
- {
- TCHAR text[MAX_TEXT];
- GetDlgItemText(hWnd, IDC_TEXT, text, MAX_TEXT);
- myInfo->UploadToSite(text);
- }
-
- break;
- }
-
break;
- }
- case WM_DESTROY:
- DeleteObject((HFONT)SendDlgItemMessage(hWnd,IDC_TEXT,WM_GETFONT,0,0));
- myInfo = NULL;
- if (bServiceMode) //close miranda if in service mode
- {
- PostQuitMessage(0);
+
+ case IDC_COPYTEXT:
+ SetLastError(0);
+ if (GetOpenClipboardWindow())
+ Log( TranslateT("The clipboard is not available, retry."));
+ else {
+ OpenClipboard(hWnd);
+ //Ok, let's begin, then.
+ EmptyClipboard();
+ //Storage data we'll use.
+ TCHAR text[MAX_TEXT];
+ LPTSTR lptstrCopy;
+ GetDlgItemText(hWnd, IDC_TEXT, text, MAX_TEXT);
+ int length = lstrlen(text) + 1;
+ HANDLE hData = GlobalAlloc(GMEM_MOVEABLE, (length + 5)*sizeof( TCHAR ));
+ //Lock memory, copy it, release it.
+ lptstrCopy = (LPTSTR)GlobalLock(hData);
+ lstrcpyn(lptstrCopy, text, length);
+ lptstrCopy[length] = '\0';
+ GlobalUnlock(hData);
+ //Now set the clipboard data.
+ SetClipboardData(CF_TEXT, hData);
+ //Remove the lock on the clipboard.
+ CloseClipboard();
}
-
+
break;
-
- default:
-
+
+ case IDC_SAVETOFILE:
+ TCHAR text[MAX_TEXT];
+ GetDlgItemText(hWnd, IDC_TEXT, text, MAX_TEXT);
+ myInfo->PrintInformationsToFile(text);
break;
+ }
+
+ break;
+ }
+ case WM_DESTROY:
+ DeleteObject((HFONT)SendDlgItemMessage(hWnd,IDC_TEXT,WM_GETFONT,0,0));
+ myInfo = NULL;
+ if (bServiceMode) //close miranda if in service mode
+ PostQuitMessage(0);
+
+ break;
}
return 0;
-}
\ No newline at end of file +}
diff --git a/plugins/Svc_vi/hooked_events.cpp b/plugins/Svc_vi/hooked_events.cpp index 960147bbb9..3a9dfa3ce2 100644 --- a/plugins/Svc_vi/hooked_events.cpp +++ b/plugins/Svc_vi/hooked_events.cpp @@ -66,10 +66,9 @@ int OnModulesLoaded(WPARAM wParam, LPARAM lParam) CallService(MS_UPDATE_REGISTER, 0, (LPARAM) &update);
bFoldersAvailable = ServiceExists(MS_FOLDERS_REGISTER_PATH);
- hOutputLocation = FoldersRegisterCustomPath("VersionInfo", "Output folder", "%miranda_path%");
+ hOutputLocation = FoldersRegisterCustomPathT("VersionInfo", "Output folder", _T("%miranda_path%"));
GetStringFromDatabase("UUIDCharMark", _T(DEF_UUID_CHARMARK), PLUGIN_UUID_MARK, cPLUGIN_UUID_MARK);
-
return 0;
}
diff --git a/plugins/Svc_vi/main.cpp b/plugins/Svc_vi/main.cpp index 530b6fe487..b376278c41 100644 --- a/plugins/Svc_vi/main.cpp +++ b/plugins/Svc_vi/main.cpp @@ -77,33 +77,25 @@ extern "C" __declspec(dllexport) const MUUID *MirandaPluginInterfaces() bool WINAPI DllMain(HINSTANCE hinstDLL,DWORD fdwReason,LPVOID lpvReserved)
{
- LogToFileInit();
- LogToFile("Entering %s", __FUNCTION__);
hInst=hinstDLL;
if (fdwReason == DLL_PROCESS_ATTACH) DisableThreadLibraryCalls(hinstDLL);
EnglishLocale = MAKELCID(MAKELANGID(0x09, 0x01), SORT_DEFAULT); //create our english locale and use it everywhere it's needed
- LogToFile("Leaving %s", __FUNCTION__);
return TRUE;
}
extern "C" __declspec(dllexport) PLUGININFOEX* MirandaPluginInfoEx(DWORD mirandaVersion)
{
- LogToFile("Entering %s", __FUNCTION__);
- LogToFile("Leaving %s", __FUNCTION__);
return &pluginInfo;
}
extern "C" int __declspec(dllexport) Load(PLUGINLINK *link)
{
- LogToFile("Entering %s", __FUNCTION__);
pluginLink=link;
mir_getLP(&pluginInfo);
mir_getMMI(&mmi);
mir_getUTFI(&utfi);
- LogToFile("Initialising services ...");
InitServices();
- LogToFile("Hooking events ...");
HookEvents();
hiVIIcon = LoadIcon(hInst,MAKEINTRESOURCE(IDI_MAIN));
@@ -133,7 +125,6 @@ extern "C" int __declspec(dllexport) Load(PLUGINLINK *link) //Menu item
//if (DBGetContactSettingByte(NULL, ModuleName, "MenuItem", TRUE)) {
{
- LogToFile("creating menu item ...");
CLISTMENUITEM mi = { 0 };
mi.cbSize = sizeof(mi);
mi.position = mi.popupPosition = 2000089999;
@@ -147,24 +138,15 @@ extern "C" int __declspec(dllexport) Load(PLUGINLINK *link) // mi.pszName = "Test 1";
// CallService(MS_CLIST_ADDMAINMENUITEM, 0, (LPARAM) &mi);
}
- LogToFile("Check riched32.dll ...");
if (LoadLibraryA("RichEd32.dll") == NULL)
MessageBoxA(NULL, "d'oh", "d'oh", MB_OK);
- LogToFile("Leaving %s", __FUNCTION__);
return 0;
}
extern "C" int __declspec(dllexport) Unload(void)
{
- LogToFile("Entering %s", __FUNCTION__);
-
- LogToFile("Unhooking events ...");
UnhookEvents();
-
- LogToFile("Destroying services ...");
DestroyServices();
-
- LogToFile("Leaving %s", __FUNCTION__);
return 0;
}
\ No newline at end of file diff --git a/plugins/Svc_vi/utils.cpp b/plugins/Svc_vi/utils.cpp index 4e74f9ee13..47fff93119 100644 --- a/plugins/Svc_vi/utils.cpp +++ b/plugins/Svc_vi/utils.cpp @@ -29,22 +29,21 @@ Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. /*
My usual MessageBoxes :-)
*/
-void MB(char* message) {
- if (verbose) MessageBoxA(NULL, message, ModuleName, MB_OK | MB_ICONEXCLAMATION);
+void MB(const TCHAR* message)
+{
+ if (verbose) MessageBox(NULL, message, _T("VersionInfo"), MB_OK | MB_ICONEXCLAMATION);
}
-void Log(char* message) {
- if (ServiceExists(MS_POPUP_ADDPOPUP))
- {
- POPUPDATA pu = {0};
+void Log(const TCHAR* message)
+{
+ if (ServiceExists(MS_POPUP_ADDPOPUPT)) {
+ POPUPDATAT pu = {0};
pu.lchIcon = hiVIIcon;
- strncpy(pu.lptzContactName, Translate("Version Information"), MAX_CONTACTNAME);
- strncpy(pu.lptzText, message, MAX_SECONDLINE);
- PUAddPopUp(&pu);
- }
- else {
- MessageBoxA(NULL, message, ModuleName, MB_OK | MB_ICONINFORMATION);
+ _tcsncpy(pu.lptzContactName, TranslateT("Version Information"), MAX_CONTACTNAME);
+ _tcsncpy(pu.lptzText, message, MAX_SECONDLINE);
+ PUAddPopUpT(&pu);
}
+ else MessageBox(NULL, message, _T("VersionInfo"), MB_OK | MB_ICONINFORMATION);
}
int SplitStringInfo(const TCHAR *szWholeText, TCHAR *szStartText, TCHAR *szEndText)
@@ -110,56 +109,13 @@ TCHAR *AbsolutePathToRelative(TCHAR *szAbsolute, TCHAR *szRelative, size_t size) return szRelative;
}
-void LogToFileInit()
-{
-#ifdef USE_LOG_FUNCTIONS
- DeleteFile("versioninfo.log");
-#endif
-}
-
-void LogToFile(char *format, ...)
-{
-#ifdef USE_LOG_FUNCTIONS
- char str[4096];
- va_list vararg;
- int tBytes;
- FILE *fout = fopen("versioninfo.log", "at");
- if (!fout)
- {
- Log("Can't open file versioninfo.log ...");
- }
- time_t currentTime = time(NULL);
- tm *timp = localtime(¤tTime);
- strftime(str, sizeof(str), "%d %b @ %H:%M:%S -> ", timp);
- fputs(str, fout);
-
- va_start(vararg, format);
-
- tBytes = _vsnprintf(str, sizeof(str), format, vararg);
- if (tBytes > 0)
- {
- str[tBytes] = 0;
- }
-
- va_end(vararg);
- if (str[strlen(str) - 1] != '\n')
- {
- strcat(str, "\n");
- }
-
- fputs(str, fout);
- fclose(fout);
-#endif
-}
-
-
#define GetFacility(dwError) (HIWORD(dwError) && 0x0000111111111111)
#define GetErrorCode(dwError) (LOWORD(dwError))
-void NotifyError(DWORD dwError, char* szSetting, int iLine)
+void NotifyError(DWORD dwError, const TCHAR* szSetting, int iLine)
{
- char str[1024];
- mir_snprintf(str, SIZEOF(str), Translate("Ok, something went wrong in the \"%s\" setting. Report back the following values:\nFacility: %X\nError code: %X\nLine number: %d"), szSetting, GetFacility(dwError), GetErrorCode(dwError), iLine);
+ TCHAR str[1024];
+ mir_sntprintf(str, SIZEOF(str), TranslateT("Ok, something went wrong in the \"%s\" setting. Report back the following values:\nFacility: %X\nError code: %X\nLine number: %d"), szSetting, GetFacility(dwError), GetErrorCode(dwError), iLine);
Log(str);
}
@@ -273,26 +229,24 @@ void GetModuleTimeStamp(TCHAR* pszDate, TCHAR* pszTime) //From Egodust or Cyreve... I don't really know.
PLUGININFOEX *CopyPluginInfo(PLUGININFOEX *piSrc)
{
- PLUGININFOEX *pi;
- if(piSrc==NULL) return NULL;
- pi=(PLUGININFOEX *)malloc(sizeof(PLUGININFOEX));
-
- *pi=*piSrc;
- pi->uuid = UUID_NULL;
+ if(piSrc==NULL)
+ return NULL;
+
+ PLUGININFOEX *pi = (PLUGININFOEX *)malloc(sizeof(PLUGININFOEX));
+ *pi = *piSrc;
if (piSrc->cbSize >= sizeof(PLUGININFOEX))
- {
pi->uuid = piSrc->uuid;
- }
-
- if (piSrc->cbSize >= sizeof(PLUGININFO))
- {
- if(pi->author) pi->author=_strdup(pi->author);
- if(pi->authorEmail) pi->authorEmail=_strdup(pi->authorEmail);
- if(pi->copyright) pi->copyright=_strdup(pi->copyright);
- if(pi->description) pi->description=_strdup(pi->description);
- if(pi->homepage) pi->homepage=_strdup(pi->homepage);
- if(pi->shortName) pi->shortName=_strdup(pi->shortName);
+ else
+ pi->uuid = UUID_NULL;
+
+ if (piSrc->cbSize >= sizeof(PLUGININFO)) {
+ if(pi->author) pi->author = _strdup(pi->author);
+ if(pi->authorEmail) pi->authorEmail = _strdup(pi->authorEmail);
+ if(pi->copyright) pi->copyright = _strdup(pi->copyright);
+ if(pi->description) pi->description = _strdup(pi->description);
+ if(pi->homepage) pi->homepage = _strdup(pi->homepage);
+ if(pi->shortName) pi->shortName = _strdup(pi->shortName);
}
return pi;
@@ -329,7 +283,6 @@ BOOL IsCurrentUserLocalAdministrator(void) PSECURITY_DESCRIPTOR psdAdmin = NULL;
SID_IDENTIFIER_AUTHORITY SystemSidAuthority = SECURITY_NT_AUTHORITY;
-
/*
Determine if the current thread is running as a user that is a member of
the local admins group. To do this, create a security descriptor that
diff --git a/plugins/Svc_vi/utils.h b/plugins/Svc_vi/utils.h index eb28ce6146..5db4b1a811 100644 --- a/plugins/Svc_vi/utils.h +++ b/plugins/Svc_vi/utils.h @@ -4,15 +4,10 @@ #include "common.h"
//utils.cpp
-void MB(char*);
-void Log(char*);
+void MB(const TCHAR*);
+void Log(const TCHAR*);
TCHAR *StrTrim(TCHAR *, const TCHAR *);
-//logging functions
-//utils.cpp
-void LogToFileInit();
-void LogToFile(char *format, ...);
-
//utils.cpp
TCHAR *RelativePathToAbsolute(TCHAR *szRelative, TCHAR *szAbsolute, size_t size);
TCHAR *AbsolutePathToRelative(TCHAR *szAbsolute, TCHAR *szRelative, size_t size);
@@ -30,7 +25,7 @@ bool DoesDllExist(char *dllName); //utils.cpp
void GetModuleTimeStamp(TCHAR*, TCHAR*);
-void NotifyError(DWORD, char*, int);
+void NotifyError(DWORD, const TCHAR*, int);
//utils.cpp
PLUGININFOEX *GetPluginInfo(const char *,HINSTANCE *);
diff --git a/plugins/Svc_vi/version.h b/plugins/Svc_vi/version.h index b5653f869f..13ab339f7c 100644 --- a/plugins/Svc_vi/version.h +++ b/plugins/Svc_vi/version.h @@ -22,9 +22,9 @@ Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. #define M_VERSIONINFO_VERSION_H
#define __MAJOR_VERSION 1
-#define __MINOR_VERSION 4
-#define __RELEASE_NUM 3
-#define __BUILD_NUM 4
+#define __MINOR_VERSION 5
+#define __RELEASE_NUM 0
+#define __BUILD_NUM 1
#define VERSION PLUGIN_MAKE_VERSION(__MAJOR_VERSION, __MINOR_VERSION, __RELEASE_NUM, __BUILD_NUM)
@@ -35,15 +35,19 @@ Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. #define __VERSION_STRING __STRINGIFY(__PLUGINVERSION_STRING_DOTS)
#define __DESC "Collects and prints information related to Miranda, the plugins and the OS."
-#define __AUTHOR "Luca Santarelli, Cristian Libotean"
-#define __AUTHOREMAIL "hrk@users.sourceforge.net, eblis102@yahoo.com"
+#define __AUTHOR "Luca Santarelli, Cristian Libotean, George Hazan"
+#define __AUTHOREMAIL "hrk@users.sourceforge.net, eblis102@yahoo.com, ghazan@miranda.im"
#define __COPYRIGHT "© 2002-2005 Luca Santarelli, © 2005-2009 Cristian Libotean"
#define __AUTHORWEB "http://www.miranda-im.org/"
#if defined(WIN64) || defined(_WIN64)
-#define __PLUGIN_DISPLAY_NAME "Version Information (x64)"
+ #define __PLUGIN_DISPLAY_NAME "Version Information x64 (Unicode)"
#else
-#define __PLUGIN_DISPLAY_NAME "Version Information"
+ #if defined(UNICODE)
+ #define __PLUGIN_DISPLAY_NAME "Version Information (Unicode)"
+ #else
+ #define __PLUGIN_DISPLAY_NAME "Version Information"
+ #endif
#endif
#endif //M_VERSIONINFO_VERSION_H
|