Commit 14311c87 authored by Ghislain MARY's avatar Ghislain MARY

Hacks::contactHasParam() can now be removed thanks to an update of belle-sip.

parent 9f9da0fd
......@@ -200,7 +200,7 @@ void ClientGroupChatRoom::onCallSessionStateChanged (const CallSession &session,
Address addr(session.getRemoteContact());
addr.clean();
onConferenceCreated(addr);
if (Hacks::contactHasParam(session.getRemoteContact(), "isfocus"))
if (session.getRemoteContactAddress()->hasParam("isfocus"))
eventHandler->subscribe(conferenceAddress);
}
}
......
......@@ -86,6 +86,7 @@ protected:
CallSessionParams *params = nullptr;
mutable CallSessionParams *currentParams = nullptr;
CallSessionParams *remoteParams = nullptr;
mutable Address remoteContactAddress;
std::string subject;
LinphoneCallDir direction = LinphoneCallOutgoing;
......
......@@ -1002,6 +1002,17 @@ string CallSession::getRemoteContact () const {
return string();
}
const Address *CallSession::getRemoteContactAddress () const {
L_D();
if (!d->op) {
return nullptr;
}
char *addrStr = sal_address_as_string(d->op->get_remote_contact_address());
d->remoteContactAddress = Address(addrStr);
bctbx_free(addrStr);
return &d->remoteContactAddress;
}
const CallSessionParams * CallSession::getRemoteParams () {
L_D();
if (d->op){
......
......@@ -67,6 +67,7 @@ public:
const Address& getRemoteAddress () const;
std::string getRemoteAddressAsString () const;
std::string getRemoteContact () const;
const Address *getRemoteContactAddress () const;
const CallSessionParams *getRemoteParams ();
LinphoneCallState getState () const;
......
......@@ -30,16 +30,4 @@ LINPHONE_BEGIN_NAMESPACE
// -----------------------------------------------------------------------------
bool Hacks::contactHasParam(const string &contact, const string &paramName) {
// This is very ugly!!! The handling of Contact headers and addresses is a real
// crap that really needs to be reworked. Meanwhile, we cannot get the params on the
// remote contact address and need to forge and parse a contact header.
ostringstream os;
os << "Contact: " << contact;
belle_sip_header_contact_t *contactHeader = belle_sip_header_contact_parse(os.str().c_str());
bool result = belle_sip_parameters_has_parameter(BELLE_SIP_PARAMETERS(contactHeader), paramName.c_str());
belle_sip_object_unref(contactHeader);
return result;
}
LINPHONE_END_NAMESPACE
......@@ -31,7 +31,6 @@ LINPHONE_BEGIN_NAMESPACE
// can be located more easily.
class Hacks {
public:
static bool contactHasParam(const std::string &contact, const std::string &paramName);
private:
Hacks () = default;
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment