From 5735d6a9ee7c250bd563529a3226174efe74ba38 Mon Sep 17 00:00:00 2001 From: Gluzskiy Alexandr Date: Sat, 22 Dec 2012 08:54:19 +0200 Subject: merged with mirnada ng main repo --- src/clist.cpp | 15 ++---- src/commonheaders.h | 3 +- src/icons.cpp | 74 ++++++----------------------- src/init.cpp | 131 +++++++++++++++++++++++++-------------------------- src/main.cpp | 36 +++++++++++++- src/messages.cpp | 21 +++++---- src/metacontacts.cpp | 2 +- src/options.cpp | 4 +- src/utilities.cpp | 20 ++++---- 9 files changed, 144 insertions(+), 162 deletions(-) (limited to 'src') diff --git a/src/clist.cpp b/src/clist.cpp index c64fb17..4533a46 100755 --- a/src/clist.cpp +++ b/src/clist.cpp @@ -16,26 +16,17 @@ #include "commonheaders.h" -extern HANDLE g_hCLIcon; void RefreshContactListIcons(void); +void setClistIcon(HANDLE); int onExtraImageListRebuilding(WPARAM, LPARAM) { - if(g_hCLIcon && ServiceExists(MS_CLIST_EXTRA_ADD_ICON) ) - RefreshContactListIcons(); + RefreshContactListIcons(); return 0; } - int onExtraImageApplying(WPARAM wParam, LPARAM) { - void setClistIcon(HANDLE); - if(g_hCLIcon && ServiceExists(MS_CLIST_EXTRA_SET_ICON)) - { -// IconExtraColumn iec = {0}; //need to init this - if( g_hCLIcon ) - setClistIcon((HANDLE)wParam); -// ExtraIcon_SetIcon(g_hCLIcon, (HANDLE)wParam, iec.hImage); - } + setClistIcon((HANDLE)wParam); return 0; } diff --git a/src/commonheaders.h b/src/commonheaders.h index 459d76e..b33b5c4 100755 --- a/src/commonheaders.h +++ b/src/commonheaders.h @@ -15,7 +15,7 @@ // Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. #ifndef COMMONHEADERS_H #define COMMONHEADERS_H -#define MIRANDA_VER 0x0901 +#define MIRANDA_VER 0x0A00 //windows #include #include @@ -73,6 +73,7 @@ using std::fstream; #include #include "m_extraicons.h" #include "m_metacontacts.h" +#include "win2k.h" #include "resource.h" diff --git a/src/icons.cpp b/src/icons.cpp index 3f89da2..4d16183 100755 --- a/src/icons.cpp +++ b/src/icons.cpp @@ -16,67 +16,34 @@ #include "commonheaders.h" -HANDLE IconLibDefine(TCHAR* desc, TCHAR* section, char* ident, HICON icon, char* def_file, int def_idx, int size) -{ - SKINICONDESC sid = {0}; - HANDLE hIcon; - - if(!size) - size = 16; - - sid.cbSize = sizeof( SKINICONDESC ); - sid.ptszSection = section; - sid.ptszDescription = desc; - sid.flags = SIDF_TCHAR; - - sid.pszName = ident; - sid.pszDefaultFile = def_file; - sid.iDefaultIndex = def_idx; - sid.hDefaultIcon = icon; - sid.cx = sid.cy = size; - - hIcon = Skin_AddIcon(&sid); - - return hIcon; -} +extern HINSTANCE hInst; +static IconItem iconList[] = +{ + { "Secured", "secured", IDI_SECURED }, + { "Unsecured", "unsecured", IDI_UNSECURED } +}; void InitIconLib() { - extern HINSTANCE hInst; - char lib[MAX_PATH]; - GetModuleFileNameA(hInst, lib, MAX_PATH); - TCHAR *module = mir_a2t(szGPGModuleName); - - IconLibDefine(_T("Secured"), module, "secured", NULL, lib, -IDI_SECURED,0); - IconLibDefine(_T("Unsecured"), module, "unsecured", NULL, lib, -IDI_UNSECURED,0); - mir_free(module); + Icon_Register(hInst, szGPGModuleName, iconList, SIZEOF(iconList)); } - - - - HICON IconLibGetIcon(const char* ident) { - return (HICON)CallService(MS_SKIN2_GETICON, 0, (LPARAM)ident); + return Skin_GetIcon(ident); } - - void IconLibReleaseIcon(const char* ident) { - CallService(MS_SKIN2_RELEASEICON, 0, (LPARAM)ident); + Skin_ReleaseIcon(ident); } - - HANDLE IconLibHookIconsChanged(MIRANDAHOOK hook) { - return HookEvent(ME_SKIN2_ICONSCHANGED, hook); + return HookEvent(ME_SKIN2_ICONSCHANGED, hook); } - void setClistIcon(HANDLE hContact) { bool enabled = isContactSecured(hContact); @@ -86,22 +53,10 @@ void setClistIcon(HANDLE hContact) hMC = metaGetContact(hContact); else if(metaIsProtoMetaContacts(hContact)) hMC = metaGetContact(hContact); - if(g_hCLIcon && enabled) - { - HICON icon = IconLibGetIcon("secured"); - IconExtraColumn iec = {0}; - iec.cbSize = sizeof(iec); - iec.hImage = (HANDLE)CallService(MS_CLIST_EXTRA_ADD_ICON, (WPARAM)icon, (LPARAM)0); - ExtraIcon_SetIcon(g_hCLIcon, hContact, iec.hImage); - if(hMC) - ExtraIcon_SetIcon(g_hCLIcon, hMC, iec.hImage); - } - else - { - ExtraIcon_SetIcon(g_hCLIcon, hContact, (HANDLE)0); // is it right ? hmm.., at least working.... - if(hMC) - ExtraIcon_SetIcon(g_hCLIcon, hMC, (HANDLE)0); - } + const char *szIconId = (enabled) ? "secured" : NULL; + ExtraIcon_SetIcon(g_hCLIcon, hContact, szIconId); + if(hMC) + ExtraIcon_SetIcon(g_hCLIcon, hMC, szIconId); } void setSrmmIcon(HANDLE h) @@ -139,7 +94,6 @@ void setSrmmIcon(HANDLE h) void RefreshContactListIcons() { - extern HANDLE g_hCLIcon; CallService(MS_CLUI_LISTBEGINREBUILD,0,0); HANDLE hContact = db_find_first(); while (hContact) diff --git a/src/init.cpp b/src/init.cpp index 24f8fe2..445b302 100755 --- a/src/init.cpp +++ b/src/init.cpp @@ -24,8 +24,6 @@ list Accounts; HINSTANCE hInst; HANDLE hLoadPubKey = NULL, hToggleEncryption = NULL, hOnPreBuildContactMenu = NULL, hSendKey = NULL, g_hCLIcon = NULL, hExportGpgKeys = NULL, hImportGpgKeys = NULL; -IconExtraColumn g_IEC = {0}; -static int OnModulesLoaded(WPARAM wParam,LPARAM lParam); extern char *date(); RECT key_from_keyserver_rect = {0}, firstrun_rect = {0}, new_key_rect = {0}, key_gen_rect = {0}, load_key_rect = {0}, import_key_rect = {0}, key_password_rect = {0}, load_existing_key_rect = {0}; XML_API xi = {0}; @@ -113,65 +111,8 @@ void init_vars() tabsrmm_used = isTabsrmmUsed(); } -extern "C" int __declspec(dllexport) Load() -{ - HookEvent(ME_SYSTEM_MODULESLOADED, OnModulesLoaded); - mir_getXI(&xi); //TODO: check if we have access to api - mir_getLP(&pluginInfo); - init_vars(); - CreateServiceFunction("/LoadPubKey",LoadKey); - CreateServiceFunction("/ToggleEncryption",ToggleEncryption); - CreateServiceFunction("/SendKey",SendKey); - CreateServiceFunction("/ExportGPGKeys",ExportGpGKeys); - CreateServiceFunction("/ImportGPGKeys",ImportGpGKeys); - - CLISTMENUITEM mi = {0}; - mi.cbSize=sizeof(mi); - mi.position=-0x7FFFFFFF; - mi.flags=CMIF_TCHAR; - mi.hIcon=LoadSkinnedIcon(SKINICON_OTHER_MIRANDA); - mi.ptszName=LPGENT("Load GPG public key"); - mi.pszService="/LoadPubKey"; - hLoadPubKey = Menu_AddContactMenuItem(&mi); - ZeroMemory(&mi,sizeof(mi)); - mi.cbSize=sizeof(mi); - mi.position=-0x7FFFFFFe; - mi.flags=CMIF_TCHAR; - mi.hIcon=LoadSkinnedIcon(SKINICON_OTHER_MIRANDA); - mi.ptszName=LPGENT("Toggle GPG encryption"); - mi.pszService="/ToggleEncryption"; - hToggleEncryption = Menu_AddContactMenuItem(&mi); - ZeroMemory(&mi,sizeof(mi)); - mi.cbSize=sizeof(mi); - mi.position=-0x7FFFFFFe; - mi.flags=CMIF_TCHAR; - mi.hIcon=LoadSkinnedIcon(SKINICON_OTHER_MIRANDA); - mi.ptszName=LPGENT("Send public key"); - mi.pszService="/SendKey"; - hSendKey = Menu_AddContactMenuItem(&mi); - ZeroMemory(&mi,sizeof(mi)); - mi.cbSize=sizeof(mi); - mi.position=-0x7FFFFFFF; - mi.flags=CMIF_TCHAR; - mi.hIcon=LoadSkinnedIcon(SKINICON_OTHER_MIRANDA); - mi.ptszName=LPGENT("Export GPG Public keys from all users"); - mi.pszService="/ExportGPGKeys"; - hExportGpgKeys = Menu_AddMainMenuItem(&mi); - ZeroMemory(&mi,sizeof(mi)); - mi.cbSize=sizeof(mi); - mi.position=-0x7FFFFFFF; - mi.flags=CMIF_TCHAR; - mi.hIcon=LoadSkinnedIcon(SKINICON_OTHER_MIRANDA); - mi.ptszName=LPGENT("Import GPG Public keys from all users"); - mi.pszService="/ImportGPGKeys"; - hImportGpgKeys = Menu_AddMainMenuItem(&mi); - - return 0; -} - static int OnModulesLoaded(WPARAM wParam,LPARAM lParam) { - int GpgOptInit(WPARAM wParam,LPARAM lParam); int OnPreBuildContactMenu(WPARAM w, LPARAM l); int RecvMsgSvc(WPARAM w, LPARAM l); @@ -232,15 +173,11 @@ static int OnModulesLoaded(WPARAM wParam,LPARAM lParam) HookEvent(ME_MSG_WINDOWEVENT, onWindowEvent); HookEvent(ME_MSG_ICONPRESSED, onIconPressed); - if(ServiceExists(MS_EXTRAICON_REGISTER)) - g_hCLIcon = ExtraIcon_Register(szGPGModuleName, Translate("GPG encryption status"), "secured", (MIRANDAHOOK)onExtraImageListRebuilding, (MIRANDAHOOK)onExtraImageApplying); - - + g_hCLIcon = ExtraIcon_Register(szGPGModuleName, Translate("GPG encryption status"), "secured", (MIRANDAHOOK)onExtraImageListRebuilding, (MIRANDAHOOK)onExtraImageApplying); - PROTOCOLDESCRIPTOR pd = {0}; - pd.cbSize=sizeof(PROTOCOLDESCRIPTOR); - pd.szName=szGPGModuleName; - pd.type=PROTOTYPE_ENCRYPTION; + PROTOCOLDESCRIPTOR pd = { sizeof(pd) }; + pd.szName = szGPGModuleName; + pd.type = PROTOTYPE_ENCRYPTION; CallService(MS_PROTO_REGISTERMODULE,0,(LPARAM)&pd); CreateProtoServiceFunction(szGPGModuleName, PSR_MESSAGE, (MIRANDASERVICE)RecvMsgSvc); @@ -253,6 +190,66 @@ static int OnModulesLoaded(WPARAM wParam,LPARAM lParam) return 0; } +extern "C" int __declspec(dllexport) Load() +{ + HookEvent(ME_SYSTEM_MODULESLOADED, OnModulesLoaded); + mir_getXI(&xi); //TODO: check if we have access to api + mir_getLP(&pluginInfo); + init_vars(); + CreateServiceFunction("/LoadPubKey",LoadKey); + CreateServiceFunction("/ToggleEncryption",ToggleEncryption); + CreateServiceFunction("/SendKey",SendKey); + CreateServiceFunction("/ExportGPGKeys",ExportGpGKeys); + CreateServiceFunction("/ImportGPGKeys",ImportGpGKeys); + + // !!!!!!!! check it later + CLISTMENUITEM mi = { sizeof(mi) }; + mi.position=-0x7FFFFFFF; + mi.flags=CMIF_TCHAR; + mi.hIcon=LoadSkinnedIcon(SKINICON_OTHER_MIRANDA); + mi.ptszName=LPGENT("Load GPG public key"); + mi.pszService="/LoadPubKey"; + hLoadPubKey = Menu_AddContactMenuItem(&mi); + + ZeroMemory(&mi,sizeof(mi)); + mi.cbSize=sizeof(mi); + mi.position=-0x7FFFFFFe; + mi.flags=CMIF_TCHAR; + mi.hIcon=LoadSkinnedIcon(SKINICON_OTHER_MIRANDA); + mi.ptszName=LPGENT("Toggle GPG encryption"); + mi.pszService="/ToggleEncryption"; + hToggleEncryption = Menu_AddContactMenuItem(&mi); + + ZeroMemory(&mi,sizeof(mi)); + mi.cbSize=sizeof(mi); + mi.position=-0x7FFFFFFe; + mi.flags=CMIF_TCHAR; + mi.hIcon=LoadSkinnedIcon(SKINICON_OTHER_MIRANDA); + mi.ptszName=LPGENT("Send public key"); + mi.pszService="/SendKey"; + hSendKey = Menu_AddContactMenuItem(&mi); + + ZeroMemory(&mi,sizeof(mi)); + mi.cbSize=sizeof(mi); + mi.position=-0x7FFFFFFF; + mi.flags=CMIF_TCHAR; + mi.hIcon=LoadSkinnedIcon(SKINICON_OTHER_MIRANDA); + mi.ptszName=LPGENT("Export GPG Public keys from all users"); + mi.pszService="/ExportGPGKeys"; + hExportGpgKeys = Menu_AddMainMenuItem(&mi); + + ZeroMemory(&mi,sizeof(mi)); + mi.cbSize=sizeof(mi); + mi.position=-0x7FFFFFFF; + mi.flags=CMIF_TCHAR; + mi.hIcon=LoadSkinnedIcon(SKINICON_OTHER_MIRANDA); + mi.ptszName=LPGENT("Import GPG Public keys from all users"); + mi.pszService="/ImportGPGKeys"; + hImportGpgKeys = Menu_AddMainMenuItem(&mi); + + return 0; +} + extern list transfers; extern "C" int __declspec(dllexport) Unload(void) { diff --git a/src/main.cpp b/src/main.cpp index b38d57c..9918b66 100755 --- a/src/main.cpp +++ b/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/src/messages.cpp b/src/messages.cpp index 7eb598c..292ad10 100755 --- a/src/messages.cpp +++ b/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)); @@ -568,11 +573,9 @@ int RecvMsgSvc(WPARAM w, LPARAM l) } else if(!isContactHaveKey(ccs->hContact) && bAutoExchange && gpg_valid && gpg_keyexist) { - LPSTR proto = (LPSTR)CallService(MS_PROTO_GETCONTACTBASEPROTO, (WPARAM)ccs->hContact, 0); + char *proto = GetContactProto(ccs->hContact); DWORD uin = DBGetContactSettingDword(ccs->hContact, proto, "UIN", 0); - if(uin) - { - char *proto = (char*)CallService(MS_PROTO_GETCONTACTBASEPROTO, (WPARAM)ccs->hContact, 0); + if(uin) { char svc[64]; strcpy(svc, proto); strcat(svc, PS_ICQ_CHECKCAPABILITY); @@ -610,7 +613,7 @@ int RecvMsgSvc(WPARAM w, LPARAM l) mir_free(caps); if(str.find(_T("GPG_Key_Auto_Exchange:0")) != string::npos) { - CallContactService(ccs->hContact, PSS_MESSAGE, (WPARAM)0, (LPARAM)"-----PGP KEY REQUEST-----"); + CallContactService(ccs->hContact, PSS_MESSAGE, 0, (LPARAM)"-----PGP KEY REQUEST-----"); return 0; } } @@ -841,11 +844,11 @@ int SendMsgSvc(WPARAM w, LPARAM l) if(bAutoExchange && !strstr(msg, "-----PGP KEY REQUEST-----") && !strstr(msg, "-----BEGIN PGP PUBLIC KEY BLOCK-----") && gpg_valid) { void send_encrypted_msgs_thread(HANDLE hContact); - LPSTR proto = (LPSTR)CallService(MS_PROTO_GETCONTACTBASEPROTO, (WPARAM)ccs->hContact, 0); + LPSTR proto = GetContactProto(ccs->hContact); DWORD uin = DBGetContactSettingDword(ccs->hContact, proto, "UIN", 0); if(uin) { - char *proto = (char*)CallService(MS_PROTO_GETCONTACTBASEPROTO, (WPARAM)ccs->hContact, 0); + char *proto = GetContactProto(ccs->hContact); char svc[64]; strcpy(svc, proto); strcat(svc, PS_ICQ_CHECKCAPABILITY); diff --git a/src/metacontacts.cpp b/src/metacontacts.cpp index 1abc2aa..ab3c60b 100755 --- a/src/metacontacts.cpp +++ b/src/metacontacts.cpp @@ -21,7 +21,7 @@ extern bool bMetaContacts; bool metaIsProtoMetaContacts(HANDLE hContact) { if(bMetaContacts) { - LPSTR proto = (LPSTR)CallService(MS_PROTO_GETCONTACTBASEPROTO, (WPARAM)hContact, 0); + LPSTR proto = GetContactProto(hContact); if( proto && strcmp(proto,"MetaContacts")==0 ) { return true; } diff --git a/src/options.cpp b/src/options.cpp index be20c44..17a383f 100755 --- a/src/options.cpp +++ b/src/options.cpp @@ -83,7 +83,7 @@ int GpgOptInit(WPARAM wParam,LPARAM lParam) odp.ptszTitle = _T(szGPGModuleName); odp.ptszGroup = LPGENT("Services"); odp.ptszTab = LPGENT("Advanced"); - odp.flags=ODPF_BOLDGROUPS | ODPF_EXPERTONLY | ODPF_TCHAR; + odp.flags=ODPF_BOLDGROUPS | ODPF_TCHAR; odp.pfnDlgProc = DlgProcGpgAdvOpts; Options_AddPage(wParam, &odp); @@ -156,7 +156,7 @@ static INT_PTR CALLBACK DlgProcGpgOpts(HWND hwndDlg, UINT msg, WPARAM wParam, LP item.pszText = name; iRow = ListView_InsertItem(hwndList, &item); ListView_SetItemText(hwndList, iRow, 0, name); - TCHAR *tmp = mir_a2t((char*)CallService(MS_PROTO_GETCONTACTBASEPROTO, (WPARAM)hContact, 0)); + TCHAR *tmp = mir_a2t(GetContactProto(hContact)); ListView_SetItemText(hwndList, iRow, 4, tmp); mir_free(tmp); tmp2 = UniGetContactSettingUtf(hContact, szGPGModuleName, "KeyID", ""); diff --git a/src/utilities.cpp b/src/utilities.cpp index a734ec0..3f25394 100755 --- a/src/utilities.cpp +++ b/src/utilities.cpp @@ -195,7 +195,7 @@ INT_PTR SendKey(WPARAM w, LPARAM l) hContact = metaGetMostOnline(hContact); char *szMessage; { - LPSTR proto = (LPSTR)CallService(MS_PROTO_GETCONTACTBASEPROTO, (WPARAM)hContact, 0); + LPSTR proto = GetContactProto(hContact); PROTOACCOUNT *acc = (PROTOACCOUNT*)CallService(MS_PROTO_GETACCOUNT, 0, (LPARAM)proto); std::string acc_str; if(acc) @@ -257,8 +257,8 @@ INT_PTR ToggleEncryption(WPARAM w, LPARAM l) setSrmmIcon(hContact); setClistIcon(hContact); enc = enc?0:1; - CLISTMENUITEM mi = {0}; - mi.cbSize=sizeof(mi); + + CLISTMENUITEM mi = { 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); @@ -270,8 +270,8 @@ int OnPreBuildContactMenu(WPARAM w, LPARAM l) HANDLE hContact = (HANDLE)w; if(metaIsProtoMetaContacts(hContact)) hContact = metaGetMostOnline(hContact); - CLISTMENUITEM mi = {0}; - mi.cbSize=sizeof(mi); + + CLISTMENUITEM mi = { sizeof(mi) }; mi.flags = CMIM_NAME; TCHAR *tmp = UniGetContactSettingUtf(hContact, szGPGModuleName, "GPGPubKey", _T("")); if(_tcslen(tmp) < 1) @@ -321,6 +321,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) @@ -567,7 +568,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 .... @@ -1214,7 +1215,7 @@ int SendBroadcast( HANDLE hContact, int type, int result, HANDLE hProcess, LPARA ACKDATA ack; memset(&ack,0,sizeof(ack)); ack.cbSize = sizeof( ACKDATA ); - ack.szModule = szGPGModuleName;// (char*)CallService(MS_PROTO_GETCONTACTBASEPROTO, (WPARAM)hContact, 0); + ack.szModule = szGPGModuleName;// GetContactProto(hContact); ack.hContact = hContact; ack.type = type; ack.result = result; @@ -1251,6 +1252,7 @@ int returnNoError(HANDLE hContact) { return 777; } // end from secureim + string toUTF8(wstring str) @@ -1347,7 +1349,7 @@ bool isTabsrmmUsed() enm.lParam = (LPARAM)&found; enm.pfnEnumProc = (DBSETTINGENUMPROC)&handleEnum; enm.szModule = "PluginDisable"; - if(CallService(MS_DB_CONTACT_ENUMSETTINGS, (WPARAM)NULL, (LPARAM)&enm) == -1) + if(CallService(MS_DB_CONTACT_ENUMSETTINGS, 0, (LPARAM)&enm) == -1) return false; return found; @@ -1382,7 +1384,7 @@ INT_PTR ExportGpGKeys(WPARAM w, LPARAM l) std::string key = k; mir_free(k); - const char* proto = (const char*)CallService(MS_PROTO_GETCONTACTBASEPROTO, (WPARAM)hContact, 0); + const char* proto = (const char*)GetContactProto(hContact); std::string id = "Comment: login "; const char * uid = (const char*)CallProtoService(proto, PS_GETCAPS, (WPARAM)PFLAG_UNIQUEIDSETTING, 0); DBVARIANT dbv = {0}; -- cgit v1.2.3