예제 #1
0
int OnAccChanged(WPARAM wParam, LPARAM lParam)
{
	PROTOACCOUNT *pa = (PROTOACCOUNT*)lParam;
	switch (wParam) {
	case PRAC_ADDED:
		startupSettings.insert(new TSSSetting(-1, pa));
		break;

	case PRAC_REMOVED:
		for (int i = 0; i < startupSettings.getCount(); i++) {
			if (!mir_strcmp(startupSettings[i].szName, pa->szModuleName)) {
				startupSettings.remove(i);
				break;
			}
		}
		break;
	}

	return 0;
}
예제 #2
0
int GetProfile( int profile, TSettingsList& arSettings )
{
    if ( profile < 0 ) // get default profile
        profile = db_get_w(NULL, MODULENAME, SETTING_DEFAULTPROFILE, 0);

    int count = db_get_w(NULL, MODULENAME, SETTING_PROFILECOUNT, 0);
    if ( profile >= count && count > 0 )
        return -1;

    arSettings.destroy();

    // if count == 0, continue so the default profile will be returned
    PROTOACCOUNT** protos;
    Proto_EnumAccounts( &count, &protos );

    for ( int i=0; i < count; i++ )
        if ( IsSuitableProto( protos[i] ))
            arSettings.insert( new TSSSetting( profile, protos[i] ));

    return ( arSettings.getCount() == 0 ) ? -1 : 0;
}