summaryrefslogtreecommitdiff
path: root/plugins/New_GPG/src
diff options
context:
space:
mode:
authorGeorge Hazan <george.hazan@gmail.com>2015-06-30 18:59:38 +0000
committerGeorge Hazan <george.hazan@gmail.com>2015-06-30 18:59:38 +0000
commit10bc9e42dfba6ed8be41199243d688c2e367dc0d (patch)
tree891aca91eeb2feddb6c76498c4eb880689360fe6 /plugins/New_GPG/src
parent5dac5be47f2d9af8cbceead6511ff4c0fc40bab5 (diff)
MS_CLIST_GETSTATUSMODEDESCRIPTION & MS_CLIST_GETCONTACTDISPLAYNAME replaced with pcli->* members
git-svn-id: http://svn.miranda-ng.org/main/trunk@14459 1316c22d-e87f-b044-9b9b-93d7a3e3ba9c
Diffstat (limited to 'plugins/New_GPG/src')
-rw-r--r--plugins/New_GPG/src/commonheaders.h2
-rw-r--r--plugins/New_GPG/src/init.cpp6
-rwxr-xr-xplugins/New_GPG/src/main.cpp2
-rwxr-xr-xplugins/New_GPG/src/messages.cpp63
-rwxr-xr-xplugins/New_GPG/src/options.cpp6
-rwxr-xr-xplugins/New_GPG/src/utilities.cpp18
6 files changed, 50 insertions, 47 deletions
diff --git a/plugins/New_GPG/src/commonheaders.h b/plugins/New_GPG/src/commonheaders.h
index c3ff37eede..120f288341 100644
--- a/plugins/New_GPG/src/commonheaders.h
+++ b/plugins/New_GPG/src/commonheaders.h
@@ -63,7 +63,7 @@ using std::fstream;
#include <m_jabber.h>
#include <m_icq.h>
#include <m_message.h>
-#include <m_clist.h>
+#include <m_clist.h>
#include <m_cluiframes.h>
#include <m_icolib.h>
#include <m_extraicons.h>
diff --git a/plugins/New_GPG/src/init.cpp b/plugins/New_GPG/src/init.cpp
index 19d274ed51..47f7733ec3 100644
--- a/plugins/New_GPG/src/init.cpp
+++ b/plugins/New_GPG/src/init.cpp
@@ -22,6 +22,7 @@ TCHAR *inopentag = NULL, *inclosetag = NULL, *outopentag = NULL, *outclosetag =
list <JabberAccount*> Accounts;
+CLIST_INTERFACE *pcli;
HINSTANCE hInst;
HFONT bold_font = NULL;
HANDLE hLoadPubKey = NULL, g_hCLIcon = NULL, hExportGpgKeys = NULL, hImportGpgKeys = NULL;
@@ -167,8 +168,11 @@ static int OnModulesLoaded(WPARAM wParam,LPARAM lParam)
extern "C" int __declspec(dllexport) Load()
{
- HookEvent(ME_SYSTEM_MODULESLOADED, OnModulesLoaded);
mir_getLP(&pluginInfo);
+ mir_getCLI();
+
+ HookEvent(ME_SYSTEM_MODULESLOADED, OnModulesLoaded);
+
init_vars();
CreateServiceFunction("/LoadPubKey",LoadKey);
CreateServiceFunction("/ToggleEncryption",ToggleEncryption);
diff --git a/plugins/New_GPG/src/main.cpp b/plugins/New_GPG/src/main.cpp
index 6f64c97c5e..93c1c704f9 100755
--- a/plugins/New_GPG/src/main.cpp
+++ b/plugins/New_GPG/src/main.cpp
@@ -1296,7 +1296,7 @@ static INT_PTR CALLBACK DlgProcNewKeyDialog(HWND hwndDlg, UINT msg, WPARAM wPara
SetDlgItemText(hwndDlg, ID_IMPORT, tmp[0]?TranslateT("Replace"):TranslateT("Accept"));
mir_free(tmp);
tmp = new TCHAR [256];
- mir_sntprintf(tmp, 255*sizeof(TCHAR),TranslateT("Received key from %s"), CallService(MS_CLIST_GETCONTACTDISPLAYNAME, hContact, GCDNF_TCHAR));
+ mir_sntprintf(tmp, 255*sizeof(TCHAR),TranslateT("Received key from %s"), pcli->pfnGetContactDisplayName(hContact, 0));
SetDlgItemText(hwndDlg, IDC_KEY_FROM, tmp);
delete [] tmp;
}
diff --git a/plugins/New_GPG/src/messages.cpp b/plugins/New_GPG/src/messages.cpp
index 384f1d7fb1..fbaea6013b 100755
--- a/plugins/New_GPG/src/messages.cpp
+++ b/plugins/New_GPG/src/messages.cpp
@@ -16,7 +16,6 @@
#include "commonheaders.h"
-
wstring new_key;
MCONTACT new_key_hcnt = NULL;
boost::mutex new_key_hcnt_mutex;
@@ -38,7 +37,7 @@ void RecvMsgSvc_func(MCONTACT hContact, std::wstring str, char *msg, DWORD flags
if(!isContactSecured(hContact))
{
if(bDebugLog)
- debuglog<<std::string(time_str()+": info: received encrypted message from: "+toUTF8((TCHAR*)CallService(MS_CLIST_GETCONTACTDISPLAYNAME, hContact, GCDNF_TCHAR))+" with turned off encryption");
+ debuglog<<std::string(time_str()+": info: received encrypted message from: "+toUTF8(pcli->pfnGetContactDisplayName(hContact, 0))+" with turned off encryption");
if(MessageBox(0, TranslateT("We received encrypted message from contact with encryption turned off.\nDo you want to turn on encryption for this contact?"), TranslateT("Warning"), MB_YESNO) == IDYES)
{
if(!isContactHaveKey(hContact))
@@ -69,7 +68,7 @@ void RecvMsgSvc_func(MCONTACT hContact, std::wstring str, char *msg, DWORD flags
}
else if(bDebugLog)
{
- debuglog<<std::string(time_str()+": info: received encrypted message from: "+toUTF8((TCHAR*)CallService(MS_CLIST_GETCONTACTDISPLAYNAME, hContact, GCDNF_TCHAR)));
+ debuglog<<std::string(time_str()+": info: received encrypted message from: "+toUTF8(pcli->pfnGetContactDisplayName(hContact, 0)));
}
boost::algorithm::erase_all(str, "\r");
s2 += mir_tstrlen(_T("-----END PGP MESSAGE-----"));
@@ -103,13 +102,13 @@ void RecvMsgSvc_func(MCONTACT hContact, std::wstring str, char *msg, DWORD flags
dbsetting += "_Password";
pass = UniGetContactSettingUtf(NULL, szGPGModuleName, dbsetting.c_str(), _T(""));
if(pass[0] && bDebugLog)
- debuglog<<std::string(time_str()+": info: found password in database for key ID: "+inkeyid+", trying to decrypt message from "+toUTF8((TCHAR*)CallService(MS_CLIST_GETCONTACTDISPLAYNAME, hContact, GCDNF_TCHAR))+" with password");
+ debuglog<<std::string(time_str()+": info: found password in database for key ID: "+inkeyid+", trying to decrypt message from "+toUTF8(pcli->pfnGetContactDisplayName(hContact, 0))+" with password");
}
else
{
pass = UniGetContactSettingUtf(NULL, szGPGModuleName, "szKeyPassword", _T(""));
if(pass[0] && bDebugLog)
- debuglog<<std::string(time_str()+": info: found password for all keys in database, trying to decrypt message from "+toUTF8((TCHAR*)CallService(MS_CLIST_GETCONTACTDISPLAYNAME, hContact, GCDNF_TCHAR))+" with password");
+ debuglog<<std::string(time_str()+": info: found password for all keys in database, trying to decrypt message from "+toUTF8(pcli->pfnGetContactDisplayName(hContact, 0))+" with password");
}
if(pass && pass[0])
{
@@ -119,12 +118,12 @@ void RecvMsgSvc_func(MCONTACT hContact, std::wstring str, char *msg, DWORD flags
else if(password && password[0])
{
if(bDebugLog)
- debuglog<<std::string(time_str()+": info: found password in memory, trying to decrypt message from "+toUTF8((TCHAR*)CallService(MS_CLIST_GETCONTACTDISPLAYNAME, hContact, GCDNF_TCHAR))+" with password");
+ debuglog<<std::string(time_str()+": info: found password in memory, trying to decrypt message from "+toUTF8(pcli->pfnGetContactDisplayName(hContact, 0))+" with password");
cmd.push_back(L"--passphrase");
cmd.push_back(password);
}
else if (bDebugLog)
- debuglog<<std::string(time_str()+": info: passwords not found in database or memory, trying to decrypt message from "+toUTF8((TCHAR*)CallService(MS_CLIST_GETCONTACTDISPLAYNAME, hContact, GCDNF_TCHAR))+" with out password");
+ debuglog<<std::string(time_str()+": info: passwords not found in database or memory, trying to decrypt message from "+toUTF8(pcli->pfnGetContactDisplayName(hContact, 0))+" with out password");
mir_free(pass);
mir_free(inkeyid);
}
@@ -174,7 +173,7 @@ void RecvMsgSvc_func(MCONTACT hContact, std::wstring str, char *msg, DWORD flags
while(out.find("public key decryption failed: bad passphrase") != string::npos)
{
if(bDebugLog)
- debuglog<<std::string(time_str()+": info: failed to decrypt messaage from "+toUTF8((TCHAR*)CallService(MS_CLIST_GETCONTACTDISPLAYNAME, hContact, GCDNF_TCHAR))+" password needed, trying to get one");
+ debuglog<<std::string(time_str()+": info: failed to decrypt messaage from "+toUTF8(pcli->pfnGetContactDisplayName(hContact, 0))+" password needed, trying to get one");
if(_terminate)
{
BYTE enc = db_get_b(hContact, szGPGModuleName, "GPGEncryption", 0);
@@ -199,7 +198,7 @@ void RecvMsgSvc_func(MCONTACT hContact, std::wstring str, char *msg, DWORD flags
if(password)
{
if(bDebugLog)
- debuglog<<std::string(time_str()+": info: found password in memory, trying to decrypt message from "+toUTF8((TCHAR*)CallService(MS_CLIST_GETCONTACTDISPLAYNAME, hContact, GCDNF_TCHAR)));
+ debuglog<<std::string(time_str()+": info: found password in memory, trying to decrypt message from "+toUTF8(pcli->pfnGetContactDisplayName(hContact, 0)));
std::vector<wstring> tmp;
tmp.push_back(L"--passphrase");
tmp.push_back(password);
@@ -356,7 +355,7 @@ INT_PTR RecvMsgSvc(WPARAM w, LPARAM l)
else
{
if(bDebugLog)
- debuglog<<std::string(time_str()+": info: blocked pgp message to metacontact:"+toUTF8((TCHAR*)CallService(MS_CLIST_GETCONTACTDISPLAYNAME, (WPARAM)ccs->hContact, GCDNF_TCHAR)));
+ debuglog<<std::string(time_str()+": info: blocked pgp message to metacontact:"+toUTF8(pcli->pfnGetContactDisplayName(ccs->hContact, 0)));
return 0;
}
}
@@ -365,13 +364,13 @@ INT_PTR RecvMsgSvc(WPARAM w, LPARAM l)
if(bAutoExchange && (str.find(_T("-----PGP KEY RESPONSE-----")) != wstring::npos))
{
if(bDebugLog)
- debuglog<<std::string(time_str()+": info(autoexchange): parsing key response:"+toUTF8((TCHAR*)CallService(MS_CLIST_GETCONTACTDISPLAYNAME, (WPARAM)ccs->hContact, GCDNF_TCHAR)));
+ debuglog<<std::string(time_str()+": info(autoexchange): parsing key response:"+toUTF8(pcli->pfnGetContactDisplayName(ccs->hContact, 0)));
s2 = str.find(_T("-----END PGP PUBLIC KEY BLOCK-----"));
s1 = str.find(_T("-----BEGIN PGP PUBLIC KEY BLOCK-----"));
if(s1 != wstring::npos && s2 != wstring::npos)
{
if(bDebugLog)
- debuglog<<std::string(time_str()+": info(autoexchange): found pubkey block:"+toUTF8((TCHAR*)CallService(MS_CLIST_GETCONTACTDISPLAYNAME, (WPARAM)ccs->hContact, GCDNF_TCHAR)));
+ debuglog<<std::string(time_str()+": info(autoexchange): found pubkey block:"+toUTF8(pcli->pfnGetContactDisplayName(ccs->hContact, 0)));
s2 += mir_tstrlen(_T("-----END PGP PUBLIC KEY BLOCK-----"));
db_set_ts(ccs->hContact, szGPGModuleName, "GPGPubKey", str.substr(s1,s2-s1).c_str());
{ //gpg execute block
@@ -492,7 +491,7 @@ INT_PTR RecvMsgSvc(WPARAM w, LPARAM l)
if((s2 != wstring::npos) && (s1 != wstring::npos))
{ //this is public key
if(bDebugLog)
- debuglog<<std::string(time_str()+": info: received key from: "+toUTF8((TCHAR*)CallService(MS_CLIST_GETCONTACTDISPLAYNAME, (WPARAM)ccs->hContact, GCDNF_TCHAR)));
+ debuglog<<std::string(time_str()+": info: received key from: "+toUTF8(pcli->pfnGetContactDisplayName(ccs->hContact, 0)));
s1 = 0;
while((s1 = str.find(_T("\r"), s1)) != wstring::npos)
str.erase(s1, 1);
@@ -515,7 +514,7 @@ INT_PTR RecvMsgSvc(WPARAM w, LPARAM l)
if(bAutoExchange && strstr(msg, "-----PGP KEY REQUEST-----") && gpg_valid && gpg_keyexist)
{
if(bDebugLog)
- debuglog<<std::string(time_str()+": info(autoexchange): received key request from: "+toUTF8((TCHAR*)CallService(MS_CLIST_GETCONTACTDISPLAYNAME, (WPARAM)ccs->hContact, GCDNF_TCHAR)));
+ debuglog<<std::string(time_str()+": info(autoexchange): received key request from: "+toUTF8(pcli->pfnGetContactDisplayName(ccs->hContact, 0)));
char *tmp = UniGetContactSettingUtf(NULL, szGPGModuleName, "GPGPubKey", "");
if(tmp[0])
{
@@ -591,7 +590,7 @@ void SendMsgSvc_func(MCONTACT hContact, char *msg, DWORD flags)
if(bStripTags && bAppendTags)
{
if(bDebugLog)
- debuglog<<std::string(time_str()+": info: stripping tags in outgoing message, name: "+toUTF8((TCHAR*)CallService(MS_CLIST_GETCONTACTDISPLAYNAME, hContact, GCDNF_TCHAR)));
+ debuglog<<std::string(time_str()+": info: stripping tags in outgoing message, name: "+toUTF8(pcli->pfnGetContactDisplayName(hContact, 0)));
strip_tags(str);
}
/* for(std::wstring::size_type i = str.find(_T("\r\n")); i != std::wstring::npos; i = str.find(_T("\r\n"), i+1))
@@ -748,7 +747,7 @@ void SendMsgSvc_func(MCONTACT hContact, char *msg, DWORD flags)
}
if(bDebugLog)
- debuglog<<std::string(time_str()+": adding event to contact: "+toUTF8((TCHAR*)CallService(MS_CLIST_GETCONTACTDISPLAYNAME, hContact, GCDNF_TCHAR))+" on send message.");
+ debuglog<<std::string(time_str()+": adding event to contact: "+toUTF8(pcli->pfnGetContactDisplayName(hContact, 0))+" on send message.");
fix_line_term(str);
sent_msgs.push_back((HANDLE)CallContactService(hContact, PSS_MESSAGE, flags, (LPARAM)toUTF8(str).c_str()));
@@ -765,23 +764,23 @@ INT_PTR SendMsgSvc(WPARAM w, LPARAM l)
if (!msg)
{
if(bDebugLog)
- debuglog<<std::string(time_str()+": info: failed to get message data, name: "+toUTF8((TCHAR*)CallService(MS_CLIST_GETCONTACTDISPLAYNAME, (WPARAM)ccs->hContact, GCDNF_TCHAR)));
+ debuglog<<std::string(time_str()+": info: failed to get message data, name: "+toUTF8(pcli->pfnGetContactDisplayName(ccs->hContact, 0)));
return Proto_ChainSend(w, ccs);
}
if(strstr(msg,"-----BEGIN PGP MESSAGE-----"))
{
if(bDebugLog)
- debuglog<<std::string(time_str()+": info: encrypted messge, let it go, name: "+toUTF8((TCHAR*)CallService(MS_CLIST_GETCONTACTDISPLAYNAME, (WPARAM)ccs->hContact, GCDNF_TCHAR)));
+ debuglog<<std::string(time_str()+": info: encrypted messge, let it go, name: "+toUTF8(pcli->pfnGetContactDisplayName(ccs->hContact, 0)));
return Proto_ChainSend(w, ccs);
}
if(bDebugLog)
- debuglog<<std::string(time_str()+": info: contact have key, name: "+toUTF8((TCHAR*)CallService(MS_CLIST_GETCONTACTDISPLAYNAME, (WPARAM)ccs->hContact, GCDNF_TCHAR)));
+ debuglog<<std::string(time_str()+": info: contact have key, name: "+toUTF8(pcli->pfnGetContactDisplayName(ccs->hContact, 0)));
if(bDebugLog && db_mc_isMeta(ccs->hContact))
- debuglog<<std::string(time_str()+": info: protocol is metacontacts, name: "+toUTF8((TCHAR*)CallService(MS_CLIST_GETCONTACTDISPLAYNAME, (WPARAM)ccs->hContact, GCDNF_TCHAR)));
+ debuglog<<std::string(time_str()+": info: protocol is metacontacts, name: "+toUTF8(pcli->pfnGetContactDisplayName(ccs->hContact, 0)));
if(!isContactSecured(ccs->hContact) || db_mc_isMeta(ccs->hContact))
{
if(bDebugLog)
- debuglog<<std::string(time_str()+": info: contact not secured, name: "+toUTF8((TCHAR*)CallService(MS_CLIST_GETCONTACTDISPLAYNAME, (WPARAM)ccs->hContact, GCDNF_TCHAR)));
+ debuglog<<std::string(time_str()+": info: contact not secured, name: "+toUTF8(pcli->pfnGetContactDisplayName(ccs->hContact, 0)));
return Proto_ChainSend(w, ccs);
}
return returnNoError(ccs->hContact);
@@ -802,13 +801,13 @@ int HookSendMsg(WPARAM w, LPARAM l)
if(isContactSecured(hContact) && strstr((char*)dbei->pBlob, "-----BEGIN PGP MESSAGE-----")) //our service data, can be double added by metacontacts e.t.c.
{
if(bDebugLog)
- debuglog<<std::string(time_str()+": info(send handler): block pgp message event, name: "+toUTF8((TCHAR*)CallService(MS_CLIST_GETCONTACTDISPLAYNAME, hContact, GCDNF_TCHAR)));
+ debuglog<<std::string(time_str()+": info(send handler): block pgp message event, name: "+toUTF8(pcli->pfnGetContactDisplayName(hContact, 0)));
return 1;
}
if(bAutoExchange && (strstr((char*)dbei->pBlob, "-----PGP KEY RESPONSE-----") || strstr((char*)dbei->pBlob, "-----PGP KEY REQUEST-----"))) ///do not show service data in history
{
if(bDebugLog)
- debuglog<<std::string(time_str()+": info(send handler): block pgp key request/response event, name: "+toUTF8((TCHAR*)CallService(MS_CLIST_GETCONTACTDISPLAYNAME, hContact, GCDNF_TCHAR)));
+ debuglog<<std::string(time_str()+": info(send handler): block pgp key request/response event, name: "+toUTF8(pcli->pfnGetContactDisplayName(hContact, 0)));
return 1;
}
}
@@ -818,27 +817,27 @@ int HookSendMsg(WPARAM w, LPARAM l)
if(!isContactHaveKey(hContact))
{
if(bDebugLog)
- debuglog<<std::string(time_str()+": info: contact have not key, name: "+toUTF8((TCHAR*)CallService(MS_CLIST_GETCONTACTDISPLAYNAME, hContact, GCDNF_TCHAR)));
+ debuglog<<std::string(time_str()+": info: contact have not key, name: "+toUTF8(pcli->pfnGetContactDisplayName(hContact, 0)));
if(bAutoExchange && !strstr((char*)dbei->pBlob, "-----PGP KEY REQUEST-----") && !strstr((char*)dbei->pBlob, "-----BEGIN PGP PUBLIC KEY BLOCK-----") && gpg_valid)
{
if(bDebugLog)
- debuglog<<std::string(time_str()+": info: checking for autoexchange possibility, name: "+toUTF8((TCHAR*)CallService(MS_CLIST_GETCONTACTDISPLAYNAME, hContact, GCDNF_TCHAR)));
+ debuglog<<std::string(time_str()+": info: checking for autoexchange possibility, name: "+toUTF8(pcli->pfnGetContactDisplayName(hContact, 0)));
LPSTR proto = GetContactProto(hContact);
DWORD uin = db_get_dw(hContact, proto, "UIN", 0);
if(uin)
{
if(bDebugLog)
- debuglog<<std::string(time_str()+": info(autoexchange): protocol looks like icq, name: "+toUTF8((TCHAR*)CallService(MS_CLIST_GETCONTACTDISPLAYNAME, hContact, GCDNF_TCHAR)));
+ debuglog<<std::string(time_str()+": info(autoexchange): protocol looks like icq, name: "+toUTF8(pcli->pfnGetContactDisplayName(hContact, 0)));
char *proto = GetContactProto(hContact);
if( ProtoServiceExists(proto, PS_ICQ_CHECKCAPABILITY)) {
if(bDebugLog)
- debuglog<<std::string(time_str()+": info(autoexchange, icq): checking for autoexchange icq capability, name: "+toUTF8((TCHAR*)CallService(MS_CLIST_GETCONTACTDISPLAYNAME, hContact, GCDNF_TCHAR)));
+ debuglog<<std::string(time_str()+": info(autoexchange, icq): checking for autoexchange icq capability, name: "+toUTF8(pcli->pfnGetContactDisplayName(hContact, 0)));
ICQ_CUSTOMCAP cap = {0};
strncpy(cap.caps, "GPGAutoExchange", sizeof(cap.caps));
if (CallProtoService(proto, PS_ICQ_CHECKCAPABILITY, hContact, (LPARAM)&cap)) {
if(bDebugLog)
- debuglog<<std::string(time_str()+": info(autoexchange, icq): sending key requiest, name: "+toUTF8((TCHAR*)CallService(MS_CLIST_GETCONTACTDISPLAYNAME, hContact, GCDNF_TCHAR)));
+ 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));
@@ -853,7 +852,7 @@ int HookSendMsg(WPARAM w, LPARAM l)
if(jid[0])
{
if(bDebugLog)
- debuglog<<std::string(time_str()+": info(autoexchange): protocol looks like jabber, name: "+toUTF8((TCHAR*)CallService(MS_CLIST_GETCONTACTDISPLAYNAME, hContact, GCDNF_TCHAR)));
+ debuglog<<std::string(time_str()+": info(autoexchange): protocol looks like jabber, name: "+toUTF8(pcli->pfnGetContactDisplayName(hContact, 0)));
extern list <JabberAccount*> Accounts;
list<JabberAccount*>::iterator end = Accounts.end();
for(list<JabberAccount*>::iterator p = Accounts.begin(); p != end; p++)
@@ -873,7 +872,7 @@ int HookSendMsg(WPARAM w, LPARAM l)
if(str.find(_T("GPG_Key_Auto_Exchange:0")) != string::npos)
{
if(bDebugLog)
- debuglog<<std::string(time_str()+": info(autoexchange, jabber): autoexchange capability found, sending key request, name: "+toUTF8((TCHAR*)CallService(MS_CLIST_GETCONTACTDISPLAYNAME, hContact, GCDNF_TCHAR)));
+ 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));
@@ -911,7 +910,7 @@ int HookSendMsg(WPARAM w, LPARAM l)
if(!isContactSecured(hContact))
{
if(bDebugLog)
- debuglog<<std::string(time_str()+": event message: \""+(char*)dbei->pBlob+"\" passed event filter, contact "+toUTF8((TCHAR*)CallService(MS_CLIST_GETCONTACTDISPLAYNAME, hContact, GCDNF_TCHAR))+" is unsecured");
+ debuglog<<std::string(time_str()+": event message: \""+(char*)dbei->pBlob+"\" passed event filter, contact "+toUTF8(pcli->pfnGetContactDisplayName(hContact, 0))+" is unsecured");
return 0;
}
if(!(dbei->flags & DBEF_SENT) && db_mc_isMeta((MCONTACT)w))
@@ -922,7 +921,7 @@ int HookSendMsg(WPARAM w, LPARAM l)
if(strstr(tmp, "-----BEGIN PGP MESSAGE-----"))
{
if(bDebugLog)
- debuglog<<std::string(time_str()+": info(send handler): block pgp message event, name: "+toUTF8((TCHAR*)CallService(MS_CLIST_GETCONTACTDISPLAYNAME, hContact, GCDNF_TCHAR)));
+ debuglog<<std::string(time_str()+": info(send handler): block pgp message event, name: "+toUTF8(pcli->pfnGetContactDisplayName(hContact, 0)));
return 1;
}
}
diff --git a/plugins/New_GPG/src/options.cpp b/plugins/New_GPG/src/options.cpp
index 68d705f19c..bed5aaa640 100755
--- a/plugins/New_GPG/src/options.cpp
+++ b/plugins/New_GPG/src/options.cpp
@@ -122,7 +122,7 @@ static INT_PTR CALLBACK DlgProcGpgOpts(HWND hwndDlg, UINT msg, WPARAM wParam, LP
int i = 1, iRow = 0;
for(MCONTACT hContact = db_find_first(); hContact != NULL; hContact = db_find_next(hContact)) {
if(isContactHaveKey(hContact)) {
- TCHAR *name = (TCHAR*)CallService(MS_CLIST_GETCONTACTDISPLAYNAME, hContact, GCDNF_TCHAR);
+ TCHAR *name = pcli->pfnGetContactDisplayName(hContact, 0);
item.mask = LVIF_TEXT;
item.iItem = i;
item.iSubItem = 0;
@@ -735,7 +735,7 @@ static INT_PTR CALLBACK DlgProcLoadPublicKey(HWND hwndDlg,UINT msg,WPARAM wParam
TranslateDialogDefault(hwndDlg);
{
wstring msg = TranslateT("Load Public GPG Key for ");
- msg += (TCHAR*)CallService(MS_CLIST_GETCONTACTDISPLAYNAME, (WPARAM)hcnt, GCDNF_TCHAR);
+ msg += pcli->pfnGetContactDisplayName(hcnt, 0);
SetWindowText(hwndDlg, msg.c_str());
}
if(!hcnt)
@@ -811,7 +811,7 @@ static INT_PTR CALLBACK DlgProcLoadPublicKey(HWND hwndDlg,UINT msg,WPARAM wParam
str.append(tmp3);
mir_free(tmp3);
string msg = Translate("Load Public GPG Key for ");
- msg += (char*)CallService(MS_CLIST_GETCONTACTDISPLAYNAME, (WPARAM)hcnt, 0);
+ msg += _T2A(pcli->pfnGetContactDisplayName(hcnt, 0));
msg += " (Key ID: ";
msg += hcontact_data[hcnt].key_in_prescense;
msg += Translate(" found in presence, and exists in keyring.)");
diff --git a/plugins/New_GPG/src/utilities.cpp b/plugins/New_GPG/src/utilities.cpp
index 356657bb19..a3fceecef4 100755
--- a/plugins/New_GPG/src/utilities.cpp
+++ b/plugins/New_GPG/src/utilities.cpp
@@ -351,13 +351,13 @@ int onProtoAck(WPARAM w, LPARAM l)
dbsetting += "_Password";
pass = UniGetContactSettingUtf(NULL, szGPGModuleName, dbsetting.c_str(), _T(""));
if(mir_tstrlen(pass) > 0 && bDebugLog)
- debuglog<<std::string(time_str()+": info: found password in database for key ID: "+keyid+", trying to decrypt message from "+toUTF8((TCHAR*)CallService(MS_CLIST_GETCONTACTDISPLAYNAME, (WPARAM)ack->hContact, GCDNF_TCHAR))+" with password");
+ debuglog<<std::string(time_str()+": info: found password in database for key ID: "+keyid+", trying to decrypt message from "+toUTF8(pcli->pfnGetContactDisplayName(ack->hContact, 0))+" with password");
}
else
{
pass = UniGetContactSettingUtf(NULL, szGPGModuleName, "szKeyPassword", _T(""));
if(mir_tstrlen(pass) > 0 && bDebugLog)
- debuglog<<std::string(time_str()+": info: found password for all keys in database, trying to decrypt message from "+toUTF8((TCHAR*)CallService(MS_CLIST_GETCONTACTDISPLAYNAME, (WPARAM)ack->hContact, GCDNF_TCHAR))+" with password");
+ debuglog<<std::string(time_str()+": info: found password for all keys in database, trying to decrypt message from "+toUTF8(pcli->pfnGetContactDisplayName(ack->hContact, 0))+" with password");
}
if(mir_tstrlen(pass) > 0)
{
@@ -367,12 +367,12 @@ int onProtoAck(WPARAM w, LPARAM l)
else if(password)
{
if(bDebugLog)
- debuglog<<std::string(time_str()+": info: found password in memory, trying to decrypt message from "+toUTF8((TCHAR*)CallService(MS_CLIST_GETCONTACTDISPLAYNAME, (WPARAM)ack->hContact, GCDNF_TCHAR))+" with password");
+ debuglog<<std::string(time_str()+": info: found password in memory, trying to decrypt message from "+toUTF8(pcli->pfnGetContactDisplayName(ack->hContact, 0))+" with password");
cmd.push_back(L"--passphrase");
cmd.push_back(password);
}
else if (bDebugLog)
- debuglog<<std::string(time_str()+": info: passwords not found in database or memory, trying to decrypt message from "+toUTF8((TCHAR*)CallService(MS_CLIST_GETCONTACTDISPLAYNAME, (WPARAM)ack->hContact, GCDNF_TCHAR))+" with out password");
+ debuglog<<std::string(time_str()+": info: passwords not found in database or memory, trying to decrypt message from "+toUTF8(pcli->pfnGetContactDisplayName(ack->hContact, 0))+" with out password");
mir_free(pass);
mir_free(keyid);
}
@@ -387,7 +387,7 @@ int onProtoAck(WPARAM w, LPARAM l)
while(out.find("public key decryption failed: bad passphrase") != string::npos)
{
if(bDebugLog)
- debuglog<<std::string(time_str()+": info: failed to decrypt messaage from "+toUTF8((TCHAR*)CallService(MS_CLIST_GETCONTACTDISPLAYNAME, (WPARAM)ack->hContact, GCDNF_TCHAR))+" password needed, trying to get one");
+ debuglog<<std::string(time_str()+": info: failed to decrypt messaage from "+toUTF8(pcli->pfnGetContactDisplayName(ack->hContact, 0))+" password needed, trying to get one");
if(_terminate)
break;
{ //save inkey id
@@ -408,7 +408,7 @@ int onProtoAck(WPARAM w, LPARAM l)
if(password)
{
if(bDebugLog)
- debuglog<<std::string(time_str()+": info: found password in memory, trying to decrypt message from "+toUTF8((TCHAR*)CallService(MS_CLIST_GETCONTACTDISPLAYNAME, (WPARAM)ack->hContact, GCDNF_TCHAR)));
+ debuglog<<std::string(time_str()+": info: found password in memory, trying to decrypt message from "+toUTF8(pcli->pfnGetContactDisplayName(ack->hContact, 0)));
std::vector<wstring> tmp;
tmp.push_back(L"--passphrase");
tmp.push_back(password);
@@ -1065,7 +1065,7 @@ bool isContactSecured(MCONTACT hContact)
if(!gpg_enc)
{
if(bDebugLog)
- debuglog<<std::string(time_str()+": encryption is turned off for "+toUTF8((TCHAR*)CallService(MS_CLIST_GETCONTACTDISPLAYNAME, hContact, GCDNF_TCHAR)));
+ debuglog<<std::string(time_str()+": encryption is turned off for "+toUTF8(pcli->pfnGetContactDisplayName(hContact, 0)));
return false;
}
if(!db_mc_isMeta(hContact))
@@ -1075,13 +1075,13 @@ bool isContactSecured(MCONTACT hContact)
{
mir_free(key);
if(bDebugLog)
- debuglog<<std::string(time_str()+": encryption is turned off for "+toUTF8((TCHAR*)CallService(MS_CLIST_GETCONTACTDISPLAYNAME, hContact, GCDNF_TCHAR)));
+ debuglog<<std::string(time_str()+": encryption is turned off for "+toUTF8(pcli->pfnGetContactDisplayName(hContact, 0)));
return false;
}
mir_free(key);
}
if(bDebugLog)
- debuglog<<std::string(time_str()+": encryption is turned on for "+toUTF8((TCHAR*)CallService(MS_CLIST_GETCONTACTDISPLAYNAME, hContact, GCDNF_TCHAR)));
+ debuglog<<std::string(time_str()+": encryption is turned on for "+toUTF8(pcli->pfnGetContactDisplayName(hContact, 0)));
return true;
}