summaryrefslogtreecommitdiff
path: root/plugins/New_GPG/src
diff options
context:
space:
mode:
Diffstat (limited to 'plugins/New_GPG/src')
-rwxr-xr-xplugins/New_GPG/src/main.cpp36
-rwxr-xr-xplugins/New_GPG/src/messages.cpp9
-rwxr-xr-xplugins/New_GPG/src/utilities.cpp3
3 files changed, 44 insertions, 4 deletions
diff --git a/plugins/New_GPG/src/main.cpp b/plugins/New_GPG/src/main.cpp
index b38d57c866..9918b66cc7 100755
--- a/plugins/New_GPG/src/main.cpp
+++ b/plugins/New_GPG/src/main.cpp
@@ -71,6 +71,12 @@ static INT_PTR CALLBACK DlgProcFirstRun(HWND hwndDlg,UINT msg,WPARAM wParam,LPAR
col.fmt = LVCFMT_LEFT;
col.cx = 30;
ListView_InsertColumn(hwndList, 4, &col);
+ ZeroMemory(&col,sizeof(col));
+ col.pszText = TranslateT("Accounts");
+ col.mask = LVCF_TEXT | LVCF_WIDTH;
+ col.fmt = LVCFMT_LEFT;
+ col.cx = 30;
+ ListView_InsertColumn(hwndList, 5, &col);
ListView_SetExtendedListViewStyleEx(hwndList, 0, LVS_EX_FULLROWSELECT);
int i = 1, iRow = 0;
{
@@ -121,6 +127,7 @@ static INT_PTR CALLBACK DlgProcFirstRun(HWND hwndDlg,UINT msg,WPARAM wParam,LPAR
p = out.find(" ", p2);
tmp = mir_wstrdup(toUTF16(out.substr(p2,p-p2)).c_str());
ListView_SetItemText(hwndList, iRow, 0, tmp);
+ std::wstring key_id = tmp;
mir_free(tmp);
p = out.find("uid ", p);
p2 = out.find_first_not_of(" ", p+5);
@@ -144,6 +151,33 @@ static INT_PTR CALLBACK DlgProcFirstRun(HWND hwndDlg,UINT msg,WPARAM wParam,LPAR
ListView_SetColumnWidth(hwndList, 2, LVSCW_AUTOSIZE);
ListView_SetColumnWidth(hwndList, 3, LVSCW_AUTOSIZE);
ListView_SetColumnWidth(hwndList, 4, LVSCW_AUTOSIZE);
+ { //get accounts
+ int count = 0;
+ PROTOACCOUNT **accounts;
+ ProtoEnumAccounts(&count, &accounts);
+ std::wstring accs;
+ for(int i = 0; i < count; i++)
+ {
+ std::string setting = toUTF8(accounts[i]->tszAccountName);
+ setting += "(";
+ setting += accounts[i]->szModuleName;
+ setting += ")" ;
+ setting += "_KeyID";
+ TCHAR *str = UniGetContactSettingUtf(NULL, szGPGModuleName, setting.c_str(), _T(""));
+ if(key_id == str)
+ {
+ if(accs.empty())
+ accs += accounts[i]->tszAccountName;
+ else
+ {
+ accs += _T(",");
+ accs += accounts[i]->tszAccountName;
+ }
+ }
+ }
+ ListView_SetItemText(hwndList, iRow, 5, (TCHAR*)accs.c_str());
+ ListView_SetColumnWidth(hwndList, 5, LVSCW_AUTOSIZE);
+ }
i++;
}
}
@@ -1123,7 +1157,7 @@ static INT_PTR CALLBACK DlgProcNewKeyDialog(HWND hwndDlg, UINT msg, WPARAM wPara
case WM_INITDIALOG:
{
hContact = new_key_hcnt;
- new_key_hcnt_mutex.unlock();
+ //new_key_hcnt_mutex.unlock();
SetWindowPos(hwndDlg, 0, new_key_rect.left, new_key_rect.top, 0, 0, SWP_NOSIZE|SWP_SHOWWINDOW);
TranslateDialogDefault(hwndDlg);
TCHAR *tmp = UniGetContactSettingUtf(hContact, szGPGModuleName, "GPGPubKey", _T(""));
diff --git a/plugins/New_GPG/src/messages.cpp b/plugins/New_GPG/src/messages.cpp
index db17333da6..292ad1062c 100755
--- a/plugins/New_GPG/src/messages.cpp
+++ b/plugins/New_GPG/src/messages.cpp
@@ -410,7 +410,11 @@ int RecvMsgSvc(WPARAM w, LPARAM l)
_tcscpy(tmp2, ptmp);
mir_free(ptmp);
_tcscat(tmp2, _T("\\"));
- _tcscat(tmp2, _T("temporary_exported.asc"));
+ TCHAR *tmp3 = mir_a2t(get_random(5).c_str());
+ _tcscat(tmp2, tmp3);
+ _tcscat(tmp2, _T(".asc"));
+ mir_free(tmp3);
+ //_tcscat(tmp2, _T("temporary_exported.asc"));
DeleteFile(tmp2);
wfstream f(tmp2, std::ios::out);
while(!f.is_open())
@@ -443,6 +447,7 @@ int RecvMsgSvc(WPARAM w, LPARAM l)
}
if(result == pxNotFound)
return 1;
+ DeleteFile(tmp2);
//TODO: check gpg output for errors
{
char *tmp = NULL;
@@ -543,7 +548,7 @@ int RecvMsgSvc(WPARAM w, LPARAM l)
s2 += _tcslen(_T("-----END PGP PRIVATE KEY BLOCK-----"));
}
new_key.append(str.substr(s1,s2-s1));
- new_key_hcnt_mutex.lock();
+ //new_key_hcnt_mutex.lock();
new_key_hcnt = ccs->hContact;
ShowNewKeyDialog();
HistoryLog(ccs->hContact, db_event(msg, 0, 0, dbflags));
diff --git a/plugins/New_GPG/src/utilities.cpp b/plugins/New_GPG/src/utilities.cpp
index 3effa8aa48..5d9e9a2ecd 100755
--- a/plugins/New_GPG/src/utilities.cpp
+++ b/plugins/New_GPG/src/utilities.cpp
@@ -272,6 +272,7 @@ int onProtoAck(WPARAM w, LPARAM l)
}
if(_tcsstr(filename, _T(".gpg"))) //decrypt it
{ //process encrypted file
+ HistoryLog(ack->hContact, db_event("Recieved encrypted file, trying to decrypt", 0,0, 0));
if(_waccess(f->tszCurrentFile, 0) == -1)
{
if(errno == ENOENT)
@@ -518,7 +519,7 @@ int onSendFile(WPARAM w, LPARAM l)
CCSDATA *ccs=(CCSDATA*)l;
if(isContactSecured(ccs->hContact))
{
-
+ 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 ....