summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--init.cpp2
-rw-r--r--messages.cpp12
-rw-r--r--new_gpg.rc4
-rw-r--r--options.cpp8
-rw-r--r--utilities.cpp27
5 files changed, 43 insertions, 10 deletions
diff --git a/init.cpp b/init.cpp
index be462da..d12472c 100644
--- a/init.cpp
+++ b/init.cpp
@@ -39,7 +39,7 @@ logtofile debuglog;
PLUGININFOEX pluginInfo={
sizeof(PLUGININFOEX),
0,
- PLUGIN_MAKE_VERSION(0,0,0,5),
+ PLUGIN_MAKE_VERSION(0,0,0,6),
"new GPG encryption support plugin, used code from http://addons.miranda-im.org/details.php?action=viewfile&id=3485",
"sss",
"sss123next@list.ru",
diff --git a/messages.cpp b/messages.cpp
index 18db824..9dfe9d7 100644
--- a/messages.cpp
+++ b/messages.cpp
@@ -316,14 +316,15 @@ int RecvMsgSvc(WPARAM w, LPARAM l)
delete [] tmp;
str.append(tmp2);
mir_free(tmp2);
+ f.close();
+ DeleteFile(path.c_str());
}
- f.close();
- DeleteFile(path.c_str());
if(str.empty())
{
string str = pre->szMessage;
mir_free((void**)pre->szMessage);
str.insert(0, "Failed to decrypt GPG encrypted message:\n");
+ debuglog<<"info: Failed to decrypt GPG encrypted message.\n";
pre->szMessage = mir_strdup(str.c_str());
return CallService(MS_PROTO_CHAINRECV, w, (LPARAM)ccs);
}
@@ -473,12 +474,13 @@ int SendMsgSvc(WPARAM w, LPARAM l)
tmp[size]= '\0';
str.append(tmp);
delete [] tmp;
+ f.close();
+ DeleteFile(path.c_str());
}
- f.close();
- DeleteFile(path.c_str());
- if(!str.length())
+ if(str.empty())
{
HistoryLog(hContact, "Failed to encrypt message with GPG", EVENTTYPE_MESSAGE, DBEF_SENT);
+ debuglog<<"info: Failed to encrypt message with GPG";
return CallService(MS_PROTO_CHAINRECV, w, (LPARAM)ccs);
}
// mir_free((void**)ccs->lParam);
diff --git a/new_gpg.rc b/new_gpg.rc
index 9e6e23f..290c690 100644
--- a/new_gpg.rc
+++ b/new_gpg.rc
@@ -241,7 +241,7 @@ IDI_UNSECURED ICON "icons\\unsecured.ico"
//
VS_VERSION_INFO VERSIONINFO
- FILEVERSION 0,0,0,5
+ FILEVERSION 0,0,0,6
PRODUCTVERSION 0,8,0,1
FILEFLAGSMASK 0x17L
#ifdef _DEBUG
@@ -258,7 +258,7 @@ BEGIN
BLOCK "041904b0"
BEGIN
VALUE "FileDescription", "new_gpg"
- VALUE "FileVersion", "0, 0, 0, 5"
+ VALUE "FileVersion", "0, 0, 0, 6"
VALUE "InternalName", "new_gpg"
VALUE "LegalCopyright", "Copyright (C) 2010 sss"
VALUE "OriginalFilename", "new_gpg"
diff --git a/options.cpp b/options.cpp
index c615cb8..9c1dce4 100644
--- a/options.cpp
+++ b/options.cpp
@@ -1048,8 +1048,14 @@ static BOOL CALLBACK DlgProcLoadPublicKey(HWND hwndDlg,UINT msg,WPARAM wParam,LP
tmp[size]= '\0';
key_buf.append(tmp);
delete [] tmp;
+ f.close();
+ }
+ if(key_buf.empty())
+ {
+ key_buf.clear();
+ debuglog<<"info: Failed to read key file\n";
+ break;
}
- f.close();
if(((ws2 = key_buf.find(_T("-----END PGP PUBLIC KEY BLOCK-----"))) == wstring::npos) || ((ws1 = key_buf.find(_T("-----BEGIN PGP PUBLIC KEY BLOCK-----"))) == wstring::npos))
{
MessageBox(0, _T("This is not public key"), _T("INFO"), MB_OK);
diff --git a/utilities.cpp b/utilities.cpp
index c78bc4a..9c07b89 100644
--- a/utilities.cpp
+++ b/utilities.cpp
@@ -409,6 +409,14 @@ static JABBER_HANDLER_FUNC SendHandler(IJabberInterface *ji, HXML node, void *pU
f<<tmp;
mir_free(tmp);
f.close();
+ if(_waccess(path_out.c_str(), 0) == -1)
+ {
+ if(errno == ENOENT)
+ {
+ debuglog<<"info: Failed to write prescense in file\n";
+ return FALSE;
+ }
+ }
{
extern TCHAR *password;
string out;
@@ -487,8 +495,13 @@ static JABBER_HANDLER_FUNC SendHandler(IJabberInterface *ji, HXML node, void *pU
tmp[size]= '\0';
data.append(tmp);
delete [] tmp;
+ DeleteFile(path_out.c_str());
+ }
+ if(data.empty())
+ {
+ debuglog<<"info: Failed to read prescense sign from file\n";
+ return FALSE;
}
- DeleteFile(path_out.c_str());
if(data.find(_T("-----BEGIN PGP MESSAGE-----")) != wstring::npos && data.find(_T("-----END PGP MESSAGE-----")) != wstring::npos)
{
wstring::size_type p1 = data.find(_T("-----BEGIN PGP MESSAGE-----")) + _tcslen(_T("-----BEGIN PGP MESSAGE-----"));
@@ -504,6 +517,18 @@ static JABBER_HANDLER_FUNC SendHandler(IJabberInterface *ji, HXML node, void *pU
else
p1 += 2;
}
+ if(data.find(_T("Comment: "), p1) != wstring::npos)
+ {
+ p1 = data.find(_T("Comment: "), p1);
+ p1 = data.find(_T("\n"), p1);
+ if(data.find(_T("Comment: "), p1) != wstring::npos)
+ {
+ p1 = data.find(_T("Comment: "), p1);
+ p1 = data.find(_T("\n"), p1)+2;
+ }
+ else
+ p1 += 2;
+ }
else
p1+=2;
wstring::size_type p2 = data.find(_T("-----END PGP MESSAGE-----"));