diff --git a/coreapi/Makefile.am b/coreapi/Makefile.am index 353071c07..27100c6f5 100644 --- a/coreapi/Makefile.am +++ b/coreapi/Makefile.am @@ -43,8 +43,7 @@ linphone_include_HEADERS=\ lpconfig.h \ sipsetup.h \ xml2lpc.h \ - xmlrpc.h \ - conference.h + xmlrpc.h lib_LTLIBRARIES=liblinphone.la diff --git a/coreapi/call_log.c b/coreapi/call_log.c index a9ecf0149..b82131560 100644 --- a/coreapi/call_log.c +++ b/coreapi/call_log.c @@ -423,6 +423,9 @@ static int create_call_log(void *data, int argc, char **argv, char **colName) { unsigned int storage_id = atoi(argv[0]); from = linphone_address_new(argv[1]); to = linphone_address_new(argv[2]); + + if (from == NULL || to == NULL) goto error; + dir = (LinphoneCallDir) atoi(argv[3]); log = linphone_call_log_new(dir, from, to); @@ -445,7 +448,16 @@ static int create_call_log(void *data, int argc, char **argv, char **colName) { } *list = ms_list_append(*list, log); - + return 0; + +error: + if (from){ + linphone_address_destroy(from); + } + if (to){ + linphone_address_destroy(to); + } + ms_error("Bad call log at storage_id %u", storage_id); return 0; } diff --git a/tester/presence_tester.c b/tester/presence_tester.c index f0fa5ed14..9abda838c 100644 --- a/tester/presence_tester.c +++ b/tester/presence_tester.c @@ -129,7 +129,7 @@ static void simple_publish_with_expire(int expires) { LinphoneProxyConfig* proxy; LinphonePresenceModel* presence; - linphone_core_get_default_proxy(marie->lc,&proxy); + proxy = linphone_core_get_default_proxy_config(marie->lc); linphone_proxy_config_edit(proxy); if (expires >0) { linphone_proxy_config_set_publish_expires(proxy,expires); @@ -743,6 +743,36 @@ static void test_presence_list_subscribe_before_publish(void) { linphone_core_manager_destroy(pauline); } +static void test_presence_list_subscription_expire(void) { + LinphoneCoreManager *laure = linphone_core_manager_new("laure_tcp_rc"); + const char *rls_uri = "sip:rls@sip.example.org"; + 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:michelle@sip.inexistentdomain.com"); + linphone_friend_list_add_friend(lfl, lf); + linphone_core_set_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)); + + /*sal_set_send_error(laure->lc->sal,1500);*/ /*make sure no refresh is sent, trash the message without generating error*/ + + /*make sure we don't received any notify, even when subscribtion has expired*/ + /*BC_ASSERT_FALSE(wait_for_until(laure->lc, NULL, &laure->stat.number_of_NotifyPresenceReceived, 1, 5000)); + + sal_set_send_error(laure->lc->sal,0);*/ + + linphone_core_manager_destroy(laure); +} + + test_t presence_tests[] = { { "Simple Subscribe", simple_subscribe }, { "Simple Publish", simple_publish }, @@ -758,7 +788,8 @@ test_t presence_tests[] = { { "Forked subscribe with late publish", test_forked_subscribe_notify_publish }, #endif { "Presence list", test_presence_list }, - { "Presence list (subscribe before publish)", test_presence_list_subscribe_before_publish } + { "Presence list (subscribe before publish)", test_presence_list_subscribe_before_publish }, + { "Presence list, subscription expiration",test_presence_list_subscription_expire} }; test_suite_t presence_test_suite = {"Presence", NULL, NULL, liblinphone_tester_before_each, liblinphone_tester_after_each, diff --git a/tester/setup_tester.c b/tester/setup_tester.c index 8aa744666..f41324d3f 100644 --- a/tester/setup_tester.c +++ b/tester/setup_tester.c @@ -79,10 +79,19 @@ static void linphone_interpret_url_test(void) LinphoneCore* lc; const char* sips_address = "sips:margaux@sip.linphone.org"; LinphoneAddress* address; - + LinphoneProxyConfig *proxy_config; + char *tmp; memset ( &v_table,0,sizeof ( v_table ) ); lc = linphone_core_new ( &v_table,NULL,NULL,NULL ); BC_ASSERT_PTR_NOT_NULL_FATAL ( lc ); + + proxy_config =linphone_core_create_proxy_config(lc); + linphone_proxy_config_set_identity(proxy_config, "sip:moi@sip.linphone.org"); + linphone_proxy_config_enable_register(proxy_config, FALSE); + linphone_proxy_config_set_server_addr(proxy_config,"sip:sip.linphone.org"); + linphone_core_add_proxy_config(lc, proxy_config); + linphone_core_set_default_proxy_config(lc,proxy_config); + address = linphone_core_interpret_url(lc, sips_address); @@ -93,6 +102,33 @@ static void linphone_interpret_url_test(void) linphone_address_destroy(address); + address = linphone_core_interpret_url(lc,"23"); + + BC_ASSERT_PTR_NOT_NULL(address); + BC_ASSERT_STRING_EQUAL(linphone_address_get_scheme(address), "sip"); + BC_ASSERT_STRING_EQUAL(linphone_address_get_username(address), "23"); + BC_ASSERT_STRING_EQUAL(linphone_address_get_domain(address), "sip.linphone.org"); + linphone_address_destroy(address); + + address = linphone_core_interpret_url(lc,"#24"); + + BC_ASSERT_PTR_NOT_NULL(address); + BC_ASSERT_STRING_EQUAL(linphone_address_get_scheme(address), "sip"); + BC_ASSERT_STRING_EQUAL(linphone_address_get_username(address), "#24"); + BC_ASSERT_STRING_EQUAL(linphone_address_get_domain(address), "sip.linphone.org"); + tmp = linphone_address_as_string(address); + BC_ASSERT_TRUE(strcmp (tmp,"sip:%2324@sip.linphone.org") == 0); + linphone_address_destroy(address); + + address = linphone_core_interpret_url(lc,tmp); + BC_ASSERT_STRING_EQUAL(linphone_address_get_scheme(address), "sip"); + BC_ASSERT_STRING_EQUAL(linphone_address_get_username(address), "#24"); + BC_ASSERT_STRING_EQUAL(linphone_address_get_domain(address), "sip.linphone.org"); + + linphone_address_destroy(address); + ms_free(tmp); + + linphone_core_destroy ( lc ); }