Exemplo n.º 1
0
Arquivo: account.c Projeto: 91D2/pvpgn
static t_account * account_load_new(char const * name, unsigned uid)
{
    t_account *account;
    t_attrgroup *attrgroup;

    if (name && account_check_name(name)) return NULL;

    force_account_add = 1; /* disable the protection */

    attrgroup = attrgroup_create_nameuid(name, uid);
    if (!attrgroup) {
	force_account_add = 0;
	return NULL;
    }

    if (!(account = account_load(attrgroup))) {
        eventlog(eventlog_level_error, __FUNCTION__,"could not load account");
        attrgroup_destroy(attrgroup);
	force_account_add = 0;
        return NULL;
    }

    if (!accountlist_add_account(account)) {
        eventlog(eventlog_level_error, __FUNCTION__,"could not add account to list");
        account_destroy(account);
	force_account_add = 0;
        return NULL;
    }

    force_account_add = 0;

    return account;
}
Exemplo n.º 2
0
		static int attrlayer_unload_default(void)
		{
			attrgroup_destroy(defattrs);
			defattrs = NULL;

			return 0;
		}
Exemplo n.º 3
0
Arquivo: account.c Projeto: 91D2/pvpgn
static void account_destroy(t_account * account)
{
    assert(account);

    friendlist_close(account->friends);
    teams_destroy(account->teams);
    if (account->attrgroup)
    	attrgroup_destroy(account->attrgroup);
    if (account->name)
        xfree(account->name);

    xfree(account);
}
Exemplo n.º 4
0
Arquivo: account.c Projeto: 91D2/pvpgn
static int _cb_read_accounts(t_attrgroup *attrgroup, void *data)
{
    unsigned int *count = (unsigned int *)data;
    t_account *account;

    if (!(account = account_load(attrgroup))) {
        eventlog(eventlog_level_error, __FUNCTION__,"could not load account");
	attrgroup_destroy(attrgroup);
        return -1;
    }

    if (!accountlist_add_account(account)) {
        eventlog(eventlog_level_error, __FUNCTION__,"could not add account to list");
        account_destroy(account);
        return -1;
    }

    /* might as well free up the memory since we probably won't need it */
    account_flush(account,FS_FORCE); /* force unload */

    (*count)++;

    return 0;
}