Exemple #1
0
CMonoActor::CMonoActor()
	: m_pAnimatedCharacter(NULL)
	, m_bClient(false)
	, m_bMigrating(false)
	, m_pScript(nullptr)
{
	m_currentPhysProfile=GetDefaultProfile(eEA_Physics);
}
Exemple #2
0
/**
 * Retrieve server specific information
 */
static bool mapitest_get_server_info(struct mapitest *mt,
				     char *opt_profname,
				     const char *password,
				     bool opt_dumpdata,
				     const char *opt_debug)
{
	TALLOC_CTX		*mem_ctx;
	enum MAPISTATUS		retval;
	struct emsmdb_info	*info = NULL;
	struct mapi_session	*session = NULL;

	/* if the user explicitly asked for just the no-server tests 
	to be run, then we're done here */
	if (mt->no_server == true) return 0;

	mem_ctx = talloc_named(NULL, 0, "mapitest_get_server_info");

	/* if no profile was specified, get the default */
	if (!opt_profname) {
		retval = GetDefaultProfile(mt->mapi_ctx, &opt_profname);
		if (retval != MAPI_E_SUCCESS) {
			mapi_errstr("GetDefaultProfile", retval);
			talloc_free(mem_ctx);
			return false;
		}
	}
		

	/* debug options */
	SetMAPIDumpData(mt->mapi_ctx, opt_dumpdata);

	if (opt_debug) {
		SetMAPIDebugLevel(mt->mapi_ctx, atoi(opt_debug));
	}

	retval = MapiLogonEx(mt->mapi_ctx, &session, opt_profname, password);
	MAPIFreeBuffer(opt_profname);
	talloc_free(mem_ctx);
	if (retval != MAPI_E_SUCCESS) {
		mapi_errstr("MapiLogonEx", retval);
		return false;
	}
	mt->session = session;
	mt->profile = session->profile;

	info = emsmdb_get_info(session);
	memcpy(&mt->info, info, sizeof (struct emsmdb_info));

	/* extract org and org_unit from info.mailbox */
	mt->org = x500_get_dn_element(mt->mem_ctx, info->szDNPrefix, "/o=");
	mt->org_unit = x500_get_dn_element(mt->mem_ctx, info->szDNPrefix, "/ou=");
	
	return true;
}
//-----------------------------------------------------------------------------
Profile* ProfileManager::GetDefaultUserProfile(const ProfileDeviceKey& deviceKey)
{
	const char* userName = GetDefaultUser(deviceKey);

    Profile* profile = GetProfile(deviceKey, userName);

    if (!profile)
    {
        profile = GetDefaultProfile(deviceKey.HmdType);
    }

    return profile;
}
QString MapiProfiles::defaultGet()
{
    if (!init()) {
        return QString();
    }

    char *profname;
    if (MAPI_E_SUCCESS != GetDefaultProfile(m_context, &profname)) {
        error() << "cannot get default profile:" << mapiError();
        return QString();
    }
    return QString::fromLocal8Bit(profname);
}
Exemple #5
0
int main(int argc, char *argv[])
{
        enum MAPISTATUS                 retval;
	struct mapi_context		*mapi_ctx;
	TALLOC_CTX			*mem_ctx;
        struct mapi_session             *session = NULL;
        mapi_object_t                   obj_store;
        mapi_object_t                   obj_folder;
        mapi_object_t                   obj_table;
        mapi_object_t                   obj_message;
        struct mapi_SPropValue_array	props_all;
        struct SRowSet                  rowset;
        struct SPropTagArray            *SPropTagArray;
        mapi_id_t                       id_inbox;
        mapi_id_t                       *fid, *mid;
        char                            *profname;
	char				*profdb;
	uint32_t			Numerator;
	uint32_t			Denominator;
        uint32_t                        i;

	mem_ctx = talloc_named(NULL, 0, "fetchmail");

        /* Initialize MAPI */
	profdb = talloc_asprintf(mem_ctx, DEFAULT_PROFDB, getenv("HOME"));
        retval = MAPIInitialize(&mapi_ctx, profdb);
        MAPI_RETVAL_IF(retval, retval, mem_ctx);

        /* Find Default Profile */
        retval = GetDefaultProfile(mapi_ctx, &profname);
        MAPI_RETVAL_IF(retval, retval, mem_ctx);

        /* Log on EMSMDB and NSPI */
        retval = MapiLogonEx(mapi_ctx, &session, profname, NULL);
        MAPI_RETVAL_IF(retval, retval, mem_ctx);

        /* Open Message Store */
        mapi_object_init(&obj_store);
        retval = OpenMsgStore(session, &obj_store);
        MAPI_RETVAL_IF(retval, retval, mem_ctx);

        /* Find Inbox default folder */
        retval = GetDefaultFolder(&obj_store, &id_inbox, olFolderInbox);
        MAPI_RETVAL_IF(retval, retval, mem_ctx);

        /* Open Inbox folder */
        mapi_object_init(&obj_folder);
        retval = OpenFolder(&obj_store, id_inbox, &obj_folder);
        MAPI_RETVAL_IF(retval, retval, mem_ctx);

        /* Retrieve Inbox content table */
        mapi_object_init(&obj_table);
        retval = GetContentsTable(&obj_folder, &obj_table, 0x0, NULL);
        MAPI_RETVAL_IF(retval, retval, mem_ctx);

        /* Create the MAPI table view */
        SPropTagArray = set_SPropTagArray(mem_ctx, 0x2, PR_FID, PR_MID);
        retval = SetColumns(&obj_table, SPropTagArray);
        MAPIFreeBuffer(SPropTagArray);
        MAPI_RETVAL_IF(retval, retval, mem_ctx);
        talloc_free(mem_ctx);

        /* Get current cursor position */
        retval = QueryPosition(&obj_table, &Numerator, &Denominator);
        MAPI_RETVAL_IF(retval, retval, mem_ctx);

        /* Iterate through rows */
        while ((retval = QueryRows(&obj_table, Denominator, TBL_ADVANCE, &rowset)) 
	       != -1 && rowset.cRows) {
                for (i = 0; i < rowset.cRows; i++) {
			fid = (mapi_id_t *)find_SPropValue_data(&(rowset.aRow[i]), PR_FID);
			mid = (mapi_id_t *)find_SPropValue_data(&(rowset.aRow[i]), PR_MID);
			mapi_object_init(&obj_message);
                        retval = OpenMessage(&obj_store, *fid, *mid, &obj_message, 0x0);
                        if (retval != MAPI_E_NOT_FOUND) {
                                retval = GetPropsAll(&obj_message, MAPI_UNICODE, &props_all);
                                mapidump_message(&props_all, NULL, &obj_message);
                                mapi_object_release(&obj_message);
                        }
                }

        }

        /* Release MAPI objects */
        mapi_object_release(&obj_table);
        mapi_object_release(&obj_folder);

	Logoff(&obj_store);

        /* Uninitialize MAPI */
        MAPIUninitialize(mapi_ctx);
        return (0);
}