mirror of
https://gitlab.linphone.org/BC/public/linphone-iphone.git
synced 2026-01-23 14:18:07 +00:00
info api working
This commit is contained in:
parent
4cc7c7c074
commit
a08b50bd69
5 changed files with 13 additions and 8 deletions
|
|
@ -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);
|
||||
|
||||
/**
|
||||
|
|
|
|||
|
|
@ -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);
|
||||
|
|
|
|||
|
|
@ -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);
|
||||
|
||||
|
|
|
|||
|
|
@ -163,17 +163,21 @@ static void text_message_with_send_error(void) {
|
|||
|
||||
static const char *info_content="<somexml>blabla</somexml>";
|
||||
|
||||
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";
|
||||
|
|
|
|||
|
|
@ -19,7 +19,7 @@
|
|||
#include <stdio.h>
|
||||
#include "CUnit/Basic.h"
|
||||
#include "linphonecore.h"
|
||||
#include "private.h"
|
||||
|
||||
#include "liblinphone_tester.h"
|
||||
|
||||
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue