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/init.cpp | 131 +++++++++++++++++++++++++++++------------------------------ 1 file changed, 64 insertions(+), 67 deletions(-) (limited to 'src/init.cpp') 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) { -- cgit v1.2.3