summaryrefslogtreecommitdiff
path: root/utilities.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'utilities.cpp')
-rw-r--r--utilities.cpp620
1 files changed, 310 insertions, 310 deletions
diff --git a/utilities.cpp b/utilities.cpp
index 65b4b6f..03cb2c4 100644
--- a/utilities.cpp
+++ b/utilities.cpp
@@ -1,216 +1,216 @@
-// Copyright © 2010 sss
-//
-// This program is free software; you can redistribute it and/or
-// modify it under the terms of the GNU General Public License
-// as published by the Free Software Foundation; either version 2
-// of the License, or (at your option) any later version.
-//
-// This program is distributed in the hope that it will be useful,
-// but WITHOUT ANY WARRANTY; without even the implied warranty of
-// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
-// GNU General Public License for more details.
-//
-// You should have received a copy of the GNU General Public License
-// 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"
-
-
-TCHAR* __stdcall UniGetContactSettingUtf(HANDLE hContact, const char *szModule,const char* szSetting, TCHAR* szDef)
-{
- DBVARIANT dbv = {DBVT_DELETED};
- TCHAR* szRes;
- if (DBGetContactSettingTString(hContact, szModule, szSetting, &dbv))
- return _tcsdup(szDef);
- if(dbv.pszVal)
- szRes = _tcsdup(dbv.ptszVal);
- DBFreeVariant(&dbv);
- return szRes;
-}
-
-char* __stdcall UniGetContactSettingUtf(HANDLE hContact, const char *szModule,const char* szSetting, char* szDef)
-{
- DBVARIANT dbv = {DBVT_DELETED};
- char* szRes;
- if (DBGetContactSettingString(hContact, szModule, szSetting, &dbv))
- return _strdup(szDef);
- if(dbv.pszVal)
- szRes = _strdup(dbv.pszVal);
- DBFreeVariant(&dbv);
- return szRes;
-}
-
-
-char *date()
-{
- static char d[11];
- char *tmp = __DATE__, m[4], mn[3] = "01";
- m[0]=tmp[0];
- m[1]=tmp[1];
- m[2]=tmp[2];
- if(strstr(m,"Jan"))
- strcpy(mn,"01");
- else if(strstr(m,"Feb"))
- strcpy(mn,"02");
- else if(strstr(m,"Mar"))
- strcpy(mn,"03");
- else if(strstr(m,"Apr"))
- strcpy(mn,"04");
- else if(strstr(m,"May"))
- strcpy(mn,"05");
- else if(strstr(m,"Jun"))
- strcpy(mn,"06");
- else if(strstr(m,"Jul"))
- strcpy(mn,"07");
- else if(strstr(m,"Aug"))
- strcpy(mn,"08");
- else if(strstr(m,"Sep"))
- strcpy(mn,"09");
- else if(strstr(m,"Oct"))
- strcpy(mn,"10");
- else if(strstr(m,"Nov"))
- strcpy(mn,"11");
- else if(strstr(m,"Dec"))
- strcpy(mn,"12");
- d[0]=tmp[7];
- d[1]=tmp[8];
- d[2]=tmp[9];
- d[3]=tmp[10];
- d[4]='.';
- d[5]=mn[0];
- d[6]=mn[1];
- d[7]='.';
- if (tmp[4] == ' ')
- d[8] = '0';
- else
- d[8]=tmp[4];
- d[9]=tmp[5];
- return d;
-}
-
-void GetFilePath(TCHAR *WindowTittle, char *szSetting, TCHAR *szExt, TCHAR *szExtDesc)
-{
- TCHAR str[MAX_PATH+2] = {0}, *tmp;
- OPENFILENAME ofn={0};
- TCHAR filter[512], *pfilter;
- ofn.lStructSize=CDSIZEOF_STRUCT(OPENFILENAME,lpTemplateName);
- ofn.Flags=OFN_EXPLORER;
- ofn.lpstrTitle=TranslateW(WindowTittle);
- _tcscpy(filter,TranslateW(szExtDesc));
- pfilter=filter+_tcslen(filter)+1;
- _tcscpy(pfilter, szExt);
- pfilter[_tcslen(pfilter)+1] = '\0';
- pfilter[_tcslen(pfilter)+2] = '\0';
- ofn.lpstrFilter=filter;
- tmp = UniGetContactSettingUtf(0, szGPGModuleName, szSetting, _T(""));
- _tcscpy(str, tmp);
- mir_free(tmp);
- if(_tcslen(str)< 2)
- str[0] = '\0';
- ofn.lpstrFile=str;
- ofn.nMaxFile=_MAX_PATH;
- ofn.nMaxFileTitle=MAX_PATH;
- if(!GetOpenFileName(&ofn))
- return;
- DBWriteContactSettingTString(0, szGPGModuleName, szSetting, str);
-}
-
-TCHAR *GetFilePath(TCHAR *WindowTittle, TCHAR *szExt, TCHAR *szExtDesc, bool save_file)
-{
- TCHAR *str = new TCHAR [MAX_PATH+2];
- OPENFILENAME ofn={0};
- TCHAR filter[512], *pfilter;
- ofn.lStructSize=CDSIZEOF_STRUCT(OPENFILENAME,lpTemplateName);
- ofn.Flags=OFN_EXPLORER;
- ofn.lpstrTitle=TranslateW(WindowTittle);
- _tcscpy(filter,TranslateW(szExtDesc));
- pfilter=filter+_tcslen(filter)+1;
- _tcscpy(pfilter, szExt);
- pfilter[_tcslen(pfilter)+1] = '\0';
- pfilter[_tcslen(pfilter)+2] = '\0';
- ofn.lpstrFilter=filter;
- _tcscpy(str, _T(""));
- if(_tcslen(str)< 2)
- str[0] = '\0';
- ofn.lpstrFile=str;
- ofn.nMaxFile=_MAX_PATH;
- ofn.nMaxFileTitle=MAX_PATH;
- if(!save_file)
- {
- if(!GetOpenFileName(&ofn))
- {
- delete [] str;
- return NULL;
- }
- }
- else
- {
- if(!GetSaveFileName(&ofn))
- {
- delete [] str;
- return NULL;
- }
- }
- return str;
-}
-
-void GetFolderPath(TCHAR *WindowTittle, char *szSetting)
-{
- BROWSEINFO pbi = {0};
- pbi.lpszTitle = WindowTittle;
- pbi.ulFlags = BIF_EDITBOX|BIF_NEWDIALOGSTYLE|BIF_SHAREABLE;
- LPITEMIDLIST pidl = SHBrowseForFolder(&pbi);
- if (pidl != 0)
- {
- TCHAR path[MAX_PATH];
- if (SHGetPathFromIDList(pidl, path))
- {
- DBWriteContactSettingTString(NULL, szGPGModuleName, "szHomePath", path);
- }
- IMalloc * imalloc = 0;
- if (SUCCEEDED(SHGetMalloc(&imalloc)))
- {
- imalloc->Free(pidl);
- imalloc->Release();
- }
- }
-}
-
-int LoadKey(WPARAM w, LPARAM l)
-{
- void ShowLoadPublicKeyDialog();
- extern map<int, HANDLE> user_data;
- extern int item_num;
- item_num = 0; //black magic here
- user_data[1] = (HANDLE)w;
- ShowLoadPublicKeyDialog();
- return 0;
-}
-
-int SendKey(WPARAM w, LPARAM l)
-{
- HANDLE hContact = (HANDLE)w;
- if(isProtoMetaContacts(hContact))
- hContact = metaGetMostOnline(hContact);
- char *szMessage = UniGetContactSettingUtf(NULL, szGPGModuleName, "GPGPubKey", "");
- if(strlen(szMessage) > 1)
- {
- BYTE enc = DBGetContactSettingByte(hContact, szGPGModuleName, "GPGEncryption", 0);
- DBWriteContactSettingByte(hContact, szGPGModuleName, "GPGEncryption", 0);
- CallContactService(hContact, PSS_MESSAGE, (WPARAM)PREF_UTF, (LPARAM)szMessage);
- HistoryLog(hContact, "Public key sent", EVENTTYPE_MESSAGE, DBEF_SENT);
- DBWriteContactSettingByte(hContact, szGPGModuleName, "GPGEncryption", enc);
- }
- mir_free(szMessage);
- return 0;
-}
-
-extern HANDLE hLoadPublicKey, hToggleEncryption;
-
-int ToggleEncryption(WPARAM w, LPARAM l)
-{
+// Copyright © 2010 sss
+//
+// This program is free software; you can redistribute it and/or
+// modify it under the terms of the GNU General Public License
+// as published by the Free Software Foundation; either version 2
+// of the License, or (at your option) any later version.
+//
+// This program is distributed in the hope that it will be useful,
+// but WITHOUT ANY WARRANTY; without even the implied warranty of
+// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+// GNU General Public License for more details.
+//
+// You should have received a copy of the GNU General Public License
+// 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"
+
+
+TCHAR* __stdcall UniGetContactSettingUtf(HANDLE hContact, const char *szModule,const char* szSetting, TCHAR* szDef)
+{
+ DBVARIANT dbv = {DBVT_DELETED};
+ TCHAR* szRes;
+ if (DBGetContactSettingTString(hContact, szModule, szSetting, &dbv))
+ return _tcsdup(szDef);
+ if(dbv.pszVal)
+ szRes = _tcsdup(dbv.ptszVal);
+ DBFreeVariant(&dbv);
+ return szRes;
+}
+
+char* __stdcall UniGetContactSettingUtf(HANDLE hContact, const char *szModule,const char* szSetting, char* szDef)
+{
+ DBVARIANT dbv = {DBVT_DELETED};
+ char* szRes;
+ if (DBGetContactSettingString(hContact, szModule, szSetting, &dbv))
+ return _strdup(szDef);
+ if(dbv.pszVal)
+ szRes = _strdup(dbv.pszVal);
+ DBFreeVariant(&dbv);
+ return szRes;
+}
+
+
+char *date()
+{
+ static char d[11];
+ char *tmp = __DATE__, m[4], mn[3] = "01";
+ m[0]=tmp[0];
+ m[1]=tmp[1];
+ m[2]=tmp[2];
+ if(strstr(m,"Jan"))
+ strcpy(mn,"01");
+ else if(strstr(m,"Feb"))
+ strcpy(mn,"02");
+ else if(strstr(m,"Mar"))
+ strcpy(mn,"03");
+ else if(strstr(m,"Apr"))
+ strcpy(mn,"04");
+ else if(strstr(m,"May"))
+ strcpy(mn,"05");
+ else if(strstr(m,"Jun"))
+ strcpy(mn,"06");
+ else if(strstr(m,"Jul"))
+ strcpy(mn,"07");
+ else if(strstr(m,"Aug"))
+ strcpy(mn,"08");
+ else if(strstr(m,"Sep"))
+ strcpy(mn,"09");
+ else if(strstr(m,"Oct"))
+ strcpy(mn,"10");
+ else if(strstr(m,"Nov"))
+ strcpy(mn,"11");
+ else if(strstr(m,"Dec"))
+ strcpy(mn,"12");
+ d[0]=tmp[7];
+ d[1]=tmp[8];
+ d[2]=tmp[9];
+ d[3]=tmp[10];
+ d[4]='.';
+ d[5]=mn[0];
+ d[6]=mn[1];
+ d[7]='.';
+ if (tmp[4] == ' ')
+ d[8] = '0';
+ else
+ d[8]=tmp[4];
+ d[9]=tmp[5];
+ return d;
+}
+
+void GetFilePath(TCHAR *WindowTittle, char *szSetting, TCHAR *szExt, TCHAR *szExtDesc)
+{
+ TCHAR str[MAX_PATH+2] = {0}, *tmp;
+ OPENFILENAME ofn={0};
+ TCHAR filter[512], *pfilter;
+ ofn.lStructSize=CDSIZEOF_STRUCT(OPENFILENAME,lpTemplateName);
+ ofn.Flags=OFN_EXPLORER;
+ ofn.lpstrTitle=TranslateW(WindowTittle);
+ _tcscpy(filter,TranslateW(szExtDesc));
+ pfilter=filter+_tcslen(filter)+1;
+ _tcscpy(pfilter, szExt);
+ pfilter[_tcslen(pfilter)+1] = '\0';
+ pfilter[_tcslen(pfilter)+2] = '\0';
+ ofn.lpstrFilter=filter;
+ tmp = UniGetContactSettingUtf(0, szGPGModuleName, szSetting, _T(""));
+ _tcscpy(str, tmp);
+ mir_free(tmp);
+ if(_tcslen(str)< 2)
+ str[0] = '\0';
+ ofn.lpstrFile=str;
+ ofn.nMaxFile=_MAX_PATH;
+ ofn.nMaxFileTitle=MAX_PATH;
+ if(!GetOpenFileName(&ofn))
+ return;
+ DBWriteContactSettingTString(0, szGPGModuleName, szSetting, str);
+}
+
+TCHAR *GetFilePath(TCHAR *WindowTittle, TCHAR *szExt, TCHAR *szExtDesc, bool save_file)
+{
+ TCHAR *str = new TCHAR [MAX_PATH+2];
+ OPENFILENAME ofn={0};
+ TCHAR filter[512], *pfilter;
+ ofn.lStructSize=CDSIZEOF_STRUCT(OPENFILENAME,lpTemplateName);
+ ofn.Flags=OFN_EXPLORER;
+ ofn.lpstrTitle=TranslateW(WindowTittle);
+ _tcscpy(filter,TranslateW(szExtDesc));
+ pfilter=filter+_tcslen(filter)+1;
+ _tcscpy(pfilter, szExt);
+ pfilter[_tcslen(pfilter)+1] = '\0';
+ pfilter[_tcslen(pfilter)+2] = '\0';
+ ofn.lpstrFilter=filter;
+ _tcscpy(str, _T(""));
+ if(_tcslen(str)< 2)
+ str[0] = '\0';
+ ofn.lpstrFile=str;
+ ofn.nMaxFile=_MAX_PATH;
+ ofn.nMaxFileTitle=MAX_PATH;
+ if(!save_file)
+ {
+ if(!GetOpenFileName(&ofn))
+ {
+ delete [] str;
+ return NULL;
+ }
+ }
+ else
+ {
+ if(!GetSaveFileName(&ofn))
+ {
+ delete [] str;
+ return NULL;
+ }
+ }
+ return str;
+}
+
+void GetFolderPath(TCHAR *WindowTittle, char *szSetting)
+{
+ BROWSEINFO pbi = {0};
+ pbi.lpszTitle = WindowTittle;
+ pbi.ulFlags = BIF_EDITBOX|BIF_NEWDIALOGSTYLE|BIF_SHAREABLE;
+ LPITEMIDLIST pidl = SHBrowseForFolder(&pbi);
+ if (pidl != 0)
+ {
+ TCHAR path[MAX_PATH];
+ if (SHGetPathFromIDList(pidl, path))
+ {
+ DBWriteContactSettingTString(NULL, szGPGModuleName, "szHomePath", path);
+ }
+ IMalloc * imalloc = 0;
+ if (SUCCEEDED(SHGetMalloc(&imalloc)))
+ {
+ imalloc->Free(pidl);
+ imalloc->Release();
+ }
+ }
+}
+
+int LoadKey(WPARAM w, LPARAM l)
+{
+ void ShowLoadPublicKeyDialog();
+ extern map<int, HANDLE> user_data;
+ extern int item_num;
+ item_num = 0; //black magic here
+ user_data[1] = (HANDLE)w;
+ ShowLoadPublicKeyDialog();
+ return 0;
+}
+
+int SendKey(WPARAM w, LPARAM l)
+{
+ HANDLE hContact = (HANDLE)w;
+ if(isProtoMetaContacts(hContact))
+ hContact = metaGetMostOnline(hContact);
+ char *szMessage = UniGetContactSettingUtf(NULL, szGPGModuleName, "GPGPubKey", "");
+ if(strlen(szMessage) > 1)
+ {
+ BYTE enc = DBGetContactSettingByte(hContact, szGPGModuleName, "GPGEncryption", 0);
+ DBWriteContactSettingByte(hContact, szGPGModuleName, "GPGEncryption", 0);
+ CallContactService(hContact, PSS_MESSAGE, (WPARAM)PREF_UTF, (LPARAM)szMessage);
+ HistoryLog(hContact, "Public key sent", EVENTTYPE_MESSAGE, DBEF_SENT);
+ DBWriteContactSettingByte(hContact, szGPGModuleName, "GPGEncryption", enc);
+ }
+ mir_free(szMessage);
+ return 0;
+}
+
+extern HANDLE hLoadPublicKey, hToggleEncryption;
+
+int ToggleEncryption(WPARAM w, LPARAM l)
+{
HANDLE hContact = (HANDLE)w;
BYTE enc = 0;
if(isProtoMetaContacts(hContact))
@@ -234,58 +234,58 @@ int ToggleEncryption(WPARAM w, LPARAM l)
}
else
DBWriteContactSettingByte(hContact, szGPGModuleName, "GPGEncryption", enc?0:1);
- }
- void setSrmmIcon(HANDLE hContact);
- void setClistIcon(HANDLE hContact);
- setSrmmIcon(hContact);
- setClistIcon(hContact);
- enc = enc?0:1;
- CLISTMENUITEM mi = {0};
- mi.cbSize=sizeof(mi);
- mi.flags = CMIM_NAME;
- enc?mi.pszName="Turn off GPG encryption":mi.pszName="Turn on GPG encryption";
- CallService(MS_CLIST_MODIFYMENUITEM, (WPARAM)hToggleEncryption, (LPARAM)&mi);
- return 0;
-}
-
-int OnPreBuildContactMenu(WPARAM w, LPARAM l)
-{
- HANDLE hContact = (HANDLE)w;
- if(isProtoMetaContacts(hContact))
- hContact = metaGetMostOnline(hContact);
- CLISTMENUITEM mi = {0};
- mi.cbSize=sizeof(mi);
- mi.flags = CMIM_NAME;
- TCHAR *tmp = UniGetContactSettingUtf(hContact, szGPGModuleName, "GPGPubKey", _T(""));
- if(_tcslen(tmp) < 1)
- {
- DBDeleteContactSetting(hContact, szGPGModuleName, "GPGEncryption");
- mi.flags += CMIM_FLAGS | CMIF_GRAYED;
- }
- else
- mi.flags = CMIM_NAME | CMIM_FLAGS;
- mi.pszName = DBGetContactSettingByte(hContact, szGPGModuleName, "GPGEncryption", 0)?"Turn off GPG encryption":"Turn on GPG encryption";
- CallService(MS_CLIST_MODIFYMENUITEM, (WPARAM)hToggleEncryption, (LPARAM)&mi);
- return 0;
-}
-
-
-void storeOutput(HANDLE ahandle, string *output)
-{
- BOOL success;
- char readbuffer[4096] = {0};
- unsigned long transfered, available;
-
- do {
- PeekNamedPipe(ahandle,NULL,0,NULL,&available,NULL);
- if (!available)
- continue;
- success=ReadFile(ahandle,readbuffer,sizeof(readbuffer),&transfered,NULL);
- if (success && transfered)
- output->append(readbuffer, 4096);
- } while (available>0);
-}
-
+ }
+ void setSrmmIcon(HANDLE hContact);
+ void setClistIcon(HANDLE hContact);
+ setSrmmIcon(hContact);
+ setClistIcon(hContact);
+ enc = enc?0:1;
+ CLISTMENUITEM mi = {0};
+ mi.cbSize=sizeof(mi);
+ mi.flags = CMIM_NAME;
+ enc?mi.pszName="Turn off GPG encryption":mi.pszName="Turn on GPG encryption";
+ CallService(MS_CLIST_MODIFYMENUITEM, (WPARAM)hToggleEncryption, (LPARAM)&mi);
+ return 0;
+}
+
+int OnPreBuildContactMenu(WPARAM w, LPARAM l)
+{
+ HANDLE hContact = (HANDLE)w;
+ if(isProtoMetaContacts(hContact))
+ hContact = metaGetMostOnline(hContact);
+ CLISTMENUITEM mi = {0};
+ mi.cbSize=sizeof(mi);
+ mi.flags = CMIM_NAME;
+ TCHAR *tmp = UniGetContactSettingUtf(hContact, szGPGModuleName, "GPGPubKey", _T(""));
+ if(_tcslen(tmp) < 1)
+ {
+ DBDeleteContactSetting(hContact, szGPGModuleName, "GPGEncryption");
+ mi.flags += CMIM_FLAGS | CMIF_GRAYED;
+ }
+ else
+ mi.flags = CMIM_NAME | CMIM_FLAGS;
+ mi.pszName = DBGetContactSettingByte(hContact, szGPGModuleName, "GPGEncryption", 0)?"Turn off GPG encryption":"Turn on GPG encryption";
+ CallService(MS_CLIST_MODIFYMENUITEM, (WPARAM)hToggleEncryption, (LPARAM)&mi);
+ return 0;
+}
+
+
+void storeOutput(HANDLE ahandle, string *output)
+{
+ BOOL success;
+ char readbuffer[4096] = {0};
+ unsigned long transfered, available;
+
+ do {
+ PeekNamedPipe(ahandle,NULL,0,NULL,&available,NULL);
+ if (!available)
+ continue;
+ success=ReadFile(ahandle,readbuffer,sizeof(readbuffer),&transfered,NULL);
+ if (success && transfered)
+ output->append(readbuffer, 4096);
+ } while (available>0);
+}
+
void HistoryLog(HANDLE hContact, char *data, int event_type, int flags)
{
DBEVENTINFO Event = {0};
@@ -411,58 +411,58 @@ static JABBER_HANDLER_FUNC SendHandler(IJabberInterface *ji, HXML node, void *pU
extern TCHAR *password;
string out;
DWORD code;
- wstring cmd;
- {
- TCHAR *tmp = UniGetContactSettingUtf(NULL, szGPGModuleName, "szKeyPassword", _T(""));
- if(_tcslen(tmp) > 0)
- {
- cmd += _T("--passphrase \"");
- cmd += tmp;
- cmd += _T("\" ");
- }
- else if(password)
- {
- cmd += _T("--passphrase \"");
- cmd += password;
- cmd += _T("\" ");
- }
- mir_free(tmp);
+ wstring cmd;
+ {
+ TCHAR *tmp = UniGetContactSettingUtf(NULL, szGPGModuleName, "szKeyPassword", _T(""));
+ if(_tcslen(tmp) > 0)
+ {
+ cmd += _T("--passphrase \"");
+ cmd += tmp;
+ cmd += _T("\" ");
+ }
+ else if(password)
+ {
+ cmd += _T("--passphrase \"");
+ cmd += password;
+ cmd += _T("\" ");
+ }
+ mir_free(tmp);
}
- cmd += _T("--default-key ");
- path_c = UniGetContactSettingUtf(NULL, szGPGModuleName, "KeyID", _T(""));
- cmd += path_c;
- mir_free(path_c);
+ cmd += _T("--default-key ");
+ path_c = UniGetContactSettingUtf(NULL, szGPGModuleName, "KeyID", _T(""));
+ cmd += path_c;
+ mir_free(path_c);
cmd += _T(" --batch --yes -a -s \"");
cmd += path_out;
- cmd += _T("\" ");
- gpg_execution_params params;
- pxResult result;
- params.cmd = &cmd;
- params.useless = "";
- params.out = &out;
- params.code = &code;
- params.result = &result;
- HANDLE gpg_thread = mir_forkthread(pxEexcute_thread, (void*)&params);
- if(WaitForSingleObject(gpg_thread, 10000) == WAIT_TIMEOUT)
- {
- TerminateThread(gpg_thread, 0);
- MessageBox(0, _T("GPG execution timed out, aborted"), _T(""), MB_OK);
- }
- if(result == pxNotFound)
+ cmd += _T("\" ");
+ gpg_execution_params params;
+ pxResult result;
+ params.cmd = &cmd;
+ params.useless = "";
+ params.out = &out;
+ params.code = &code;
+ params.result = &result;
+ HANDLE gpg_thread = mir_forkthread(pxEexcute_thread, (void*)&params);
+ if(WaitForSingleObject(gpg_thread, 10000) == WAIT_TIMEOUT)
{
- MessageBox(0, _T("Set path to gpg.exe first!"), _T("Warning"), MB_OK);
- }
+ TerminateThread(gpg_thread, 0);
+ MessageBox(0, _T("GPG execution timed out, aborted"), _T(""), MB_OK);
+ }
+ if(result == pxNotFound)
+ {
+ MessageBox(0, _T("Set path to gpg.exe first!"), _T("Warning"), MB_OK);
+ }
DeleteFile(path_out.c_str());
path_out += _T(".asc");
f.open(path_out.c_str(), std::ios::in);
- wstring data;
- while(!f.eof() && f.is_open())
- {
- TCHAR tmp[128];
- f.getline(tmp, 128);
- data.append(tmp);
- data.append(_T("\n"));
- }
+ wstring data;
+ while(!f.eof() && f.is_open())
+ {
+ TCHAR tmp[128];
+ f.getline(tmp, 128);
+ data.append(tmp);
+ data.append(_T("\n"));
+ }
DeleteFile(path_out.c_str());
if(data.find(_T("-----BEGIN PGP MESSAGE-----")) != wstring::npos && data.find(_T("-----END PGP MESSAGE-----")) != wstring::npos)
{