From a08b50bd69a67a5d000724b940a5a5e403154156 Mon Sep 17 00:00:00 2001 From: Simon Morlat Date: Mon, 20 May 2013 11:06:06 +0200 Subject: [PATCH] info api working --- coreapi/linphonecore.h | 4 ++-- tester/liblinphone_tester.c | 1 + tester/liblinphone_tester.h | 2 +- tester/message_tester.c | 12 ++++++++---- tester/setup_tester.c | 2 +- 5 files changed, 13 insertions(+), 8 deletions(-) diff --git a/coreapi/linphonecore.h b/coreapi/linphonecore.h index 433001d65..4ef4b6a4f 100644 --- a/coreapi/linphonecore.h +++ b/coreapi/linphonecore.h @@ -247,9 +247,9 @@ typedef struct _LinphoneContent LinphoneContent; LINPHONE_PUBLIC LinphoneInfoMessage *linphone_core_create_info_message(LinphoneCore *lc); LINPHONE_PUBLIC int linphone_core_send_info_message(LinphoneCore *lc, const LinphoneInfoMessage *info, const LinphoneAddress *addr); LINPHONE_PUBLIC void linphone_info_message_add_header(LinphoneInfoMessage *im, const char *name, const char *value); -LINPHONE_PUBLIC const char *linphone_info_message_get_header(LinphoneInfoMessage *im, const char *name); +LINPHONE_PUBLIC const char *linphone_info_message_get_header(const LinphoneInfoMessage *im, const char *name); LINPHONE_PUBLIC void linphone_info_message_set_content(LinphoneInfoMessage *im, const LinphoneContent *content); -LINPHONE_PUBLIC const LinphoneContent * linphone_info_message_get_content(LinphoneInfoMessage *im); +LINPHONE_PUBLIC const LinphoneContent * linphone_info_message_get_content(const LinphoneInfoMessage *im); LINPHONE_PUBLIC void linphone_info_message_destroy(LinphoneInfoMessage *im); /** diff --git a/tester/liblinphone_tester.c b/tester/liblinphone_tester.c index 1c9c767dc..185ce9587 100644 --- a/tester/liblinphone_tester.c +++ b/tester/liblinphone_tester.c @@ -184,6 +184,7 @@ LinphoneCoreManager* linphone_core_manager_new2(const char* path, const char* rc mgr->v_table.new_subscription_request=new_subscribtion_request; mgr->v_table.notify_presence_recv=notify_presence_received; mgr->v_table.transfer_state_changed=linphone_transfer_state_changed; + mgr->v_table.info_received=info_message_received; mgr->lc=configure_lc_from(&mgr->v_table, path, rc_file, check_for_proxies?(rc_file?1:0):0); enable_codec(mgr->lc,"PCMU",8000); linphone_core_set_user_data(mgr->lc,&mgr->stat); diff --git a/tester/liblinphone_tester.h b/tester/liblinphone_tester.h index 6b3f2a2dd..91ed8ac5e 100644 --- a/tester/liblinphone_tester.h +++ b/tester/liblinphone_tester.h @@ -159,7 +159,7 @@ void linphone_transfer_state_changed(LinphoneCore *lc, LinphoneCall *transfered, void notify_presence_received(LinphoneCore *lc, LinphoneFriend * lf); void text_message_received(LinphoneCore *lc, LinphoneChatRoom *room, const LinphoneAddress *from_address, const char *message); void message_received(LinphoneCore *lc, LinphoneChatRoom *room, LinphoneChatMessage* message); -void info_message_received(LinphoneCore *lc, LinphoneInfoMessage *msg); +void info_message_received(LinphoneCore *lc, const LinphoneInfoMessage *msg); void new_subscribtion_request(LinphoneCore *lc, LinphoneFriend *lf, const char *url); void auth_info_requested(LinphoneCore *lc, const char *realm, const char *username); diff --git a/tester/message_tester.c b/tester/message_tester.c index fb06a5dbf..a9beef3ed 100644 --- a/tester/message_tester.c +++ b/tester/message_tester.c @@ -163,17 +163,21 @@ static void text_message_with_send_error(void) { static const char *info_content="blabla"; -void info_message_received(LinphoneCore *lc, LinphoneInfoMessage *msg){ +void info_message_received(LinphoneCore *lc, const LinphoneInfoMessage *msg){ stats* counters = (stats*)linphone_core_get_user_data(lc); const char *hvalue=linphone_info_message_get_header(msg, "Weather"); const LinphoneContent *content=linphone_info_message_get_content(msg); - CU_ASSERT_PTR_NOT_NULL(hvalue); + CU_ASSERT_PTR_NOT_NULL_FATAL(hvalue); CU_ASSERT_TRUE(strcmp(hvalue,"still bad")==0); if (!content){ counters->number_of_inforeceived++; }else{ - CU_ASSERT_PTR_NOT_NULL(content->data); + CU_ASSERT_PTR_NOT_NULL_FATAL(content->data); + CU_ASSERT_PTR_NOT_NULL_FATAL(content->type); + CU_ASSERT_PTR_NOT_NULL_FATAL(content->subtype); + CU_ASSERT_TRUE(strcmp(content->type,"application")==0); + CU_ASSERT_TRUE(strcmp(content->subtype,"somexml")==0); CU_ASSERT_TRUE(strcmp((const char*)content->data,info_content)==0); CU_ASSERT_EQUAL(content->size,strlen(info_content)); counters->number_of_inforeceived_with_body++; @@ -186,7 +190,7 @@ static void info_message_with_args(bool_t with_content) { LinphoneCoreManager* marie = linphone_core_manager_new(liblinphone_tester_file_prefix, "marie_rc"); LinphoneCoreManager* pauline = linphone_core_manager_new(liblinphone_tester_file_prefix, "pauline_rc"); LinphoneInfoMessage *info=linphone_core_create_info_message(marie->lc); - linphone_info_message_add_header(info,"Wheather","still bad"); + linphone_info_message_add_header(info,"Weather","still bad"); if (with_content) { LinphoneContent ct; ct.type="application"; diff --git a/tester/setup_tester.c b/tester/setup_tester.c index f567ca2e2..d14dca0b8 100644 --- a/tester/setup_tester.c +++ b/tester/setup_tester.c @@ -19,7 +19,7 @@ #include #include "CUnit/Basic.h" #include "linphonecore.h" -#include "private.h" + #include "liblinphone_tester.h"