Ignore:
Timestamp:
Jul 21, 2008 6:12:51 PM (11 years ago)
Author:
bennylp
Message:

Ticket #576: Added user data in pjsua account and buddy

File:
1 edited

Legend:

Unmodified
Added
Removed
  • pjproject/trunk/pjsip/src/pjsua-lib/pjsua_acc.c

    r2142 r2162  
    160160    } 
    161161 
    162  
    163162    /* Save the user and domain part. These will be used when finding an  
    164163     * account for incoming requests. 
     
    383382     
    384383    return pjsua_acc_add(&cfg, is_default, p_acc_id); 
     384} 
     385 
     386 
     387/* 
     388 * Set arbitrary data to be associated with the account. 
     389 */ 
     390PJ_DEF(pj_status_t) pjsua_acc_set_user_data(pjsua_acc_id acc_id, 
     391                                            void *user_data) 
     392{ 
     393    PJ_ASSERT_RETURN(acc_id>=0 && acc_id<(int)PJ_ARRAY_SIZE(pjsua_var.acc), 
     394                     PJ_EINVAL); 
     395    PJ_ASSERT_RETURN(pjsua_var.acc[acc_id].valid, PJ_EINVALIDOP); 
     396 
     397    PJSUA_LOCK(); 
     398 
     399    pjsua_var.acc[acc_id].cfg.user_data = user_data; 
     400 
     401    PJSUA_UNLOCK(); 
     402 
     403    return PJ_SUCCESS; 
     404} 
     405 
     406 
     407/* 
     408 * Retrieve arbitrary data associated with the account. 
     409 */ 
     410PJ_DEF(void*) pjsua_acc_get_user_data(pjsua_acc_id acc_id) 
     411{ 
     412    PJ_ASSERT_RETURN(acc_id>=0 && acc_id<(int)PJ_ARRAY_SIZE(pjsua_var.acc), 
     413                     NULL); 
     414    PJ_ASSERT_RETURN(pjsua_var.acc[acc_id].valid, NULL); 
     415 
     416    return pjsua_var.acc[acc_id].cfg.user_data; 
    385417} 
    386418 
Note: See TracChangeset for help on using the changeset viewer.