Ignore:
Timestamp:
Oct 31, 2007 10:54:53 AM (16 years ago)
Author:
bennylp
Message:

Ticket #406: New PJSUA API to update buddy's presence subscription

File:
1 edited

Legend:

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

    r1534 r1535  
    312312 
    313313/* 
     314 * Update buddy's presence. 
     315 */ 
     316PJ_DEF(pj_status_t) pjsua_buddy_update_pres(pjsua_buddy_id buddy_id) 
     317{ 
     318    pjsua_buddy *buddy; 
     319 
     320    PJ_ASSERT_RETURN(buddy_id>=0 &&  
     321                        buddy_id<(int)PJ_ARRAY_SIZE(pjsua_var.buddy), 
     322                     PJ_EINVAL); 
     323 
     324    PJSUA_LOCK(); 
     325 
     326    buddy = &pjsua_var.buddy[buddy_id]; 
     327 
     328    /* Return error if buddy's presence monitoring is not enabled */ 
     329    if (!buddy->monitor) { 
     330        PJSUA_UNLOCK(); 
     331        return PJ_EINVALIDOP; 
     332    } 
     333 
     334    /* Ignore if presence is already active for the buddy */ 
     335    if (buddy->sub) { 
     336        PJSUA_UNLOCK(); 
     337        return PJ_SUCCESS; 
     338    } 
     339 
     340    /* Initiate presence subscription */ 
     341    subscribe_buddy_presence(buddy_id); 
     342 
     343    PJSUA_UNLOCK(); 
     344 
     345    return PJ_SUCCESS; 
     346} 
     347 
     348 
     349/* 
    314350 * Dump presence subscriptions to log file. 
    315351 */ 
Note: See TracChangeset for help on using the changeset viewer.