Commit d6c17a16 authored by Benjamin REIS's avatar Benjamin REIS

add priority header with 'non-urgent' valu to imdn & is-composing

parent 2fb4ce6f
......@@ -160,7 +160,10 @@ private:
bool isSecured = false;
mutable bool isReadOnly = false;
Content internalContent;
// TODO: to replace salCustomheaders
std::unordered_map<std::string, std::string> customHeaders;
mutable LinphoneErrorInfo * errorInfo = nullptr;
SalOp *salOp = nullptr;
SalCustomHeader *salCustomHeaders = nullptr;
......
......@@ -40,6 +40,7 @@
#include "core/core-p.h"
#include "logger/logger.h"
#include "chat/notification/imdn.h"
#include "sip-tools/sip-headers.h"
#include "ortp/b64.h"
......@@ -402,7 +403,9 @@ void ChatMessagePrivate::sendImdn (Imdn::Type imdnType, LinphoneReason reason) {
if (reason != LinphoneReasonNone)
msg->getPrivate()->setEncryptionPrevented(true);
msg->setToBeStored(false);
msg->getPrivate()->addSalCustomHeader(PriorityHeader::HeaderName, PriorityHeader::NonUrgent);
msg->getPrivate()->send();
}
......
......@@ -100,6 +100,7 @@ public:
const Content &getInternalContent () const;
void setInternalContent (const Content &content);
// TODO: to replace salCustomheaders
std::string getCustomHeaderValue (const std::string &headerName) const;
void addCustomHeader (const std::string &headerName, const std::string &headerValue);
void removeCustomHeader (const std::string &headerName);
......
......@@ -25,6 +25,7 @@
#include "chat/chat-message/chat-message-p.h"
#include "chat/chat-room/chat-room-p.h"
#include "core/core-p.h"
#include "sip-tools/sip-headers.h"
// =============================================================================
......@@ -50,7 +51,7 @@ void ChatRoomPrivate::sendChatMessage (const shared_ptr<ChatMessage> &chatMessag
dChatMessage->setTime(ms_time(0));
dChatMessage->send();
LinphoneChatRoom *cr = L_GET_C_BACK_PTR(q);
LinphoneChatRoom *cr = L_GET_C_BACK_PTR(q);
// TODO: server currently don't stock message, remove condition in the future.
if (!linphone_core_conference_server_enabled(q->getCore()->getCCore())) {
shared_ptr<ConferenceChatMessageEvent> event = static_pointer_cast<ConferenceChatMessageEvent>(
......@@ -71,18 +72,23 @@ void ChatRoomPrivate::sendChatMessage (const shared_ptr<ChatMessage> &chatMessag
void ChatRoomPrivate::sendIsComposingNotification () {
L_Q();
LinphoneImNotifPolicy *policy = linphone_core_get_im_notif_policy(q->getCore()->getCCore());
if (linphone_im_notif_policy_get_send_is_composing(policy)) {
string payload = isComposingHandler->marshal(isComposing);
if (!payload.empty()) {
shared_ptr<ChatMessage> chatMessage = createChatMessage(ChatMessage::Direction::Outgoing);
chatMessage->setToBeStored(false);
Content *content = new Content();
content->setContentType(ContentType::ImIsComposing);
content->setBody(payload);
chatMessage->addContent(*content);
chatMessage->getPrivate()->send();
}
}
if (!linphone_im_notif_policy_get_send_is_composing(policy))
return;
string payload = isComposingHandler->marshal(isComposing);
if (payload.empty())
return;
Content *content = new Content();
content->setContentType(ContentType::ImIsComposing);
content->setBody(payload);
shared_ptr<ChatMessage> chatMessage = createChatMessage(ChatMessage::Direction::Outgoing);
chatMessage->setToBeStored(false);
chatMessage->addContent(*content);
chatMessage->getPrivate()->addSalCustomHeader(PriorityHeader::HeaderName, PriorityHeader::NonUrgent);
chatMessage->getPrivate()->send();
}
// -----------------------------------------------------------------------------
......
/*
* sip-headers.h
* Copyright (C) 2010-2018 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 2
* 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, write to the Free Software
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
*/
#ifndef _L_SIP_HEADERS_H_
#define _L_SIP_HEADERS_H_
#include "linphone/utils/general.h"
// =============================================================================
using namespace std;
LINPHONE_BEGIN_NAMESPACE
namespace PriorityHeader {
constexpr const char HeaderName[] = "Priority";
// Values
constexpr const char NonUrgent[] = "non-urgent";
constexpr const char Urgent[] = "urgent";
constexpr const char Emergency[] = "emergency";
constexpr const char Normal[] = "normal";
}
LINPHONE_END_NAMESPACE
#endif // _L_SIP_HEADERS_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