summaryrefslogtreecommitdiff
path: root/plugins
diff options
context:
space:
mode:
authorAlexander Gluzsky <sss123next@list.ru>2012-10-14 01:34:34 +0000
committerAlexander Gluzsky <sss123next@list.ru>2012-10-14 01:34:34 +0000
commit888ed6aaa3fc2d01e865359a8cacf68059ad579d (patch)
treeeddc9b21cec70b1a4aebd36cf6ac68b01eb73978 /plugins
parentfd90113f1a40064a9a6dc670a60dd3b2a738a467 (diff)
one more metacontacts problem fixed
turned of xmpp traffic modification for contacts with disabled encryption git-svn-id: http://svn.miranda-ng.org/main/trunk@1916 1316c22d-e87f-b044-9b9b-93d7a3e3ba9c
Diffstat (limited to 'plugins')
-rwxr-xr-xplugins/New_GPG/src/messages.cpp28
-rwxr-xr-xplugins/New_GPG/src/utilities.cpp8
2 files changed, 22 insertions, 14 deletions
diff --git a/plugins/New_GPG/src/messages.cpp b/plugins/New_GPG/src/messages.cpp
index 4fe4268ea6..bab5fb051e 100755
--- a/plugins/New_GPG/src/messages.cpp
+++ b/plugins/New_GPG/src/messages.cpp
@@ -381,10 +381,17 @@ int RecvMsgSvc(WPARAM w, LPARAM l)
char *msg = pre->szMessage;
if (!msg)
return CallService(MS_PROTO_CHAINRECV, w, l);
+ DWORD dbflags = DBEF_UTF;
+ if(metaIsProtoMetaContacts(ccs->hContact))
+ {
+ if(!strstr(msg, "-----BEGIN PGP MESSAGE-----"))
+ return CallService(MS_PROTO_CHAINRECV, w, l);
+ else
+ return 0;
+ }
wstring str = toUTF16(msg);
wstring::size_type s1 = wstring::npos, s2 = wstring::npos;
- DWORD dbflags = DBEF_UTF;
- if(bAutoExchange && (str.find(_T("-----PGP KEY RESPONSE-----")) != wstring::npos) && !metaIsProtoMetaContacts(ccs->hContact))
+ if(bAutoExchange && (str.find(_T("-----PGP KEY RESPONSE-----")) != wstring::npos))
{
s2 = str.find(_T("-----END PGP PUBLIC KEY BLOCK-----"));
s1 = str.find(_T("-----BEGIN PGP PUBLIC KEY BLOCK-----"));
@@ -518,17 +525,10 @@ int RecvMsgSvc(WPARAM w, LPARAM l)
}
if((s2 != wstring::npos) && (s1 != wstring::npos))
{ //this is public key
- if(metaIsProtoMetaContacts(ccs->hContact))
- {
- HistoryLog(ccs->hContact, db_event(msg, 0, 0, dbflags));
- return 0;
- }
debuglog<<time_str()<<": info: "<<"received key from: "<<(TCHAR*)CallService(MS_CLIST_GETCONTACTDISPLAYNAME, (WPARAM)ccs->hContact, GCDNF_TCHAR)<<"\n";
s1 = 0;
while((s1 = str.find(_T("\r"), s1)) != wstring::npos)
- {
str.erase(s1, 1);
- }
void ShowNewKeyDialog();
if((str.find(_T("-----END PGP PUBLIC KEY BLOCK-----")) != wstring::npos) && (str.find(_T("-----BEGIN PGP PUBLIC KEY BLOCK-----")) != wstring::npos))
{
@@ -564,7 +564,7 @@ int RecvMsgSvc(WPARAM w, LPARAM l)
DBWriteContactSettingByte(ccs->hContact, szGPGModuleName, "GPGEncryption", 1);
}
mir_free(tmp);
- return returnNoError(ccs->hContact);
+ return 0;
}
else if(!isContactHaveKey(ccs->hContact) && bAutoExchange && gpg_valid && gpg_keyexist)
{
@@ -583,7 +583,7 @@ int RecvMsgSvc(WPARAM w, LPARAM l)
if(CallService(svc, (WPARAM)ccs->hContact, (LPARAM)&cap))
{
CallContactService(ccs->hContact, PSS_MESSAGE, (WPARAM)PREF_UTF, (LPARAM)"-----PGP KEY REQUEST-----");
- return returnNoError(ccs->hContact);
+ return 0;
}
}
}
@@ -611,17 +611,17 @@ int RecvMsgSvc(WPARAM w, LPARAM l)
if(str.find(_T("GPG_Key_Auto_Exchange:0")) != string::npos)
{
CallContactService(ccs->hContact, PSS_MESSAGE, (WPARAM)0, (LPARAM)"-----PGP KEY REQUEST-----");
- return returnNoError(ccs->hContact);
+ return 0;
}
}
}
}
}
}
- if(!(strstr(msg, "-----BEGIN PGP MESSAGE-----") && strstr(msg, "-----END PGP MESSAGE-----")))
+ if(!strstr(msg, "-----BEGIN PGP MESSAGE-----"))
return CallService(MS_PROTO_CHAINRECV, w, l);
boost::thread *thr = new boost::thread(boost::bind(RecvMsgSvc_func, ccs->hContact, str, msg, ccs->wParam, pre->timestamp));
- return returnNoError(ccs->hContact);
+ return 0;
}
void SendMsgSvc_func(HANDLE hContact, char *msg, DWORD flags)
diff --git a/plugins/New_GPG/src/utilities.cpp b/plugins/New_GPG/src/utilities.cpp
index 652b383cc8..0c13d33e8d 100755
--- a/plugins/New_GPG/src/utilities.cpp
+++ b/plugins/New_GPG/src/utilities.cpp
@@ -659,6 +659,14 @@ static JABBER_HANDLER_FUNC SendHandler(IJabberInterface *ji, HXML node, void *pU
{
LPCTSTR str = xi.getText(local_node);
LPCTSTR nodename = xi.getName(local_node);
+ LPCTSTR attr = xi.getAttrValue(local_node, _T("to"));
+ if(attr)
+ {
+ HANDLE hContact = ji->Sys()->ContactFromJID(attr);
+ if(hContact)
+ if(!isContactSecured(hContact))
+ return FALSE;
+ }
if(str)
{
if(_tcsstr(str, _T("-----BEGIN PGP MESSAGE-----")) && _tcsstr(str, _T("-----END PGP MESSAGE-----")))