Changeset 2162 for pjproject/trunk/pjsip/src/pjsua-lib/pjsua_pres.c
- Timestamp:
- Jul 21, 2008 6:12:51 PM (16 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
pjproject/trunk/pjsip/src/pjsua-lib/pjsua_pres.c
r2150 r2162 71 71 72 72 /* 73 * Find buddy. 74 */ 75 PJ_DEF(pjsua_buddy_id) pjsua_buddy_find(const pj_str_t *uri_str) 76 { 77 pj_str_t input; 78 pj_pool_t *pool; 79 pjsip_uri *uri; 80 pjsua_buddy_id buddy_id; 81 82 pool = pjsua_pool_create("buddyfind", 512, 512); 83 pj_strdup_with_null(pool, &input, uri_str); 84 85 uri = pjsip_parse_uri(pool, input.ptr, input.slen, 0); 86 if (!uri) 87 buddy_id = PJSUA_INVALID_ID; 88 else 89 buddy_id = pjsua_find_buddy(uri); 90 91 pj_pool_release(pool); 92 93 return buddy_id; 94 } 95 96 97 /* 73 98 * Check if buddy ID is valid. 74 99 */ … … 191 216 } 192 217 218 /* 219 * Set the user data associated with the buddy object. 220 */ 221 PJ_DEF(pj_status_t) pjsua_buddy_set_user_data( pjsua_buddy_id buddy_id, 222 void *user_data) 223 { 224 PJ_ASSERT_RETURN(buddy_id>=0 && 225 buddy_id<(int)PJ_ARRAY_SIZE(pjsua_var.buddy), 226 PJ_EINVAL); 227 228 PJSUA_LOCK(); 229 230 pjsua_var.buddy[buddy_id].user_data = user_data; 231 232 PJSUA_UNLOCK(); 233 234 return PJ_SUCCESS; 235 } 236 237 238 /* 239 * Get the user data associated with the budy object. 240 */ 241 PJ_DEF(void*) pjsua_buddy_get_user_data(pjsua_buddy_id buddy_id) 242 { 243 void *user_data; 244 245 PJ_ASSERT_RETURN(buddy_id>=0 && 246 buddy_id<(int)PJ_ARRAY_SIZE(pjsua_var.buddy), 247 NULL); 248 249 PJSUA_LOCK(); 250 251 user_data = pjsua_var.buddy[buddy_id].user_data; 252 253 PJSUA_UNLOCK(); 254 255 return user_data; 256 } 257 193 258 194 259 /* … … 289 354 if (pjsua_var.buddy[index].port == 0) 290 355 pjsua_var.buddy[index].port = 5060; 356 357 /* Save user data */ 358 pjsua_var.buddy[index].user_data = (void*)cfg->user_data; 291 359 292 360 if (p_buddy_id)
Note: See TracChangeset
for help on using the changeset viewer.