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; }
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 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_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" 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; 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(); }
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; }
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; }
// 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; 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; }
//===== 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; }
extern "C" int __declspec(dllexport) CListInitialise(PLUGINLINK * link) { int rc = 0; DBVARIANT dbv; int i; char szProfilePath[MAX_PATH]; pluginLink = link; #ifdef _DEBUG _CrtSetDbgFlag(_CRTDBG_ALLOC_MEM_DF | _CRTDBG_LEAK_CHECK_DF); #endif mir_getMMI(&mmi); mir_getLI(&li); mir_getTMI(&tmi); mir_getLP( &pluginInfo ); API::onInit(); LoadCLCButtonModule(); RegisterCLUIFrameClasses(); ZeroMemory((void*) &cfg::dat, sizeof(cfg::dat)); int iCount = CallService(MS_DB_CONTACT_GETCOUNT, 0, 0); iCount += 20; if( iCount < 300 ) iCount = 300; cfg::eCache = reinterpret_cast<TExtraCache *>(malloc(sizeof(TExtraCache) * iCount)); ZeroMemory(cfg::eCache, sizeof(struct TExtraCache) * iCount); cfg::nextCacheEntry = 0; cfg::maxCacheEntry = iCount; cfg::init(); cfg::dat.toolbarVisibility = cfg::getDword("CLUI", "TBVisibility", DEFAULT_TB_VISIBILITY); cfg::dat.hMenuButtons = GetSubMenu(LoadMenu(g_hInst, MAKEINTRESOURCE(IDR_CONTEXT)), 3); cfg::dat.hMenuNotify = CreatePopupMenu(); cfg::dat.wNextMenuID = 1; cfg::dat.sortTimer = cfg::getDword("CLC", "SortTimer", 150); cfg::dat.szNoEvents = TranslateTS(szNoevents); cfg::dat.avatarBorder = (COLORREF)cfg::getDword("CLC", "avatarborder", 0); cfg::dat.avatarRadius = (COLORREF)cfg::getDword("CLC", "avatarradius", 4); cfg::dat.hBrushAvatarBorder = CreateSolidBrush(cfg::dat.avatarBorder); cfg::dat.avatarSize = cfg::getWord("CList", "AvatarSize", 24); cfg::dat.dualRowMode = cfg::getByte("CLC", "DualRowMode", 0); cfg::dat.avatarPadding = cfg::getByte("CList", "AvatarPadding", 0); cfg::dat.isTransparent = cfg::getByte("CList", "Transparent", 0); cfg::dat.alpha = cfg::getByte("CList", "Alpha", SETTING_ALPHA_DEFAULT); cfg::dat.autoalpha = cfg::getByte("CList", "AutoAlpha", SETTING_ALPHA_DEFAULT); cfg::dat.fadeinout = cfg::getByte("CLUI", "FadeInOut", 0); cfg::dat.autosize = cfg::getByte("CLUI", "AutoSize", 0); cfg::dat.dwExtraImageMask = cfg::getDword("CLUI", "ximgmask", 0); cfg::dat.bNoOfflineAvatars = cfg::getByte("CList", "NoOfflineAV", 1); cfg::dat.bFullTransparent = cfg::getByte("CLUI", "fulltransparent", 0); cfg::dat.bDblClkAvatars = cfg::getByte("CLC", "dblclkav", 0); cfg::dat.bEqualSections = cfg::getByte("CLUI", "EqualSections", 0); cfg::dat.bCenterStatusIcons = cfg::getByte("CLC", "si_centered", 1); cfg::dat.boldHideOffline = -1; cfg::dat.bSecIMAvail = ServiceExists("SecureIM/IsContactSecured") ? 1 : 0; cfg::dat.bNoTrayTips = cfg::getByte("CList", "NoTrayTips", 0); cfg::dat.bShowLocalTime = cfg::getByte("CLC", "ShowLocalTime", 1); cfg::dat.bShowLocalTimeSelective = cfg::getByte("CLC", "SelectiveLocalTime", 1); cfg::dat.bDontSeparateOffline = cfg::getByte("CList", "DontSeparateOffline", 0); cfg::dat.bShowXStatusOnSbar = cfg::getByte("CLUI", "xstatus_sbar", 0); cfg::dat.bLayeredHack = cfg::getByte("CLUI", "layeredhack", 1); cfg::dat.bFirstRun = cfg::getByte("CLUI", "firstrun", 1); cfg::dat.langPackCP = CallService(MS_LANGPACK_GETCODEPAGE, 0, 0); cfg::dat.realTimeSaving = cfg::getByte("CLUI", "save_pos_always", 0); DWORD sortOrder = cfg::getDword("CList", "SortOrder", SORTBY_NAME); cfg::dat.sortOrder[0] = LOBYTE(LOWORD(sortOrder)); cfg::dat.sortOrder[1] = HIBYTE(LOWORD(sortOrder)); cfg::dat.sortOrder[2] = LOBYTE(HIWORD(sortOrder)); if(cfg::dat.bFirstRun) cfg::writeByte("CLUI", "firstrun", 0); if(!cfg::getString(NULL, "CLUI", "exIconOrder", &dbv)) { if(lstrlenA(dbv.pszVal) < EXICON_COUNT) { for(i = 1; i <= EXICON_COUNT; i++) cfg::dat.exIconOrder[i - 1] = i; } else { for(i = 0; i < EXICON_COUNT; i++) if(dbv.pszVal[i] < EXICON_COUNT+1 && dbv.pszVal[i] >0) cfg::dat.exIconOrder[i] = dbv.pszVal[i]; else cfg::dat.exIconOrder[i] = i+1; } DBFreeVariant(&dbv); } else { for(i = 1; i <= EXICON_COUNT; i++) cfg::dat.exIconOrder[i - 1] = i; } ReloadThemedOptions(); FLT_ReadOptions(); Reload3dBevelColors(); himlExtraImages = ImageList_Create(16, 16, ILC_MASK | (IsWinVerXPPlus() ? ILC_COLOR32 : ILC_COLOR16), 30, 2); ImageList_SetIconSize(himlExtraImages, cfg::dat.exIconScale, cfg::dat.exIconScale); cfg::dat.dwFlags = cfg::getDword("CLUI", "Frameflags", CLUI_FRAME_SHOWTOPBUTTONS | CLUI_FRAME_STATUSICONS | CLUI_FRAME_SHOWBOTTOMBUTTONS | CLUI_FRAME_BUTTONSFLAT | CLUI_FRAME_CLISTSUNKEN); cfg::dat.dwFlags |= (cfg::getByte("CLUI", "ShowSBar", 1) ? CLUI_FRAME_SBARSHOW : 0); cfg::dat.soundsOff = cfg::getByte("CLUI", "NoSounds", 0); CallService(MS_DB_GETPROFILEPATH, MAX_PATH, (LPARAM)szProfilePath); #if defined(_UNICODE) MultiByteToWideChar(CP_ACP, 0, szProfilePath, MAX_PATH, cfg::dat.tszProfilePath, MAX_PATH); cfg::dat.tszProfilePath[MAX_PATH - 1] = 0; #else mir_sntprintf(cfg::dat.tszProfilePath, MAX_PATH, "%s", szProfilePath); #endif _tcslwr(cfg::dat.tszProfilePath); if(cfg::getByte("Skin", "UseSound", 0) != cfg::dat.soundsOff) cfg::writeByte("Skin", "UseSound", (BYTE)(cfg::dat.soundsOff ? 0 : 1)); // get the clist interface pcli = ( CLIST_INTERFACE* )CallService(MS_CLIST_RETRIEVE_INTERFACE, 0, (LPARAM)g_hInst); if ( (INT_PTR)pcli == CALLSERVICE_NOTFOUND ) { LBL_Error: MessageBoxA( NULL, "This plugin requires Miranda IM 0.8.0.9 or later", "Fatal error", MB_OK ); return 1; } if ( pcli->version < 6 ) // don't join it with the previous if() goto LBL_Error; pcli->pfnBuildGroupPopupMenu = BuildGroupPopupMenu; pcli->pfnCluiProtocolStatusChanged = CluiProtocolStatusChanged; pcli->pfnCompareContacts = CompareContacts; pcli->pfnCreateClcContact = CreateClcContact; pcli->pfnCreateEvent = fnCreateEvent; pcli->pfnDocking_ProcessWindowMessage = Docking_ProcessWindowMessage; pcli->pfnGetDefaultFontSetting = GetDefaultFontSetting; pcli->pfnGetRowBottomY = RowHeight::getItemBottomY; pcli->pfnGetRowHeight = RowHeight::getHeight; pcli->pfnGetRowTopY = RowHeight::getItemTopY; pcli->pfnGetRowTotalHeight = RowHeight::getTotalHeight; pcli->pfnGetWindowVisibleState = GetWindowVisibleState; pcli->pfnHitTest = HitTest; pcli->pfnLoadContactTree = LoadContactTree; pcli->pfnOnCreateClc = LoadCLUIModule; pcli->pfnPaintClc = PaintClc; pcli->pfnRebuildEntireList = RebuildEntireList; pcli->pfnRowHitTest = RowHeight::hitTest; pcli->pfnScrollTo = ScrollTo; pcli->pfnTrayIconUpdateBase = TrayIconUpdateBase; pcli->pfnSetHideOffline = SetHideOffline; pcli->pfnShowHide = ShowHide; saveAddContactToGroup = pcli->pfnAddContactToGroup; pcli->pfnAddContactToGroup = AddContactToGroup; saveRemoveItemFromGroup = pcli->pfnRemoveItemFromGroup; pcli->pfnRemoveItemFromGroup = RemoveItemFromGroup; saveAddEvent = pcli->pfnAddEvent; pcli->pfnAddEvent = AddEvent; saveRemoveEvent = pcli->pfnRemoveEvent; pcli->pfnRemoveEvent = RemoveEvent; saveAddGroup = pcli->pfnAddGroup; pcli->pfnAddGroup = AddGroup; saveAddInfoItemToGroup = pcli->pfnAddInfoItemToGroup; pcli->pfnAddInfoItemToGroup = AddInfoItemToGroup; saveContactListControlWndProc = pcli->pfnContactListControlWndProc; pcli->pfnContactListControlWndProc = ContactListControlWndProc; saveContactListWndProc = pcli->pfnContactListWndProc; pcli->pfnContactListWndProc = ContactListWndProc; saveIconFromStatusMode = pcli->pfnIconFromStatusMode; pcli->pfnIconFromStatusMode = fnIconFromStatusMode; saveLoadClcOptions = pcli->pfnLoadClcOptions; pcli->pfnLoadClcOptions = LoadClcOptions; saveProcessExternalMessages = pcli->pfnProcessExternalMessages; pcli->pfnProcessExternalMessages = ProcessExternalMessages; saveRecalcScrollBar = pcli->pfnRecalcScrollBar; pcli->pfnRecalcScrollBar = RecalcScrollBar; saveTrayIconProcessMessage = pcli->pfnTrayIconProcessMessage; pcli->pfnTrayIconProcessMessage = TrayIconProcessMessage; rc = LoadContactListModule(); if (rc == 0) rc = LoadCLCModule(); HookEvent(ME_SYSTEM_MODULESLOADED, systemModulesLoaded); return rc; }
/** * 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; }