Example #1
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;
}
Example #2
0
extern "C" int __declspec(dllexport) Load()
{
	// set the memory, lists & utf8 managers
	mir_getXI(&xi);
	mir_getTMI(&tmi);
	mir_getLP(&pluginInfo);
	mir_getCLI();

	{
		INT_PTR 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. Jabber Protocol will be disabled."), _T("Error"), MB_OK | MB_ICONERROR | MB_APPLMODAL, 0);
			return 1;
		}
	}

	WORD v[4];
	CallService(MS_SYSTEM_GETFILEVERSION, 0, (LPARAM)v);
	mir_sntprintf(szCoreVersion, SIZEOF(szCoreVersion), _T("%d.%d.%d.%d"), v[0], v[1], v[2], v[3]);

	CallService(MS_UTILS_GETCOUNTRYLIST, (WPARAM)&g_cbCountries, (LPARAM)&g_countries);

	hExtListInit = CreateHookableEvent(ME_JABBER_EXTLISTINIT);
	hDiscoInfoResult = CreateHookableEvent(ME_JABBER_SRVDISCOINFO);

	// Register protocol module
	PROTOCOLDESCRIPTOR pd = { sizeof(pd) };
	pd.szName = "JABBER";
	pd.fnInit = (pfnInitProto)jabberProtoInit;
	pd.fnUninit = (pfnUninitProto)jabberProtoUninit;
	pd.type = PROTOTYPE_PROTOCOL;
	CallService(MS_PROTO_REGISTERMODULE, 0, (LPARAM)&pd);

	g_IconsInit();
	g_XstatusIconsInit();
	// Init extra icons
	hExtraActivity = ExtraIcon_Register("activity", LPGEN("Jabber Activity"), "jabber_dancing");
	hExtraMood = ExtraIcon_Register("mood", LPGEN("Jabber Mood"), "jabber_contemplative");
	g_MenuInit();
	HookEvent(ME_SYSTEM_MODULESLOADED, OnModulesLoaded);
	JabberUserInfoInit();
	return 0;
}