summaryrefslogtreecommitdiff
path: root/plugins/New_GPG/src
diff options
context:
space:
mode:
authorGeorge Hazan <george.hazan@gmail.com>2015-07-31 18:54:53 +0000
committerGeorge Hazan <george.hazan@gmail.com>2015-07-31 18:54:53 +0000
commit2ba65d614cd595945f310b6821ba426d35c18348 (patch)
tree3127d19197a62902b5422530b8ff72b0fc551187 /plugins/New_GPG/src
parent2614e3d766e7d69407cf6f9f4ece54d8a8fbe13f (diff)
unified project for New_GPG
git-svn-id: http://svn.miranda-ng.org/main/trunk@14770 1316c22d-e87f-b044-9b9b-93d7a3e3ba9c
Diffstat (limited to 'plugins/New_GPG/src')
-rw-r--r--plugins/New_GPG/src/clist.cpp2
-rwxr-xr-xplugins/New_GPG/src/gpg_wrapper.cpp9
-rw-r--r--plugins/New_GPG/src/gpg_wrapper.h1
-rw-r--r--plugins/New_GPG/src/icons.cpp2
-rw-r--r--plugins/New_GPG/src/init.cpp8
-rw-r--r--plugins/New_GPG/src/jabber_account.cpp2
-rw-r--r--plugins/New_GPG/src/log.cpp2
-rwxr-xr-xplugins/New_GPG/src/main.cpp23
-rwxr-xr-xplugins/New_GPG/src/messages.cpp20
-rw-r--r--plugins/New_GPG/src/metacontacts.cpp2
-rwxr-xr-xplugins/New_GPG/src/options.cpp5
-rw-r--r--plugins/New_GPG/src/srmm.cpp8
-rw-r--r--plugins/New_GPG/src/stdafx.cxx (renamed from plugins/New_GPG/src/stdafx.cpp)2
-rw-r--r--plugins/New_GPG/src/stdafx.h (renamed from plugins/New_GPG/src/commonheaders.h)3
-rwxr-xr-xplugins/New_GPG/src/utilities.cpp398
15 files changed, 205 insertions, 282 deletions
diff --git a/plugins/New_GPG/src/clist.cpp b/plugins/New_GPG/src/clist.cpp
index 7057db9813..0c27067479 100644
--- a/plugins/New_GPG/src/clist.cpp
+++ b/plugins/New_GPG/src/clist.cpp
@@ -14,7 +14,7 @@
// 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"
+#include "stdafx.h"
void RefreshContactListIcons(void);
diff --git a/plugins/New_GPG/src/gpg_wrapper.cpp b/plugins/New_GPG/src/gpg_wrapper.cpp
index 2c9c57fc92..626be8d6f8 100755
--- a/plugins/New_GPG/src/gpg_wrapper.cpp
+++ b/plugins/New_GPG/src/gpg_wrapper.cpp
@@ -14,7 +14,7 @@
// 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"
+#include "stdafx.h"
//thx gpg module from Harald Treder, Zakhar V. Bardymov
@@ -168,9 +168,7 @@ bool gpg_launcher(gpg_execution_params &params, boost::posix_time::time_duration
return ret;
}
-
-
-pxResult pxExecute_passwd_change(std::vector<std::wstring> &aargv, string *aoutput, LPDWORD aexitcode, pxResult *result, boost::process::child *_child, string &old_pass, string &new_pass)
+pxResult pxExecute_passwd_change(std::vector<std::wstring> &aargv, pxResult *result, boost::process::child *_child)
{
if(!gpg_valid)
return pxNotConfigured;
@@ -192,7 +190,6 @@ pxResult pxExecute_passwd_change(std::vector<std::wstring> &aargv, string *aoutp
using namespace boost::process::initializers;
using namespace boost::iostreams;
-
std::vector<std::wstring> argv;
std::vector<std::wstring> env;
env.push_back(L"LANGUAGE=en@quot");
@@ -339,5 +336,5 @@ pxResult pxExecute_passwd_change(std::vector<std::wstring> &aargv, string *aoutp
void pxEexcute_passwd_change_thread(void *param)
{
gpg_execution_params_pass *params = (gpg_execution_params_pass*)param;
- pxResult result = pxExecute_passwd_change(params->args, params->out, params->code, params->result, params->child, params->old_pass, params->new_pass);
+ pxExecute_passwd_change(params->args, params->result, params->child);
}
diff --git a/plugins/New_GPG/src/gpg_wrapper.h b/plugins/New_GPG/src/gpg_wrapper.h
index 9ff09578b5..a867553462 100644
--- a/plugins/New_GPG/src/gpg_wrapper.h
+++ b/plugins/New_GPG/src/gpg_wrapper.h
@@ -33,7 +33,6 @@ typedef enum {
pxResult;
pxResult pxExecute(std::vector<std::string> &aargv, string *aoutput, LPDWORD aexitcode, pxResult *result);
-pxResult pxExecute_passwd_change(std::vector<std::string> &aargv, string *aoutput, LPDWORD aexitcode, pxResult *result, string &old_pass, string &new_pass);
struct gpg_execution_params
{
diff --git a/plugins/New_GPG/src/icons.cpp b/plugins/New_GPG/src/icons.cpp
index 6d89633710..4cb37750c5 100644
--- a/plugins/New_GPG/src/icons.cpp
+++ b/plugins/New_GPG/src/icons.cpp
@@ -14,7 +14,7 @@
// 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"
+#include "stdafx.h"
extern HINSTANCE hInst;
diff --git a/plugins/New_GPG/src/init.cpp b/plugins/New_GPG/src/init.cpp
index ad6ad927c4..2e30326e0f 100644
--- a/plugins/New_GPG/src/init.cpp
+++ b/plugins/New_GPG/src/init.cpp
@@ -14,7 +14,7 @@
// 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"
+#include "stdafx.h"
//global variables
bool bAppendTags = false, bDebugLog = false, bJabberAPI = false, bPresenceSigning = false, bIsMiranda09 = false, bFileTransfers = false, bSameAction = false, bAutoExchange = false, bStripTags = false, tabsrmm_used = false;
@@ -48,14 +48,14 @@ PLUGININFOEX pluginInfo={
{ 0x4227c050, 0x8d97, 0x48d2, { 0x91, 0xec, 0x6a, 0x95, 0x2b, 0x3d, 0xab, 0x94 } }
};
-BOOL WINAPI DllMain(HINSTANCE hinstDLL, DWORD fdwReason, LPVOID lpvReserved)
+BOOL WINAPI DllMain(HINSTANCE hinstDLL, DWORD, LPVOID)
{
hInst = hinstDLL;
return TRUE;
}
-extern "C" __declspec(dllexport) PLUGININFOEX* MirandaPluginInfoEx(DWORD mirandaVersion)
+extern "C" __declspec(dllexport) PLUGININFOEX* MirandaPluginInfoEx(DWORD)
{
return &pluginInfo;
}
@@ -105,7 +105,7 @@ void init_vars()
bold_font = CreateFont(14, 0, 0, 0, 600, 0, 0, 0, DEFAULT_CHARSET, 0, 0, 0, 0, _T("Arial"));
}
-static int OnModulesLoaded(WPARAM wParam,LPARAM lParam)
+static int OnModulesLoaded(WPARAM, LPARAM)
{
int GpgOptInit(WPARAM wParam,LPARAM lParam);
int OnPreBuildContactMenu(WPARAM w, LPARAM l);
diff --git a/plugins/New_GPG/src/jabber_account.cpp b/plugins/New_GPG/src/jabber_account.cpp
index 6a264a490d..879e6c7a48 100644
--- a/plugins/New_GPG/src/jabber_account.cpp
+++ b/plugins/New_GPG/src/jabber_account.cpp
@@ -14,7 +14,7 @@
// 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"
+#include "stdafx.h"
void JabberAccount::setAccountName(TCHAR *Name)
{
diff --git a/plugins/New_GPG/src/log.cpp b/plugins/New_GPG/src/log.cpp
index 29f80a1d5e..e9daf7d1df 100644
--- a/plugins/New_GPG/src/log.cpp
+++ b/plugins/New_GPG/src/log.cpp
@@ -14,7 +14,7 @@
// 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"
+#include "stdafx.h"
logtofile& logtofile::operator<<(TCHAR *buf)
diff --git a/plugins/New_GPG/src/main.cpp b/plugins/New_GPG/src/main.cpp
index 261b622407..9aab074d5a 100755
--- a/plugins/New_GPG/src/main.cpp
+++ b/plugins/New_GPG/src/main.cpp
@@ -14,7 +14,9 @@
// 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"
+#include "stdafx.h"
+
+#pragma comment(lib, "shlwapi.lib")
extern HFONT bold_font;
extern bool bAutoExchange;
@@ -317,7 +319,7 @@ static INT_PTR CALLBACK DlgProcFirstRun(HWND hwndDlg,UINT msg,WPARAM wParam,LPAR
}
if(result == pxNotFound)
break;
- string::size_type s = 0;
+
boost::algorithm::erase_all(out, "\r");
{
char buf[64];
@@ -768,12 +770,10 @@ static INT_PTR CALLBACK DlgProcFirstRun(HWND hwndDlg,UINT msg,WPARAM wParam,LPAR
break;
case IDC_CHANGE_PASSWD:
ListView_GetItemText(hwndList, itemnum, 0, key_id_global, _countof(key_id_global));
-// extern void ShowChangePasswdDlg();
-// ShowChangePasswdDlg();
+
//temporary code follows
std::vector<std::wstring> cmd;
std::string old_pass, new_pass;
- TCHAR tmp2[MAX_PATH] = {0};
string output;
DWORD exitcode;
cmd.push_back(L"--edit-key");
@@ -845,7 +845,7 @@ static INT_PTR CALLBACK DlgProcFirstRun(HWND hwndDlg,UINT msg,WPARAM wParam,LPAR
return FALSE;
}
-static INT_PTR CALLBACK DlgProcGpgBinOpts(HWND hwndDlg, UINT msg, WPARAM wParam, LPARAM lParam)
+static INT_PTR CALLBACK DlgProcGpgBinOpts(HWND hwndDlg, UINT msg, WPARAM wParam, LPARAM)
{
TCHAR *tmp = NULL;
switch (msg)
@@ -1279,11 +1279,11 @@ static INT_PTR CALLBACK DlgProcGpgBinOpts(HWND hwndDlg, UINT msg, WPARAM wParam,
return FALSE;
}
-static INT_PTR CALLBACK DlgProcNewKeyDialog(HWND hwndDlg, UINT msg, WPARAM wParam, LPARAM lParam)
+static INT_PTR CALLBACK DlgProcNewKeyDialog(HWND hwndDlg, UINT msg, WPARAM wParam, LPARAM)
{
static MCONTACT hContact = INVALID_CONTACT_ID;
void ImportKey();
- TCHAR *tmp = NULL;
+
switch (msg)
{
case WM_INITDIALOG:
@@ -1342,7 +1342,7 @@ static INT_PTR CALLBACK DlgProcNewKeyDialog(HWND hwndDlg, UINT msg, WPARAM wPara
return FALSE;
}
-static INT_PTR CALLBACK DlgProcKeyGenDialog(HWND hwndDlg, UINT msg, WPARAM wParam, LPARAM lParam)
+static INT_PTR CALLBACK DlgProcKeyGenDialog(HWND hwndDlg, UINT msg, WPARAM wParam, LPARAM)
{
switch (msg)
{
@@ -1895,7 +1895,7 @@ static INT_PTR CALLBACK DlgProcLoadExistingKey(HWND hwndDlg,UINT msg,WPARAM wPar
return FALSE;
}
-static INT_PTR CALLBACK DlgProcImportKeyDialog(HWND hwndDlg, UINT msg, WPARAM wParam, LPARAM lParam)
+static INT_PTR CALLBACK DlgProcImportKeyDialog(HWND hwndDlg, UINT msg, WPARAM wParam, LPARAM)
{
MCONTACT hContact = INVALID_CONTACT_ID;
@@ -2006,7 +2006,6 @@ void ShowImportKeyDialog()
void FirstRun()
{
- DWORD pid = 0;
if(!db_get_b(NULL, szGPGModuleName, "FirstRun", 1))
return;
ShowSetDirsDialog();
@@ -2065,7 +2064,7 @@ void InitCheck()
string out;
DWORD code;
pxResult result;
- wstring::size_type p = 0, p2 = 0, stop = 0;
+ wstring::size_type p = 0, p2 = 0;
{
std::vector<wstring> cmd;
cmd.push_back(L"--batch");
diff --git a/plugins/New_GPG/src/messages.cpp b/plugins/New_GPG/src/messages.cpp
index 036cb60fd1..3890e57e45 100755
--- a/plugins/New_GPG/src/messages.cpp
+++ b/plugins/New_GPG/src/messages.cpp
@@ -14,7 +14,7 @@
// 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"
+#include "stdafx.h"
wstring new_key;
MCONTACT new_key_hcnt = NULL;
@@ -24,7 +24,7 @@ int returnNoError(MCONTACT hContact);
std::list<HANDLE> sent_msgs;
-void RecvMsgSvc_func(MCONTACT hContact, std::wstring str, char *msg, DWORD flags, DWORD timestamp)
+void RecvMsgSvc_func(MCONTACT hContact, std::wstring str, char *msg, DWORD, DWORD timestamp)
{
DWORD dbflags = DBEF_UTF;
{ //check for gpg related data
@@ -578,14 +578,13 @@ INT_PTR RecvMsgSvc(WPARAM w, LPARAM l)
}
if(!strstr(msg, "-----BEGIN PGP MESSAGE-----"))
return Proto_ChainRecv(w, ccs);
- boost::thread *thr = new boost::thread(boost::bind(RecvMsgSvc_func, ccs->hContact, str, msg, (DWORD)ccs->wParam, pre->timestamp));
+
+ new boost::thread(boost::bind(RecvMsgSvc_func, ccs->hContact, str, msg, (DWORD)ccs->wParam, pre->timestamp));
return 0;
}
void SendMsgSvc_func(MCONTACT hContact, char *msg, DWORD flags)
{
- bool isansi = false;
- DWORD dbflags = DBEF_UTF;
wstring str = toUTF16(msg);
if(bStripTags && bAppendTags)
{
@@ -840,8 +839,7 @@ int HookSendMsg(WPARAM w, LPARAM l)
debuglog<<std::string(time_str()+": info(autoexchange, icq): sending key requiest, name: "+toUTF8(pcli->pfnGetContactDisplayName(hContact, 0)));
CallContactService(hContact, PSS_MESSAGE, 0, (LPARAM)"-----PGP KEY REQUEST-----");
hcontact_data[hContact].msgs_to_send.push_back((char*)dbei->pBlob);
- boost::thread *thr = new boost::thread(boost::bind(send_encrypted_msgs_thread, (void*)hContact));
- //TODO: wait for message
+ new boost::thread(boost::bind(send_encrypted_msgs_thread, (void*)hContact));
return 0;
}
}
@@ -875,9 +873,7 @@ int HookSendMsg(WPARAM w, LPARAM l)
debuglog<<std::string(time_str()+": info(autoexchange, jabber): autoexchange capability found, sending key request, name: "+toUTF8(pcli->pfnGetContactDisplayName(hContact, 0)));
CallContactService(hContact, PSS_MESSAGE, 0, (LPARAM)"-----PGP KEY REQUEST-----");
hcontact_data[hContact].msgs_to_send.push_back((char*)dbei->pBlob);
- boost::thread *thr = new boost::thread(boost::bind(send_encrypted_msgs_thread, (void*)hContact));
- //mir_free((char*)dbei->pBlob);
- //TODO: wait for message
+ new boost::thread(boost::bind(send_encrypted_msgs_thread, (void*)hContact));
return 0;
}
}
@@ -928,8 +924,7 @@ int HookSendMsg(WPARAM w, LPARAM l)
return 0;
}
-
-static INT_PTR CALLBACK DlgProcKeyPassword(HWND hwndDlg, UINT msg, WPARAM wParam, LPARAM lParam)
+static INT_PTR CALLBACK DlgProcKeyPassword(HWND hwndDlg, UINT msg, WPARAM wParam, LPARAM)
{
char *inkeyid = NULL;
switch (msg)
@@ -938,7 +933,6 @@ static INT_PTR CALLBACK DlgProcKeyPassword(HWND hwndDlg, UINT msg, WPARAM wParam
{
inkeyid = UniGetContactSettingUtf(new_key_hcnt, szGPGModuleName, "InKeyID", "");
new_key_hcnt_mutex.unlock();
- TCHAR *tmp = NULL;
SetWindowPos(hwndDlg, 0, key_password_rect.left, key_password_rect.top, 0, 0, SWP_NOSIZE|SWP_SHOWWINDOW);
TranslateDialogDefault(hwndDlg);
diff --git a/plugins/New_GPG/src/metacontacts.cpp b/plugins/New_GPG/src/metacontacts.cpp
index 5a7fa5a031..5de14098b4 100644
--- a/plugins/New_GPG/src/metacontacts.cpp
+++ b/plugins/New_GPG/src/metacontacts.cpp
@@ -14,7 +14,7 @@
// 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"
+#include "stdafx.h"
bool metaIsDefaultSubContact(MCONTACT hContact)
{
diff --git a/plugins/New_GPG/src/options.cpp b/plugins/New_GPG/src/options.cpp
index bed5aaa640..79c5d5773b 100755
--- a/plugins/New_GPG/src/options.cpp
+++ b/plugins/New_GPG/src/options.cpp
@@ -14,7 +14,7 @@
// 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"
+#include "stdafx.h"
extern HINSTANCE hInst;
@@ -37,7 +37,7 @@ BOOL CheckStateStoreDB(HWND hwndDlg, int idCtrl, const char* szSetting)
return state;
}
-int GpgOptInit(WPARAM wParam,LPARAM lParam)
+int GpgOptInit(WPARAM wParam, LPARAM)
{
OPTIONSDIALOGPAGE odp = { 0 };
odp.hInstance = hInst;
@@ -195,7 +195,6 @@ static INT_PTR CALLBACK DlgProcGpgOpts(HWND hwndDlg, UINT msg, WPARAM wParam, LP
void setClistIcon(MCONTACT hContact);
void setSrmmIcon(MCONTACT hContact);
{ //gpg execute block
- TCHAR tmp2[MAX_PATH] = {0};
TCHAR *ptmp;
char *tmp;
bool keep = false;
diff --git a/plugins/New_GPG/src/srmm.cpp b/plugins/New_GPG/src/srmm.cpp
index f1b646ff06..5dd57c2b11 100644
--- a/plugins/New_GPG/src/srmm.cpp
+++ b/plugins/New_GPG/src/srmm.cpp
@@ -16,18 +16,16 @@
-#include "commonheaders.h"
+#include "stdafx.h"
void ShowStatusIcon(MCONTACT hContact);
void setSrmmIcon(MCONTACT hContact);
-int __cdecl onWindowEvent(WPARAM wParam, LPARAM lParam) {
-
+int __cdecl onWindowEvent(WPARAM, LPARAM lParam)
+{
MessageWindowEventData *mwd = (MessageWindowEventData *)lParam;
if(mwd->uType == MSG_WINDOW_EVT_OPEN || mwd->uType == MSG_WINDOW_EVT_OPENING)
- {
setSrmmIcon(mwd->hContact);
- }
return 0;
}
diff --git a/plugins/New_GPG/src/stdafx.cpp b/plugins/New_GPG/src/stdafx.cxx
index 048b14e9d2..0c766ea07f 100644
--- a/plugins/New_GPG/src/stdafx.cpp
+++ b/plugins/New_GPG/src/stdafx.cxx
@@ -15,4 +15,4 @@ You should have received a copy of the GNU General Public License
along with this program. If not, see <http://www.gnu.org/licenses/>.
*/
-#include "commonheaders.h" \ No newline at end of file
+#include "stdafx.h"
diff --git a/plugins/New_GPG/src/commonheaders.h b/plugins/New_GPG/src/stdafx.h
index 120f288341..eb5e6ba6a3 100644
--- a/plugins/New_GPG/src/commonheaders.h
+++ b/plugins/New_GPG/src/stdafx.h
@@ -17,7 +17,8 @@
#ifndef COMMONHEADERS_H
#define COMMONHEADERS_H
-#define _CRT_SECURE_NO_WARNINGS
+#pragma warning(disable:4512 4267 4127)
+
#define _SCL_SECURE_NO_WARNINGS
//windows
diff --git a/plugins/New_GPG/src/utilities.cpp b/plugins/New_GPG/src/utilities.cpp
index a3fceecef4..891a8b16cc 100755
--- a/plugins/New_GPG/src/utilities.cpp
+++ b/plugins/New_GPG/src/utilities.cpp
@@ -15,7 +15,7 @@
// Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
-#include "commonheaders.h"
+#include "stdafx.h"
void ShowExportKeysDlg();
void ShowLoadPublicKeyDialog();
@@ -119,7 +119,7 @@ TCHAR *GetFilePath(TCHAR *WindowTittle, TCHAR *szExt, TCHAR *szExtDesc, bool sav
return str;
}
-void GetFolderPath(TCHAR *WindowTittle, char *szSetting)
+void GetFolderPath(TCHAR *WindowTittle, char*)
{
BROWSEINFO pbi = {0};
pbi.lpszTitle = WindowTittle;
@@ -148,7 +148,7 @@ INT_PTR LoadKey(WPARAM w, LPARAM)
return 0;
}
-INT_PTR SendKey(WPARAM w, LPARAM l)
+INT_PTR SendKey(WPARAM w, LPARAM)
{
MCONTACT hContact = db_mc_tryMeta(w);
char *szMessage;
@@ -199,7 +199,7 @@ INT_PTR SendKey(WPARAM w, LPARAM l)
return 0;
}
-INT_PTR ToggleEncryption(WPARAM w, LPARAM l)
+INT_PTR ToggleEncryption(WPARAM w, LPARAM)
{
MCONTACT hContact = (MCONTACT)w;
BYTE enc;
@@ -231,7 +231,7 @@ INT_PTR ToggleEncryption(WPARAM w, LPARAM l)
return 0;
}
-int OnPreBuildContactMenu(WPARAM w, LPARAM l)
+int OnPreBuildContactMenu(WPARAM w, LPARAM)
{
MCONTACT hContact = db_mc_tryMeta(w);
{
@@ -280,11 +280,9 @@ list<wstring> transfers;
DWORD file_msg_state = -1;
-int onProtoAck(WPARAM w, LPARAM l)
+int onProtoAck(WPARAM, LPARAM l)
{
ACKDATA *ack=(ACKDATA*)l;
- CCSDATA *ccs=(CCSDATA*)ack->lParam;
-
if(ack->type == ACKTYPE_FILE)
{
switch(ack->result)
@@ -586,13 +584,10 @@ INT_PTR onSendFile(WPARAM w, LPARAM l)
return Proto_ChainSend(w, ccs);
}
HistoryLog(ccs->hContact, db_event(Translate("encrypting file for transfer"), 0, 0, DBEF_SENT));
- DWORD flags = (DWORD)ccs->wParam; //check for PFTS_UNICODE here
- int i;
-// if(flags & PFTS_UNICODE) //this does not work ....
if(StriStr(ccs->szProtoService, "/sendfilew"))
{
TCHAR **file=(TCHAR **)ccs->lParam;
- for(i = 0; file[i]; i++)
+ for(int i = 0; file[i]; i++)
{
if(!boost::filesystem::exists(file[i]))
return 0; //we do not want to send file unencrypted (sometimes ack have wrong info)
@@ -607,7 +602,7 @@ INT_PTR onSendFile(WPARAM w, LPARAM l)
else
{
char **file = (char**) ccs->lParam;
- for(i = 0; file[i]; i++)
+ for(int i = 0; file[i]; i++)
{
if(!boost::filesystem::exists(file[i]))
return 0; //we do not want to send file unencrypted (sometimes ack have wrong info)
@@ -659,7 +654,7 @@ int ComboBoxAddStringUtf(HWND hCombo, const TCHAR *szString, DWORD data)
}
-int GetJabberInterface(WPARAM w, LPARAM l) //get interface for all jabber accounts, options later
+int GetJabberInterface(WPARAM, LPARAM) //get interface for all jabber accounts, options later
{
extern list <JabberAccount*> Accounts;
void AddHandlers();
@@ -699,7 +694,7 @@ int GetJabberInterface(WPARAM w, LPARAM l) //get interface for all jabber accoun
return 0;
}
-static JABBER_HANDLER_FUNC SendHandler(IJabberInterface *ji, HXML node, void *pUserData)
+static JABBER_HANDLER_FUNC SendHandler(IJabberInterface *ji, HXML node, void*)
{
HXML local_node = node;
for(int n = 0; n <= xmlGetChildCount(node); n++)
@@ -903,12 +898,11 @@ static JABBER_HANDLER_FUNC SendHandler(IJabberInterface *ji, HXML node, void *pU
//boost::mutex sign_file_mutex;
-static JABBER_HANDLER_FUNC PrescenseHandler(IJabberInterface *ji, HXML node, void *pUserData)
+static JABBER_HANDLER_FUNC PrescenseHandler(IJabberInterface*, HXML node, void*)
{
HXML local_node = node;
for(int n = 0; n <= xmlGetChildCount(node); n++)
{
- LPCTSTR str = xmlGetText(local_node);
LPCTSTR nodename = xmlGetName(local_node);
if(nodename)
{
@@ -1024,7 +1018,7 @@ static JABBER_HANDLER_FUNC PrescenseHandler(IJabberInterface *ji, HXML node, voi
return FALSE;
}
-static JABBER_HANDLER_FUNC MessageHandler(IJabberInterface *ji, HXML node, void *pUserData)
+static JABBER_HANDLER_FUNC MessageHandler(IJabberInterface*, HXML, void*)
{
return FALSE;
}
@@ -1146,7 +1140,7 @@ bool isGPGValid()
tmp = mir_tstrdup(path);
mir_free(path);
}
- DWORD len = MAX_PATH;
+
if(gpg_exists)
{
db_set_ts(NULL, szGPGModuleName, "szGpgBinPath", tmp);
@@ -1551,7 +1545,7 @@ INT_PTR ExportGpGKeys(WPARAM, LPARAM)
return 0;
}
-INT_PTR ImportGpGKeys(WPARAM w, LPARAM l)
+INT_PTR ImportGpGKeys(WPARAM, LPARAM)
{
TCHAR *p = GetFilePath(_T("Choose file to import keys from"), _T("*"), _T("Any file"));
if(!p || !p[0])
@@ -1742,7 +1736,6 @@ INT_PTR ImportGpGKeys(WPARAM w, LPARAM l)
string output;
DWORD exitcode;
{
- MCONTACT hcnt = hContact;
ptmp = UniGetContactSettingUtf(NULL, szGPGModuleName, "szHomePath", _T(""));
path = ptmp;
mir_free(ptmp);
@@ -1933,66 +1926,45 @@ void strip_tags(std::wstring &str)
boost::algorithm::erase_all(str, outclosetag);
}
-
-static INT_PTR CALLBACK DlgProcEncryptedFileMsgBox(HWND hwndDlg, UINT msg, WPARAM wParam, LPARAM lParam)
+static INT_PTR CALLBACK DlgProcEncryptedFileMsgBox(HWND hwndDlg, UINT msg, WPARAM wParam, LPARAM)
{
- char *inkeyid = NULL;
- switch (msg)
- {
- case WM_INITDIALOG:
- {
+ switch (msg) {
+ case WM_INITDIALOG:
TranslateDialogDefault(hwndDlg);
file_msg_state = -1;
- return TRUE;
- }
-
-
- case WM_COMMAND:
- {
- switch (LOWORD(wParam))
- {
- case IDC_IGNORE:
- if(IsDlgButtonChecked(hwndDlg, IDC_REMEMBER))
- {
- db_set_b(NULL, szGPGModuleName, "bSameAction", 1);
- bSameAction = true;
- }
- DestroyWindow(hwndDlg);
- break;
-
- case IDC_DECRYPT:
- file_msg_state = 1;
- if(IsDlgButtonChecked(hwndDlg, IDC_REMEMBER))
- {
- db_set_b(NULL, szGPGModuleName, "bFileTransfers", 1);
- bFileTransfers = true;
- db_set_b(NULL, szGPGModuleName, "bSameAction", 0);
- bSameAction = false;
- }
-
- DestroyWindow(hwndDlg);
- break;
-
- default:
+ return TRUE;
+
+ case WM_COMMAND:
+ switch (LOWORD(wParam)) {
+ case IDC_IGNORE:
+ if(IsDlgButtonChecked(hwndDlg, IDC_REMEMBER))
+ {
+ db_set_b(NULL, szGPGModuleName, "bSameAction", 1);
+ bSameAction = true;
+ }
+ DestroyWindow(hwndDlg);
+ break;
+
+ case IDC_DECRYPT:
+ file_msg_state = 1;
+ if(IsDlgButtonChecked(hwndDlg, IDC_REMEMBER))
+ {
+ db_set_b(NULL, szGPGModuleName, "bFileTransfers", 1);
+ bFileTransfers = true;
+ db_set_b(NULL, szGPGModuleName, "bSameAction", 0);
+ bSameAction = false;
+ }
+
+ DestroyWindow(hwndDlg);
+ break;
+ }
+ break;
+
+ case WM_CLOSE:
+ DestroyWindow(hwndDlg);
break;
- }
-
- break;
- }
-
- case WM_NOTIFY:
- {
}
- break;
- case WM_CLOSE:
- DestroyWindow(hwndDlg);
- break;
- case WM_DESTROY:
- {
- }
- break;
- }
- return FALSE;
+ return FALSE;
}
@@ -2002,56 +1974,37 @@ void ShowEncryptedFileMsgBox()
DialogBox(hInst, MAKEINTRESOURCE(IDD_ENCRYPTED_FILE_MSG_BOX), NULL, DlgProcEncryptedFileMsgBox);
}
-
-static INT_PTR CALLBACK DlgProcExportKeys(HWND hwndDlg, UINT msg, WPARAM wParam, LPARAM lParam)
+static INT_PTR CALLBACK DlgProcExportKeys(HWND hwndDlg, UINT msg, WPARAM wParam, LPARAM)
{
- switch (msg)
- {
- case WM_INITDIALOG:
- {
+ switch (msg) {
+ case WM_INITDIALOG:
TranslateDialogDefault(hwndDlg);
- return TRUE;
- }
-
-
- case WM_COMMAND:
- {
- switch (LOWORD(wParam))
- {
- case IDC_OK:
- if(IsDlgButtonChecked(hwndDlg, IDC_PUBLIC))
- ExportGpGKeysFunc(0);
- else if(IsDlgButtonChecked(hwndDlg, IDC_PRIVATE))
- ExportGpGKeysFunc(1);
- else if(IsDlgButtonChecked(hwndDlg, IDC_ALL))
- ExportGpGKeysFunc(2);
- DestroyWindow(hwndDlg);
- break;
-
- case IDC_CANCEL:
- DestroyWindow(hwndDlg);
- break;
-
- default:
+ return TRUE;
+
+ case WM_COMMAND:
+ switch (LOWORD(wParam)) {
+ case IDC_OK:
+ if(IsDlgButtonChecked(hwndDlg, IDC_PUBLIC))
+ ExportGpGKeysFunc(0);
+ else if(IsDlgButtonChecked(hwndDlg, IDC_PRIVATE))
+ ExportGpGKeysFunc(1);
+ else if(IsDlgButtonChecked(hwndDlg, IDC_ALL))
+ ExportGpGKeysFunc(2);
+ DestroyWindow(hwndDlg);
+ break;
+
+ case IDC_CANCEL:
+ DestroyWindow(hwndDlg);
+ break;
+ }
+
+ break;
+
+ case WM_CLOSE:
+ DestroyWindow(hwndDlg);
break;
- }
-
- break;
- }
-
- case WM_NOTIFY:
- {
}
- break;
- case WM_CLOSE:
- DestroyWindow(hwndDlg);
- break;
- case WM_DESTROY:
- {
- }
- break;
- }
- return FALSE;
+ return FALSE;
}
void ShowExportKeysDlg()
@@ -2059,118 +2012,102 @@ void ShowExportKeysDlg()
DialogBox(hInst, MAKEINTRESOURCE(IDD_EXPORT_TYPE), NULL, DlgProcExportKeys);
}
-static INT_PTR CALLBACK DlgProcChangePasswd(HWND hwndDlg, UINT msg, WPARAM wParam, LPARAM lParam)
+static INT_PTR CALLBACK DlgProcChangePasswd(HWND hwndDlg, UINT msg, WPARAM wParam, LPARAM)
{
- switch (msg)
- {
- case WM_INITDIALOG:
- {
+ switch (msg) {
+ case WM_INITDIALOG:
TranslateDialogDefault(hwndDlg);
- return TRUE;
- }
-
-
- case WM_COMMAND:
- {
- switch (LOWORD(wParam))
- {
- case IDC_OK:
- //TODO: show some prgress
- {
- std::string old_pass, new_pass;
- extern TCHAR key_id_global[17];
- TCHAR buf[256] = {0};
- GetDlgItemText(hwndDlg, IDC_NEW_PASSWD1, buf, _countof(buf));
- new_pass = toUTF8(buf);
- GetDlgItemText(hwndDlg, IDC_NEW_PASSWD2, buf, _countof(buf));
- if(new_pass != toUTF8(buf))
- {
- MessageBox(hwndDlg, TranslateT("New passwords do not match"), TranslateT("Error"), MB_OK);
- //key_id_global[0] = 0;
- break;
- }
- GetDlgItemText(hwndDlg, IDC_OLD_PASSWD, buf, _countof(buf));
- old_pass = toUTF8(buf);
- bool old_pass_match = false;
- TCHAR *pass = UniGetContactSettingUtf(NULL, szGPGModuleName, "szKeyPassword", _T(""));
- if(!mir_tstrcmp(pass,buf))
- old_pass_match = true;
- mir_free(pass);
- if(!old_pass_match)
- {
- if(key_id_global[0])
- {
- string dbsetting = "szKey_";
- dbsetting += toUTF8(key_id_global);
- dbsetting += "_Password";
- pass = UniGetContactSettingUtf(NULL, szGPGModuleName, dbsetting.c_str(), _T(""));
- if(!mir_tstrcmp(pass,buf))
- old_pass_match = true;
- mir_free(pass);
- }
- }
- if(!old_pass_match)
- {
- if(MessageBox(hwndDlg, TranslateT("Old password does not match, you can continue, but GPG will reject wrong password.\nDo you want to continue?"), TranslateT("Error"), MB_YESNO) == IDNO)
- {
- //key_id_global[0] = 0;
- break;
- }
- }
- std::vector<std::wstring> cmd;
- TCHAR tmp2[MAX_PATH] = {0};
- string output;
- DWORD exitcode;
- cmd.push_back(L"--edit-key");
- cmd.push_back(key_id_global);
- cmd.push_back(L"passwd");
- gpg_execution_params_pass params(cmd, old_pass, new_pass);
- pxResult result;
- params.out = &output;
- params.code = &exitcode;
- params.result = &result;
- boost::thread gpg_thread(boost::bind(&pxEexcute_passwd_change_thread, &params));
- if(!gpg_thread.timed_join(boost::posix_time::minutes(10)))
- {
- gpg_thread.~thread();
- if(params.child)
- boost::process::terminate(*(params.child));
- if(bDebugLog)
- debuglog<<std::string(time_str()+": GPG execution timed out, aborted");
- DestroyWindow(hwndDlg);
- break;
- }
- if(result == pxNotFound)
- break;
- //if(result == pxSuccess)
- //TODO: save to db
-
-
- }
- DestroyWindow(hwndDlg);
- break;
- default:
+ return TRUE;
+
+ case WM_COMMAND:
+ switch (LOWORD(wParam)) {
+ case IDC_OK:
+ //TODO: show some prgress
+ {
+ std::string old_pass, new_pass;
+ extern TCHAR key_id_global[17];
+ TCHAR buf[256] = {0};
+ GetDlgItemText(hwndDlg, IDC_NEW_PASSWD1, buf, _countof(buf));
+ new_pass = toUTF8(buf);
+ GetDlgItemText(hwndDlg, IDC_NEW_PASSWD2, buf, _countof(buf));
+ if(new_pass != toUTF8(buf))
+ {
+ MessageBox(hwndDlg, TranslateT("New passwords do not match"), TranslateT("Error"), MB_OK);
+ //key_id_global[0] = 0;
+ break;
+ }
+ GetDlgItemText(hwndDlg, IDC_OLD_PASSWD, buf, _countof(buf));
+ old_pass = toUTF8(buf);
+ bool old_pass_match = false;
+ TCHAR *pass = UniGetContactSettingUtf(NULL, szGPGModuleName, "szKeyPassword", _T(""));
+ if(!mir_tstrcmp(pass,buf))
+ old_pass_match = true;
+ mir_free(pass);
+ if(!old_pass_match)
+ {
+ if(key_id_global[0])
+ {
+ string dbsetting = "szKey_";
+ dbsetting += toUTF8(key_id_global);
+ dbsetting += "_Password";
+ pass = UniGetContactSettingUtf(NULL, szGPGModuleName, dbsetting.c_str(), _T(""));
+ if(!mir_tstrcmp(pass,buf))
+ old_pass_match = true;
+ mir_free(pass);
+ }
+ }
+ if(!old_pass_match)
+ {
+ if(MessageBox(hwndDlg, TranslateT("Old password does not match, you can continue, but GPG will reject wrong password.\nDo you want to continue?"), TranslateT("Error"), MB_YESNO) == IDNO)
+ {
+ //key_id_global[0] = 0;
+ break;
+ }
+ }
+ std::vector<std::wstring> cmd;
+ string output;
+ DWORD exitcode;
+ cmd.push_back(L"--edit-key");
+ cmd.push_back(key_id_global);
+ cmd.push_back(L"passwd");
+ gpg_execution_params_pass params(cmd, old_pass, new_pass);
+ pxResult result;
+ params.out = &output;
+ params.code = &exitcode;
+ params.result = &result;
+ boost::thread gpg_thread(boost::bind(&pxEexcute_passwd_change_thread, &params));
+ if(!gpg_thread.timed_join(boost::posix_time::minutes(10)))
+ {
+ gpg_thread.~thread();
+ if(params.child)
+ boost::process::terminate(*(params.child));
+ if(bDebugLog)
+ debuglog<<std::string(time_str()+": GPG execution timed out, aborted");
+ DestroyWindow(hwndDlg);
+ break;
+ }
+ if(result == pxNotFound)
+ break;
+ //if(result == pxSuccess)
+ //TODO: save to db
+
+
+ }
+ DestroyWindow(hwndDlg);
+ break;
+ }
+ break;
+
+ case WM_CLOSE:
+ DestroyWindow(hwndDlg);
+ break;
+
+ case WM_DESTROY:
+ extern TCHAR key_id_global[17];
+ key_id_global[0] = 0;
break;
- }
-
- break;
- }
-
- case WM_NOTIFY:
- {
}
- break;
- case WM_CLOSE:
- DestroyWindow(hwndDlg);
- break;
- case WM_DESTROY:
- {
- extern TCHAR key_id_global[17];
- key_id_global[0] = 0;
- }
- break;
- }
- return FALSE;
+ return FALSE;
}
void ShowChangePasswdDlg()
@@ -2181,7 +2118,6 @@ void ShowChangePasswdDlg()
SetForegroundWindow(hwndPaaswdDlg);
}
-
void clean_temp_dir()
{
using namespace boost::filesystem;