Commit 5961e5a6 authored by Ghislain MARY's avatar Ghislain MARY

Add the Hacks class.

parent 96bd4b35
......@@ -85,6 +85,7 @@ set(LINPHONE_CXX_OBJECTS_PRIVATE_HEADER_FILES
event-log/conference-participant-event.h
event-log/event-log-p.h
event-log/event-log.h
hacks/hacks.h
logger/logger.h
nat/ice-agent.h
nat/stun-client.h
......@@ -152,6 +153,7 @@ set(LINPHONE_CXX_OBJECTS_SOURCE_FILES
event-log/conference-event.cpp
event-log/conference-participant-event.cpp
event-log/event-log.cpp
hacks/hacks.cpp
logger/logger.cpp
nat/ice-agent.cpp
nat/stun-client.cpp
......
/*
* hacks.cpp
* Copyright (C) 2017 Belledonne Communications SARL
*
* This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation, either version 3 of the License, or
* (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY {} without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program. If not, see <http://www.gnu.org/licenses/>.
*/
#include <sstream>
#include <belle-sip/headers.h>
#include "hacks.h"
// =============================================================================
using namespace std;
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
/*
* hacks.h
* Copyright (C) 2017 Belledonne Communications SARL
*
* This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation, either version 3 of the License, or
* (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program. If not, see <http://www.gnu.org/licenses/>.
*/
#ifndef _HACKS_H_
#define _HACKS_H_
#include <string>
#include "linphone/utils/general.h"
// =============================================================================
LINPHONE_BEGIN_NAMESPACE
// This class has the purpose to centralize the temporary hacks so that they
// can be located more easily.
class Hacks {
public:
static bool contactHasParam(const std::string &contact, const std::string &paramName);
};
LINPHONE_END_NAMESPACE
#endif // ifndef _HACKS_H_
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