mirror of
https://gitlab.linphone.org/BC/public/linphone-iphone.git
synced 2026-05-06 21:33:08 +00:00
Add the Hacks class.
This commit is contained in:
parent
96bd4b35e0
commit
5961e5a6aa
3 changed files with 86 additions and 0 deletions
|
|
@ -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
|
||||
|
|
|
|||
45
src/hacks/hacks.cpp
Normal file
45
src/hacks/hacks.cpp
Normal file
|
|
@ -0,0 +1,45 @@
|
|||
/*
|
||||
* 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 ¶mName) {
|
||||
// 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
|
||||
39
src/hacks/hacks.h
Normal file
39
src/hacks/hacks.h
Normal file
|
|
@ -0,0 +1,39 @@
|
|||
/*
|
||||
* 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 ¶mName);
|
||||
};
|
||||
|
||||
LINPHONE_END_NAMESPACE
|
||||
|
||||
#endif // ifndef _HACKS_H_
|
||||
Loading…
Add table
Reference in a new issue