extern "C" SAMETIME_API int Load(PLUGINLINK *link) { pluginLink=link; if(!IsUnicodeOS()) { MessageBox(0, TranslateT("This plugin requires a Unicode capable Windows installation."), TranslateT("Sametime Error"), MB_OK | MB_ICONERROR); return 1; } if ( !ServiceExists( MS_DB_CONTACT_GETSETTING_STR )) { MessageBox( 0, TranslateT( "This plugin requires db3x plugin version 0.5.1.0 or later." ), TranslateT("Sametime Error"), MB_OK ); return 1; } DuplicateHandle( GetCurrentProcess(), GetCurrentThread(), GetCurrentProcess(), &mainThread, THREAD_SET_CONTEXT, FALSE, 0 ); mainThreadId = GetCurrentThreadId(); previous_status = current_status = ID_STATUS_OFFLINE; if(ServiceExists(MS_LANGPACK_GETCODEPAGE)) code_page = CallService(MS_LANGPACK_GETCODEPAGE, 0, 0); mir_getMMI(&mmi); mir_getUTFI(&utfi); if(ServiceExists(MS_DB_SETSETTINGRESIDENT)) { // 0.6+ char buff[256]; mir_snprintf(buff, 256, "%s/%s", PROTO, "Status"); CallService(MS_DB_SETSETTINGRESIDENT, TRUE, (LPARAM)buff); mir_snprintf(buff, 256, "%s/%s", PROTO, "IdleTS"); CallService(MS_DB_SETSETTINGRESIDENT, TRUE, (LPARAM)buff); } InitAwayMsg(); InitCritSection(); // Get module name from DLL file name { char* str1; char str2[MAX_PATH]; GetModuleFileNameA(hInst, str2, MAX_PATH); str1 = strrchr(str2, '\\'); if (str1 != NULL && strlen(str1+1) > 4) { strncpy(PROTO, str1+1, strlen(str1+1)-4); PROTO[strlen(str1+1)-3] = 0; } CharUpperA(PROTO); strcpy(PROTO_GROUPS, PROTO); strcat(PROTO_GROUPS, "_GROUPS"); } PROTOCOLDESCRIPTOR pd = {0}; pd.cbSize = sizeof(pd); pd.szName = PROTO; pd.type = PROTOTYPE_PROTOCOL; CallService(MS_PROTO_REGISTERMODULE,0,(LPARAM)&pd); InitUtils(); CreatePluginServices(); LoadOptions(); //DeleteAllContacts(); //!!! SetAllOffline(); HookEvent(ME_SYSTEM_MODULESLOADED, OnModulesLoaded); HookEvent(ME_OPT_INITIALISE, OptInit ); HookEvent(ME_SYSTEM_PRESHUTDOWN, OnPreShutdown); HookEvent(ME_SYSTEM_SHUTDOWN, OnShutdown); return 0; }
extern "C" int POPUPS2_API Load(PLUGINLINK *link) { pluginLink = link; mir_getLI(&li); mir_getMMI(&mmi); InitMessagePump(); InitOptions(); InitNotify(); hEventPreShutdown = HookEvent(ME_SYSTEM_PRESHUTDOWN, PreShutdown); hEventModulesLoaded = HookEvent(ME_SYSTEM_MODULESLOADED, ModulesLoaded); /* // test popup classes PopupClass test = {0}; test.cbSize = sizeof(test); test.flags = PCF_TCHAR; test.hIcon = LoadIcon(0, IDI_WARNING); test.colorBack = RGB(0, 0, 0); test.colorText = RGB(255, 255, 255); test.iSeconds = 10; test.ptszDescription = TranslateT("Test popup class"); test.pszName = "popup/testclass"; CallService(MS_POPUP_REGISTERCLASS, 0, (WPARAM)&test); */ return 0; }
extern "C" int __declspec(dllexport) Load(PLUGINLINK *link) { pluginLink = link; mir_getMMI(&mmi); mir_getMD5I(&md5i); mir_getUTFI(&utfi); mir_getLI(&li); pcli = reinterpret_cast<CLIST_INTERFACE*>( CallService( MS_CLIST_RETRIEVE_INTERFACE,0,reinterpret_cast<LPARAM>(g_hInstance)) ); PROTOCOLDESCRIPTOR pd = {sizeof(pd)}; pd.szName = "Twitter"; pd.type = PROTOTYPE_PROTOCOL; pd.fnInit = protoInit; pd.fnUninit = protoUninit; CallService(MS_PROTO_REGISTERMODULE,0,reinterpret_cast<LPARAM>(&pd)); g_hEvents[0] = HookEvent(ME_SYSTEM_MODULESLOADED,OnModulesLoaded); InitIcons(); InitContactMenus(); return 0; }
int __declspec(dllexport) Load(PLUGINLINK *link) { PROTOCOLDESCRIPTOR pd; pluginLink = link; mir_getMMI( &mmi ); mir_getMD5I( &md5i ); mir_getSHA1I( &sha1i ); mir_getUTFI( &utfi ); DuplicateHandle(GetCurrentProcess(), GetCurrentThread(), GetCurrentProcess(), &hMainThread, THREAD_SET_CONTEXT, FALSE, 0); srand((unsigned) time(NULL)); TlenRegisterIcons(); // Register protocol module ZeroMemory(&pd, sizeof(PROTOCOLDESCRIPTOR)); pd.cbSize = sizeof(PROTOCOLDESCRIPTOR); pd.szName = "TLEN"; pd.fnInit = ( pfnInitProto )tlenProtoInit; pd.fnUninit = ( pfnUninitProto )tlenProtoUninit; pd.type = PROTOTYPE_PROTOCOL; CallService(MS_PROTO_REGISTERMODULE, 0, (LPARAM) &pd); return 0; }
extern "C" int __declspec(dllexport) Load(PLUGINLINK *link) { char text[_MAX_PATH]; char *p, *q; int wdsize = GetCurrentDirectory(0, NULL); workingDir = new TCHAR[wdsize]; GetCurrentDirectory(wdsize, workingDir); Utils::convertPath(workingDir); GetModuleFileNameA(hInstance, text, sizeof(text)); p = strrchr(text, '\\'); p++; q = strrchr(p, '.'); *q = '\0'; ieviewModuleName = _strdup(p); _strupr(ieviewModuleName); pluginLink = link; mir_getMMI( &mmi ); Utils::hookEvent_Ex(ME_OPT_INITIALISE, IEViewOptInit); Utils::hookEvent_Ex(ME_SYSTEM_MODULESLOADED, ModulesLoaded); Utils::hookEvent_Ex(ME_SYSTEM_PRESHUTDOWN, PreShutdown); Utils::createServiceFunction_Ex(MS_IEVIEW_WINDOW, HandleIEWindow); Utils::createServiceFunction_Ex(MS_IEVIEW_EVENT, HandleIEEvent); Utils::createServiceFunction_Ex(MS_IEVIEW_EVENT, HandleIENavigate); hHookOptionsChanged = CreateHookableEvent(ME_IEVIEW_OPTIONSCHANGED); return 0; }
extern "C" int __declspec(dllexport) Load(PLUGINLINK *link) { #if _MSC_VER >= 1300 Log("%s", "Entering function " __FUNCTION__); #endif pluginLink = link; mir_getLP(&pluginInfo); mir_getMMI(&mmi); Log("%s", "Creating service functions ..."); InitServices(); InitEvents(); #ifdef _DEBUG hTestPlugin = CreateServiceFunction(MS_FOLDERS_TEST_PLUGIN, TestPlugin); CLISTMENUITEM mi = {0}; mi.cbSize=sizeof(mi); mi.position=300050000; mi.flags=0; mi.hIcon=0; mi.pszName=Translate("Test folders"); mi.pszService=MS_FOLDERS_TEST_PLUGIN; CallService(MS_CLIST_ADDMAINMENUITEM,0,(LPARAM)&mi); #endif #if _MSC_VER >= 1300 Log("%s", "Hooking events ..."); #endif HookEvents(); #if _MSC_VER >= 1300 Log("%s", "Leaving function " __FUNCTION__); #endif return 0; }
extern "C" int __declspec(dllexport) Load(PLUGINLINK *link) { pluginLink = link; CHECK_VERSION("Voice Service") if (Pa_Initialize() != paNoError) MessageBox(NULL, TranslateT("Error initializing portaudio."), TranslateT("Voice Service"), MB_OK | MB_ICONERROR); // TODO Assert results here mir_getMMI(&mmi); mir_getUTFI(&utfi); mir_getLI(&li); CreateServiceFunction(MS_VOICESERVICE_CLIST_DBLCLK, CListDblClick); CreateServiceFunction(MS_VOICESERVICE_REGISTER, VoiceRegister); CreateServiceFunction(MS_VOICESERVICE_UNREGISTER, VoiceUnregister); // Hooks hHooks.push_back( HookEvent(ME_SYSTEM_MODULESLOADED, ModulesLoaded) ); hHooks.push_back( HookEvent(ME_SYSTEM_PRESHUTDOWN, PreShutdown) ); hHooks.push_back( HookEvent(ME_PROTO_ACK, ProtoAck) ); return 0; }
extern "C" int __declspec(dllexport) Load(PLUGINLINK *link) { pluginLink = link; mir_getMMI( &mmi ); mir_getLI( &li ); LoadModernOptsModule(); return 0; }
int __declspec(dllexport) Load(PLUGINLINK * link) { pluginLink = link; mir_getMMI(&mmi); mir_getUTFI(&utfi); mir_getLI(&li); mir_getTMI(&tmi); return LoadSendRecvMessageModule(); }
extern "C" __declspec(dllexport) int Load(PLUGINLINK *link) { pluginLink = link; mir_getMMI(&mmi); mir_getUTFI(&utfi); mir_getLP(&pluginInfoEx); hHook = HookEvent(ME_SYSTEM_MODULESLOADED, OnModulesLoaded); return 0; }
int __declspec(dllexport) Load(PLUGINLINK *link) { BOOL bFlag = FALSE; HINSTANCE hDll; #ifndef NDEBUG //mem leak detector :-) Thanks Tornado! int flag = _CrtSetDbgFlag(_CRTDBG_REPORT_FLAG); // Get current flag flag |= _CRTDBG_LEAK_CHECK_DF; // Turn on leak-checking bit _CrtSetDbgFlag(flag); // Set flag to the new value #endif pluginLink = link; // set the memory & utf8 managers mir_getMMI( &memoryManagerInterface ); mir_getUTFI( &utfi ); mir_getLP( &pluginInfo ); hDll = LoadLibraryA("riched20.dll"); if ( hDll ) { char modulePath[MAX_PATH]; if (GetModuleFileNameA(hDll, modulePath, MAX_PATH)) { DWORD dummy; VS_FIXEDFILEINFO* vsInfo; UINT vsInfoSize; DWORD size = GetFileVersionInfoSizeA(modulePath, &dummy); BYTE* buffer = (BYTE*) mir_alloc(size); if (GetFileVersionInfoA(modulePath, 0, size, buffer)) if (VerQueryValueA(buffer, "\\", (LPVOID*) &vsInfo, &vsInfoSize)) if (LOWORD(vsInfo->dwFileVersionMS) != 0) bFlag= TRUE; mir_free(buffer); } } if ( !bFlag ) { if (IDYES == MessageBox(0, TranslateT("Miranda could not load the Chat plugin because Microsoft Rich Edit v 3 is missing.\nIf you are using Windows 95/98/NT or WINE please upgrade your Rich Edit control.\n\nDo you want to download an update now?."),TranslateT("Information"),MB_YESNO|MB_ICONINFORMATION)) CallService(MS_UTILS_OPENURL, 1, (LPARAM) "http://members.chello.se/matrix/re3/richupd.exe"); FreeLibrary(GetModuleHandleA("riched20.dll")); return 1; } UpgradeCheck(); g_hMenu = LoadMenu(g_hInst, MAKEINTRESOURCE(IDR_MENU)); InitREOleCallback(); HookEvents(); CreateServiceFunctions(); CreateHookableEvents(); OptionsInit(); TabsInit(); return 0; }
extern "C" int __declspec( dllexport ) Load( PLUGINLINK *link ) { pluginLink = link; // set the memory, lists & utf8 managers mir_getMMI( &mmi ); mir_getLI( &li ); mir_getUTFI( &utfi ); mir_getMD5I( &md5i ); mir_getSHA1I( &sha1i ); mir_getXI( &xi ); mir_getTMI( &tmi ); mir_getLP( &pluginInfo ); CallService( MS_UTILS_GETCOUNTRYLIST, ( WPARAM )&g_cbCountries, ( LPARAM )&g_countries ); setlocale(LC_ALL, ""); mir_snprintf( szVersion, sizeof( szVersion ), Translate("Jabber protocol plugin for Miranda IM (%s)"), __DATE__ ); pcli = ( CLIST_INTERFACE* )CallService(MS_CLIST_RETRIEVE_INTERFACE, 0, (LPARAM)hInst); // Register protocol module PROTOCOLDESCRIPTOR pd; ZeroMemory( &pd, sizeof( PROTOCOLDESCRIPTOR )); pd.cbSize = sizeof( PROTOCOLDESCRIPTOR ); pd.szName = "JABBER"; pd.fnInit = ( pfnInitProto )jabberProtoInit; pd.fnUninit = ( pfnUninitProto )jabberProtoUninit; pd.type = PROTOTYPE_PROTOCOL; CallService( MS_PROTO_REGISTERMODULE, 0, ( LPARAM )&pd ); // Load some fuctions HMODULE hDll; if ( hDll = GetModuleHandleA( "gdi32.dll" )) JabberAlphaBlend = (BOOL (WINAPI *)(HDC, int, int, int, int, HDC, int, int, int, int, BLENDFUNCTION)) GetProcAddress(hDll, "GdiAlphaBlend"); if ( JabberAlphaBlend == NULL && ( hDll = LoadLibraryA("msimg32.dll" ))) JabberAlphaBlend = (BOOL (WINAPI *)(HDC, int, int, int, int, HDC, int, int, int, int, BLENDFUNCTION)) GetProcAddress(hDll, "AlphaBlend"); if ( IsWinVerXPPlus() ) { if ( hDll = GetModuleHandleA("uxtheme")) { JabberDrawThemeParentBackground = (HRESULT (WINAPI *)(HWND,HDC,RECT *))GetProcAddress(hDll, "DrawThemeParentBackground"); JabberIsThemeActive = (BOOL (WINAPI *)())GetProcAddress(hDll, "IsThemeActive"); } } g_IconsInit(); g_MenuInit(); hModulesLoaded = HookEvent(ME_SYSTEM_MODULESLOADED, OnModulesLoaded); hModulesLoadedTB = HookEvent(ME_TB_MODULELOADED, g_OnModernToolbarInit); JabberUserInfoInit(); return 0; }
extern "C" int __declspec(dllexport) Load(PLUGINLINK *link) { pluginLink = link; CHECK_VERSION("SIP_CLI") // TODO Assert results here mir_getMMI(&mmi); mir_getUTFI(&utfi); HookEvent(ME_SYSTEM_MODULESLOADED, ModulesLoaded); HookEvent(ME_SYSTEM_PRESHUTDOWN, PreShutdown); return 0; }
extern "C" int __declspec(dllexport) Load(PLUGINLINK *link) { pluginLink = link; if (UnicodeCheck(pluginInfoEx.shortName, FALSE)) return 0; mir_getMMI( &mmi ); mir_getLI( &li ); mir_getLP( &pluginInfoEx ); hExitHook = HookEvent(ME_SYSTEM_OKTOEXIT, Exit); hModulesLoadedHook = HookEvent(ME_SYSTEM_MODULESLOADED, ModulesLoaded); LoadVarModule(); return 0; }
int __declspec(dllexport) Load(PLUGINLINK * link) { pluginLink = link; // set the memory manager mir_getMMI( &mmi ); mir_getLI( &li ); mir_getUTFI( &utfi ); mir_getTMI(&tmi); mir_getLP( &pluginInfo ); if (IsWinVer7Plus()) CoCreateInstance(&CLSID_TaskbarList, NULL, CLSCTX_ALL, &IID_ITaskbarList3, (void**)&pTaskbarInterface); InitSendQueue(); return OnLoadModule(); }
PLUGININTERFACE int CListInitialise(PLUGINLINK * link) { pluginLink=link; /* #ifdef _DEBUG _CrtSetBreakAlloc(11166); #endif */ HMODULE hKernel = GetModuleHandleA( "kernel32.dll" ); fnTryEnterCriticalSection = ( pfnTryEnterCriticalSection )GetProcAddress( hKernel, "TryEnterCriticalSection" ); HMODULE hUser = GetModuleHandleA( "user32.dll" ); fnGetMenuBarInfo = ( pfnGetMenuBarInfo )GetProcAddress( hUser, "GetMenuBarInfo" ); fnGetScrollBarInfo = ( pfnGetScrollBarInfo )GetProcAddress( hUser, "GetScrollBarInfo" ); fnMsgWaitForMultipleObjectsEx = ( pfnMsgWaitForMultipleObjectsEx )GetProcAddress( hUser, "MsgWaitForMultipleObjectsEx" ); if (( fnGetAncestor = ( pfnGetAncestor )GetProcAddress( hUser, "GetAncestor" )) == NULL ) fnGetAncestor = MyGetAncestor; g_dwMainThreadID = GetCurrentThreadId(); DuplicateHandle(GetCurrentProcess(),GetCurrentThread(),GetCurrentProcess(),&g_hMainThread,0,FALSE,DUPLICATE_SAME_ACCESS); mir_getMMI(&mmi); mir_getUTFI(&utfi); mir_getLI(&li); mir_getTMI(&tmi); CHECKRES ( PreLoadContactListModule ( ) ); CHECKRES ( SubclassClistInterface ( ) ); CHECKRES ( CreateHookableEvents ( ) ); CHECKRES ( XPThemesLoadModule ( ) ); CHECKRES ( SkinEngineLoadModule ( ) ); CHECKRES ( BackgroundsLoadModule ( ) ); CHECKRES ( CluiLoadModule ( ) ); CHECKRES ( ClcLoadModule ( ) ); CHECKRES ( ToolbarButtonLoadModule( ) ); CHECKRES ( ToolbarLoadModule() ); TRACE( "CListInitialise Modern Contact List ... Done\r\n" ); return S_OK; }
extern "C" int __declspec(dllexport)Load(PLUGINLINK *link) { pluginLink = link; /** * Grab the interface handles (through pluginLink) */ int i = mir_getLI( &li ); if (i) { MessageBox(NULL, _T("Can not retrieve the core List Interface."), _T("Yahoo Plugin Load Failed"), MB_ICONERROR | MB_OK); return 1; } mir_getMMI( &mmi ); mir_getUTFI( &utfi ); mir_getMD5I( &md5i ); mir_getLP( &pluginInfo ); PROTOCOLDESCRIPTOR pd = { 0 }; pd.cbSize = sizeof(pd); pd.szName = "YAHOO"; pd.type = PROTOTYPE_PROTOCOL; pd.fnInit = ( pfnInitProto )yahooProtoInit; pd.fnUninit = ( pfnUninitProto )yahooProtoUninit; CallService( MS_PROTO_REGISTERMODULE, 0, ( LPARAM )&pd ); NETLIBUSER nlu = {0}; nlu.cbSize = sizeof(nlu); nlu.flags = NUF_TCHAR | NUF_OUTGOING | NUF_HTTPCONNS; nlu.szSettingsModule = "YAHOO/libyahoo2"; nlu.ptszDescriptiveName = TranslateT("YAHOO plugin HTTP connections"); g_hNetlibUser = ( HANDLE )YAHOO_CallService( MS_NETLIB_REGISTERUSER, 0, ( LPARAM )&nlu ); YmsgrLinksInit(); /** * Register LibYahoo2 callback functions */ register_callbacks(); return 0; }
int Load(PLUGINLINK *link) { pluginLink = link; DisableThreadLibraryCalls(g_hInst); // get memoryManagerInterface address mir_getMMI( &mmi ); // register plugin module PROTOCOLDESCRIPTOR pd; memset(&pd,0,sizeof(pd)); pd.cbSize = sizeof(pd); pd.szName = (char*)szModuleName; pd.type = PROTOTYPE_ENCRYPTION; CallService(MS_PROTO_REGISTERMODULE, 0, (LPARAM)&pd); // hook events HookEvent(ME_SYSTEM_MODULESLOADED,onModulesLoaded); return 0; }
// returns 0 if all the APIs are injected otherwise, 1 static int LoadDatabase( char * profile, void * plink ) { PLUGINLINK *link = plink; #ifdef _DEBUG _CrtSetDbgFlag( _CRTDBG_ALLOC_MEM_DF | _CRTDBG_LEAK_CHECK_DF); #endif // don't need thread notifications strncpy(szDbPath, profile, sizeof(szDbPath)); // this is like Load()'s pluginLink pluginLink=link; // set the memory, lists & UTF8 manager mir_getLI( &li ); mir_getMMI( &mmi ); mir_getUTFI( &utfi ); mir_getLP( &pluginInfo ); // inject all APIs and hooks into the core return LoadDatabaseModule(); }
extern "C" int __declspec(dllexport) Load( PLUGINLINK *link ) { pluginLink = link; mir_getMMI( &mmi ); mir_getUTFI( &utfi ); mir_getLI( &li ); AddIcons(); InitTimers(); InitServers(); InitContactMenus(); // register protocol PROTOCOLDESCRIPTOR pd = { 0 }; pd.cbSize = sizeof( pd ); pd.szName = "IRC"; pd.type = PROTOTYPE_PROTOCOL; pd.fnInit = ( pfnInitProto )ircProtoInit; pd.fnUninit = ( pfnUninitProto )ircProtoUninit; CallService( MS_PROTO_REGISTERMODULE, 0, (LPARAM)&pd ); return 0; }
extern "C" int __declspec(dllexport) Load(PLUGINLINK *link) { pluginLink = link; mir_getMMI(&mmi); mir_getMD5I(&md5i); mir_getUTFI(&utfi); mir_getLI(&li); hMooduleLoaded = HookEvent(ME_SYSTEM_MODULESLOADED, OnModulesLoaded); PROTOCOLDESCRIPTOR pd = {0}; pd.cbSize = sizeof(pd); pd.szName = "AIM"; pd.type = PROTOTYPE_PROTOCOL; pd.fnInit = protoInit; pd.fnUninit = protoUninit; CallService(MS_PROTO_REGISTERMODULE, 0, (LPARAM) & pd); InitThemeSupport(); InitIcons(); return 0; }
extern "C" int __declspec(dllexport) Load(PLUGINLINK *link) { pluginLink = link; mir_getMMI(&mmi); mir_getUTFI(&utfi); mir_getLP(&pluginInfo); DWORD ret = CallService(MS_CLUI_GETCAPS, CLUICAPS_FLAGS2, 0); clistFirstSlot = HIWORD(ret); clistSlotCount = LOWORD(ret); // Icons IcoLib_Register("AlwaysVis", "Contact List", "Always Visible", IDI_ALWAYSVIS); IcoLib_Register("NeverVis", "Contact List", "Never Visible", IDI_NEVERVIS); IcoLib_Register("ChatActivity", "Contact List", "Chat Activity", IDI_CHAT); IcoLib_Register("gender_male", "Contact List", "Male", IDI_MALE); IcoLib_Register("gender_female", "Contact List", "Female", IDI_FEMALE); // Hooks hHooks.push_back(HookEvent(ME_SYSTEM_MODULESLOADED, &ModulesLoaded)); hHooks.push_back(HookEvent(ME_SYSTEM_PRESHUTDOWN, &PreShutdown)); hHooks.push_back(HookEvent(ME_CLIST_EXTRA_LIST_REBUILD, &ClistExtraListRebuild)); hHooks.push_back(HookEvent(ME_CLIST_EXTRA_IMAGE_APPLY, &ClistExtraImageApply)); hHooks.push_back(HookEvent(ME_CLIST_EXTRA_CLICK, &ClistExtraClick)); // Services hServices.push_back(CreateServiceFunction(MS_EXTRAICON_REGISTER, &ExtraIcon_Register)); hServices.push_back(CreateServiceFunction(MS_EXTRAICON_SET_ICON, &ExtraIcon_SetIcon)); DefaultExtraIcons_Load(); return 0; }
int __declspec(dllexport) Load(PLUGINLINK *link) { // Copy data pluginLink = link; // CHECK_VERSION("My Details") mir_getMMI(&mmi); mir_getUTFI(&utfi); init_list_interface(); // Hook event to load messages and show first one hModulesLoadedHook = HookEvent(ME_SYSTEM_MODULESLOADED, MainInit); hPreShutdownHook = HookEvent(ME_SYSTEM_PRESHUTDOWN, MainUninit); nickname_dialog_open = 0; status_msg_dialog_open = 0; // Options InitOptions(); // Register services CreateServiceFunction(MS_MYDETAILS_SETMYNICKNAME, PluginCommand_SetMyNickname); CreateServiceFunction(MS_MYDETAILS_SETMYNICKNAMEUI, PluginCommand_SetMyNicknameUI); CreateServiceFunction(MS_MYDETAILS_SETMYAVATAR, PluginCommand_SetMyAvatar); CreateServiceFunction(MS_MYDETAILS_SETMYAVATARUI, PluginCommand_SetMyAvatarUI); CreateServiceFunction(MS_MYDETAILS_GETMYNICKNAME, PluginCommand_GetMyNickname); CreateServiceFunction(MS_MYDETAILS_GETMYAVATAR, PluginCommand_GetMyAvatar); CreateServiceFunction(MS_MYDETAILS_SETMYSTATUSMESSAGEUI, PluginCommand_SetMyStatusMessageUI); CreateServiceFunction(MS_MYDETAILS_SHOWNEXTPROTOCOL, PluginCommand_ShowNextProtocol); CreateServiceFunction(MS_MYDETAILS_SHOWPREVIOUSPROTOCOL, PluginCommand_ShowPreviousProtocol); CreateServiceFunction(MS_MYDETAILS_SHOWPROTOCOL, PluginCommand_ShowProtocol); CreateServiceFunction(MS_MYDETAILS_CYCLE_THROUGH_PROTOCOLS, PluginCommand_CicleThroughtProtocols); return 0; }
extern "C" int __declspec(dllexport) Load(PLUGINLINK *link) { pluginLink = link; if (mir_getMMI(&mmi) || mir_getLI(&li) || !ServiceExists(MS_IMG_GETINTERFACE)) { MessageBox(NULL, TranslateT("Cannot obtain required interfaces!\nTooltips will not be available until you upgrade Miranda IM to the newest version."), TranslateT("Tipper error"), MB_OK | MB_ICONSTOP); return 1; } CallService(MS_IMG_GETINTERFACE, FI_IF_VERSION, (LPARAM)&fii); mir_getTMI(&tmi); mir_getLP(&pluginInfoEx); if (ServiceExists(MS_LANGPACK_GETCODEPAGE)) iCodePage = CallService(MS_LANGPACK_GETCODEPAGE, 0, 0); InitTranslations(); InitMessagePump(); InitOptions(); // for compatibility with mToolTip status tooltips hShowTipService = CreateServiceFunction("mToolTip/ShowTip", ShowTip); #ifdef _UNICODE hShowTipWService = CreateServiceFunction("mToolTip/ShowTipW", ShowTipW); #endif hHideTipService = CreateServiceFunction("mToolTip/HideTip", HideTip); hEventPreShutdown = HookEvent(ME_SYSTEM_PRESHUTDOWN, Shutdown); hEventModulesLoaded = HookEvent(ME_SYSTEM_MODULESLOADED, ModulesLoaded); hSettingChangedEvent = HookEvent(ME_DB_CONTACT_SETTINGCHANGED, SettingChanged); hEventDeleted = HookEvent(ME_DB_EVENT_DELETED, EventDeleted); return 0; }
extern "C" __declspec(dllexport) int Load(PLUGINLINK *link) { pluginLink = link; mir_getMMI(&mmi); mir_getLI(&li); mir_getMD5I(&md5i); mir_getUTFI(&utfi); #else extern "C" __declspec(dllexport) int Load(void) { mir_getLP(&pluginInfoEx); InitServices(); #endif db_set_b(NULL, MODNAME, "NeedRestart", 0); DWORD dwLen = GetTempPath( SIZEOF(tszTempPath), tszTempPath); if (tszTempPath[dwLen-1] == '\\') tszTempPath[dwLen-1] = 0; LoadOptions(); InitPopupList(); InitNetlib(); InitIcoLib(); // Add cheking update menu item InitCheck(); CLISTMENUITEM mi = { sizeof(mi) }; mi.position = 400010000; mi.icolibItem = Skin_GetIconHandle("check_update"); mi.pszName = LPGEN("Check for updates"); mi.pszService = MODNAME"/CheckUpdates"; Menu_AddMainMenuItem(&mi); #if MIRANDA_VER >= 0x0A00 InitListNew(); mi.position++; mi.icolibItem = Skin_GetIconHandle("plg_list"); mi.pszName = LPGEN("Available components list"); mi.pszService = MODNAME"/ShowList"; Menu_AddMainMenuItem(&mi); InitOptions(); #endif // Add hotkey HOTKEYDESC hkd = { sizeof(hkd) }; hkd.pszName = "Check for updates"; hkd.pszDescription = "Check for updates"; hkd.pszSection = "Plugin Updater"; hkd.pszService = MODNAME"/CheckUpdates"; hkd.DefHotKey = HOTKEYCODE(HOTKEYF_CONTROL, VK_F10) | HKF_MIRANDA_LOCAL; hkd.lParam = FALSE; Hotkey_Register(&hkd); InitEvents(); //add sounds SkinAddNewSoundEx("updatecompleted",LPGEN("Plugin Updater"),LPGEN("Update completed")); SkinAddNewSoundEx("updatefailed",LPGEN("Plugin Updater"),LPGEN("Update failed")); return 0; }
extern "C" int __declspec(dllexport) Load(PLUGINLINK *link) { pluginLink=link; if(mir_getMMI(&mmi)) { MessageBox(NULL,_T("Avatar History"),_T("Miranda Memory manager not initialized, plugin cannot load.\nPlease update Miranda IM to the latest version."),MB_OK | MB_TOPMOST); return 1; } if(mir_getUTFI(&utfi)) { MessageBox(NULL,_T("Avatar History"),_T("Miranda UTF8 interface not initialized, plugin cannot load.\nPlease update Miranda IM to the latest version."),MB_OK | MB_TOPMOST); return 1; } mir_getLP(&pluginInfo); // Is first run? if (DBGetContactSettingByte(NULL, MODULE_NAME, "FirstRun", 1)) { // Show dialog int ret = DialogBoxParam(hInst, MAKEINTRESOURCE(IDD_FIRST_RUN), NULL, FirstRunDlgProc, 0); if (ret == 0) return -1; // Write settings DBWriteContactSettingByte(NULL, MODULE_NAME, "LogToDisk", 1); if (ret == IDC_MIR_SAME) DBWriteContactSettingByte(NULL, MODULE_NAME, "LogKeepSameFolder", 1); else DBWriteContactSettingByte(NULL, MODULE_NAME, "LogKeepSameFolder", 0); if (ret == IDC_MIR_SHORT || ret == IDC_SHORT || ret == IDC_DUP) DBWriteContactSettingByte(NULL, MODULE_NAME, "LogPerContactFolders", 1); else DBWriteContactSettingByte(NULL, MODULE_NAME, "LogPerContactFolders", 0); if (ret == IDC_DUP) DBWriteContactSettingByte(NULL, MODULE_NAME, "StoreAsHash", 0); else DBWriteContactSettingByte(NULL, MODULE_NAME, "StoreAsHash", 1); if (ret == IDC_MIR_SAME || ret == IDC_MIR_PROTO || ret == IDC_MIR_SHORT) DBWriteContactSettingByte(NULL, MODULE_NAME, "LogToHistory", 1); else DBWriteContactSettingByte(NULL, MODULE_NAME, "LogToHistory", 0); DBWriteContactSettingByte(NULL, MODULE_NAME, "FirstRun", 0); } LoadOptions(); hHooks[0] = HookEvent(ME_SYSTEM_MODULESLOADED,ModulesLoaded); hHooks[1] = HookEvent(ME_SYSTEM_PRESHUTDOWN, PreShutdown); hHooks[3] = HookEvent(ME_OPT_INITIALISE, OptInit); hHooks[4] = HookEvent(ME_SKIN2_ICONSCHANGED, IcoLibIconsChanged); hHooks[5] = HookEvent(ME_CLIST_PREBUILDCONTACTMENU, PreBuildContactMenu); hServices[0] = CreateServiceFunction(MS_AVATARHISTORY_ENABLED, IsEnabled); hServices[1] = CreateServiceFunction(MS_AVATARHISTORY_GET_CACHED_AVATAR, GetCachedAvatar); if(CallService(MS_DB_GETPROFILEPATHT, MAX_PATH, (LPARAM)profilePath) != 0) _tcscpy(profilePath, _T(".")); // Failed, use current dir SkinAddNewSoundExT("avatar_changed",LPGENT("Avatar History"),LPGENT("Contact changed avatar")); SkinAddNewSoundExT("avatar_removed",LPGENT("Avatar History"),LPGENT("Contact removed avatar")); hAvatarWindowsList = (HANDLE)CallService(MS_UTILS_ALLOCWINDOWLIST, 0, 0); SetupIcoLib(); InitMenuItem(); return 0; }
int __cdecl Load(PLUGINLINK *link) { pluginLink = link; DisableThreadLibraryCalls(g_hInst); InitializeCriticalSection(&localQueueMutex); { char temp[MAX_PATH]; GetTempPath(sizeof(temp),temp); GetLongPathName(temp,TEMP,sizeof(TEMP)); TEMP_SIZE = strlen(TEMP); if(TEMP[TEMP_SIZE-1]=='\\') { TEMP_SIZE--; TEMP[TEMP_SIZE]='\0'; } } // get memoryManagerInterface address mir_getMMI( &mmi ); // check for support TrueColor Icons BOOL bIsComCtl6 = FALSE; HMODULE hComCtlDll = LoadLibrary("comctl32.dll"); if ( hComCtlDll ) { typedef HRESULT (CALLBACK *PFNDLLGETVERSION)(DLLVERSIONINFO*); PFNDLLGETVERSION pfnDllGetVersion = (PFNDLLGETVERSION) GetProcAddress(hComCtlDll,"DllGetVersion"); if ( pfnDllGetVersion ) { DLLVERSIONINFO dvi; memset(&dvi,0,sizeof(dvi)); dvi.cbSize = sizeof(dvi); HRESULT hRes = (*pfnDllGetVersion)( &dvi ); if ( SUCCEEDED(hRes) && dvi.dwMajorVersion >= 6 ) { bIsComCtl6 = TRUE; } } FreeLibrary(hComCtlDll); } if (bIsComCtl6) iBmpDepth = ILC_COLOR32 | ILC_MASK; // 32-bit images are supported else iBmpDepth = ILC_COLOR24 | ILC_MASK; // iBmpDepth = ILC_COLOR32 | ILC_MASK; char version[512]; CallService(MS_SYSTEM_GETVERSIONTEXT, sizeof(version), (LPARAM)&version); bCoreUnicode = strstr(version, "Unicode")!=0; iCoreVersion = CallService(MS_SYSTEM_GETVERSION,0,0); // load crypo++ dll if( !loadlib() ) { msgbox1(0,sim107,szModuleName,MB_OK|MB_ICONSTOP); return 1; } load_rtfconv(); // register plugin module PROTOCOLDESCRIPTOR pd; memset(&pd,0,sizeof(pd)); pd.cbSize = sizeof(pd); pd.szName = (char*)szModuleName; pd.type = PROTOTYPE_ENCRYPTION; CallService(MS_PROTO_REGISTERMODULE, 0, (LPARAM)&pd); // hook events AddHookFunction(ME_SYSTEM_MODULESLOADED, onModulesLoaded); AddHookFunction(ME_SYSTEM_OKTOEXIT, onSystemOKToExit); g_hEvent[0] = CreateHookableEvent(MODULENAME"/Disabled"); g_hEvent[1] = CreateHookableEvent(MODULENAME"/Established"); AddServiceFunction((LPCSTR)MODULENAME"/IsContactSecured",(MIRANDASERVICE)Service_IsContactSecured); AddServiceFunction((LPCSTR)MODULENAME"/SIM_EST",(MIRANDASERVICE)Service_CreateIM); AddServiceFunction((LPCSTR)MODULENAME"/SIM_DIS",(MIRANDASERVICE)Service_DisableIM); AddServiceFunction((LPCSTR)MODULENAME"/SIM_ST_DIS",(MIRANDASERVICE)Service_StatusDis); AddServiceFunction((LPCSTR)MODULENAME"/SIM_ST_ENA",(MIRANDASERVICE)Service_StatusEna); AddServiceFunction((LPCSTR)MODULENAME"/SIM_ST_TRY",(MIRANDASERVICE)Service_StatusTry); AddServiceFunction((LPCSTR)MODULENAME"/PGP_SET",(MIRANDASERVICE)Service_PGPsetKey); AddServiceFunction((LPCSTR)MODULENAME"/PGP_DEL",(MIRANDASERVICE)Service_PGPdelKey); AddServiceFunction((LPCSTR)MODULENAME"/GPG_SET",(MIRANDASERVICE)Service_GPGsetKey); AddServiceFunction((LPCSTR)MODULENAME"/GPG_DEL",(MIRANDASERVICE)Service_GPGdelKey); AddServiceFunction((LPCSTR)MODULENAME"/MODE_NAT",(MIRANDASERVICE)Service_ModeNative); AddServiceFunction((LPCSTR)MODULENAME"/MODE_PGP",(MIRANDASERVICE)Service_ModePGP); AddServiceFunction((LPCSTR)MODULENAME"/MODE_GPG",(MIRANDASERVICE)Service_ModeGPG); AddServiceFunction((LPCSTR)MODULENAME"/MODE_RSA",(MIRANDASERVICE)Service_ModeRSAAES); return 0; }
/** Initializes the services provided and the link to those needed * Called when the plugin is loaded into Miranda */ int __declspec(dllexport)Load(PLUGINLINK *link) { PROTOCOLDESCRIPTOR pd; DBVARIANT dbv; pluginLink=link; mir_getMMI(&mmi); mir_getLP(&pluginInfo); os_unicode_enabled = IsUnicodeOS(); if(ServiceExists(MS_DB_SETSETTINGRESIDENT)) { // 0.6+ CallService(MS_DB_SETSETTINGRESIDENT, TRUE, (LPARAM)(META_PROTO "/Status")); CallService(MS_DB_SETSETTINGRESIDENT, TRUE, (LPARAM)(META_PROTO "/IdleTS")); CallService(MS_DB_SETSETTINGRESIDENT, TRUE, (LPARAM)(META_PROTO "/ContactCountCheck")); CallService(MS_DB_SETSETTINGRESIDENT, TRUE, (LPARAM)(META_PROTO "/Handle")); CallService(MS_DB_SETSETTINGRESIDENT, TRUE, (LPARAM)(META_PROTO "/WindowOpen")); } //set all contacts to 'offline', and initialize subcontact counter for db consistency check { HANDLE hContact = (HANDLE)CallService( MS_DB_CONTACT_FINDFIRST, 0, 0); char *proto; while(hContact != NULL) { //proto = (char *)CallService(MS_PROTO_GETCONTACTBASEPROTO, (WPARAM)hContact, 0); if(!DBGetContactSetting(hContact, "Protocol", "p", &dbv)) { proto = dbv.pszVal; if (proto && !lstrcmp( META_PROTO, proto)) { DBWriteContactSettingWord(hContact, META_PROTO, "Status", ID_STATUS_OFFLINE); DBWriteContactSettingDword(hContact, META_PROTO, "IdleTS", 0); DBWriteContactSettingByte(hContact, META_PROTO, "ContactCountCheck", 0); // restore any saved defaults that might have remained if miranda was closed or crashed while a convo was happening if(DBGetContactSettingDword(hContact, META_PROTO, "SavedDefault", (DWORD)-1) != (DWORD)-1) { DBWriteContactSettingDword(hContact, META_PROTO, "Default", DBGetContactSettingDword(hContact, META_PROTO, "SavedDefault", 0)); DBWriteContactSettingDword(hContact, META_PROTO, "SavedDefault", (DWORD)-1); } } DBFreeVariant(&dbv); } hContact = ( HANDLE )CallService( MS_DB_CONTACT_FINDNEXT,( WPARAM )hContact, 0 ); } } Meta_ReadOptions(&options); // sets subcontact handles to metacontacts, and metacontact handles to subcontacts // (since these handles are not necessarily the same from run to run of miranda) // also verifies that subcontacts: have metacontacts, and that contact numbers are reasonable, // that metacontacts: have the correct number of subcontacts, and have reasonable defaults if(Meta_SetHandles()) { // error - db corruption if(!DBGetContactSettingByte(0, META_PROTO, "DisabledMessageShown", 0)) { MessageBox(0, Translate("Error - Database corruption.\nPlugin disabled."), Translate("MetaContacts"), MB_OK | MB_ICONERROR); DBWriteContactSettingByte(0, META_PROTO, "DisabledMessageShown", 1); } //Meta_HideMetaContacts(TRUE); return 1; } DBDeleteContactSetting(0, META_PROTO, "DisabledMessageShown"); // add our modules to the KnownModules list { DBVARIANT dbv; if (DBGetContactSetting(NULL, "KnownModules", META_PROTO, &dbv)) DBWriteContactSettingString(NULL, "KnownModules", META_PROTO, META_PROTO); else DBFreeVariant(&dbv); } ZeroMemory(&pd,sizeof(pd)); pd.cbSize=PROTOCOLDESCRIPTOR_V3_SIZE;//sizeof(pd); pd.szName=META_FILTER; pd.type=PROTOTYPE_FILTER; CallService(MS_PROTO_REGISTERMODULE,0,(LPARAM)&pd); ZeroMemory(&pd,sizeof(pd)); pd.cbSize=PROTOCOLDESCRIPTOR_V3_SIZE;//sizeof(pd); pd.szName=META_PROTO; pd.type = PROTOTYPE_PROTOCOL; CallService(MS_PROTO_REGISTERMODULE,0,(LPARAM)&pd); // further db setup done in modules loaded (nick [protocol string required] & clist display name) Meta_InitServices(); // moved to 'modules loaded' event handler (in meta_services.c) because we need to // check protocol for jabber hack, and the proto modules must be loaded //Meta_HideLinkedContactsAndSetHandles(); if(ServiceExists(MS_MSG_GETWINDOWAPI)) { message_window_api_enabled = TRUE; } // for clist_meta_mw - write hidden group name to DB DBWriteContactSettingString(0, META_PROTO, "HiddenGroupName", META_HIDDEN_GROUP); return 0; }
//===== Load ===== //Initializes the services provided and the link to those needed //Called when the plugin is loaded into Miranda MIRAPI int Load(PLUGINLINK *link) { char ver[1024]; pluginLink=link; g_popup.isOsUnicode = (GetVersion() & 0x80000000) == 0; CallService(MS_SYSTEM_GETVERSIONTEXT, (WPARAM) sizeof(ver), (LPARAM) ver); g_popup.isMirUnicode = strstr(ver, "Unicode") != NULL; hGetStatus = CreateServiceFunction(MS_POPUP_GETSTATUS, GetStatus); DuplicateHandle(GetCurrentProcess(), GetCurrentThread(), GetCurrentProcess(), &hMainThread, THREAD_SET_CONTEXT, FALSE, 0); mir_getLI (&li); mir_getMMI (&mmi); mir_getUTFI (&utfi); mir_getMTI (&MText); mir_getLP(&pluginInfoEx); #if defined(_DEBUG) PopUpOptions.debug = DBGetContactSettingByte(NULL, MODULNAME, "debug", FALSE); #else PopUpOptions.debug = false; #endif LoadGDIPlus(); //Transparent and animation routines OSVERSIONINFO osvi = { 0 }; BOOL bResult = FALSE; osvi.dwOSVersionInfoSize = sizeof(OSVERSIONINFO); bResult = GetVersionEx(&osvi); // MLU layer for ansi release #if !defined(_UNICODE) MySetLayeredWindowAttributes = 0; MyUpdateLayeredWindow = 0; MyAnimateWindow = 0; MyDrawTextW = 0; MyDrawTextExW = 0; MySetWindowTextW = 0; MySendMessageW = 0; MyCallWindowProcW = 0; MyCreateWindowExW = 0; MyGetMonitorInfo = 0; MyMonitorFromWindow = 0; hUserDll = LoadLibrary(_T("user32.dll")); if (hUserDll) { MySetLayeredWindowAttributes = (BOOL (WINAPI *)(HWND,COLORREF,BYTE,DWORD))GetProcAddress(hUserDll, "SetLayeredWindowAttributes"); MyUpdateLayeredWindow = (BOOL (WINAPI *)(HWND, HDC, POINT *, SIZE *, HDC, POINT *, COLORREF, BLENDFUNCTION *, DWORD))GetProcAddress(hUserDll, "UpdateLayeredWindow"); MyAnimateWindow = (BOOL (WINAPI*)(HWND,DWORD,DWORD))GetProcAddress(hUserDll,"AnimateWindow"); MyDrawTextW = (int (WINAPI *)(HDC, LPCWSTR, int, LPRECT, UINT))GetProcAddress(hUserDll,"DrawTextW"); MyDrawTextExW = (int (WINAPI*)(HDC,LPCWSTR,int,LPRECT,UINT,LPDRAWTEXTPARAMS))GetProcAddress(hUserDll,"DrawTextExW"); MySetWindowTextW = (BOOL (WINAPI*)(HWND, LPCWSTR))GetProcAddress(hUserDll,"SetWindowTextW"); MySendMessageW = (LRESULT (WINAPI *)(HWND, UINT, WPARAM, LPARAM))GetProcAddress(hUserDll,"SendMessageW"); MyCallWindowProcW = (LRESULT (WINAPI *)(WNDPROC, HWND, UINT, WPARAM, LPARAM))GetProcAddress(hUserDll,"CallWindowProcW"); MyCreateWindowExW = (HWND (WINAPI*)(DWORD, LPCWSTR, LPCWSTR, DWORD, int, int, int, int, HWND, HMENU, HINSTANCE, LPVOID))GetProcAddress(hUserDll,"CreateWindowExW"); if (LOWORD(GetVersion())!=4) { //Windows 98, ME, 2000, XP, and later support multimonitor configuration. if (bResult) { if (osvi.dwPlatformId == VER_PLATFORM_WIN32_NT) { //2000 or XP #ifdef UNICODE MyGetMonitorInfo = (BOOL (WINAPI*)(HMONITOR,LPMONITORINFO))GetProcAddress(hUserDll,("GetMonitorInfoW")); #else MyGetMonitorInfo = (BOOL (WINAPI*)(HMONITOR,LPMONITORINFO))GetProcAddress(hUserDll,("GetMonitorInfoA")); #endif //UNICODE } else { //98 or ME // attempt to fix multimonitor on 9x MyGetMonitorInfo = (BOOL (WINAPI*)(HMONITOR,LPMONITORINFO))GetProcAddress(hUserDll,("GetMonitorInfoA")); if (!MyGetMonitorInfo) MyGetMonitorInfo = (BOOL (WINAPI*)(HMONITOR,LPMONITORINFO))GetProcAddress(hUserDll,("GetMonitorInfo")); } } //There's no need for an else branch. if (MyGetMonitorInfo) MyMonitorFromWindow = (HMONITOR (WINAPI*)(HWND,DWORD))GetProcAddress(hUserDll, ("MonitorFromWindow")); } } hGdiDll = LoadLibrary(_T("gdi32.dll")); if (hGdiDll) { MyGetTextExtentPoint32W = (BOOL (WINAPI *)(HDC, LPCWSTR, int, LPSIZE))GetProcAddress(hGdiDll,"GetTextExtentPoint32W"); } else{ MyGetTextExtentPoint32W = 0; } hMsimgDll = LoadLibrary(_T("msimg32.dll")); MyAlphaBlend = 0; MyTransparentBlt = 0; if (hMsimgDll) { MyTransparentBlt = (BOOL (WINAPI *)(HDC, int, int, int, int, HDC, int, int, int, int, UINT)) GetProcAddress(hMsimgDll, "TransparentBlt"); MyAlphaBlend = (BOOL (WINAPI *)(HDC, int, int, int, int, HDC, int, int, int, int, BLENDFUNCTION)) GetProcAddress(hMsimgDll, "AlphaBlend"); } #endif hDwmapiDll = LoadLibrary(_T("dwmapi.dll")); MyDwmEnableBlurBehindWindow = 0; if (hDwmapiDll) { MyDwmEnableBlurBehindWindow = (HRESULT (WINAPI *)(HWND, DWM_BLURBEHIND *)) GetProcAddress(hDwmapiDll, "DwmEnableBlurBehindWindow"); } PopupHistoryLoad(); LoadPopupThread(); if (!LoadPopupWnd2()) { MessageBox(0, TranslateTS( _T("Error: I could not register the PopUp Window class.\r\n") _T("The plugin will not operate.") ), _T(MODULNAME_LONG), MB_ICONSTOP|MB_OK); return 0; //We couldn't register our Window Class, don't hook any event: the plugin will act as if it was disabled. } RegisterOptPrevBox(); // Register in DBEditor++ DBVARIANT dbv; if (DBGetContactSetting(NULL, "KnownModules", MODULNAME, &dbv)) DBWriteContactSettingString(NULL, "KnownModules", pluginInfoEx.shortName, MODULNAME); DBFreeVariant(&dbv); hModulesLoaded = HookEvent(ME_SYSTEM_MODULESLOADED, ModulesLoaded); hOptionsInitialize = HookEvent(ME_OPT_INITIALISE, OptionsInitialize); hOkToExit = HookEvent(ME_SYSTEM_OKTOEXIT, OkToExit); // hEventStatusChanged = HookEvent(ME_CLIST_STATUSMODECHANGE,StatusModeChanged); hbmNoAvatar = LoadBitmap(hInst, MAKEINTRESOURCE(IDB_NOAVATAR)); if(!OptionLoaded){ LoadOptions(); } //Service Functions for (int i = SIZEOF(popupServices); i--; ) popupServices[i].handle = CreateServiceFunction(popupServices[i].name, popupServices[i].func); //load icons / create hook InitIcons(); hIconsChanged = HookEvent(ME_SKIN2_ICONSCHANGED,IconsChanged); //add menu items InitMenuItems(); return 0; }
/** * This function is called by Miranda to initialize the plugin. * * @return 0 **/ extern "C" INT __declspec(dllexport) Load(PLUGINLINK *link) { INITCOMMONCONTROLSEX ccEx; pluginLink = link; if (link && CoreCheck()) { mir_getLP(&pluginInfo); // init common controls ccEx.dwSize = sizeof(ccEx); ccEx.dwICC = ICC_WIN95_CLASSES|ICC_DATE_CLASSES; InitCommonControlsEx(&ccEx); ZeroMemory(&myGlobals, sizeof(MGLOBAL)); // init miranda's memory interface if (!mir_getMMI(&mmi) && !mir_getLI(&li) && !mir_getUTFI(&utfi) /*&& mir_getXI(&xi)*/) { // init clist interface pcli = (CLIST_INTERFACE*)CallService(MS_CLIST_RETRIEVE_INTERFACE, 0, (LPARAM)0); // init new miranda timezone interface mir_getTMI(&tmi); // init freeimage interface INT_PTR result = CALLSERVICE_NOTFOUND; if(ServiceExists(MS_IMG_GETINTERFACE)) result = CallService(MS_IMG_GETINTERFACE, FI_IF_VERSION, (LPARAM)&FIP); if(FIP == NULL || result != S_OK) { MessageBoxEx(NULL, TranslateT("Fatal error, image services not found. Flags Module will be disabled."), _T("Error"), MB_OK | MB_ICONERROR | MB_APPLMODAL, 0); return 1; } if (IsWinVerVistaPlus()) { HMODULE hDwmApi = LoadLibraryA("dwmapi.dll"); if (hDwmApi) { dwmIsCompositionEnabled = (pfnDwmIsCompositionEnabled)GetProcAddress(hDwmApi,"DwmIsCompositionEnabled"); } } // check for dbx_tree myGlobals.UseDbxTree = ServiceExists("DBT/Entity/GetRoot"); // load icon library IcoLib_LoadModule(); SvcFlagsLoadModule(); tmi.getTimeZoneTime ? SvcTimezoneLoadModule() : SvcTimezoneLoadModule_old(); SvcContactInfoLoadModule(); SvcEMailLoadModule(); SvcRefreshContactInfoLoadModule(); CtrlContactLoadModule(); // load my button class CtrlButtonLoadModule(); // initializes the Ex/Import Services SvcExImport_LoadModule(); // load the UserInfoPropertySheet module DlgContactInfoLoadModule(); // Anniversary stuff DlgAnniversaryListLoadModule(); SvcReminderLoadModule(); // Now the module is loaded! Start initializing certain things ghModulesLoadedHook = HookEvent(ME_SYSTEM_MODULESLOADED, OnModulesLoaded); ghTopToolBarLoaded = HookEvent(ME_TTB_MODULELOADED, OnTopToolBarLoaded); ghModernToolBarLoaded = HookEvent(ME_TB_MODULELOADED, OnModernToolBarLoaded); ghShutdownHook = HookEvent(ME_SYSTEM_SHUTDOWN, OnShutdown); return 0; } } return 1; }