Commit 6a395649 authored by Ronan's avatar Ronan
Browse files

fix(core): coding style

parent fc75fdef
...@@ -42,6 +42,8 @@ ...@@ -42,6 +42,8 @@
#include "chat/real-time-text-chat-room-p.h" #include "chat/real-time-text-chat-room-p.h"
#include "content/content-type.h" #include "content/content-type.h"
using namespace std;
void linphone_core_disable_chat(LinphoneCore *lc, LinphoneReason deny_reason) { void linphone_core_disable_chat(LinphoneCore *lc, LinphoneReason deny_reason) {
lc->chat_deny_code = deny_reason; lc->chat_deny_code = deny_reason;
} }
...@@ -236,9 +238,9 @@ int linphone_core_message_received(LinphoneCore *lc, SalOp *op, const SalMessage ...@@ -236,9 +238,9 @@ int linphone_core_message_received(LinphoneCore *lc, SalOp *op, const SalMessage
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)) {
std::shared_ptr<LinphonePrivate::RealTimeTextChatRoom> rttcr = shared_ptr<LinphonePrivate::RealTimeTextChatRoom> rttcr =
std::static_pointer_cast<LinphonePrivate::RealTimeTextChatRoom>(L_GET_CPP_PTR_FROM_C_OBJECT(cr)); static_pointer_cast<LinphonePrivate::RealTimeTextChatRoom>(L_GET_CPP_PTR_FROM_C_OBJECT(cr));
L_GET_PRIVATE(rttcr)->realtimeTextReceived(character, call); L_GET_PRIVATE(rttcr)->realtimeTextReceived(character, call);
//L_GET_PRIVATE(std::static_pointer_cast<LinphonePrivate::RealTimeTextChatRoom>(L_GET_CPP_PTR_FROM_C_OBJECT(cr)))->realtimeTextReceived(character, call); //L_GET_PRIVATE(static_pointer_cast<LinphonePrivate::RealTimeTextChatRoom>(L_GET_CPP_PTR_FROM_C_OBJECT(cr)))->realtimeTextReceived(character, call);
} }
} }
/* /*
call-transfer.cc call-transfer.cc
Copyright (C) 2016 Belledonne Communications, Grenoble, France Copyright (C) 2016 Belledonne Communications, Grenoble, France
This library is free software; you can redistribute it and/or modify it This library is free software; you can redistribute it and/or modify it
under the terms of the GNU Lesser General Public License as published by under the terms of the GNU Lesser General Public License as published by
...@@ -85,7 +85,7 @@ void CallTransferCommand::exec(Daemon* app, const string& args) ...@@ -85,7 +85,7 @@ void CallTransferCommand::exec(Daemon* app, const string& args)
return; return;
} }
if (linphone_call_transfer_to_another(call_to_transfer, call_to_transfer_to) == 0) { if (linphone_call_transfer_to_another(call_to_transfer, call_to_transfer_to) == 0) {
std::ostringstream ostr; ostringstream ostr;
ostr << "Call ID: " << call_to_transfer_id << "\n"; ostr << "Call ID: " << call_to_transfer_id << "\n";
ostr << "Transfer to: " << call_to_transfer_to_id << "\n"; ostr << "Transfer to: " << call_to_transfer_to_id << "\n";
app->sendResponse(Response(ostr.str(), Response::Ok)); app->sendResponse(Response(ostr.str(), Response::Ok));
...@@ -93,7 +93,7 @@ void CallTransferCommand::exec(Daemon* app, const string& args) ...@@ -93,7 +93,7 @@ void CallTransferCommand::exec(Daemon* app, const string& args)
} }
} else { } else {
if (linphone_call_transfer(call_to_transfer, sip_uri_to_transfer_to.c_str()) == 0) { if (linphone_call_transfer(call_to_transfer, sip_uri_to_transfer_to.c_str()) == 0) {
std::ostringstream ostr; ostringstream ostr;
ostr << "Call ID: " << call_to_transfer_id << "\n"; ostr << "Call ID: " << call_to_transfer_id << "\n";
ostr << "Transfer to: " << sip_uri_to_transfer_to << "\n"; ostr << "Transfer to: " << sip_uri_to_transfer_to << "\n";
app->sendResponse(Response(ostr.str(), Response::Ok)); app->sendResponse(Response(ostr.str(), Response::Ok));
......
/* /*
conference.cc conference.cc
Copyright (C) 2016 Belledonne Communications, Grenoble, France Copyright (C) 2016 Belledonne Communications, Grenoble, France
This library is free software; you can redistribute it and/or modify it This library is free software; you can redistribute it and/or modify it
under the terms of the GNU Lesser General Public License as published by under the terms of the GNU Lesser General Public License as published by
...@@ -79,7 +79,7 @@ void ConferenceCommand::exec(Daemon* app, const string& args) { ...@@ -79,7 +79,7 @@ void ConferenceCommand::exec(Daemon* app, const string& args) {
} }
if (ret == 0) { if (ret == 0) {
std::ostringstream ostr; ostringstream ostr;
ostr << "Call ID: " << id << "\n"; ostr << "Call ID: " << id << "\n";
ostr << "Conference: " << subcommand << " OK" << "\n"; ostr << "Conference: " << subcommand << " OK" << "\n";
app->sendResponse(Response(ostr.str(), Response::Ok)); app->sendResponse(Response(ostr.str(), Response::Ok));
......
/* /*
register-info.cc register-info.cc
Copyright (C) 2016 Belledonne Communications, Grenoble, France Copyright (C) 2016 Belledonne Communications, Grenoble, France
This library is free software; you can redistribute it and/or modify it This library is free software; you can redistribute it and/or modify it
under the terms of the GNU Lesser General Public License as published by under the terms of the GNU Lesser General Public License as published by
...@@ -21,6 +21,8 @@ Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA ...@@ -21,6 +21,8 @@ Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
#include <string> #include <string>
#include "register-info.h" #include "register-info.h"
using namespace std;
class RegisterInfoResponse: public Response { class RegisterInfoResponse: public Response {
public: public:
RegisterInfoResponse(): Response() {} RegisterInfoResponse(): Response() {}
...@@ -28,19 +30,19 @@ public: ...@@ -28,19 +30,19 @@ public:
append(id, cfg); append(id, cfg);
} }
void append(int id, const ::LinphoneProxyConfig *cfg) { void append(int id, const ::LinphoneProxyConfig *cfg) {
std::ostringstream ost; ostringstream ost;
ost << getBody(); ost << getBody();
if (ost.tellp() > 0) ost << std::endl; if (ost.tellp() > 0) ost << endl;
ost << "Id: " << id << std::endl; ost << "Id: " << id << endl;
ost << "Identity: " << linphone_proxy_config_get_identity(cfg) << std::endl; ost << "Identity: " << linphone_proxy_config_get_identity(cfg) << endl;
ost << "Proxy: " << linphone_proxy_config_get_server_addr(cfg) << std::endl; ost << "Proxy: " << linphone_proxy_config_get_server_addr(cfg) << endl;
const char *route = linphone_proxy_config_get_route(cfg); const char *route = linphone_proxy_config_get_route(cfg);
if (route != NULL) { if (route != NULL) {
ost << "Route: " << route << std::endl; ost << "Route: " << route << endl;
} }
ost << "State: " << linphone_registration_state_to_string(linphone_proxy_config_get_state(cfg)) << std::endl; ost << "State: " << linphone_registration_state_to_string(linphone_proxy_config_get_state(cfg)) << endl;
setBody(ost.str()); setBody(ost.str());
} }
}; };
...@@ -72,9 +74,9 @@ RegisterInfoCommand::RegisterInfoCommand(): ...@@ -72,9 +74,9 @@ RegisterInfoCommand::RegisterInfoCommand():
"Reason: No register with such id.")); "Reason: No register with such id."));
} }
void RegisterInfoCommand::exec(Daemon *app, const std::string& args) { void RegisterInfoCommand::exec(Daemon *app, const string& args) {
std::string param; string param;
std::istringstream ist(args); istringstream ist(args);
ist >> param; ist >> param;
if (ist.fail()) { if (ist.fail()) {
app->sendResponse(Response("Missing parameter.", Response::Error)); app->sendResponse(Response("Missing parameter.", Response::Error));
...@@ -93,10 +95,10 @@ void RegisterInfoCommand::exec(Daemon *app, const std::string& args) { ...@@ -93,10 +95,10 @@ void RegisterInfoCommand::exec(Daemon *app, const std::string& args) {
int id; int id;
try { try {
id = atoi(param.c_str()); id = atoi(param.c_str());
} catch (std::invalid_argument) { } catch (invalid_argument) {
app->sendResponse(Response("Invalid ID.", Response::Error)); app->sendResponse(Response("Invalid ID.", Response::Error));
return; return;
} catch (std::out_of_range) { } catch (out_of_range) {
app->sendResponse(Response("Out of range ID.", Response::Error)); app->sendResponse(Response("Out of range ID.", Response::Error));
return; return;
} }
......
/* /*
video.cc video.cc
Copyright (C) 2016 Belledonne Communications, Grenoble, France Copyright (C) 2016 Belledonne Communications, Grenoble, France
This library is free software; you can redistribute it and/or modify it This library is free software; you can redistribute it and/or modify it
under the terms of the GNU Lesser General Public License as published by under the terms of the GNU Lesser General Public License as published by
...@@ -162,7 +162,7 @@ AutoVideo::AutoVideo(): ...@@ -162,7 +162,7 @@ AutoVideo::AutoVideo():
"Auto video OFF")); "Auto video OFF"));
} }
void AutoVideo::exec(Daemon* app, const std::string& args) void AutoVideo::exec(Daemon* app, const string& args)
{ {
bool enable = (args.compare("on") == 0); bool enable = (args.compare("on") == 0);
......
/* /*
daemon.cc daemon.cc
Copyright (C) 2016 Belledonne Communications, Grenoble, France Copyright (C) 2016 Belledonne Communications, Grenoble, France
This library is free software; you can redistribute it and/or modify it This library is free software; you can redistribute it and/or modify it
under the terms of the GNU Lesser General Public License as published by under the terms of the GNU Lesser General Public License as published by
...@@ -331,11 +331,11 @@ Daemon::Daemon(const char *config_path, const char *factory_config_path, const c ...@@ -331,11 +331,11 @@ Daemon::Daemon(const char *config_path, const char *factory_config_path, const c
linphone_core_set_user_data(mLc, this); linphone_core_set_user_data(mLc, this);
linphone_core_enable_video_capture(mLc,capture_video); linphone_core_enable_video_capture(mLc,capture_video);
linphone_core_enable_video_display(mLc,display_video); linphone_core_enable_video_display(mLc,display_video);
for(const bctbx_list_t *proxy = linphone_core_get_proxy_config_list(mLc); proxy != NULL; proxy = bctbx_list_next(proxy)) { for(const bctbx_list_t *proxy = linphone_core_get_proxy_config_list(mLc); proxy != NULL; proxy = bctbx_list_next(proxy)) {
updateProxyId((LinphoneProxyConfig *)bctbx_list_get_data(proxy)); updateProxyId((LinphoneProxyConfig *)bctbx_list_get_data(proxy));
} }
initCommands(); initCommands();
mUseStatsEvents=true; mUseStatsEvents=true;
} }
...@@ -403,7 +403,7 @@ LinphoneAuthInfo *Daemon::findAuthInfo(int id) { ...@@ -403,7 +403,7 @@ LinphoneAuthInfo *Daemon::findAuthInfo(int id) {
} }
int Daemon::updateAudioStreamId(AudioStream *audio_stream) { int Daemon::updateAudioStreamId(AudioStream *audio_stream) {
for (std::map<int, AudioStreamAndOther*>::iterator it = mAudioStreams.begin(); it != mAudioStreams.end(); ++it) { for (map<int, AudioStreamAndOther*>::iterator it = mAudioStreams.begin(); it != mAudioStreams.end(); ++it) {
if (it->second->stream == audio_stream) if (it->second->stream == audio_stream)
return it->first; return it->first;
} }
...@@ -414,21 +414,21 @@ int Daemon::updateAudioStreamId(AudioStream *audio_stream) { ...@@ -414,21 +414,21 @@ int Daemon::updateAudioStreamId(AudioStream *audio_stream) {
} }
AudioStreamAndOther *Daemon::findAudioStreamAndOther(int id) { AudioStreamAndOther *Daemon::findAudioStreamAndOther(int id) {
std::map<int, AudioStreamAndOther*>::iterator it = mAudioStreams.find(id); map<int, AudioStreamAndOther*>::iterator it = mAudioStreams.find(id);
if (it != mAudioStreams.end()) if (it != mAudioStreams.end())
return it->second; return it->second;
return NULL; return NULL;
} }
AudioStream *Daemon::findAudioStream(int id) { AudioStream *Daemon::findAudioStream(int id) {
std::map<int, AudioStreamAndOther*>::iterator it = mAudioStreams.find(id); map<int, AudioStreamAndOther*>::iterator it = mAudioStreams.find(id);
if (it != mAudioStreams.end()) if (it != mAudioStreams.end())
return it->second->stream; return it->second->stream;
return NULL; return NULL;
} }
void Daemon::removeAudioStream(int id) { void Daemon::removeAudioStream(int id) {
std::map<int, AudioStreamAndOther*>::iterator it = mAudioStreams.find(id); map<int, AudioStreamAndOther*>::iterator it = mAudioStreams.find(id);
if (it != mAudioStreams.end()) { if (it != mAudioStreams.end()) {
mAudioStreams.erase(it); mAudioStreams.erase(it);
delete(it->second); delete(it->second);
...@@ -542,7 +542,7 @@ void Daemon::dtmfReceived(LinphoneCore *lc, LinphoneCall *call, int dtmf) { ...@@ -542,7 +542,7 @@ void Daemon::dtmfReceived(LinphoneCore *lc, LinphoneCall *call, int dtmf) {
} }
void Daemon::iterateStreamStats() { void Daemon::iterateStreamStats() {
for (std::map<int, AudioStreamAndOther*>::iterator it = mAudioStreams.begin(); it != mAudioStreams.end(); ++it) { for (map<int, AudioStreamAndOther*>::iterator it = mAudioStreams.begin(); it != mAudioStreams.end(); ++it) {
OrtpEvent *ev; OrtpEvent *ev;
while (it->second->queue && (NULL != (ev=ortp_ev_queue_get(it->second->queue)))){ while (it->second->queue && (NULL != (ev=ortp_ev_queue_get(it->second->queue)))){
OrtpEventType evt=ortp_event_get_type(ev); OrtpEventType evt=ortp_event_get_type(ev);
...@@ -730,7 +730,7 @@ void Daemon::dumpCommandsHelpHtml(){ ...@@ -730,7 +730,7 @@ void Daemon::dumpCommandsHelpHtml(){
cout<<"<h3>"<<"Description"<<"</h3>"<<endl; cout<<"<h3>"<<"Description"<<"</h3>"<<endl;
cout<<"<p>"<<htmlEscape((*it)->getDescription())<<"</p>"<<endl; cout<<"<p>"<<htmlEscape((*it)->getDescription())<<"</p>"<<endl;
cout<<"<h3>"<<"Examples"<<"</h3>"<<endl; cout<<"<h3>"<<"Examples"<<"</h3>"<<endl;
const std::list<const DaemonCommandExample*> &examples=(*it)->getExamples(); const list<const DaemonCommandExample*> &examples=(*it)->getExamples();
cout<<"<p><i>"; cout<<"<p><i>";
for(list<const DaemonCommandExample*>::const_iterator ex_it=examples.begin();ex_it!=examples.end();++ex_it){ for(list<const DaemonCommandExample*>::const_iterator ex_it=examples.begin();ex_it!=examples.end();++ex_it){
cout<<"<b>"<<htmlEscape("Linphone-daemon>")<<htmlEscape((*ex_it)->getCommand())<<"</b><br>"<<endl; cout<<"<b>"<<htmlEscape("Linphone-daemon>")<<htmlEscape((*ex_it)->getCommand())<<"</b><br>"<<endl;
...@@ -792,7 +792,7 @@ string Daemon::readLine(const string& prompt, bool *eof) { ...@@ -792,7 +792,7 @@ string Daemon::readLine(const string& prompt, bool *eof) {
stringbuf outbuf; stringbuf outbuf;
cin.get(outbuf); cin.get(outbuf);
cin.clear(); cin.clear();
cin.ignore(std::numeric_limits<std::streamsize>::max(), '\n'); cin.ignore(numeric_limits<streamsize>::max(), '\n');
return outbuf.str(); return outbuf.str();
#endif #endif
} }
...@@ -851,7 +851,7 @@ void Daemon::enableLSD(bool enabled) { ...@@ -851,7 +851,7 @@ void Daemon::enableLSD(bool enabled) {
Daemon::~Daemon() { Daemon::~Daemon() {
uninitCommands(); uninitCommands();
for (std::map<int, AudioStreamAndOther *>::iterator it = mAudioStreams.begin(); it != mAudioStreams.end(); ++it) { for (map<int, AudioStreamAndOther *>::iterator it = mAudioStreams.begin(); it != mAudioStreams.end(); ++it) {
audio_stream_stop(it->second->stream); audio_stream_stop(it->second->stream);
} }
......
...@@ -735,7 +735,7 @@ const char *linphone_call_get_remote_user_agent (LinphoneCall *call) { ...@@ -735,7 +735,7 @@ const char *linphone_call_get_remote_user_agent (LinphoneCall *call) {
} }
const char * linphone_call_get_remote_contact (LinphoneCall *call) { const char * linphone_call_get_remote_contact (LinphoneCall *call) {
std::string contact = L_GET_CPP_PTR_FROM_C_OBJECT(call)->getRemoteContact(); string contact = L_GET_CPP_PTR_FROM_C_OBJECT(call)->getRemoteContact();
if (contact.empty()) if (contact.empty())
return nullptr; return nullptr;
if (call->remoteContactCache) if (call->remoteContactCache)
...@@ -745,7 +745,7 @@ const char * linphone_call_get_remote_contact (LinphoneCall *call) { ...@@ -745,7 +745,7 @@ const char * linphone_call_get_remote_contact (LinphoneCall *call) {
} }
const char *linphone_call_get_authentication_token (LinphoneCall *call) { const char *linphone_call_get_authentication_token (LinphoneCall *call) {
std::string token = L_GET_CPP_PTR_FROM_C_OBJECT(call)->getAuthenticationToken(); string token = L_GET_CPP_PTR_FROM_C_OBJECT(call)->getAuthenticationToken();
return token.empty() ? nullptr : token.c_str(); return token.empty() ? nullptr : token.c_str();
} }
...@@ -1184,7 +1184,7 @@ void linphone_call_set_user_data (LinphoneCall *call, void *ud) { ...@@ -1184,7 +1184,7 @@ void linphone_call_set_user_data (LinphoneCall *call, void *ud) {
LinphoneCall *linphone_call_new_outgoing (LinphoneCore *lc, const LinphoneAddress *from, const LinphoneAddress *to, const LinphoneCallParams *params, LinphoneProxyConfig *cfg) { LinphoneCall *linphone_call_new_outgoing (LinphoneCore *lc, const LinphoneAddress *from, const LinphoneAddress *to, const LinphoneCallParams *params, LinphoneProxyConfig *cfg) {
LinphoneCall *call = L_INIT(Call); LinphoneCall *call = L_INIT(Call);
L_SET_CPP_PTR_FROM_C_OBJECT(call, std::make_shared<LinphonePrivate::Call>(call, lc, LinphoneCallOutgoing, L_SET_CPP_PTR_FROM_C_OBJECT(call, make_shared<LinphonePrivate::Call>(call, lc, LinphoneCallOutgoing,
*L_GET_CPP_PTR_FROM_C_OBJECT(from), *L_GET_CPP_PTR_FROM_C_OBJECT(to), *L_GET_CPP_PTR_FROM_C_OBJECT(from), *L_GET_CPP_PTR_FROM_C_OBJECT(to),
cfg, nullptr, L_GET_CPP_PTR_FROM_C_OBJECT(params))); cfg, nullptr, L_GET_CPP_PTR_FROM_C_OBJECT(params)));
call->currentParamsCache = linphone_call_params_new_for_wrapper(); call->currentParamsCache = linphone_call_params_new_for_wrapper();
...@@ -1196,7 +1196,7 @@ LinphoneCall *linphone_call_new_outgoing (LinphoneCore *lc, const LinphoneAddres ...@@ -1196,7 +1196,7 @@ LinphoneCall *linphone_call_new_outgoing (LinphoneCore *lc, const LinphoneAddres
LinphoneCall *linphone_call_new_incoming (LinphoneCore *lc, const LinphoneAddress *from, const LinphoneAddress *to, SalOp *op) { LinphoneCall *linphone_call_new_incoming (LinphoneCore *lc, const LinphoneAddress *from, const LinphoneAddress *to, SalOp *op) {
LinphoneCall *call = L_INIT(Call); LinphoneCall *call = L_INIT(Call);
L_SET_CPP_PTR_FROM_C_OBJECT(call, std::make_shared<LinphonePrivate::Call>(call, lc, LinphoneCallIncoming, L_SET_CPP_PTR_FROM_C_OBJECT(call, make_shared<LinphonePrivate::Call>(call, lc, LinphoneCallIncoming,
*L_GET_CPP_PTR_FROM_C_OBJECT(from), *L_GET_CPP_PTR_FROM_C_OBJECT(to), *L_GET_CPP_PTR_FROM_C_OBJECT(from), *L_GET_CPP_PTR_FROM_C_OBJECT(to),
nullptr, op, nullptr)); nullptr, op, nullptr));
call->currentParamsCache = linphone_call_params_new_for_wrapper(); call->currentParamsCache = linphone_call_params_new_for_wrapper();
......
...@@ -498,8 +498,8 @@ void linphone_chat_message_send_display_notification(LinphoneChatMessage *cm) { ...@@ -498,8 +498,8 @@ void linphone_chat_message_send_display_notification(LinphoneChatMessage *cm) {
}LinphoneStatus linphone_chat_message_put_char(LinphoneChatMessage *msg, uint32_t character) { }LinphoneStatus linphone_chat_message_put_char(LinphoneChatMessage *msg, uint32_t character) {
LinphoneChatRoom *cr = linphone_chat_message_get_chat_room(msg); LinphoneChatRoom *cr = linphone_chat_message_get_chat_room(msg);
if (linphone_core_realtime_text_enabled(linphone_chat_room_get_core(cr))) { if (linphone_core_realtime_text_enabled(linphone_chat_room_get_core(cr))) {
std::shared_ptr<LinphonePrivate::RealTimeTextChatRoom> rttcr = shared_ptr<LinphonePrivate::RealTimeTextChatRoom> rttcr =
std::static_pointer_cast<LinphonePrivate::RealTimeTextChatRoom>(L_GET_CPP_PTR_FROM_C_OBJECT(cr)); static_pointer_cast<LinphonePrivate::RealTimeTextChatRoom>(L_GET_CPP_PTR_FROM_C_OBJECT(cr));
LinphoneCall *call = rttcr->getCall(); LinphoneCall *call = rttcr->getCall();
LinphoneCore *lc = rttcr->getCore(); LinphoneCore *lc = rttcr->getCore();
const uint32_t new_line = 0x2028; const uint32_t new_line = 0x2028;
......
...@@ -269,9 +269,9 @@ void linphone_chat_room_set_user_data (LinphoneChatRoom *cr, void *ud) { ...@@ -269,9 +269,9 @@ void linphone_chat_room_set_user_data (LinphoneChatRoom *cr, void *ud) {
LinphoneChatRoom *linphone_chat_room_new (LinphoneCore *core, const LinphoneAddress *addr) { LinphoneChatRoom *linphone_chat_room_new (LinphoneCore *core, const LinphoneAddress *addr) {
LinphoneChatRoom *cr = L_INIT(ChatRoom); LinphoneChatRoom *cr = L_INIT(ChatRoom);
if (linphone_core_realtime_text_enabled(core)) if (linphone_core_realtime_text_enabled(core))
L_SET_CPP_PTR_FROM_C_OBJECT(cr, std::make_shared<LinphonePrivate::RealTimeTextChatRoom>(core, *L_GET_CPP_PTR_FROM_C_OBJECT(addr))); L_SET_CPP_PTR_FROM_C_OBJECT(cr, make_shared<LinphonePrivate::RealTimeTextChatRoom>(core, *L_GET_CPP_PTR_FROM_C_OBJECT(addr)));
else else
L_SET_CPP_PTR_FROM_C_OBJECT(cr, std::make_shared<LinphonePrivate::BasicChatRoom>(core, *L_GET_CPP_PTR_FROM_C_OBJECT(addr))); L_SET_CPP_PTR_FROM_C_OBJECT(cr, make_shared<LinphonePrivate::BasicChatRoom>(core, *L_GET_CPP_PTR_FROM_C_OBJECT(addr)));
L_GET_PRIVATE_FROM_C_OBJECT(cr)->setState(LinphonePrivate::ChatRoom::State::Instantiated); L_GET_PRIVATE_FROM_C_OBJECT(cr)->setState(LinphonePrivate::ChatRoom::State::Instantiated);
L_GET_PRIVATE_FROM_C_OBJECT(cr)->setState(LinphonePrivate::ChatRoom::State::Created); L_GET_PRIVATE_FROM_C_OBJECT(cr)->setState(LinphonePrivate::ChatRoom::State::Created);
return cr; return cr;
...@@ -284,7 +284,7 @@ LinphoneChatRoom *_linphone_client_group_chat_room_new (LinphoneCore *core) { ...@@ -284,7 +284,7 @@ LinphoneChatRoom *_linphone_client_group_chat_room_new (LinphoneCore *core) {
LinphoneAddress *factoryAddr = linphone_address_new(factoryUri); LinphoneAddress *factoryAddr = linphone_address_new(factoryUri);
LinphoneProxyConfig *proxy = linphone_core_lookup_known_proxy(core, factoryAddr); LinphoneProxyConfig *proxy = linphone_core_lookup_known_proxy(core, factoryAddr);
linphone_address_unref(factoryAddr); linphone_address_unref(factoryAddr);
std::string from; string from;
if (proxy) if (proxy)
from = L_GET_CPP_PTR_FROM_C_OBJECT(linphone_proxy_config_get_identity_address(proxy))->asString(); from = L_GET_CPP_PTR_FROM_C_OBJECT(linphone_proxy_config_get_identity_address(proxy))->asString();
if (from.empty()) if (from.empty())
......
...@@ -27,7 +27,7 @@ LINPHONE_BEGIN_NAMESPACE ...@@ -27,7 +27,7 @@ LINPHONE_BEGIN_NAMESPACE
class CallListener { class CallListener {
public: public:
virtual ~CallListener() = default; virtual ~CallListener () = default;
virtual void onAckBeingSent (LinphoneHeaders *headers) = 0; virtual void onAckBeingSent (LinphoneHeaders *headers) = 0;
virtual void onAckReceived (LinphoneHeaders *headers) = 0; virtual void onAckReceived (LinphoneHeaders *headers) = 0;
......
...@@ -29,25 +29,39 @@ ...@@ -29,25 +29,39 @@
LINPHONE_BEGIN_NAMESPACE LINPHONE_BEGIN_NAMESPACE
class CallPrivate : public ObjectPrivate, CallListener { class CallPrivate :
public ObjectPrivate,
CallListener {
public: public:
CallPrivate (LinphoneCall *call, LinphoneCore *core, LinphoneCallDir direction, const Address &from, const Address &to, CallPrivate (
LinphoneProxyConfig *cfg, SalOp *op, const MediaSessionParams *msp); LinphoneCall *call,
LinphoneCore *core,
LinphoneCallDir direction,
const Address &from,
const Address &to,
LinphoneProxyConfig *cfg,
SalOp *op,
const MediaSessionParams *msp
);
virtual ~CallPrivate (); virtual ~CallPrivate ();
void initiateIncoming (); void initiateIncoming ();
bool initiateOutgoing (); bool initiateOutgoing ();
void iterate (time_t currentRealTime, bool oneSecondElapsed); void iterate (time_t currentRealTime, bool oneSecondElapsed);
void startIncomingNotification (); void startIncomingNotification ();
int startInvite (const Address *destination); /* If destination is nullptr, it is taken from the call log */
int startInvite (const Address *destination);
std::shared_ptr<CallSession> getActiveSession () const; std::shared_ptr<CallSession> getActiveSession () const;
bool getAudioMuted () const; bool getAudioMuted () const;
Conference * getConference () const { return conference; } Conference *getConference () const {
LinphoneProxyConfig * getDestProxy () const; return conference;
IceSession * getIceSession () const; }
MediaStream * getMediaStream (LinphoneStreamType type) const;
SalOp * getOp () const; LinphoneProxyConfig *getDestProxy () const;
IceSession *getIceSession () const;
MediaStream *getMediaStream (LinphoneStreamType type) const;
SalOp *getOp () const;
void setAudioMuted (bool value); void setAudioMuted (bool value);
private: private:
......
...@@ -23,16 +23,22 @@ ...@@ -23,16 +23,22 @@
#include "conference/session/media-session-p.h" #include "conference/session/media-session-p.h"
#include "logger/logger.h" #include "logger/logger.h"
#include "call.h"
// ============================================================================= // =============================================================================
using namespace std; using namespace std;
LINPHONE_BEGIN_NAMESPACE LINPHONE_BEGIN_NAMESPACE
CallPrivate::CallPrivate (LinphoneCall *call, LinphoneCore *core, LinphoneCallDir direction, const Address &from, const Address &to, CallPrivate::CallPrivate (
LinphoneProxyConfig *cfg, SalOp *op, const MediaSessionParams *msp) : lcall(call), core(core) { LinphoneCall *call,
LinphoneCore *core,
LinphoneCallDir direction,
const Address &from,
const Address &to,
LinphoneProxyConfig *cfg,
SalOp *op,
const MediaSessionParams *msp
) : lcall(call), core(core) {
nextVideoFrameDecoded._func = nullptr; nextVideoFrameDecoded._func = nullptr;
nextVideoFrameDecoded._user_data = nullptr; nextVideoFrameDecoded._user_data = nullptr;
} }
...@@ -52,19 +58,19 @@ bool CallPrivate::getAudioMuted () const { ...@@ -52,19 +58,19 @@ bool CallPrivate::getAudioMuted () const {
return static_cast<MediaSession *>(getActiveSession().get())->getPrivate()->getAudioMuted(); return static_cast<MediaSession *>(getActiveSession().get())->getPrivate()->getAudioMuted();
} }
LinphoneProxyConfig * CallPrivate::getDestProxy () const { LinphoneProxyConfig *CallPrivate::getDestProxy () const {
return getActiveSession()->getPrivate()->getDestProxy(); return getActiveSession()->getPrivate()->getDestProxy();
} }
IceSession * CallPrivate::getIceSession () const { IceSession *CallPrivate::getIceSession () const {
return static_cast<MediaSession *>(getActiveSession().get())->getPrivate()->getIceSession(); return static_cast<MediaSession *>(getActiveSession().get())->getPrivate()->getIceSession();
} }
MediaStream * CallPrivate::getMediaStream (LinphoneStreamType type) const { MediaStream *CallPrivate::getMediaStream (LinphoneStreamType type) const {
return static_cast<MediaSession *>(getActiveSession().get())->getPrivate()->getMediaStream(type); return static_cast<MediaSession *>(getActiveSession().get())->getPrivate()->getMediaStream(type);