コード例 #1
0
ファイル: modules.cpp プロジェクト: Seldom/miranda-ng
int LoadDefaultModules(void)
{
	// load order is very important for these
	if (LoadSystemModule()) return 1;
	if (LoadLangPackModule()) return 1;		// langpack will be a system module in the new order so this is moved here
	if (CheckRestart()) return 1;
	if (LoadUtilsModule()) return 1;		//order not important for this, but no dependencies and no point in pluginising
	if (LoadIcoTabsModule()) return 1;
	if (LoadHeaderbarModule()) return 1;
	if (LoadDbintfModule()) return 1;
	if (LoadEventsModule()) return 1;

	// load database drivers & service plugins without executing their Load()
	if (LoadNewPluginsModuleInfos()) return 1;

	switch (LoadDefaultServiceModePlugin()) {
	case SERVICE_CONTINUE:  // continue loading Miranda normally
	case SERVICE_ONLYDB:    // load database and go to the message cycle
		break;
	case SERVICE_MONOPOLY:  // unload database and go to the message cycle
		return 0;
	default:                // smth went wrong, terminating
		return 1;
	}

	// the database will select which db plugin to use, or fail if no profile is selected
	if (LoadDatabaseModule()) return 1;

	// database is available here
	if (LoadButtonModule()) return 1;
	if (LoadIcoLibModule()) return 1;
	if (LoadSkinIcons()) return 1;

	//	if (LoadErrorsModule()) return 1;

	switch (LoadServiceModePlugin()) {
	case SERVICE_CONTINUE:  // continue loading Miranda normally
		break;
	case SERVICE_ONLYDB:    // load database and go to the message cycle
		return 0;
	case SERVICE_MONOPOLY:  // unload database and go to the message cycle
		UnloadDatabase();
		return 0;
	default:                // smth went wrong, terminating
		return 1;
	}

	if (LoadSkinSounds()) return 1;
	if (LoadSkinHotkeys()) return 1;
	if (LoadFontserviceModule()) return 1;
	if (LoadSrmmModule()) return 1;
	if (LoadChatModule()) return 1;
	if (LoadDescButtonModule()) return 1;
	if (LoadOptionsModule()) return 1;
	if (LoadNetlibModule()) return 1;
	if (LoadSslModule()) return 1;
	if (LoadProtocolsModule()) return 1;
	LoadDbAccounts();                    // retrieves the account array from a database
	if (LoadContactsModule()) return 1;
	if (LoadContactListModule()) return 1;   // prepare contact list interface
	if (LoadAddContactModule()) return 1;
	if (LoadMetacontacts()) return 1;

	if (LoadNewPluginsModule()) return 1;    // will call Load(void) on everything, clist will load first

	Langpack_SortDuplicates();

	if (LoadAccountsModule()) return 1;

	//order becomes less important below here
	if (LoadFindAddModule()) return 1;
	if (LoadIgnoreModule()) return 1;
	if (LoadVisibilityModule()) return 1;
	if (LoadStdPlugins()) return 1;
	return 0;
}
コード例 #2
0
ファイル: init.cpp プロジェクト: 0xmono/miranda-ng
extern "C" int __declspec(dllexport) CListInitialise()
{
    mir_getLP( &pluginInfo );
    mir_getCLI();
    mir_getTMI(&tmi);

    API::onInit();
    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::init();

    cfg::dat.hMenuNotify = CreatePopupMenu();
    cfg::dat.wNextMenuID = 1;
    cfg::dat.sortTimer = cfg::getDword("CLC", "SortTimer", 150);
    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.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);

    ReloadThemedOptions();
    Reload3dBevelColors();

    cfg::dat.dwFlags = cfg::getDword("CLUI", "Frameflags", 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("Skin", "UseSound", 1) ? 0 : 1;

    CallService(MS_DB_GETPROFILEPATHT, MAX_PATH, (LPARAM)cfg::dat.tszProfilePath);
    _tcslwr(cfg::dat.tszProfilePath);

    PreloadContactListModule();

    // get the clist interface
    pcli->hInst = g_hInst;
    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 = OnCreateClc;
    pcli->pfnPaintClc = PaintClc;
    pcli->pfnRebuildEntireList = RebuildEntireList;
    pcli->pfnRowHitTest = RowHeight::hitTest;
    pcli->pfnScrollTo = ScrollTo;
    pcli->pfnTrayCalcChanged = TrayCalcChanged;
    pcli->pfnSetHideOffline = SetHideOffline;
    pcli->pfnShowHide = ShowHide;

    saveAddContactToGroup = pcli->pfnAddContactToGroup;
    pcli->pfnAddContactToGroup = AddContactToGroup;

    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;

    int rc = LoadContactListModule();
    if (rc == 0)
        rc = LoadCLCModule();
    LoadCLUIModule();
    LoadButtonModule();

    HookEvent(ME_SYSTEM_MODULESLOADED, systemModulesLoaded);
    return rc;
}
コード例 #3
0
ファイル: init.cpp プロジェクト: tweimer/miranda-ng
int CMPlugin::Load()
{
	Clist_GetInterface();
	coreCli = g_clistApi;

	API::onInit();

	memset(&cfg::dat, 0, sizeof(cfg::dat));

	int iCount = db_get_contact_count();

	iCount += 20;
	if (iCount < 300)
		iCount = 300;

	cfg::dat.hMenuNotify = CreatePopupMenu();
	cfg::dat.wNextMenuID = 1;
	cfg::dat.sortTimer = db_get_dw(NULL, "CLC", "SortTimer", 150);
	cfg::dat.avatarBorder = (COLORREF)db_get_dw(NULL, "CLC", "avatarborder", 0);
	cfg::dat.avatarRadius = (COLORREF)db_get_dw(NULL, "CLC", "avatarradius", 4);
	cfg::dat.hBrushAvatarBorder = CreateSolidBrush(cfg::dat.avatarBorder);
	cfg::dat.avatarSize = db_get_w(NULL, "CList", "AvatarSize", 24);
	cfg::dat.dualRowMode = db_get_b(NULL, "CLC", "DualRowMode", 0);
	cfg::dat.avatarPadding = db_get_b(NULL, "CList", "AvatarPadding", 0);
	cfg::dat.isTransparent = db_get_b(NULL, "CList", "Transparent", 0);
	cfg::dat.alpha = db_get_b(NULL, "CList", "Alpha", SETTING_ALPHA_DEFAULT);
	cfg::dat.autoalpha = db_get_b(NULL, "CList", "AutoAlpha", SETTING_ALPHA_DEFAULT);
	cfg::dat.fadeinout = db_get_b(NULL, "CLUI", "FadeInOut", 0);
	cfg::dat.autosize = db_get_b(NULL, "CLUI", "AutoSize", 0);
	cfg::dat.bNoOfflineAvatars = db_get_b(NULL, "CList", "NoOfflineAV", 1);
	cfg::dat.bFullTransparent = db_get_b(NULL, "CLUI", "fulltransparent", 0);
	cfg::dat.bDblClkAvatars = db_get_b(NULL, "CLC", "dblclkav", 0);
	cfg::dat.bEqualSections = db_get_b(NULL, "CLUI", "EqualSections", 0);
	cfg::dat.bCenterStatusIcons = db_get_b(NULL, "CLC", "si_centered", 1);
	cfg::dat.boldHideOffline = -1;
	cfg::dat.bSecIMAvail = ServiceExists("SecureIM/IsContactSecured") ? 1 : 0;
	cfg::dat.bNoTrayTips = db_get_b(NULL, "CList", "NoTrayTips", 0);
	cfg::dat.bShowLocalTime = db_get_b(NULL, "CLC", "ShowLocalTime", 1);
	cfg::dat.bShowLocalTimeSelective = db_get_b(NULL, "CLC", "SelectiveLocalTime", 1);
	cfg::dat.bDontSeparateOffline = db_get_b(NULL, "CList", "DontSeparateOffline", 0);
	cfg::dat.bShowXStatusOnSbar = db_get_b(NULL, "CLUI", "xstatus_sbar", 0);
	cfg::dat.bLayeredHack = db_get_b(NULL, "CLUI", "layeredhack", 1);
	cfg::dat.bFirstRun = db_get_b(NULL, "CLUI", "firstrun", 1);
	cfg::dat.langPackCP = Langpack_GetDefaultCodePage();
	cfg::dat.realTimeSaving = db_get_b(NULL, "CLUI", "save_pos_always", 0);

	DWORD sortOrder = db_get_dw(NULL, "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)
		db_set_b(NULL, "CLUI", "firstrun", 0);

	ReloadThemedOptions();
	Reload3dBevelColors();

	cfg::dat.dwFlags = db_get_dw(NULL, "CLUI", "Frameflags", CLUI_FRAME_STATUSICONS | CLUI_FRAME_SHOWBOTTOMBUTTONS | CLUI_FRAME_BUTTONSFLAT | CLUI_FRAME_CLISTSUNKEN);
	cfg::dat.dwFlags |= (db_get_b(NULL, "CLUI", "ShowSBar", 1) ? CLUI_FRAME_SBARSHOW : 0);
	cfg::dat.soundsOff = db_get_b(NULL, "Skin", "UseSound", 1) ? 0 : 1;

	Profile_GetPathW(MAX_PATH, cfg::dat.tszProfilePath);
	wcslwr(cfg::dat.tszProfilePath);

	// get the clist interface
	g_clistApi.hInst = g_plugin.getInst();
	g_clistApi.pfnCluiProtocolStatusChanged = CluiProtocolStatusChanged;
	g_clistApi.pfnCompareContacts = CompareContacts;
	g_clistApi.pfnCreateClcContact = CreateClcContact;
	g_clistApi.pfnDocking_ProcessWindowMessage = Docking_ProcessWindowMessage;
	g_clistApi.pfnGetContactHiddenStatus = CLVM_GetContactHiddenStatus;
	g_clistApi.pfnGetDefaultFontSetting = GetDefaultFontSetting;
	g_clistApi.pfnGetRowBottomY = RowHeight::getItemBottomY;
	g_clistApi.pfnGetRowHeight = RowHeight::getHeight;
	g_clistApi.pfnGetRowTopY = RowHeight::getItemTopY;
	g_clistApi.pfnGetRowTotalHeight = RowHeight::getTotalHeight;
	g_clistApi.pfnGetWindowVisibleState = GetWindowVisibleState;
	g_clistApi.pfnHitTest = HitTest;
	g_clistApi.pfnOnCreateClc = OnCreateClc;
	g_clistApi.pfnPaintClc = PaintClc;
	g_clistApi.pfnRebuildEntireList = RebuildEntireList;
	g_clistApi.pfnRowHitTest = RowHeight::hitTest;
	g_clistApi.pfnScrollTo = ScrollTo;
	g_clistApi.pfnSetHideOffline = SetHideOffline;
	g_clistApi.pfnShowHide = ShowHide;

	g_clistApi.pfnAddContactToGroup = AddContactToGroup;

	g_clistApi.pfnAddEvent = AddEvent;
	g_clistApi.pfnRemoveEvent = RemoveEvent;

	g_clistApi.pfnAddGroup = AddGroup;
	g_clistApi.pfnAddInfoItemToGroup = AddInfoItemToGroup;
	g_clistApi.pfnContactListControlWndProc = ContactListControlWndProc;
	g_clistApi.pfnContactListWndProc = ContactListWndProc;
	g_clistApi.pfnIconFromStatusMode = IconFromStatusMode;
	g_clistApi.pfnLoadClcOptions = LoadClcOptions;
	g_clistApi.pfnProcessExternalMessages = ProcessExternalMessages;
	g_clistApi.pfnRecalcScrollBar = RecalcScrollBar;
	g_clistApi.pfnTrayIconProcessMessage = TrayIconProcessMessage;

	int rc = LoadContactListModule();
	if (rc == 0)
		rc = LoadCLCModule();
	LoadCLUIModule();
	LoadButtonModule();

	HookEvent(ME_SYSTEM_MODULESLOADED, systemModulesLoaded);
	return rc;
}