Commit 34b2882e authored by Ronan's avatar Ronan
Browse files

feat(Core): use chat room api from new core

parent 2243783c
...@@ -45,6 +45,7 @@ Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. ...@@ -45,6 +45,7 @@ Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
#include "conference/session/call-session.h" #include "conference/session/call-session.h"
#include "conference/session/media-session-p.h" #include "conference/session/media-session-p.h"
#include "conference/session/media-session.h" #include "conference/session/media-session.h"
#include "core/core-p.h"
using namespace LinphonePrivate; using namespace LinphonePrivate;
...@@ -724,7 +725,7 @@ static void refer_received(SalOp *op, const SalAddress *refer_to){ ...@@ -724,7 +725,7 @@ static void refer_received(SalOp *op, const SalAddress *refer_to){
LinphoneCore *lc = reinterpret_cast<LinphoneCore *>(op->get_sal()->get_user_pointer()); LinphoneCore *lc = reinterpret_cast<LinphoneCore *>(op->get_sal()->get_user_pointer());
if (addr.hasUriParam("method") && (addr.getUriParamValue("method") == "BYE")) { if (addr.hasUriParam("method") && (addr.getUriParamValue("method") == "BYE")) {
// The server asks a participant to leave a chat room // The server asks a participant to leave a chat room
LinphoneChatRoom *cr = _linphone_core_find_group_chat_room(lc, addr.asStringUriOnly().c_str()); LinphoneChatRoom *cr = L_GET_C_BACK_PTR(lc->cppCore->findChatRoom(addr));
if (cr) { if (cr) {
L_GET_CPP_PTR_FROM_C_OBJECT(cr)->leave(); L_GET_CPP_PTR_FROM_C_OBJECT(cr)->leave();
static_cast<SalReferOp *>(op)->reply(SalReasonNone); static_cast<SalReferOp *>(op)->reply(SalReasonNone);
...@@ -732,7 +733,7 @@ static void refer_received(SalOp *op, const SalAddress *refer_to){ ...@@ -732,7 +733,7 @@ static void refer_received(SalOp *op, const SalAddress *refer_to){
} }
static_cast<SalReferOp *>(op)->reply(SalReasonDeclined); static_cast<SalReferOp *>(op)->reply(SalReasonDeclined);
} else if (addr.hasParam("admin")) { } else if (addr.hasParam("admin")) {
LinphoneChatRoom *cr = _linphone_core_find_group_chat_room(lc, op->get_to()); LinphoneChatRoom *cr = L_GET_C_BACK_PTR(lc->cppCore->findChatRoom(Address(op->get_to())));
if (cr) { if (cr) {
Address fromAddr(op->get_from()); Address fromAddr(op->get_from());
std::shared_ptr<Participant> participant = L_GET_CPP_PTR_FROM_C_OBJECT(cr)->findParticipant(fromAddr); std::shared_ptr<Participant> participant = L_GET_CPP_PTR_FROM_C_OBJECT(cr)->findParticipant(fromAddr);
...@@ -749,11 +750,12 @@ static void refer_received(SalOp *op, const SalAddress *refer_to){ ...@@ -749,11 +750,12 @@ static void refer_received(SalOp *op, const SalAddress *refer_to){
return; return;
} }
} else { } else {
LinphoneChatRoom *cr = _linphone_core_join_client_group_chat_room(lc, addr); LinphoneChatRoom *cr = _linphone_client_group_chat_room_new(lc, addr.asString().c_str(), nullptr);
if (cr) { L_GET_CPP_PTR_FROM_C_OBJECT(cr)->join();
static_cast<SalReferOp *>(op)->reply(SalReasonNone); L_GET_PRIVATE(lc->cppCore)->insertChatRoomWithDb(L_GET_CPP_PTR_FROM_C_OBJECT(cr));
return;
} static_cast<SalReferOp *>(op)->reply(SalReasonNone);
return;
} }
} }
} }
......
...@@ -38,9 +38,10 @@ ...@@ -38,9 +38,10 @@
#include "c-wrapper/c-wrapper.h" #include "c-wrapper/c-wrapper.h"
#include "chat/chat-room/basic-chat-room.h" #include "chat/chat-room/basic-chat-room.h"
#include "chat/chat-room/client-group-chat-room.h" #include "chat/chat-room/client-group-chat-room.h"
#include "chat/chat-room/real-time-text-chat-room.h"
#include "chat/chat-room/real-time-text-chat-room-p.h" #include "chat/chat-room/real-time-text-chat-room-p.h"
#include "chat/chat-room/real-time-text-chat-room.h"
#include "content/content-type.h" #include "content/content-type.h"
#include "core/core.h"
using namespace std; using namespace std;
...@@ -56,14 +57,11 @@ bool_t linphone_core_chat_enabled(const LinphoneCore *lc) { ...@@ -56,14 +57,11 @@ bool_t linphone_core_chat_enabled(const LinphoneCore *lc) {
return lc->chat_deny_code != LinphoneReasonNone; return lc->chat_deny_code != LinphoneReasonNone;
} }
const bctbx_list_t *linphone_core_get_chat_rooms(LinphoneCore *lc) { const bctbx_list_t *linphone_core_get_chat_rooms (LinphoneCore *lc) {
return lc->chatrooms; if (lc->chat_rooms)
} bctbx_list_free_with_data(lc->chat_rooms, (bctbx_list_free_func)linphone_chat_room_unref);
lc->chat_rooms = L_GET_RESOLVED_C_LIST_FROM_CPP_LIST(lc->cppCore->getChatRooms());
static LinphoneChatRoom *_linphone_core_create_chat_room(LinphoneCore *lc, const LinphoneAddress *addr) { return lc->chat_rooms;
LinphoneChatRoom *cr = linphone_chat_room_new(lc, addr);
lc->chatrooms = bctbx_list_append(lc->chatrooms, (void *)cr);
return cr;
} }
LinphoneChatRoom *_linphone_core_create_chat_room_from_call(LinphoneCall *call){ LinphoneChatRoom *_linphone_core_create_chat_room_from_call(LinphoneCall *call){
...@@ -73,91 +71,25 @@ LinphoneChatRoom *_linphone_core_create_chat_room_from_call(LinphoneCall *call){ ...@@ -73,91 +71,25 @@ LinphoneChatRoom *_linphone_core_create_chat_room_from_call(LinphoneCall *call){
return cr; return cr;
} }
static LinphoneChatRoom *_linphone_core_create_chat_room_from_url(LinphoneCore *lc, const char *to) { LinphoneChatRoom *linphone_core_get_chat_room (LinphoneCore *lc, const LinphoneAddress *addr) {
LinphoneAddress *parsed_url = NULL; return L_GET_C_BACK_PTR(lc->cppCore->getOrCreateBasicChatRoom(*L_GET_CPP_PTR_FROM_C_OBJECT(addr)));
if ((parsed_url = linphone_core_interpret_url(lc, to)) != NULL) {
return _linphone_core_create_chat_room(lc, parsed_url);
}
return NULL;
}
static bool_t linphone_chat_room_matches(LinphoneChatRoom *cr, const LinphoneAddress *from) {
LinphoneAddress *addr = linphone_address_new(L_GET_CPP_PTR_FROM_C_OBJECT(cr)->getPeerAddress().asString().c_str());
bool_t result = linphone_address_weak_equal(addr, from);
linphone_address_unref(addr);
return result;
} }
LinphoneChatRoom *_linphone_core_get_chat_room(LinphoneCore *lc, const LinphoneAddress *addr) { LinphoneChatRoom *linphone_core_create_client_group_chat_room (LinphoneCore *lc, const char *subject) {
LinphoneChatRoom *cr = NULL; return L_GET_C_BACK_PTR(lc->cppCore->createClientGroupChatRoom(L_C_TO_STRING(subject)));
bctbx_list_t *elem;
for (elem = lc->chatrooms; elem != NULL; elem = bctbx_list_next(elem)) {
cr = (LinphoneChatRoom *)elem->data;
if (linphone_chat_room_matches(cr, addr)) {
break;
}
cr = NULL;
}
return cr;
} }
static LinphoneChatRoom *_linphone_core_get_or_create_chat_room(LinphoneCore *lc, const char *to) { void linphone_core_delete_chat_room (LinphoneCore *, LinphoneChatRoom *cr) {
LinphoneAddress *to_addr = linphone_core_interpret_url(lc, to); LinphonePrivate::Core::deleteChatRoom(L_GET_CPP_PTR_FROM_C_OBJECT(cr));
LinphoneChatRoom *ret;
if (to_addr == NULL) {
ms_error("linphone_core_get_or_create_chat_room(): Cannot make a valid address with %s", to);
return NULL;
}
ret = _linphone_core_get_chat_room(lc, to_addr);
linphone_address_unref(to_addr);
if (!ret) {
ret = _linphone_core_create_chat_room_from_url(lc, to);
}
return ret;
}
LinphoneChatRoom *linphone_core_get_chat_room(LinphoneCore *lc, const LinphoneAddress *addr) {
LinphoneChatRoom *ret = _linphone_core_get_chat_room(lc, addr);
if (!ret) {
ret = _linphone_core_create_chat_room(lc, addr);
}
return ret;
}
LinphoneChatRoom * linphone_core_create_client_group_chat_room(LinphoneCore *lc, const char *subject) {
const char *factoryUri = linphone_core_get_conference_factory_uri(lc);
if (!factoryUri)
return nullptr;
LinphoneChatRoom *cr = _linphone_client_group_chat_room_new(lc, factoryUri, subject);
lc->chatrooms = bctbx_list_append(lc->chatrooms, cr);
return cr;
}
LinphoneChatRoom *_linphone_core_join_client_group_chat_room (LinphoneCore *lc, const LinphonePrivate::Address &addr) {
LinphoneChatRoom *cr = _linphone_client_group_chat_room_new(lc, addr.asString().c_str(), nullptr);
L_GET_CPP_PTR_FROM_C_OBJECT(cr)->join();
lc->chatrooms = bctbx_list_append(lc->chatrooms, cr);
return cr;
}
void linphone_core_delete_chat_room(LinphoneCore *lc, LinphoneChatRoom *cr) {
if (bctbx_list_find(lc->chatrooms, cr)) {
lc->chatrooms = bctbx_list_remove(lc->chatrooms, cr);
linphone_chat_room_delete_history(cr);
linphone_chat_room_unref(cr);
} else {
ms_error("linphone_core_delete_chat_room(): chatroom [%p] isn't part of LinphoneCore.", cr);
}
} }
LinphoneChatRoom *linphone_core_get_chat_room_from_uri(LinphoneCore *lc, const char *to) { LinphoneChatRoom *linphone_core_get_chat_room_from_uri(LinphoneCore *lc, const char *to) {
return _linphone_core_get_or_create_chat_room(lc, to); return L_GET_C_BACK_PTR(lc->cppCore->getOrCreateBasicChatRoom(L_C_TO_STRING(to)));
} }
int linphone_core_message_received(LinphoneCore *lc, LinphonePrivate::SalOp *op, const SalMessage *sal_msg) { int linphone_core_message_received(LinphoneCore *lc, LinphonePrivate::SalOp *op, const SalMessage *sal_msg) {
LinphoneReason reason = LinphoneReasonNotAcceptable; LinphoneReason reason = LinphoneReasonNotAcceptable;
LinphoneChatRoom *cr = _linphone_core_find_group_chat_room(lc, op->get_from()); LinphoneChatRoom *cr = L_GET_C_BACK_PTR(lc->cppCore->findChatRoom(LinphonePrivate::Address(op->get_from())));
if (cr) if (cr)
reason = L_GET_PRIVATE_FROM_C_OBJECT(cr)->messageReceived(op, sal_msg); reason = L_GET_PRIVATE_FROM_C_OBJECT(cr)->messageReceived(op, sal_msg);
else { else {
...@@ -171,8 +103,6 @@ int linphone_core_message_received(LinphoneCore *lc, LinphonePrivate::SalOp *op, ...@@ -171,8 +103,6 @@ int linphone_core_message_received(LinphoneCore *lc, LinphonePrivate::SalOp *op,
return reason; return reason;
} }
void linphone_core_real_time_text_received(LinphoneCore *lc, LinphoneChatRoom *cr, uint32_t character, LinphoneCall *call) { void linphone_core_real_time_text_received(LinphoneCore *lc, LinphoneChatRoom *cr, uint32_t character, LinphoneCall *call) {
if (linphone_core_realtime_text_enabled(lc)) { if (linphone_core_realtime_text_enabled(lc)) {
shared_ptr<LinphonePrivate::RealTimeTextChatRoom> rttcr = shared_ptr<LinphonePrivate::RealTimeTextChatRoom> rttcr =
......
...@@ -37,6 +37,7 @@ Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. ...@@ -37,6 +37,7 @@ Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
#include <mediastreamer2/zrtp.h> #include <mediastreamer2/zrtp.h>
#include <mediastreamer2/dtls_srtp.h> #include <mediastreamer2/dtls_srtp.h>
#include <bctoolbox/defs.h> #include <bctoolbox/defs.h>
#include "mediastreamer2/dtmfgen.h" #include "mediastreamer2/dtmfgen.h"
#include "mediastreamer2/mediastream.h" #include "mediastreamer2/mediastream.h"
#include "mediastreamer2/msequalizer.h" #include "mediastreamer2/msequalizer.h"
...@@ -45,8 +46,10 @@ Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. ...@@ -45,8 +46,10 @@ Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
#include "mediastreamer2/msjpegwriter.h" #include "mediastreamer2/msjpegwriter.h"
#include "mediastreamer2/msogl.h" #include "mediastreamer2/msogl.h"
#include "mediastreamer2/msvolume.h" #include "mediastreamer2/msvolume.h"
#include "chat/chat-room/client-group-chat-room-p.h" #include "chat/chat-room/client-group-chat-room-p.h"
#include "conference/remote-conference-event-handler.h" #include "conference/remote-conference-event-handler.h"
#include "core/core.h"
// For migration purpose. // For migration purpose.
#include "address/address-p.h" #include "address/address-p.h"
...@@ -2128,9 +2131,7 @@ static void linphone_core_internal_notify_received(LinphoneCore *lc, LinphoneEve ...@@ -2128,9 +2131,7 @@ static void linphone_core_internal_notify_received(LinphoneCore *lc, LinphoneEve
} }
} else if (strcmp(notified_event, "conference") == 0) { } else if (strcmp(notified_event, "conference") == 0) {
const LinphoneAddress *resource = linphone_event_get_resource(lev); const LinphoneAddress *resource = linphone_event_get_resource(lev);
char *resourceUri = linphone_address_as_string_uri_only(resource); LinphoneChatRoom *cr = L_GET_C_BACK_PTR(lc->cppCore->findChatRoom(*L_GET_CPP_PTR_FROM_C_OBJECT(resource)));
LinphoneChatRoom *cr = _linphone_core_find_group_chat_room(lc, resourceUri);
bctbx_free(resourceUri);
if (cr) if (cr)
L_GET_PRIVATE_FROM_C_OBJECT(cr, ClientGroupChatRoom)->notifyReceived(linphone_content_get_string_buffer(body)); L_GET_PRIVATE_FROM_C_OBJECT(cr, ClientGroupChatRoom)->notifyReceived(linphone_content_get_string_buffer(body));
} }
...@@ -2234,7 +2235,8 @@ static void linphone_core_init(LinphoneCore * lc, LinphoneCoreCbs *cbs, LpConfig ...@@ -2234,7 +2235,8 @@ static void linphone_core_init(LinphoneCore * lc, LinphoneCoreCbs *cbs, LpConfig
lc->sal->set_user_pointer(lc); lc->sal->set_user_pointer(lc);
lc->sal->set_callbacks(&linphone_sal_callbacks); lc->sal->set_callbacks(&linphone_sal_callbacks);
new(&lc->cppCore) Core(lc); new(&lc->cppCore) std::shared_ptr<Core>();
lc->cppCore = ObjectFactory::create<Core>(lc);
#ifdef TUNNEL_ENABLED #ifdef TUNNEL_ENABLED
lc->tunnel=linphone_core_tunnel_new(lc); lc->tunnel=linphone_core_tunnel_new(lc);
...@@ -2266,7 +2268,6 @@ static void linphone_core_init(LinphoneCore * lc, LinphoneCoreCbs *cbs, LpConfig ...@@ -2266,7 +2268,6 @@ static void linphone_core_init(LinphoneCore * lc, LinphoneCoreCbs *cbs, LpConfig
linphone_configuring_terminated(lc, LinphoneConfiguringSkipped, NULL); linphone_configuring_terminated(lc, LinphoneConfiguringSkipped, NULL);
} // else linphone_core_start will be called after the remote provisioning (see linphone_core_iterate) } // else linphone_core_start will be called after the remote provisioning (see linphone_core_iterate)
lc->bw_controller = ms_bandwidth_controller_new(); lc->bw_controller = ms_bandwidth_controller_new();
lc->group_chat_rooms = bctbx_mmap_cchar_new();
} }
#ifdef __ANDROID__ #ifdef __ANDROID__
...@@ -2280,7 +2281,7 @@ static void _linphone_core_set_system_context(LinphoneCore *lc, void *system_con ...@@ -2280,7 +2281,7 @@ static void _linphone_core_set_system_context(LinphoneCore *lc, void *system_con
} }
#else #else
static void _linphone_core_set_system_context(LinphoneCore *lc, void *system_context){ static void _linphone_core_set_system_context(LinphoneCore *lc, void *system_context){
} }
#endif #endif
...@@ -5873,7 +5874,7 @@ void sip_config_uninit(LinphoneCore *lc) ...@@ -5873,7 +5874,7 @@ void sip_config_uninit(LinphoneCore *lc)
delete lc->sal; delete lc->sal;
lc->sal=NULL; lc->sal=NULL;
lc->cppCore.~Core(); lc->cppCore.~shared_ptr<Core>();
if (lc->sip_conf.guessed_contact) if (lc->sip_conf.guessed_contact)
ms_free(lc->sip_conf.guessed_contact); ms_free(lc->sip_conf.guessed_contact);
...@@ -6043,9 +6044,7 @@ static void linphone_core_uninit(LinphoneCore *lc) ...@@ -6043,9 +6044,7 @@ static void linphone_core_uninit(LinphoneCore *lc)
ms_usleep(10000); ms_usleep(10000);
} }
lc->chatrooms = bctbx_list_free_with_data(lc->chatrooms, (MSIterateFunc)linphone_chat_room_release); lc->chat_rooms = bctbx_list_free_with_data(lc->chat_rooms, (bctbx_list_free_func)linphone_chat_room_unref);
if (lc->group_chat_rooms)
bctbx_mmap_cchar_delete_with_data(lc->group_chat_rooms, (void (*)(void *))linphone_chat_room_unref);
linphone_core_set_state(lc,LinphoneGlobalShutdown,"Shutting down"); linphone_core_set_state(lc,LinphoneGlobalShutdown,"Shutting down");
#ifdef VIDEO_ENABLED #ifdef VIDEO_ENABLED
...@@ -6143,11 +6142,11 @@ static void set_sip_network_reachable(LinphoneCore* lc,bool_t is_sip_reachable, ...@@ -6143,11 +6142,11 @@ static void set_sip_network_reachable(LinphoneCore* lc,bool_t is_sip_reachable,
if (lc->sip_network_reachable==is_sip_reachable) return; // no change, ignore. if (lc->sip_network_reachable==is_sip_reachable) return; // no change, ignore.
lc->network_reachable_to_be_notified=TRUE; lc->network_reachable_to_be_notified=TRUE;
if (is_sip_reachable){ if (is_sip_reachable){
getPlatformHelpers(lc)->setDnsServers(); getPlatformHelpers(lc)->setDnsServers();
} }
ms_message("SIP network reachability state is now [%s]",is_sip_reachable?"UP":"DOWN"); ms_message("SIP network reachability state is now [%s]",is_sip_reachable?"UP":"DOWN");
for(elem=linphone_core_get_proxy_config_list(lc);elem!=NULL;elem=elem->next){ for(elem=linphone_core_get_proxy_config_list(lc);elem!=NULL;elem=elem->next){
LinphoneProxyConfig *cfg=(LinphoneProxyConfig*)elem->data; LinphoneProxyConfig *cfg=(LinphoneProxyConfig*)elem->data;
...@@ -7149,53 +7148,6 @@ const char * linphone_core_get_conference_factory_uri(const LinphoneCore *lc) { ...@@ -7149,53 +7148,6 @@ const char * linphone_core_get_conference_factory_uri(const LinphoneCore *lc) {
return lp_config_get_string(linphone_core_get_config(lc), "misc", "conference_factory_uri", nullptr); return lp_config_get_string(linphone_core_get_config(lc), "misc", "conference_factory_uri", nullptr);
} }
bool_t _linphone_core_has_group_chat_room(const LinphoneCore *lc, const char *id) {
bool_t result;
bctbx_iterator_t *it = bctbx_map_cchar_find_key(lc->group_chat_rooms, id);
bctbx_iterator_t *endit = bctbx_map_cchar_end(lc->group_chat_rooms);
result = !bctbx_iterator_cchar_equals(it, endit);
bctbx_iterator_cchar_delete(endit);
bctbx_iterator_cchar_delete(it);
return result;
}
void _linphone_core_add_group_chat_room(LinphoneCore *lc, const LinphonePrivate::Address &addr, LinphoneChatRoom *cr) {
Address cleanedAddr(addr);
cleanedAddr.clean();
cleanedAddr.setPort(0);
bctbx_pair_t *pair = reinterpret_cast<bctbx_pair_t *>(bctbx_pair_cchar_new(cleanedAddr.asStringUriOnly().c_str(), linphone_chat_room_ref(cr)));
bctbx_map_cchar_insert_and_delete(lc->group_chat_rooms, pair);
}
void _linphone_core_remove_group_chat_room(LinphoneCore *lc, LinphoneChatRoom *cr) {
const LinphoneAddress *confAddr = linphone_chat_room_get_conference_address(cr);
Address cleanedAddr(*L_GET_CPP_PTR_FROM_C_OBJECT(confAddr));
cleanedAddr.clean();
cleanedAddr.setPort(0);
bctbx_iterator_t *it = bctbx_map_cchar_find_key(lc->group_chat_rooms, cleanedAddr.asStringUriOnly().c_str());
bctbx_iterator_t *endit = bctbx_map_cchar_end(lc->group_chat_rooms);
if (!bctbx_iterator_cchar_equals(it, endit)) {
bctbx_map_cchar_erase(lc->group_chat_rooms, it);
linphone_chat_room_unref(cr);
}
bctbx_iterator_cchar_delete(endit);
bctbx_iterator_cchar_delete(it);
}
LinphoneChatRoom *_linphone_core_find_group_chat_room(const LinphoneCore *lc, const char *id) {
LinphoneChatRoom *result = nullptr;
Address cleanedAddr(id);
cleanedAddr.clean();
cleanedAddr.setPort(0);
bctbx_iterator_t *it = bctbx_map_cchar_find_key(lc->group_chat_rooms, cleanedAddr.asStringUriOnly().c_str());
bctbx_iterator_t *endit = bctbx_map_cchar_end(lc->group_chat_rooms);
if (!bctbx_iterator_cchar_equals(it, endit))
result = reinterpret_cast<LinphoneChatRoom *>(bctbx_pair_cchar_get_second(bctbx_iterator_cchar_get_pair(it)));
bctbx_iterator_cchar_delete(endit);
bctbx_iterator_cchar_delete(it);
return result;
}
void linphone_core_set_tls_cert(LinphoneCore *lc, const char *tls_cert) { void linphone_core_set_tls_cert(LinphoneCore *lc, const char *tls_cert) {
if (lc->tls_cert) { if (lc->tls_cert) {
ms_free(lc->tls_cert); ms_free(lc->tls_cert);
......
...@@ -25,6 +25,8 @@ ...@@ -25,6 +25,8 @@
#ifndef _PRIVATE_H #ifndef _PRIVATE_H
#define _PRIVATE_H #define _PRIVATE_H
#include <memory>
#include "linphone/core.h" #include "linphone/core.h"
#include "linphone/friend.h" #include "linphone/friend.h"
#include "linphone/friendlist.h" #include "linphone/friendlist.h"
...@@ -34,7 +36,6 @@ ...@@ -34,7 +36,6 @@
#include "address/address.h" #include "address/address.h"
#include "c-wrapper/internal/c-sal.h" #include "c-wrapper/internal/c-sal.h"
#include "core/core.h"
#include "sal/call-op.h" #include "sal/call-op.h"
#include "sal/event-op.h" #include "sal/event-op.h"
#include "sal/message-op.h" #include "sal/message-op.h"
...@@ -456,9 +457,6 @@ bool_t linphone_core_incompatible_security(LinphoneCore *lc, SalMediaDescription ...@@ -456,9 +457,6 @@ bool_t linphone_core_incompatible_security(LinphoneCore *lc, SalMediaDescription
extern LinphonePrivate::Sal::Callbacks linphone_sal_callbacks; extern LinphonePrivate::Sal::Callbacks linphone_sal_callbacks;
LINPHONE_PUBLIC bool_t linphone_core_rtcp_enabled(const LinphoneCore *lc); LINPHONE_PUBLIC bool_t linphone_core_rtcp_enabled(const LinphoneCore *lc);
LINPHONE_PUBLIC bool_t linphone_core_symmetric_rtp_enabled(LinphoneCore*lc); LINPHONE_PUBLIC bool_t linphone_core_symmetric_rtp_enabled(LinphoneCore*lc);
bool_t _linphone_core_has_group_chat_room (const LinphoneCore *lc, const char *id);
void _linphone_core_add_group_chat_room (LinphoneCore *lc, const LinphonePrivate::Address &addr, LinphoneChatRoom *cr);
void _linphone_core_remove_group_chat_room(LinphoneCore *lc, LinphoneChatRoom *cr);
void linphone_core_queue_task(LinphoneCore *lc, belle_sip_source_func_t task_fun, void *data, const char *task_description); void linphone_core_queue_task(LinphoneCore *lc, belle_sip_source_func_t task_fun, void *data, const char *task_description);
...@@ -473,7 +471,6 @@ void _linphone_proxy_config_release_ops(LinphoneProxyConfig *obj); ...@@ -473,7 +471,6 @@ void _linphone_proxy_config_release_ops(LinphoneProxyConfig *obj);
/*chat*/ /*chat*/
LinphoneChatRoom * linphone_chat_room_new(LinphoneCore *core, const LinphoneAddress *addr); LinphoneChatRoom * linphone_chat_room_new(LinphoneCore *core, const LinphoneAddress *addr);
LinphoneChatRoom *_linphone_core_join_client_group_chat_room (LinphoneCore *core, const LinphonePrivate::Address &addr);
LinphoneChatRoom *_linphone_client_group_chat_room_new (LinphoneCore *core, const char *uri, const char *subject); LinphoneChatRoom *_linphone_client_group_chat_room_new (LinphoneCore *core, const char *uri, const char *subject);
void linphone_chat_room_release(LinphoneChatRoom *cr); void linphone_chat_room_release(LinphoneChatRoom *cr);
void linphone_chat_room_set_call(LinphoneChatRoom *cr, LinphoneCall *call); void linphone_chat_room_set_call(LinphoneChatRoom *cr, LinphoneCall *call);
...@@ -810,6 +807,10 @@ typedef struct _LCCallbackObj { ...@@ -810,6 +807,10 @@ typedef struct _LCCallbackObj {
void *_user_data; void *_user_data;
} LCCallbackObj; } LCCallbackObj;
namespace LinphonePrivate {
class Core;
};
struct _LinphoneCore struct _LinphoneCore
{ {
belle_sip_object_t base; belle_sip_object_t base;
...@@ -819,7 +820,7 @@ struct _LinphoneCore ...@@ -819,7 +820,7 @@ struct _LinphoneCore
LinphonePrivate::Sal *sal; LinphonePrivate::Sal *sal;
// For migration purposes // For migration purposes
LinphonePrivate::Core cppCore; std::shared_ptr<LinphonePrivate::Core> cppCore;
void *platform_helper; /*is a LinphonePrivate::PlatformHelpers but cannot be used as is because private.h is compiled as C in testers.*/ void *platform_helper; /*is a LinphonePrivate::PlatformHelpers but cannot be used as is because private.h is compiled as C in testers.*/
...@@ -847,8 +848,6 @@ struct _LinphoneCore ...@@ -847,8 +848,6 @@ struct _LinphoneCore
MSList *calls; /* all the processed calls */ MSList *calls; /* all the processed calls */
MSList *queued_calls; /* used by the autoreplier */ MSList *queued_calls; /* used by the autoreplier */
MSList *call_logs; MSList *call_logs;
MSList *chatrooms;
bctbx_map_t *group_chat_rooms;
int max_call_logs; int max_call_logs;
int missed_calls; int missed_calls;
VideoPreview *previewstream; VideoPreview *previewstream;
...@@ -941,6 +940,9 @@ struct _LinphoneCore ...@@ -941,6 +940,9 @@ struct _LinphoneCore
LinphoneImEncryptionEngine *im_encryption_engine; LinphoneImEncryptionEngine *im_encryption_engine;
struct _LinphoneAccountCreatorService *default_ac_service; struct _LinphoneAccountCreatorService *default_ac_service;
MSBandwidthController *bw_controller; MSBandwidthController *bw_controller;
// For migration purpose.
bctbx_list_t *chat_rooms;
}; };
#ifdef __cplusplus #ifdef __cplusplus
......
...@@ -24,7 +24,7 @@ Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. ...@@ -24,7 +24,7 @@ Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
#include "linphone/core.h" #include "linphone/core.h"
#include "linphone/tunnel.h" #include "linphone/tunnel.h"
#include "c-wrapper/internal/c-sal.h" #include "c-wrapper/internal/c-sal.h"
#include <sqlite3.h> #include <sqlite3.h>
#include "quality_reporting.h" #include "quality_reporting.h"
#include "vcard_private.h" #include "vcard_private.h"
...@@ -94,7 +94,6 @@ LINPHONE_PUBLIC mblk_t *_linphone_call_stats_get_received_rtcp (const LinphoneCa ...@@ -94,7 +94,6 @@ LINPHONE_PUBLIC mblk_t *_linphone_call_stats_get_received_rtcp (const LinphoneCa
LINPHONE_PUBLIC LinphoneQualityReporting *linphone_call_log_get_quality_reporting(LinphoneCallLog *call_log); LINPHONE_PUBLIC LinphoneQualityReporting *linphone_call_log_get_quality_reporting(LinphoneCallLog *call_log);
LINPHONE_PUBLIC reporting_session_report_t **linphone_quality_reporting_get_reports(LinphoneQualityReporting *qreporting); LINPHONE_PUBLIC reporting_session_report_t **linphone_quality_reporting_get_reports(LinphoneQualityReporting *qreporting);
LINPHONE_PUBLIC LinphoneChatRoom *_linphone_core_find_group_chat_room(const LinphoneCore *lc, const char *id);
LINPHONE_PUBLIC bctbx_list_t * linphone_chat_room_get_transient_messages(const LinphoneChatRoom *cr); LINPHONE_PUBLIC bctbx_list_t * linphone_chat_room_get_transient_messages(const LinphoneChatRoom *cr);
LINPHONE_PUBLIC MSList* linphone_core_fetch_friends_from_db(LinphoneCore *lc, LinphoneFriendList *list); LINPHONE_PUBLIC MSList* linphone_core_fetch_friends_from_db(LinphoneCore *lc, LinphoneFriendList *list);
......
...@@ -106,6 +106,7 @@ namespace Utils { ...@@ -106,6 +106,7 @@ namespace Utils {
} }
LINPHONE_PUBLIC std::tm getLongAsTm (long time); LINPHONE_PUBLIC std::tm getLongAsTm (long time);
LINPHONE_PUBLIC long getTmAsLong (const std::tm &time);
} }
LINPHONE_END_NAMESPACE LINPHONE_END_NAMESPACE
......
...@@ -205,7 +205,7 @@ bctbx_list_t *linphone_chat_room_get_history (LinphoneChatRoom *cr, int nb_messa ...@@ -205,7 +205,7 @@ bctbx_list_t *linphone_chat_room_get_history (LinphoneChatRoom *cr, int nb_messa
bctbx_list_t *linphone_chat_room_get_history_events (LinphoneChatRoom *cr, int nb_events) { bctbx_list_t *linphone_chat_room_get_history_events (LinphoneChatRoom *cr, int nb_events) {
return L_GET_RESOLVED_C_LIST_FROM_CPP_LIST( return L_GET_RESOLVED_C_LIST_FROM_CPP_LIST(
L_GET_PRIVATE(L_GET_CPP_PTR_FROM_C_OBJECT(cr)->getCore()->cppCore)->mainDb.getHistory( L_GET_PRIVATE(L_GET_CPP_PTR_FROM_C_OBJECT(cr)->getCore()->cppCore)->mainDb->getHistory(
L_GET_CPP_PTR_FROM_C_OBJECT(cr)->getPeerAddress().asStringUriOnly(), L_GET_CPP_PTR_FROM_C_OBJECT(cr)->getPeerAddress().asStringUriOnly(),
nb_events nb_events
) )
...@@ -214,7 +214,7 @@ bctbx_list_t *linphone_chat_room_get_history_events (LinphoneChatRoom *cr, int n ...@@ -214,7 +214,7 @@ bctbx_list_t *linphone_chat_room_get_history_events (LinphoneChatRoom *cr, int n
bctbx_list_t *linphone_chat_room_get_history_range_events (LinphoneChatRoom *cr, int begin, int end) { bctbx_list_t *linphone_chat_room_get_history_range_events (LinphoneChatRoom *cr, int begin, int end) {
return L_GET_RESOLVED_C_LIST_FROM_CPP_LIST( return L_GET_RESOLVED_C_LIST_FROM_CPP_LIST(
L_GET_PRIVATE(L_GET_CPP_PTR_FROM_C_OBJECT(cr)->getCore()->cppCore)->mainDb.getHistory( L_GET_PRIVATE(L_GET_CPP_PTR_FROM_C_OBJECT(cr)->getCore()->cppCore)->mainDb->getHistory(
L_GET_CPP_PTR_FROM_C_OBJECT(cr)->getPeerAddress().asStringUriOnly(), L_GET_CPP_PTR_FROM_C_OBJECT(cr)->getPeerAddress().asStringUriOnly(),
begin, begin,
end end
...@@ -330,14 +330,10 @@ void linphone_chat_room_set_user_data (LinphoneChatRoom *cr, void *ud) { ...@@ -330,14 +330,10 @@ void linphone_chat_room_set_user_data (LinphoneChatRoom *cr, void *ud) {
// ============================================================================= // =============================================================================
LinphoneChatRoom *linphone_chat_room_new (LinphoneCore *core, const LinphoneAddress *addr) { LinphoneChatRoom