Changeset 2149 for pjproject/trunk/pjsip/src/pjsip-simple/presence.c
- Timestamp:
- Jul 17, 2008 1:53:41 PM (16 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
pjproject/trunk/pjsip/src/pjsip-simple/presence.c
r2039 r2149 462 462 PJ_ASSERT_RETURN(pres != NULL, PJSIP_SIMPLE_ENOPRESENCE); 463 463 464 /* Must have at least one presence info. */ 465 PJ_ASSERT_RETURN(pres->status.info_cnt > 0, PJSIP_SIMPLE_ENOPRESENCEINFO); 464 /* Must have at least one presence info, unless state is 465 * PJSIP_EVSUB_STATE_TERMINATED. This could happen if subscription 466 * has not been active (e.g. we're waiting for user authorization) 467 * and remote cancels the subscription. 468 */ 469 PJ_ASSERT_RETURN(state==PJSIP_EVSUB_STATE_TERMINATED || 470 pres->status.info_cnt > 0, PJSIP_SIMPLE_ENOPRESENCEINFO); 466 471 467 472 … … 475 480 476 481 477 /* Create message body to reflect the presence status. */ 478 status = pres_create_msg_body( pres, tdata ); 479 if (status != PJ_SUCCESS) 480 goto on_return; 481 482 /* Create message body to reflect the presence status. 483 * Only do this if we have presence status info to send (see above). 484 */ 485 if (pres->status.info_cnt > 0) { 486 status = pres_create_msg_body( pres, tdata ); 487 if (status != PJ_SUCCESS) 488 goto on_return; 489 } 482 490 483 491 /* Done. */ … … 508 516 PJ_ASSERT_RETURN(pres != NULL, PJSIP_SIMPLE_ENOPRESENCE); 509 517 510 /* Must have at least one presence info. */ 511 PJ_ASSERT_RETURN(pres->status.info_cnt > 0, PJSIP_SIMPLE_ENOPRESENCEINFO); 518 /* We may not have a presence info yet, e.g. when we receive SUBSCRIBE 519 * to refresh subscription while we're waiting for user authorization. 520 */ 521 //PJ_ASSERT_RETURN(pres->status.info_cnt > 0, 522 // PJSIP_SIMPLE_ENOPRESENCEINFO); 512 523 513 524 … … 522 533 523 534 /* Create message body to reflect the presence status. */ 524 status = pres_create_msg_body( pres, tdata ); 525 if (status != PJ_SUCCESS) 526 goto on_return; 527 535 if (pres->status.info_cnt > 0) { 536 status = pres_create_msg_body( pres, tdata ); 537 if (status != PJ_SUCCESS) 538 goto on_return; 539 } 528 540 529 541 /* Done. */
Note: See TracChangeset
for help on using the changeset viewer.