Ignore:
Timestamp:
Jun 15, 2009 4:03:40 PM (15 years ago)
Author:
bennylp
Message:

Ticket #873: Include the parsed XML tuple in the pjsip_pres_status, and include it in the pjsua_buddy_info in PJSUA-LIB, in case the PIDF document contains other info that is needed by application (thanks Johan Lantz for the suggestion)

File:
1 edited

Legend:

Unmodified
Added
Removed
  • pjproject/trunk/pjsip/src/pjsip-simple/presence_body.c

    r2394 r2762  
    101101        pjpidf_status_set_basic_open(pidf_status,  
    102102                                     status->info[i].basic_open); 
     103 
     104        /* Add <timestamp> if configured */ 
     105#if defined(PJSIP_PRES_PIDF_ADD_TIMESTAMP) && PJSIP_PRES_PIDF_ADD_TIMESTAMP 
     106        if (PJSIP_PRES_PIDF_ADD_TIMESTAMP) { 
     107          char buf[50]; 
     108          int tslen = 0; 
     109          pj_time_val tv; 
     110          pj_parsed_time pt; 
     111 
     112          pj_gettimeofday(&tv); 
     113          /* TODO: convert time to GMT! (unsupported by pjlib) */ 
     114          pj_time_decode( &tv, &pt); 
     115 
     116          tslen = pj_ansi_snprintf(buf, sizeof(buf), 
     117                                   "%04d-%02d-%02dT%02d:%02d:%02d.%03dZ", 
     118                                   pt.year, pt.mon, pt.day,  
     119                                   pt.hour, pt.min, pt.sec, pt.msec); 
     120          if (tslen > 0 && tslen < sizeof(buf)) { 
     121              pj_str_t time = pj_str(buf); 
     122              pjpidf_tuple_set_timestamp(pool, pidf_tuple, &time); 
     123          } 
     124        } 
     125#endif 
    103126    } 
    104127 
     
    180203 
    181204    pidf_tuple = pjpidf_pres_get_first_tuple(pidf); 
    182     while (pidf_tuple) { 
     205    while (pidf_tuple && pres_status->info_cnt < PJSIP_PRES_STATUS_MAX_INFO) { 
    183206        pjpidf_status *pidf_status; 
     207 
     208        pres_status->info[pres_status->info_cnt].tuple_node =  
     209            pj_xml_clone(pool, pidf_tuple); 
    184210 
    185211        pj_strdup(pool,  
     
    232258    pres_status->info[0].basic_open = pjxpidf_get_status(xpidf); 
    233259    pres_status->info[0].id.slen = 0; 
     260    pres_status->info[0].tuple_node = NULL; 
    234261 
    235262    return PJ_SUCCESS; 
Note: See TracChangeset for help on using the changeset viewer.