void linphone_friend_apply(LinphoneFriend *fr, LinphoneCore *lc) { LinphonePresenceModel *model; if (!fr->uri) { ms_warning("No sip url defined."); return; } if (fr->inc_subscribe_pending) { switch(fr->pol) { case LinphoneSPWait: model = linphone_presence_model_new_with_activity(LinphonePresenceActivityOther, "Waiting for user acceptance"); linphone_friend_notify(fr, model); linphone_presence_model_unref(model); break; case LinphoneSPAccept: if (fr->lc) linphone_friend_notify(fr, fr->lc->presence_model); break; case LinphoneSPDeny: linphone_friend_notify(fr, NULL); break; } fr->inc_subscribe_pending = FALSE; } if (fr->lc) { linphone_friend_list_update_subscriptions(fr->friend_list, NULL, linphone_core_should_subscribe_friends_only_when_registered(fr->lc)); } ms_debug("linphone_friend_apply() done."); lc->bl_refresh=TRUE; fr->commit=FALSE; }
void linphone_core_update_friends_subscriptions(LinphoneCore *lc, LinphoneProxyConfig *cfg, bool_t only_when_registered) { bctbx_list_t *lists = lc->friends_lists; while (lists) { LinphoneFriendList *list = (LinphoneFriendList *)lists->data; linphone_friend_list_update_subscriptions(list, cfg, only_when_registered); lists = bctbx_list_next(lists); } }
void linphone_friend_list_enable_subscriptions(LinphoneFriendList *list, bool_t enabled) { if (list->enable_subscriptions != enabled) { if (enabled) { linphone_friend_list_update_subscriptions(list, NULL, TRUE); } else { linphone_friend_list_close_subscriptions(list); } list->enable_subscriptions = enabled; } }
static void test_presence_list_subscribe_before_publish(void) { LinphoneCoreManager *laure = linphone_core_manager_new("laure_tcp_rc"); LinphoneCoreManager *pauline = linphone_core_manager_new(transport_supported(LinphoneTransportTls) ? "pauline_rc" : "pauline_tcp_rc"); const char *rls_uri = "sip:[email protected]"; LinphoneFriendList *lfl; LinphoneFriend *lf; const char *pauline_identity; MSList* lcs = NULL; int dummy = 0; pauline_identity = get_identity(pauline); linphone_core_set_presence_model(pauline->lc, linphone_core_create_presence_model_with_activity(pauline->lc, LinphonePresenceActivityVacation, NULL)); lfl = linphone_core_create_friend_list(laure->lc); linphone_friend_list_set_rls_uri(lfl, rls_uri); lf = linphone_core_create_friend_with_address(laure->lc, pauline_identity); linphone_friend_list_add_friend(lfl, lf); lf = linphone_core_create_friend_with_address(laure->lc, "sip:[email protected]"); linphone_friend_list_add_friend(lfl, lf); linphone_core_remove_friend_list(laure->lc, linphone_core_get_default_friend_list(laure->lc)); linphone_core_add_friend_list(laure->lc, lfl); linphone_friend_list_unref(lfl); linphone_core_set_presence_model(laure->lc, linphone_core_create_presence_model_with_activity(laure->lc, LinphonePresenceActivityOnline, NULL)); linphone_friend_list_update_subscriptions(linphone_core_get_default_friend_list(laure->lc), NULL, FALSE); lcs = ms_list_append(lcs, laure->lc); lcs = ms_list_append(lcs, pauline->lc); wait_for_list(lcs, &dummy, 1, 2000); /* Wait a little bit for the subscribe to happen */ enable_publish(pauline, TRUE); wait_for_list(lcs, &pauline->stat.number_of_NotifyPresenceReceived, 1, 4000); BC_ASSERT_GREATER(laure->stat.number_of_NotifyPresenceReceived, 1, int, "%d"); BC_ASSERT_GREATER(linphone_core_get_default_friend_list(laure->lc)->expected_notification_version, 1, int, "%d"); lf = linphone_friend_list_find_friend_by_uri(linphone_core_get_default_friend_list(laure->lc), pauline_identity); BC_ASSERT_EQUAL(linphone_friend_get_status(lf), LinphoneStatusVacation, int, "%d"); BC_ASSERT_TRUE(lf->presence_received); BC_ASSERT_TRUE(lf->subscribe_active); lf = linphone_friend_list_find_friend_by_uri(linphone_core_get_default_friend_list(laure->lc), "sip:[email protected]"); BC_ASSERT_EQUAL(linphone_friend_get_status(lf), LinphoneStatusOffline, int, "%d"); BC_ASSERT_FALSE(lf->presence_received); BC_ASSERT_TRUE(lf->subscribe_active); enable_publish(laure, FALSE); enable_publish(pauline, FALSE); linphone_core_manager_destroy(laure); linphone_core_manager_destroy(pauline); }
static void linphone_friend_list_parse_multipart_related_body(LinphoneFriendList *list, const LinphoneContent *body, const char *first_part_body) { xmlparsing_context_t *xml_ctx = linphone_xmlparsing_context_new(); xmlSetGenericErrorFunc(xml_ctx, linphone_xmlparsing_genericxml_error); xml_ctx->doc = xmlReadDoc((const unsigned char*)first_part_body, 0, NULL, 0); if (xml_ctx->doc != NULL) { char xpath_str[MAX_XPATH_LENGTH]; LinphoneFriend *friend; LinphoneContent *presence_part; xmlXPathObjectPtr resource_object; const char *version_str = NULL; const char *full_state_str = NULL; const char *uri = NULL; bool_t full_state = FALSE; int version; int i; if (linphone_create_xml_xpath_context(xml_ctx) < 0) goto end; xmlXPathRegisterNs(xml_ctx->xpath_ctx, (const xmlChar *)"rlmi", (const xmlChar *)"urn:ietf:params:xml:ns:rlmi"); version_str = linphone_get_xml_attribute_text_content(xml_ctx, "/rlmi:list", "version"); if (version_str == NULL) { ms_warning("rlmi+xml: No version attribute in list"); goto end; } version = atoi(version_str); linphone_free_xml_text_content(version_str); if (version < list->expected_notification_version) { ms_warning("rlmi+xml: Discarding received notification with version %d because %d was expected", version, list->expected_notification_version); linphone_friend_list_update_subscriptions(list, NULL, FALSE); /* Refresh subscription to get new full state notify. */ goto end; } full_state_str = linphone_get_xml_attribute_text_content(xml_ctx, "/rlmi:list", "fullState"); if (full_state_str == NULL) { ms_warning("rlmi+xml: No fullState attribute in list"); goto end; } if ((strcmp(full_state_str, "true") == 0) || (strcmp(full_state_str, "1") == 0)) { MSList *l = list->friends; for (; l != NULL; l = l->next) { friend = (LinphoneFriend *)l->data; linphone_friend_set_presence_model(friend, NULL); } full_state = TRUE; }
static void test_presence_list_subscription_expire_for_unknown(void) { LinphoneCoreManager *laure = linphone_core_manager_new("laure_tcp_rc"); const char *rls_uri = "sip:[email protected]"; LinphoneFriendList *lfl; LinphoneFriend *lf; lp_config_set_int(laure->lc->config, "sip", "rls_presence_expires", 3); lfl = linphone_core_create_friend_list(laure->lc); linphone_friend_list_set_rls_uri(lfl, rls_uri); lf = linphone_core_create_friend_with_address(laure->lc, "sip:[email protected]"); linphone_friend_list_add_friend(lfl, lf); linphone_core_remove_friend_list(laure->lc, linphone_core_get_default_friend_list(laure->lc)); linphone_core_add_friend_list(laure->lc, lfl); linphone_friend_list_update_subscriptions(lfl,NULL,FALSE); linphone_friend_list_unref(lfl); /* wait for refresh*/ BC_ASSERT_FALSE(wait_for_until(laure->lc, NULL, &laure->stat.number_of_NotifyPresenceReceived, 1, 4000)); linphone_core_manager_destroy(laure); }
static void linphone_friend_list_parse_multipart_related_body(LinphoneFriendList *list, const LinphoneContent *body, const char *first_part_body) { xmlparsing_context_t *xml_ctx = linphone_xmlparsing_context_new(); xmlSetGenericErrorFunc(xml_ctx, linphone_xmlparsing_genericxml_error); xml_ctx->doc = xmlReadDoc((const unsigned char*)first_part_body, 0, NULL, 0); if (xml_ctx->doc != NULL) { char xpath_str[MAX_XPATH_LENGTH]; LinphoneFriend *lf; LinphoneContent *presence_part; xmlXPathObjectPtr resource_object; const char *version_str = NULL; const char *full_state_str = NULL; const char *uri = NULL; bool_t full_state = FALSE; int version; int i; if (linphone_create_xml_xpath_context(xml_ctx) < 0) goto end; xmlXPathRegisterNs(xml_ctx->xpath_ctx, (const xmlChar *)"rlmi", (const xmlChar *)"urn:ietf:params:xml:ns:rlmi"); version_str = linphone_get_xml_attribute_text_content(xml_ctx, "/rlmi:list", "version"); if (version_str == NULL) { ms_warning("rlmi+xml: No version attribute in list"); goto end; } version = atoi(version_str); linphone_free_xml_text_content(version_str); if (version < list->expected_notification_version) { ms_warning("rlmi+xml: Discarding received notification with version %d because %d was expected", version, list->expected_notification_version); linphone_friend_list_update_subscriptions(list, NULL, FALSE); /* Refresh subscription to get new full state notify. */ goto end; } full_state_str = linphone_get_xml_attribute_text_content(xml_ctx, "/rlmi:list", "fullState"); if (full_state_str == NULL) { ms_warning("rlmi+xml: No fullState attribute in list"); goto end; } if ((strcmp(full_state_str, "true") == 0) || (strcmp(full_state_str, "1") == 0)) { bctbx_list_t *l = list->friends; for (; l != NULL; l = l->next) { lf = (LinphoneFriend *)l->data; linphone_friend_set_presence_model(lf, NULL); } full_state = TRUE; } linphone_free_xml_text_content(full_state_str); if ((list->expected_notification_version == 0) && (full_state == FALSE)) { ms_warning("rlmi+xml: Notification with version 0 is not full state, this is not valid"); goto end; } list->expected_notification_version = version + 1; resource_object = linphone_get_xml_xpath_object_for_node_list(xml_ctx, "/rlmi:list/rlmi:resource"); if ((resource_object != NULL) && (resource_object->nodesetval != NULL)) { for (i = 1; i <= resource_object->nodesetval->nodeNr; i++) { snprintf(xpath_str, sizeof(xpath_str), "/rlmi:list/rlmi:resource[%i]/@uri", i); uri = linphone_get_xml_text_content(xml_ctx, xpath_str); if (uri == NULL) continue; lf = linphone_friend_list_find_friend_by_uri(list, uri); if (lf != NULL) { const char *state = NULL; snprintf(xpath_str, sizeof(xpath_str),"/rlmi:list/rlmi:resource[%i]/rlmi:instance/@state", i); state = linphone_get_xml_text_content(xml_ctx, xpath_str); if ((state != NULL) && (strcmp(state, "active") == 0)) { const char *cid = NULL; snprintf(xpath_str, sizeof(xpath_str),"/rlmi:list/rlmi:resource[%i]/rlmi:instance/@cid", i); cid = linphone_get_xml_text_content(xml_ctx, xpath_str); if (cid != NULL) { presence_part = linphone_content_find_part_by_header(body, "Content-Id", cid); if (presence_part == NULL) { ms_warning("rlmi+xml: Cannot find part with Content-Id: %s", cid); } else { SalPresenceModel *presence = NULL; linphone_notify_parse_presence(linphone_content_get_type(presence_part), linphone_content_get_subtype(presence_part), linphone_content_get_string_buffer(presence_part), &presence); if (presence != NULL) { lf->presence_received = TRUE; linphone_friend_set_presence_model(lf, (LinphonePresenceModel *)presence); if (full_state == FALSE) { linphone_core_notify_notify_presence_received(list->lc, lf); } } linphone_content_unref(presence_part); } } if (cid != NULL) linphone_free_xml_text_content(cid); } if (state != NULL) linphone_free_xml_text_content(state); lf->subscribe_active = TRUE; } linphone_free_xml_text_content(uri); } } if (resource_object != NULL) xmlXPathFreeObject(resource_object); if (full_state == TRUE) { bctbx_list_t *l = list->friends; for (; l != NULL; l = l->next) { lf = (LinphoneFriend *)l->data; if (linphone_friend_is_presence_received(lf) == TRUE) { linphone_core_notify_notify_presence_received(list->lc, lf); } } } } else { ms_warning("Wrongly formatted rlmi+xml body: %s", xml_ctx->errorBuffer); } end: linphone_xmlparsing_context_destroy(xml_ctx); }
static void test_presence_list_subscribe_with_error(bool_t io_error) { LinphoneCoreManager *laure = linphone_core_manager_new("laure_tcp_rc"); LinphoneCoreManager *pauline = linphone_core_manager_new(transport_supported(LinphoneTransportTls) ? "pauline_rc" : "pauline_tcp_rc"); const char *rls_uri = "sip:[email protected]"; LinphoneFriendList *lfl; LinphoneFriend *lf; const char *pauline_identity; MSList* lcs = NULL; int dummy = 0; lp_config_set_int(laure->lc->config, "sip", "rls_presence_expires", 5); pauline_identity = get_identity(pauline); linphone_core_set_presence_model(pauline->lc, linphone_core_create_presence_model_with_activity(pauline->lc, LinphonePresenceActivityVacation, NULL)); lfl = linphone_core_create_friend_list(laure->lc); linphone_friend_list_set_rls_uri(lfl, rls_uri); lf = linphone_core_create_friend_with_address(laure->lc, pauline_identity); linphone_friend_list_add_friend(lfl, lf); lf = linphone_core_create_friend_with_address(laure->lc, "sip:[email protected]"); linphone_friend_list_add_friend(lfl, lf); linphone_core_remove_friend_list(laure->lc, linphone_core_get_default_friend_list(laure->lc)); linphone_core_add_friend_list(laure->lc, lfl); linphone_friend_list_unref(lfl); linphone_core_set_presence_model(laure->lc, linphone_core_create_presence_model_with_activity(laure->lc, LinphonePresenceActivityOnline, NULL)); linphone_friend_list_update_subscriptions(linphone_core_get_default_friend_list(laure->lc), NULL, FALSE); lcs = ms_list_append(lcs, laure->lc); lcs = ms_list_append(lcs, pauline->lc); wait_for_list(lcs, &dummy, 1, 2000); /* Wait a little bit for the subscribe to happen */ enable_publish(pauline, TRUE); BC_ASSERT_TRUE(wait_for_until(laure->lc, pauline->lc, &laure->stat.number_of_LinphonePresenceActivityVacation, 1, 6000)); BC_ASSERT_GREATER(laure->stat.number_of_NotifyPresenceReceived, 1, int, "%d"); BC_ASSERT_GREATER(linphone_core_get_default_friend_list(laure->lc)->expected_notification_version, 1, int, "%d"); lf = linphone_friend_list_find_friend_by_uri(linphone_core_get_default_friend_list(laure->lc), pauline_identity); BC_ASSERT_EQUAL(linphone_friend_get_status(lf), LinphoneStatusVacation, int, "%d"); BC_ASSERT_TRUE(lf->presence_received); BC_ASSERT_TRUE(lf->subscribe_active); lf = linphone_friend_list_find_friend_by_uri(linphone_core_get_default_friend_list(laure->lc), "sip:[email protected]"); BC_ASSERT_EQUAL(linphone_friend_get_status(lf), LinphoneStatusOffline, int, "%d"); BC_ASSERT_FALSE(lf->presence_received); BC_ASSERT_TRUE(lf->subscribe_active); BC_ASSERT_TRUE(wait_for_until(laure->lc, pauline->lc, &laure->stat.number_of_LinphonePresenceActivityVacation, 2, 6000)); if (io_error) { ms_message("Simulating socket error"); sal_set_recv_error(laure->lc->sal, -1); wait_for_list(lcs, &dummy, 1, 500); /* just time for socket to be closed */ } else { ms_message("Simulating in/out packets losses"); sal_set_send_error(laure->lc->sal,1500); /*make sure no refresh is sent, trash the message without generating error*/ sal_set_recv_error(laure->lc->sal, 1500); /*make sure server notify to close the dialog is also ignored*/ wait_for_list(lcs, &dummy, 1, 5000); /* Wait a little bit for the subscribe to happen */ } /*restart normal behavior*/ sal_set_send_error(laure->lc->sal,0); sal_set_recv_error(laure->lc->sal, 1); BC_ASSERT_TRUE(wait_for_until(laure->lc, pauline->lc, &laure->stat.number_of_LinphonePresenceActivityVacation, 3, 6000)); /* give time for subscription to recover to avoid to receive 491 Request pending*/ linphone_core_set_presence_model(pauline->lc, linphone_core_create_presence_model_with_activity(pauline->lc, LinphonePresenceActivityAway, NULL)); BC_ASSERT_TRUE(wait_for_until(laure->lc, pauline->lc, &laure->stat.number_of_LinphonePresenceActivityAway, 1, 6000)); lf = linphone_friend_list_find_friend_by_uri(linphone_core_get_default_friend_list(laure->lc), pauline_identity); BC_ASSERT_EQUAL(linphone_friend_get_status(lf), LinphoneStatusAway, int, "%d"); linphone_core_manager_destroy(laure); linphone_core_manager_destroy(pauline); }
static void test_presence_list_base(bool_t enable_compression) { LinphoneCoreManager *laure = linphone_core_manager_new("laure_tcp_rc"); LinphoneCoreManager *marie = linphone_core_manager_new("marie_rc"); LinphoneCoreManager *pauline = linphone_core_manager_new(transport_supported(LinphoneTransportTls) ? "pauline_rc" : "pauline_tcp_rc"); const char *rls_uri = "sip:[email protected]"; LinphoneFriendList *lfl; LinphoneFriend *lf; const char *laure_identity; const char *marie_identity; const char *pauline_identity; MSList* lcs = NULL; laure_identity = get_identity(laure); marie_identity = get_identity(marie); pauline_identity = get_identity(pauline); enable_publish(marie, TRUE); enable_publish(pauline, TRUE); enable_publish(laure, TRUE); enable_deflate_content_encoding(marie, enable_compression); enable_deflate_content_encoding(pauline, enable_compression); enable_deflate_content_encoding(laure, enable_compression); linphone_core_set_presence_model(marie->lc, linphone_core_create_presence_model_with_activity(marie->lc, LinphonePresenceActivityBusy, NULL)); linphone_core_set_presence_model(pauline->lc, linphone_core_create_presence_model_with_activity(pauline->lc, LinphonePresenceActivityVacation, NULL)); lfl = linphone_core_create_friend_list(laure->lc); linphone_friend_list_set_rls_uri(lfl, rls_uri); lf = linphone_core_create_friend_with_address(laure->lc, marie_identity); linphone_friend_list_add_friend(lfl, lf); linphone_friend_unref(lf); lf = linphone_core_create_friend_with_address(laure->lc, pauline_identity); linphone_friend_list_add_friend(lfl, lf); linphone_friend_unref(lf); lf = linphone_core_create_friend_with_address(laure->lc, "sip:[email protected]"); linphone_friend_list_add_friend(lfl, lf); linphone_friend_unref(lf); linphone_core_remove_friend_list(laure->lc, linphone_core_get_default_friend_list(laure->lc)); linphone_core_add_friend_list(laure->lc, lfl); linphone_friend_list_unref(lfl); linphone_core_set_presence_model(laure->lc, linphone_core_create_presence_model_with_activity(laure->lc, LinphonePresenceActivityOnline, NULL)); lcs = ms_list_append(lcs, laure->lc); lcs = ms_list_append(lcs, marie->lc); lcs = ms_list_append(lcs, pauline->lc); wait_for_list(lcs, &laure->stat.number_of_NotifyPresenceReceived, 2, 4000); BC_ASSERT_EQUAL(laure->stat.number_of_NotifyPresenceReceived, 2, int, "%d"); BC_ASSERT_EQUAL(linphone_core_get_default_friend_list(laure->lc)->expected_notification_version, 1, int, "%d"); lf = linphone_friend_list_find_friend_by_uri(linphone_core_get_default_friend_list(laure->lc), marie_identity); BC_ASSERT_EQUAL(linphone_friend_get_status(lf), LinphoneStatusBusy, int, "%d"); if (!BC_ASSERT_TRUE(lf->presence_received)) goto end; if (!BC_ASSERT_TRUE(lf->subscribe_active)) goto end; lf = linphone_friend_list_find_friend_by_uri(linphone_core_get_default_friend_list(laure->lc), pauline_identity); BC_ASSERT_EQUAL(linphone_friend_get_status(lf), LinphoneStatusVacation, int, "%d"); if (!BC_ASSERT_TRUE(lf->presence_received)) goto end; if (!BC_ASSERT_TRUE(lf->subscribe_active)) goto end; lf = linphone_friend_list_find_friend_by_uri(linphone_core_get_default_friend_list(laure->lc), "sip:[email protected]"); BC_ASSERT_EQUAL(linphone_friend_get_status(lf), LinphoneStatusOffline, int, "%d"); BC_ASSERT_FALSE(lf->presence_received); if (!BC_ASSERT_TRUE(lf->subscribe_active)) goto end; lfl = linphone_core_create_friend_list(marie->lc); linphone_friend_list_set_rls_uri(lfl, rls_uri); lf = linphone_core_create_friend_with_address(marie->lc, laure_identity); linphone_friend_list_add_friend(lfl, lf); linphone_friend_unref(lf); linphone_core_remove_friend_list(marie->lc, linphone_core_get_default_friend_list(marie->lc)); linphone_core_add_friend_list(marie->lc, lfl); linphone_friend_list_unref(lfl); linphone_friend_list_update_subscriptions(linphone_core_get_default_friend_list(marie->lc), NULL, FALSE); wait_for_list(lcs, &marie->stat.number_of_NotifyPresenceReceived, 1, 4000); BC_ASSERT_EQUAL(marie->stat.number_of_NotifyPresenceReceived, 1, int, "%d"); BC_ASSERT_EQUAL(linphone_core_get_default_friend_list(marie->lc)->expected_notification_version, 1, int, "%d"); lf = linphone_friend_list_find_friend_by_uri(linphone_core_get_default_friend_list(marie->lc), laure_identity); BC_ASSERT_EQUAL(linphone_friend_get_status(lf), LinphoneStatusOnline, int, "%d"); if (!BC_ASSERT_TRUE(lf->presence_received)) goto end; if (!BC_ASSERT_TRUE(lf->subscribe_active)) goto end; lfl = linphone_core_create_friend_list(pauline->lc); linphone_friend_list_set_rls_uri(lfl, rls_uri); lf = linphone_core_create_friend_with_address(pauline->lc, marie_identity); linphone_friend_list_add_friend(lfl, lf); linphone_friend_unref(lf); linphone_core_remove_friend_list(pauline->lc, linphone_core_get_default_friend_list(pauline->lc)); linphone_core_add_friend_list(pauline->lc, lfl); linphone_friend_list_unref(lfl); linphone_friend_list_update_subscriptions(linphone_core_get_default_friend_list(pauline->lc), NULL, FALSE); wait_for_list(lcs, &pauline->stat.number_of_NotifyPresenceReceived, 1, 4000); BC_ASSERT_EQUAL(pauline->stat.number_of_NotifyPresenceReceived, 1, int, "%d"); BC_ASSERT_EQUAL(linphone_core_get_default_friend_list(pauline->lc)->expected_notification_version, 1, int, "%d"); lf = linphone_friend_list_find_friend_by_uri(linphone_core_get_default_friend_list(pauline->lc), marie_identity); BC_ASSERT_EQUAL(linphone_friend_get_status(lf), LinphoneStatusBusy, int, "%d"); if (!BC_ASSERT_TRUE(lf->presence_received)) goto end; if (!BC_ASSERT_TRUE(lf->subscribe_active)) goto end; linphone_core_set_presence_model(marie->lc, linphone_core_create_presence_model_with_activity(marie->lc, LinphonePresenceActivityOnThePhone, NULL)); wait_for_list(lcs, &laure->stat.number_of_NotifyPresenceReceived, 4, 4000); /* The number of PresenceReceived events can be 3 or 4 here. TODO: ideally it should always be 3. */ BC_ASSERT_GREATER(laure->stat.number_of_NotifyPresenceReceived, 3, int, "%d"); BC_ASSERT_LOWER(laure->stat.number_of_NotifyPresenceReceived, 4, int, "%d"); BC_ASSERT_EQUAL(linphone_core_get_default_friend_list(laure->lc)->expected_notification_version, 2, int, "%d"); lf = linphone_friend_list_find_friend_by_uri(linphone_core_get_default_friend_list(laure->lc), marie_identity); BC_ASSERT_EQUAL(linphone_friend_get_status(lf), LinphoneStatusOnThePhone, int, "%d"); wait_for_list(lcs, &pauline->stat.number_of_NotifyPresenceReceived, 2, 4000); BC_ASSERT_EQUAL(pauline->stat.number_of_NotifyPresenceReceived, 2, int, "%d"); BC_ASSERT_EQUAL(linphone_core_get_default_friend_list(pauline->lc)->expected_notification_version, 2, int, "%d"); lf = linphone_friend_list_find_friend_by_uri(linphone_core_get_default_friend_list(pauline->lc), marie_identity); BC_ASSERT_EQUAL(linphone_friend_get_status(lf), LinphoneStatusOnThePhone, int, "%d"); ms_message("Disabling publish"); enable_publish(laure, FALSE); enable_publish(marie, FALSE); enable_publish(pauline, FALSE); reset_counters(&pauline->stat); reset_counters(&laure->stat); reset_counters(&marie->stat); /*keep in ming long terme presence*/ if (!BC_ASSERT_TRUE(wait_for_list(lcs, &pauline->stat.number_of_LinphonePresenceActivityOnline, 1, 4000))) goto end; lf = linphone_friend_list_find_friend_by_uri(linphone_core_get_default_friend_list(pauline->lc), marie_identity); /*BC_ASSERT_EQUAL(linphone_presence_activity_get_type(linphone_presence_model_get_activity(linphone_friend_get_presence_model(lf))) , LinphonePresenceActivityOnline, int, "%d"); fixme, should be LinphonePresenceActivityUnknown*/ BC_ASSERT_EQUAL(linphone_friend_get_status(lf), LinphoneStatusOnline, int, "%d"); if (!BC_ASSERT_TRUE(wait_for_list(lcs, &laure->stat.number_of_LinphonePresenceActivityOnline, 2, 4000))) goto end; lf = linphone_friend_list_find_friend_by_uri(linphone_core_get_default_friend_list(laure->lc), pauline_identity); BC_ASSERT_EQUAL(linphone_friend_get_status(lf), LinphoneStatusOnline, int, "%d"); /*BC_ASSERT_EQUAL(linphone_presence_activity_get_type(linphone_presence_model_get_activity(linphone_friend_get_presence_model(lf))) , LinphonePresenceActivityOnline, int, "%d"); fixme, should be LinphonePresenceActivityUnknown*/ lf = linphone_friend_list_find_friend_by_uri(linphone_core_get_default_friend_list(laure->lc), marie_identity); BC_ASSERT_EQUAL(linphone_friend_get_status(lf), LinphoneStatusOnline, int, "%d"); /*BC_ASSERT_EQUAL(linphone_presence_activity_get_type(linphone_presence_model_get_activity(linphone_friend_get_presence_model(lf))) , LinphonePresenceActivityOnline, int, "%d"); fixme, should be LinphonePresenceActivityUnknown*/ if (!BC_ASSERT_TRUE(wait_for_list(lcs, &marie->stat.number_of_LinphonePresenceActivityOnline, 1, 4000))) goto end; lf = linphone_friend_list_find_friend_by_uri(linphone_core_get_default_friend_list(marie->lc), laure_identity); BC_ASSERT_EQUAL(linphone_friend_get_status(lf), LinphoneStatusOnline, int, "%d"); /*BC_ASSERT_EQUAL(linphone_presence_activity_get_type(linphone_presence_model_get_activity(linphone_friend_get_presence_model(lf))) , LinphonePresenceActivityOnline, int, "%d"); fixme, should be LinphonePresenceActivityUnknown*/ end: linphone_core_manager_destroy(laure); linphone_core_manager_destroy(marie); linphone_core_manager_destroy(pauline); }