summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--init.cpp2
-rw-r--r--main.cpp79
-rw-r--r--messages.cpp4
3 files changed, 73 insertions, 12 deletions
diff --git a/init.cpp b/init.cpp
index d0a6dff..38fe926 100644
--- a/init.cpp
+++ b/init.cpp
@@ -192,7 +192,7 @@ static int OnModulesLoaded(WPARAM wParam,LPARAM lParam)
if(bJabberAPI && bIsMiranda09)
HookEvent(ME_PROTO_ACCLISTCHANGED, GetJabberInterface);
- HookEvent(ME_PROTO_ACK, onProtoAck);
+// HookEvent(ME_PROTO_ACK, onProtoAck); //filetransfer unimplemented now
HookEvent(ME_CLIST_PREBUILDCONTACTMENU, OnPreBuildContactMenu);
diff --git a/main.cpp b/main.cpp
index 5becf47..c087b6b 100644
--- a/main.cpp
+++ b/main.cpp
@@ -413,19 +413,59 @@ static BOOL CALLBACK DlgProcGpgBinOpts(HWND hwndDlg, UINT msg, WPARAM wParam, LP
case WM_INITDIALOG:
{
TranslateDialogDefault(hwndDlg);
- DWORD len = MAX_PATH;
TCHAR *path = new TCHAR [MAX_PATH];
- tmp = UniGetContactSettingUtf(NULL, szGPGModuleName, "szGpgBinPath", (SHGetValue(HKEY_CURRENT_USER, _T("Software\\GNU\\GnuPG"), _T("gpgProgram"), 0, path, &len) == ERROR_SUCCESS)?path:_T(""));
+ bool gpg_exists = false, lang_exists = false;
+ {
+ char *mir_path = new char [MAX_PATH];
+ CallService(MS_UTILS_PATHTOABSOLUTE, (WPARAM)"\\", (LPARAM)mir_path);
+ TCHAR *path = mir_a2t(mir_path);
+ mir_free(mir_path);
+ mir_realloc(path, (_tcslen(path)+128)*sizeof(TCHAR));
+ TCHAR *gpg_path = NULL, *gpg_lang_path = NULL;
+ gpg_path = mir_wstrdup(path);
+ mir_realloc(gpg_path, (_tcslen(gpg_path)+_tcslen(_T("\\GnuPG\\gnupg.exe")) + 1)*sizeof(TCHAR));
+ _tcscat(gpg_path, _T("\\GnuPG\\gnupg.exe"));
+ gpg_lang_path = mir_wstrdup(path);
+ mir_realloc(gpg_lang_path, (_tcslen(gpg_path)+_tcslen(_T("\\GnuPG\\gnupg.nls\\en@quot.mo")) + 1)*sizeof(TCHAR));
+ _tcscat(gpg_lang_path, _T("\\GnuPG\\gnupg.nls\\en@quot.mo"));
+ mir_free(path);
+ if(_waccess(gpg_path, 0) != -1)
+ {
+ gpg_exists = true;
+ _tcscpy(path, _T("GnuPG\\gnupg.exe"));
+ }
+ if(_waccess(gpg_lang_path, 0) != -1)
+ lang_exists = true;
+ if(gpg_exists && !lang_exists) //TODO: check gpg version
+ MessageBox(0, _T("gpg binary found in miranda folder, but english locale does not exists.\nit's highly recommended to place \\gnupg.nls\\en@quot.mo in gnupg folder under miranda root.\nwithout this file you may expirense many problem with gpg output on non english systems.\nand plugin may completely do not work.\nyou have beed warned."), _T("Warning"), MB_OK);
+ mir_free(gpg_path);
+ mir_free(gpg_lang_path);
+ }
+ DWORD len = MAX_PATH;
+ if(!gpg_exists)
+ tmp = UniGetContactSettingUtf(NULL, szGPGModuleName, "szGpgBinPath", (SHGetValue(HKEY_CURRENT_USER, _T("Software\\GNU\\GnuPG"), _T("gpgProgram"), 0, path, &len) == ERROR_SUCCESS)?path:_T(""));
+ else
+ tmp = mir_wstrdup(path);
+ if(tmp[0])
+ {
+ if(_waccess(tmp, 0) == -1)
+ {
+ if(errno == ENOENT)
+ {
+ MessageBox(0, _T("gpg binary location found in system, but it does not exists.\nplease choose another location"), _T("Warning"), MB_OK);
+ }
+ }
+ }
delete [] path;
SetDlgItemText(hwndDlg, IDC_BIN_PATH, tmp);
mir_free(tmp);
- path = new TCHAR [MAX_PATH];
- ExpandEnvironmentStrings(_T("%APPDATA%"), path, MAX_PATH);
- wstring path_ = path;
- delete [] path;
- path_ += _T("\\GnuPG");
- tmp = UniGetContactSettingUtf(NULL, szGPGModuleName, "szHomePath", (TCHAR*)path_.c_str());
- SetDlgItemText(hwndDlg, IDC_HOME_DIR, tmp);
+ if(!gpg_exists)
+ {
+ 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);
return TRUE;
}
@@ -475,10 +515,31 @@ static BOOL CALLBACK DlgProcGpgBinOpts(HWND hwndDlg, UINT msg, WPARAM wParam, LP
{
TCHAR tmp[512];
GetDlgItemText(hwndDlg, IDC_BIN_PATH, tmp, 512);
+ if(tmp[0])
+ {
+ if(_waccess(tmp, 0) == -1)
+ {
+ if(errno == ENOENT)
+ {
+ MessageBox(0, _T("gpg binary does not exists.\nplease choose another location"), _T("Warning"), MB_OK);
+ break;
+ }
+ }
+ }
+ else
+ {
+ MessageBox(0, _T("please choose gpg binary location"), _T("Warning"), MB_OK);
+ break;
+ }
DBWriteContactSettingTString(NULL, szGPGModuleName, "szGpgBinPath", tmp);
GetDlgItemText(hwndDlg, IDC_HOME_DIR, tmp, 512);
while(tmp[_tcslen(tmp)-1] == '\\')
tmp[_tcslen(tmp)-1] = '\0';
+ if(!tmp[0])
+ {
+ MessageBox(0, _T("please set keyring's home directory"), _T("Warning"), MB_OK);
+ break;
+ }
DBWriteContactSettingTString(NULL, szGPGModuleName, "szHomePath", tmp);
DestroyWindow(hwndDlg);
ShowFirstRunDialog();
diff --git a/messages.cpp b/messages.cpp
index 394fcc3..99b1687 100644
--- a/messages.cpp
+++ b/messages.cpp
@@ -599,12 +599,12 @@ static BOOL CALLBACK DlgProcKeyPassword(HWND hwndDlg, UINT msg, WPARAM wParam, L
case WM_NOTIFY:
{
- switch (((LPNMHDR)lParam)->code)
+/* switch (((LPNMHDR)lParam)->code)
{
default:
EnableWindow(GetDlgItem(hwndDlg, IDC_DEFAULT_PASSWORD), IsDlgButtonChecked(hwndDlg, IDC_SAVE_PASSWORD)?1:0);
break;
- }
+ }*/
}
break;
case WM_CLOSE: