summaryrefslogtreecommitdiff
path: root/plugins/New_GPG
diff options
context:
space:
mode:
authorTobias Weimer <wishmaster51@googlemail.com>2014-07-04 21:02:05 +0000
committerTobias Weimer <wishmaster51@googlemail.com>2014-07-04 21:02:05 +0000
commitf1bbd65bbaa4291c194244424668aa16c357ca0f (patch)
tree2428e11f4554e4c8fd1c1863bcb6e3e769013088 /plugins/New_GPG
parent374a75a4d6f709c30232828f5db64f1e7278b622 (diff)
CommandLine:
-translation fixes -fixed message encoding -fixed timestamps -fixed: "sounds" command without params returned popup NewGPG: -translation fixes git-svn-id: http://svn.miranda-ng.org/main/trunk@9681 1316c22d-e87f-b044-9b9b-93d7a3e3ba9c
Diffstat (limited to 'plugins/New_GPG')
-rwxr-xr-xplugins/New_GPG/src/main.cpp50
-rwxr-xr-xplugins/New_GPG/src/options.cpp24
-rwxr-xr-xplugins/New_GPG/src/utilities.cpp40
3 files changed, 54 insertions, 60 deletions
diff --git a/plugins/New_GPG/src/main.cpp b/plugins/New_GPG/src/main.cpp
index 29783517fa..d8aef76a1e 100755
--- a/plugins/New_GPG/src/main.cpp
+++ b/plugins/New_GPG/src/main.cpp
@@ -14,11 +14,12 @@
// along with this program; if not, write to the Free Software
// Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
-
-
-
#include "commonheaders.h"
+extern HFONT bold_font;
+extern bool bAutoExchange;
+
+void ShowFirstRunDialog();
HWND hwndFirstRun = NULL, hwndSetDirs = NULL, hwndNewKey = NULL, hwndKeyGen = NULL, hwndSelectExistingKey = NULL;
@@ -249,7 +250,7 @@ static INT_PTR CALLBACK DlgProcFirstRun(HWND hwndDlg,UINT msg,WPARAM wParam,LPAR
}
}
{
- SendMessageA(GetDlgItem(hwndDlg, IDC_ACCOUNT), CB_ADDSTRING, 0, (LPARAM)Translate("Default"));
+ SendDlgItemMessageA(hwndDlg, IDC_ACCOUNT, CB_ADDSTRING, 0, (LPARAM)Translate("Default"));
int count = 0;
PROTOACCOUNT **accounts;
ProtoEnumAccounts(&count, &accounts);
@@ -264,9 +265,9 @@ static INT_PTR CALLBACK DlgProcFirstRun(HWND hwndDlg,UINT msg,WPARAM wParam,LPAR
acc += accounts[i]->szModuleName;
acc += ")";
//acc += "_KeyID";
- SendMessageA(GetDlgItem(hwndDlg, IDC_ACCOUNT), CB_ADDSTRING, 0, (LPARAM)acc.c_str());
+ SendDlgItemMessageA(hwndDlg, IDC_ACCOUNT, CB_ADDSTRING, 0, (LPARAM)acc.c_str());
}
- SendMessageA(GetDlgItem(hwndDlg, IDC_ACCOUNT), CB_SELECTSTRING, 0, (LPARAM)Translate("Default"));
+ SendDlgItemMessageA(hwndDlg, IDC_ACCOUNT, CB_SELECTSTRING, 0, (LPARAM)Translate("Default"));
string keyinfo = Translate("key ID");
keyinfo += ": ";
char *keyid = UniGetContactSettingUtf(NULL, szGPGModuleName, "KeyID", "");
@@ -577,7 +578,7 @@ static INT_PTR CALLBACK DlgProcFirstRun(HWND hwndDlg,UINT msg,WPARAM wParam,LPAR
params.result = &result;
extern HFONT bold_font;
SendMessage(GetDlgItem(hwndDlg, IDC_GENERATING_KEY), WM_SETFONT, (WPARAM)bold_font, true);
- SetWindowTextA(GetDlgItem(hwndDlg, IDC_GENERATING_KEY), Translate("Generating new random key, please wait"));
+ SetWindowText(GetDlgItem(hwndDlg, IDC_GENERATING_KEY), TranslateT("Generating new random key, please wait"));
EnableWindow(GetDlgItem(hwndDlg, IDC_GENERATE_KEY), 0);
EnableWindow(GetDlgItem(hwndDlg, IDC_OTHER), 0);
EnableWindow(GetDlgItem(hwndDlg, IDC_DELETE_KEY), 0);
@@ -705,9 +706,9 @@ static INT_PTR CALLBACK DlgProcFirstRun(HWND hwndDlg,UINT msg,WPARAM wParam,LPAR
char *szKey = (char*)GlobalLock(hMem);
if(!szKey)
{
- char msg[64];
- mir_snprintf(msg, 64, "Failed to lock memory with error %d", GetLastError());
- MessageBoxA(0, msg, "Error", MB_OK);
+ TCHAR msg[64];
+ mir_sntprintf(msg, 64, TranslateT("Failed to lock memory with error %d"), GetLastError());
+ MessageBox(0, msg, TranslateT("Error"), MB_OK);
GlobalFree(hMem);
}
memcpy(szKey, out.c_str(), out.size());
@@ -717,9 +718,9 @@ static INT_PTR CALLBACK DlgProcFirstRun(HWND hwndDlg,UINT msg,WPARAM wParam,LPAR
if(!SetClipboardData(CF_OEMTEXT, hMem))
{
GlobalFree(hMem);
- char msg[64];
- mir_snprintf(msg, 64, "Failed write to clipboard with error %d", GetLastError());
- MessageBoxA(0, msg, "Error", MB_OK);
+ TCHAR msg[64];
+ mir_sntprintf(msg, 64, TranslateT("Failed write to clipboard with error %d"), GetLastError());
+ MessageBox(0, msg, TranslateT("Error"), MB_OK);
}
CloseClipboard();
}
@@ -845,8 +846,6 @@ static INT_PTR CALLBACK DlgProcFirstRun(HWND hwndDlg,UINT msg,WPARAM wParam,LPAR
return FALSE;
}
-void ShowFirstRunDialog();
-
static INT_PTR CALLBACK DlgProcGpgBinOpts(HWND hwndDlg, UINT msg, WPARAM wParam, LPARAM lParam)
{
TCHAR *tmp = NULL;
@@ -1298,8 +1297,7 @@ static INT_PTR CALLBACK DlgProcNewKeyDialog(HWND hwndDlg, UINT msg, WPARAM wPara
SetDlgItemText(hwndDlg, ID_IMPORT, tmp[0]?TranslateT("Replace"):TranslateT("Accept"));
mir_free(tmp);
tmp = new TCHAR [256];
- _tcscpy(tmp, TranslateT("Received key from "));
- _tcscat(tmp, (TCHAR*)CallService(MS_CLIST_GETCONTACTDISPLAYNAME, hContact, (LPARAM)GCDNF_TCHAR));
+ mir_sntprintf(tmp, SIZEOF(tmp),TranslateT("Received key from %s"), CallService(MS_CLIST_GETCONTACTDISPLAYNAME, hContact, (LPARAM)GCDNF_TCHAR));
SetDlgItemText(hwndDlg, IDC_KEY_FROM, tmp);
delete [] tmp;
}
@@ -1526,9 +1524,8 @@ static INT_PTR CALLBACK DlgProcKeyGenDialog(HWND hwndDlg, UINT msg, WPARAM wPara
params.out = &out;
params.code = &code;
params.result = &result;
- extern HFONT bold_font;
SendMessage(GetDlgItem(hwndDlg, IDC_GENERATING_TEXT), WM_SETFONT, (WPARAM)bold_font, true);
- SetWindowTextA(GetDlgItem(hwndDlg, IDC_GENERATING_TEXT), Translate("Generating new key, please wait..."));
+ SetWindowText(GetDlgItem(hwndDlg, IDC_GENERATING_TEXT), TranslateT("Generating new key, please wait..."));
EnableWindow(GetDlgItem(hwndDlg, IDCANCEL), 0);
EnableWindow(GetDlgItem(hwndDlg, IDOK), 0);
EnableWindow(GetDlgItem(hwndDlg, IDC_KEY_TYPE), 0);
@@ -2049,13 +2046,13 @@ void InitCheck()
}
if(!home_dir_access || !temp_access || !gpg_valid)
{
- char buf[4096];
- strcpy(buf, gpg_valid?Translate("GPG binary is set and valid (this is good).\n"):Translate("GPG binary unset or invalid (plugin will not work).\n"));
- strcat(buf, home_dir_access?Translate("Home dir write access granted (this is good).\n"):Translate("Home dir has no write access (plugin most probably will not work).\n"));
- strcat(buf, temp_access?Translate("Temp dir write access granted (this is good).\n"):Translate("Temp dir has no write access (plugin should work, but may have some problems, file transfers will not work)."));
+ TCHAR buf[4096];
+ _tcsncpy(buf, gpg_valid?TranslateT("GPG binary is set and valid (this is good).\n"):TranslateT("GPG binary unset or invalid (plugin will not work).\n"), SIZEOF(buf));
+ _tcsncat(buf, home_dir_access?TranslateT("Home dir write access granted (this is good).\n"):TranslateT("Home dir has no write access (plugin most probably will not work).\n"), SIZEOF(buf));
+ _tcsncat(buf, temp_access?TranslateT("Temp dir write access granted (this is good).\n"):TranslateT("Temp dir has no write access (plugin should work, but may have some problems, file transfers will not work)."), SIZEOF(buf));
if(!gpg_valid)
- strcat(buf, Translate("\nGPG will be disabled until you solve these problems"));
- MessageBoxA(0, buf, Translate("GPG plugin problems"), MB_OK);
+ _tcsncat(buf, TranslateT("\nGPG will be disabled until you solve these problems"));
+ MessageBox(0, buf, TranslateT("GPG plugin problems"), MB_OK);
}
if(!gpg_valid)
return;
@@ -2105,7 +2102,6 @@ void InitCheck()
mir_free(keyid);
keyid = UniGetContactSettingUtf(NULL, szGPGModuleName, "KeyID", "");
key = UniGetContactSettingUtf(NULL, szGPGModuleName, "GPGPubKey", "");
- void ShowFirstRunDialog();
if((p = out.find(keyid)) == string::npos)
{
question += keyid;
@@ -2169,7 +2165,6 @@ void InitCheck()
question = Translate("Your secret key with ID: ");
keyid = UniGetContactSettingUtf(NULL, szGPGModuleName, "KeyID", "");
key = UniGetContactSettingUtf(NULL, szGPGModuleName, "GPGPubKey", "");
- void ShowFirstRunDialog();
if(!db_get_b(NULL, szGPGModuleName, "FirstRun", 1) && (!keyid[0] || !key[0]))
{
question = Translate("You didn't set a private key.\nWould you like to set it now?");
@@ -2239,7 +2234,6 @@ void InitCheck()
}
mir_free(path);
}
- extern bool bAutoExchange;
if(bAutoExchange)
{
int count = 0;
diff --git a/plugins/New_GPG/src/options.cpp b/plugins/New_GPG/src/options.cpp
index b7db869e86..a8f5ff9193 100755
--- a/plugins/New_GPG/src/options.cpp
+++ b/plugins/New_GPG/src/options.cpp
@@ -355,9 +355,9 @@ static INT_PTR CALLBACK DlgProcGpgOpts(HWND hwndDlg, UINT msg, WPARAM wParam, LP
szKey = (char*)GlobalLock(hMem);
if(!szKey)
{
- char msg[64];
- mir_snprintf(msg, 64, "Failed to lock memory with error %d", GetLastError());
- MessageBoxA(0, msg, "Error", MB_OK);
+ TCHAR msg[64];
+ mir_sntprintf(msg, 64, TranslateT("Failed to lock memory with error %d"), GetLastError());
+ MessageBox(0, msg, TranslateT("Error"), MB_OK);
GlobalFree(hMem);
}
memcpy(szKey, str.c_str(), str.size());
@@ -368,17 +368,17 @@ static INT_PTR CALLBACK DlgProcGpgOpts(HWND hwndDlg, UINT msg, WPARAM wParam, LP
if(!SetClipboardData(CF_OEMTEXT, hMem))
{
GlobalFree(hMem);
- char msg[64];
- mir_snprintf(msg, 64, "Failed write to clipboard with error %d", GetLastError());
- MessageBoxA(0, msg, "Error", MB_OK);
+ TCHAR msg[64];
+ mir_sntprintf(msg, 64, TranslateT("Failed write to clipboard with error %d"), GetLastError());
+ MessageBox(0, msg, TranslateT("Error"), MB_OK);
}
CloseClipboard();
}
else
{
- char msg[64];
- mir_snprintf(msg, 64, "Failed to open clipboard with error %d", GetLastError());
- MessageBoxA(0, msg, "Error", MB_OK);
+ TCHAR msg[64];
+ mir_sntprintf(msg, 64, TranslateT("Failed to open clipboard with error %d"), GetLastError());
+ MessageBox(0, msg, TranslateT("Error"), MB_OK);
}
}
break;
@@ -734,9 +734,9 @@ static INT_PTR CALLBACK DlgProcLoadPublicKey(HWND hwndDlg,UINT msg,WPARAM wParam
hcnt = metaGetMostOnline(hcnt);
TranslateDialogDefault(hwndDlg);
{
- string msg = Translate("Load Public GPG Key for ");
- msg += (char*)CallService(MS_CLIST_GETCONTACTDISPLAYNAME, (WPARAM)hcnt, 0);
- SetWindowTextA(hwndDlg, msg.c_str());
+ wstring msg = TranslateT("Load Public GPG Key for ");
+ msg += (TCHAR*)CallService(MS_CLIST_GETCONTACTDISPLAYNAME, (WPARAM)hcnt, GCDNF_TCHAR);
+ SetWindowText(hwndDlg, msg.c_str());
}
if(!hcnt)
{
diff --git a/plugins/New_GPG/src/utilities.cpp b/plugins/New_GPG/src/utilities.cpp
index dcbebe2379..e5f67a539b 100755
--- a/plugins/New_GPG/src/utilities.cpp
+++ b/plugins/New_GPG/src/utilities.cpp
@@ -17,6 +17,12 @@
#include "commonheaders.h"
+void ShowExportKeysDlg();
+void ShowLoadPublicKeyDialog();
+
+extern HINSTANCE hInst;
+extern HANDLE hLoadPublicKey;
+extern HGENMENU hToggleEncryption, hSendKey;
TCHAR* __stdcall UniGetContactSettingUtf(MCONTACT hContact, const char *szModule,const char* szSetting, TCHAR* szDef)
{
@@ -135,9 +141,8 @@ void GetFolderPath(TCHAR *WindowTittle, char *szSetting)
}
}
-INT_PTR LoadKey(WPARAM w, LPARAM l)
+INT_PTR LoadKey(WPARAM w, LPARAM)
{
- void ShowLoadPublicKeyDialog();
user_data[1] = (MCONTACT)w;
ShowLoadPublicKeyDialog();
return 0;
@@ -196,9 +201,6 @@ INT_PTR SendKey(WPARAM w, LPARAM l)
return 0;
}
-extern HANDLE hLoadPublicKey;
-extern HGENMENU hToggleEncryption, hSendKey;
-
INT_PTR ToggleEncryption(WPARAM w, LPARAM l)
{
MCONTACT hContact = (MCONTACT)w;
@@ -1244,9 +1246,9 @@ __forceinline int SendBroadcast(MCONTACT hContact, int type, int result, HANDLE
return ProtoBroadcastAck( GetContactProto(hContact), hContact, type, result, hProcess, lParam);
}
-unsigned __stdcall sttFakeAck( LPVOID param )
+unsigned __stdcall sttFakeAck(void *param)
{
- TFakeAckParams* tParam = ( TFakeAckParams* )param;
+ TFakeAckParams *tParam = ( TFakeAckParams* )param;
WaitForSingleObject( tParam->hEvent, INFINITE );
Sleep( 100 );
@@ -1368,7 +1370,7 @@ bool isTabsrmmUsed()
DBCONTACTENUMSETTINGS enm = {0};
bool found = false;
enm.lParam = (LPARAM)&found;
- enm.pfnEnumProc = (DBSETTINGENUMPROC)&handleEnum;
+ enm.pfnEnumProc = handleEnum;
enm.szModule = "PluginDisable";
if(CallService(MS_DB_CONTACT_ENUMSETTINGS, 0, (LPARAM)&enm) == -1)
return false;
@@ -1546,19 +1548,18 @@ void ExportGpGKeysFunc(int type)
}
if(file.is_open())
file.close();
- char msg[512];
+ TCHAR msg[512];
if(type == 2)
- mir_snprintf(msg, 512, "%s %d %s %s %s", Translate("we have successfully exported"), exported_keys, Translate("public keys"), Translate("and"), Translate("all private keys"));
+ mir_sntprintf(msg, 512, TranslateT("We have successfully exported %d public keys and all private keys."), exported_keys);
else if(type == 1)
- mir_snprintf(msg, 512, "%s %s", Translate("we have successfully exported"), Translate("all private keys"));
+ mir_sntprintf(msg, 512, TranslateT("We have successfully exported all private keys."));
else if(!type)
- mir_snprintf(msg, 512, "%s %d %s",Translate("we have successfully exported"), exported_keys, Translate("public keys"));
- MessageBoxA(NULL, msg, Translate("Keys export result"), MB_OK);
+ mir_sntprintf(msg, 512, TranslateT("We have successfully exported %d public keys."), exported_keys);
+ MessageBox(NULL, msg, TranslateT("Keys export result"), MB_OK);
}
-INT_PTR ExportGpGKeys(WPARAM w, LPARAM l)
+INT_PTR ExportGpGKeys(WPARAM, LPARAM)
{
- void ShowExportKeysDlg();
ShowExportKeysDlg();
return 0;
}
@@ -1896,12 +1897,12 @@ INT_PTR ImportGpGKeys(WPARAM w, LPARAM l)
}
if(file.is_open())
file.close();
- char msg[512];
+ TCHAR msg[512];
if(processed_private_keys)
- mir_snprintf(msg, 512, "we have successfully processed %d public keys and some private keys", processed_keys);
+ mir_sntprintf(msg, 512, TranslateT("We have successfully processed %d public keys and some private keys."), processed_keys);
else
- mir_snprintf(msg, 512, "we have successfully processed %d public keys", processed_keys);
- MessageBoxA(NULL, msg, Translate("Keys import result"), MB_OK);
+ mir_sntprintf(msg, 512, TranslateT("We have successfully processed %d public keys."), processed_keys);
+ MessageBox(NULL, msg, TranslateT("Keys import result"), MB_OK);
return 0;
}
@@ -2068,7 +2069,6 @@ static INT_PTR CALLBACK DlgProcExportKeys(HWND hwndDlg, UINT msg, WPARAM wParam,
void ShowExportKeysDlg()
{
- extern HINSTANCE hInst;
DialogBox(hInst, MAKEINTRESOURCE(IDD_EXPORT_TYPE), NULL, DlgProcExportKeys);
}