Logo Search packages:      
Sourcecode: jabberd2 version File versions  Download package

user_t user_load ( sm_t  sm,
jid_t  jid 
)

fetch user data

Definition at line 52 of file user.c.

References _user_alloc(), user_st::jid, sm_st::mm, mm_user_load(), user_st::p, and sm_st::users.

Referenced by _privacy_in_router(), _privacy_out_router(), dispatch(), user_create(), and user_delete().

                                     {
    user_t user;

    /* already loaded */
    user = xhash_get(sm->users, jid_user(jid));
    if(user != NULL) {
        log_debug(ZONE, "returning previously-created user data for %s", jid_user(jid));
        return user;
    }

    /* make a new one */
    user = _user_alloc(sm, jid);

    /* get modules to setup */
    if(mm_user_load(sm->mm, user) != 0) {
        log_debug(ZONE, "modules failed user load for %s", jid_user(jid));
        pool_free(user->p);
        return NULL;
    }

    /* save them for later */
    xhash_put(sm->users, jid_user(user->jid), (void *) user);

    log_debug(ZONE, "loaded user data for %s", jid_user(jid));

    return user;
}


Generated by  Doxygen 1.6.0   Back to index