Changeset 999


Ignore:
Timestamp:
Feb 24, 2007 3:28:16 PM (12 years ago)
Author:
bennylp
Message:

Fixed ticket #135: Invalid presence entity ID when URI is specified in name-addr format

File:
1 edited

Legend:

Unmodified
Added
Removed
  • pjproject/branches/pjproject-0.5-stable/pjsip/src/pjsua-lib/pjsua_pres.c

    r997 r999  
    623623    /* Create PUBLISH request */ 
    624624    if (active) { 
     625        char *bpos; 
     626        pj_str_t entity; 
     627 
    625628        status = pjsip_publishc_publish(acc->publish_sess, PJ_TRUE, &tdata); 
    626629        if (status != PJ_SUCCESS) { 
     
    634637        pres_status.info[0].basic_open = acc->online_status; 
    635638 
     639        /* Be careful not to send PIDF with presence entity ID containing 
     640         * "<" character. 
     641         */ 
     642        if ((bpos=pj_strchr(&acc_cfg->id, '<')) != NULL) { 
     643            char *epos = pj_strchr(&acc_cfg->id, '>'); 
     644            if (epos - bpos < 2) { 
     645                pj_assert(!"Unexpected invalid URI"); 
     646                status = PJSIP_EINVALIDURI; 
     647                goto on_error; 
     648            } 
     649            entity.ptr = bpos+1; 
     650            entity.slen = epos - bpos - 1; 
     651        } else { 
     652            entity = acc_cfg->id; 
     653        } 
     654 
    636655        /* Create and add PIDF message body */ 
    637656        status = pjsip_pres_create_pidf(tdata->pool, &pres_status, 
    638                                         &acc_cfg->id, &tdata->msg->body); 
     657                                        &entity, &tdata->msg->body); 
    639658        if (status != PJ_SUCCESS) { 
    640659            pjsua_perror(THIS_FILE, "Error creating PIDF for PUBLISH request", 
Note: See TracChangeset for help on using the changeset viewer.