diff options
author | Alexander Gluzsky <sss123next@list.ru> | 2012-12-24 23:53:35 +0000 |
---|---|---|
committer | Alexander Gluzsky <sss123next@list.ru> | 2012-12-24 23:53:35 +0000 |
commit | 1aef96b4eb0f9af7c525097fa0e68990d083f241 (patch) | |
tree | dc3d20661b75448bb93a550af72b4270b53e040e /plugins/New_GPG | |
parent | 367d9f6f71420e4c7ed5f273e04d280655bb3d7a (diff) |
fixed first run bugs
git-svn-id: http://svn.miranda-ng.org/main/trunk@2832 1316c22d-e87f-b044-9b9b-93d7a3e3ba9c
Diffstat (limited to 'plugins/New_GPG')
-rwxr-xr-x | plugins/New_GPG/src/init.cpp | 5 | ||||
-rwxr-xr-x | plugins/New_GPG/src/main.cpp | 14 | ||||
-rwxr-xr-x | plugins/New_GPG/src/utilities.cpp | 26 |
3 files changed, 24 insertions, 21 deletions
diff --git a/plugins/New_GPG/src/init.cpp b/plugins/New_GPG/src/init.cpp index 66fd9400f5..959eaf9813 100755 --- a/plugins/New_GPG/src/init.cpp +++ b/plugins/New_GPG/src/init.cpp @@ -83,6 +83,7 @@ void init_vars() bAutoExchange = DBGetContactSettingByte(NULL, szGPGModuleName, "bAutoExchange", 0);
password = UniGetContactSettingUtf(NULL, szGPGModuleName, "szKeyPassword", _T(""));
debuglog.init();
+ bIsMiranda09 = (DWORD)CallService(MS_SYSTEM_GETVERSION, 0, 0) >= 0x00090001?true:false;
bJabberAPI = DBGetContactSettingByte(NULL, szGPGModuleName, "bJabberAPI", bIsMiranda09?1:0);
bPresenceSigning = DBGetContactSettingByte(NULL, szGPGModuleName, "bPresenceSigning", 0);
bFileTransfers = DBGetContactSettingByte(NULL, szGPGModuleName, "bFileTransfers", 0);
@@ -122,9 +123,9 @@ static int OnModulesLoaded(WPARAM wParam,LPARAM lParam) void InitCheck();
void FirstRun();
- bIsMiranda09 = (DWORD)CallService(MS_SYSTEM_GETVERSION, 0, 0) >= 0x00090001?true:false;
FirstRun();
- InitCheck();
+ if(!DBGetContactSettingByte(NULL, szGPGModuleName, "FirstRun", 1))
+ InitCheck();
InitIconLib();
if(ServiceExists(MS_MSG_ADDICON))
{
diff --git a/plugins/New_GPG/src/main.cpp b/plugins/New_GPG/src/main.cpp index 8c66eee04a..730cbc262a 100755 --- a/plugins/New_GPG/src/main.cpp +++ b/plugins/New_GPG/src/main.cpp @@ -691,16 +691,16 @@ static INT_PTR CALLBACK DlgProcGpgBinOpts(HWND hwndDlg, UINT msg, WPARAM wParam, case WM_INITDIALOG:
{
TranslateDialogDefault(hwndDlg);
- TCHAR *path = new TCHAR [MAX_PATH];
+ TCHAR *path = (TCHAR*)mir_alloc(sizeof(TCHAR) * MAX_PATH);
bool gpg_exists = false, lang_exists = false;
{
- char *mir_path = new char [MAX_PATH];
+ char *mir_path = (char*)mir_alloc(sizeof(char) * MAX_PATH);
CallService(MS_UTILS_PATHTOABSOLUTE, (WPARAM)"\\", (LPARAM)mir_path);
SetCurrentDirectoryA(mir_path);
tmp = mir_a2t(mir_path);
mir_free(mir_path);
mir_realloc(path, (_tcslen(path)+128)*sizeof(TCHAR));
- TCHAR *gpg_path = new TCHAR [MAX_PATH], *gpg_lang_path = new TCHAR [MAX_PATH];
+ TCHAR *gpg_path = (TCHAR*)mir_alloc(sizeof(TCHAR) * MAX_PATH), *gpg_lang_path = (TCHAR*)mir_alloc(sizeof(TCHAR) * MAX_PATH);
_tcscpy(gpg_path, tmp);
_tcscat(gpg_path, _T("\\GnuPG\\gpg.exe"));
_tcscpy(gpg_lang_path, tmp);
@@ -737,7 +737,7 @@ static INT_PTR CALLBACK DlgProcGpgBinOpts(HWND hwndDlg, UINT msg, WPARAM wParam, }
else
tmp = mir_wstrdup(path);
- delete [] path;
+ mir_free(path);
SetDlgItemText(hwndDlg, IDC_BIN_PATH, tmp);
bool bad_version = false;
if(gpg_exists && lang_exists)
@@ -785,9 +785,9 @@ static INT_PTR CALLBACK DlgProcGpgBinOpts(HWND hwndDlg, UINT msg, WPARAM wParam, wstring path_ = _wgetenv(_T("APPDATA"));
path_ += _T("\\GnuPG");
tmp = UniGetContactSettingUtf(NULL, szGPGModuleName, "szHomePath", (TCHAR*)path_.c_str());
+ SetDlgItemText(hwndDlg, IDC_HOME_DIR, !gpg_exists?tmp:_T("gpg"));
+ mir_free(tmp);
}
- SetDlgItemText(hwndDlg, IDC_HOME_DIR, !gpg_exists?tmp:_T("gpg"));
- mir_free(tmp);
if(gpg_exists && lang_exists && !bad_version)
MessageBox(0, TranslateT("Your GPG version is supported. The language file was found.\nGPG plugin should work fine.\nPress OK to continue."), TranslateT("Info"), MB_OK);
extern bool bIsMiranda09;
@@ -1139,6 +1139,8 @@ static INT_PTR CALLBACK DlgProcGpgBinOpts(HWND hwndDlg, UINT msg, WPARAM wParam, break;
case WM_DESTROY:
hwndSetDirs = NULL;
+ void InitCheck();
+ InitCheck();
break;
}
diff --git a/plugins/New_GPG/src/utilities.cpp b/plugins/New_GPG/src/utilities.cpp index b71a856eb4..bdde73c971 100755 --- a/plugins/New_GPG/src/utilities.cpp +++ b/plugins/New_GPG/src/utilities.cpp @@ -1823,18 +1823,18 @@ INT_PTR ImportGpGKeys(WPARAM w, LPARAM l) }
void fix_line_term(std::string &s)
-{ - for(std::string::size_type s1 = s.find("\r\r", 0); s1 != string::npos; s1 = s.find("\r\r", s1)) - s.erase(s1, 1); -} - -void fix_line_term(std::wstring &s) -{ - for(std::wstring::size_type s1 = s.find(_T("\r\r"), 0); s1 != wstring::npos; s1 = s.find(_T("\r\r"), s1)) - s.erase(s1, 1); -} - -void strip_line_term(std::wstring &s) +{
+ for(std::string::size_type s1 = s.find("\r\r", 0); s1 != string::npos; s1 = s.find("\r\r", s1))
+ s.erase(s1, 1);
+}
+
+void fix_line_term(std::wstring &s)
+{
+ for(std::wstring::size_type s1 = s.find(_T("\r\r"), 0); s1 != wstring::npos; s1 = s.find(_T("\r\r"), s1))
+ s.erase(s1, 1);
+}
+
+void strip_line_term(std::wstring &s)
{
for(std::wstring::size_type i = s.find(_T("\r")); i != std::wstring::npos; i = s.find(_T("\r"), i+1))
s.erase(i, 1);
@@ -1842,7 +1842,7 @@ void strip_line_term(std::wstring &s) s.erase(i, 1);
}
-void strip_line_term(std::string &s) +void strip_line_term(std::string &s)
{
for(std::string::size_type i = s.find("\r"); i != std::string::npos; i = s.find("\r", i+1))
s.erase(i, 1);
|