Merge branch 'dev_imdn_optimization' into dev_refactor_cpp

This commit is contained in:
Ghislain MARY 2018-04-26 11:24:06 +02:00
commit 82c9fc9260
68 changed files with 9909 additions and 555 deletions

View file

@ -604,6 +604,12 @@ static LinphoneChatMessageState chatStatusSal2Linphone(SalMessageDeliveryStatus
}
static void message_delivery_update(SalOp *op, SalMessageDeliveryStatus status) {
auto lc = reinterpret_cast<LinphoneCore *>(op->get_sal()->get_user_pointer());
if (linphone_core_get_global_state(lc) != LinphoneGlobalOn) {
static_cast<SalReferOp *>(op)->reply(SalReasonDeclined);
return;
}
LinphonePrivate::ChatMessage *msg = reinterpret_cast<LinphonePrivate::ChatMessage *>(op->get_user_pointer());
if (!msg)
return; // Do not handle delivery status for isComposing messages.

View file

@ -88,6 +88,7 @@ static void cleanup_dead_vtable_refs(LinphoneCore *lc){
lc->vtable_notify_recursion--;
void linphone_core_notify_global_state_changed(LinphoneCore *lc, LinphoneGlobalState gstate, const char *message) {
L_GET_PRIVATE_FROM_C_OBJECT(lc)->notifyGlobalStateChanged(gstate);
NOTIFY_IF_EXIST(global_state_changed,lc,gstate,message);
cleanup_dead_vtable_refs(lc);
}

View file

@ -22,6 +22,7 @@
#include <ctime>
#include <list>
#include <sstream>
#include <string>
#include <utility>
#include <vector>
@ -107,6 +108,15 @@ namespace Utils {
return str ? str : "";
}
template<typename S, typename T>
LINPHONE_PUBLIC std::string join (const std::vector<T>& elems, const S& delim) {
std::stringstream ss;
auto e = elems.begin();
ss << *e++;
for (; e != elems.end(); ++e)
ss << delim << *e;
return ss.str();
}
LINPHONE_PUBLIC std::string trim (const std::string &str);
template<typename T>

Binary file not shown.

View file

@ -35,6 +35,11 @@ set(LINPHONE_CXX_OBJECTS_PRIVATE_HEADER_FILES
call/remote-conference-call.h
chat/chat-message/chat-message-p.h
chat/chat-message/chat-message.h
chat/chat-message/imdn-message.h
chat/chat-message/imdn-message-p.h
chat/chat-message/is-composing-message.h
chat/chat-message/notification-message.h
chat/chat-message/notification-message-p.h
chat/chat-room/abstract-chat-room-p.h
chat/chat-room/abstract-chat-room.h
chat/chat-room/basic-chat-room-p.h
@ -160,6 +165,9 @@ set(LINPHONE_CXX_OBJECTS_PRIVATE_HEADER_FILES
utils/payload-type-handler.h
variant/variant.h
xml/conference-info.h
xml/imdn.h
xml/is-composing.h
xml/linphone-imdn.h
xml/resource-lists.h
xml/xml.h
)
@ -190,6 +198,9 @@ set(LINPHONE_CXX_OBJECTS_SOURCE_FILES
call/local-conference-call.cpp
call/remote-conference-call.cpp
chat/chat-message/chat-message.cpp
chat/chat-message/imdn-message.cpp
chat/chat-message/is-composing-message.cpp
chat/chat-message/notification-message.cpp
chat/chat-room/abstract-chat-room.cpp
chat/chat-room/basic-chat-room.cpp
chat/chat-room/basic-to-client-group-chat-room.cpp
@ -279,6 +290,9 @@ set(LINPHONE_CXX_OBJECTS_SOURCE_FILES
utils/utils.cpp
variant/variant.cpp
xml/conference-info.cpp
xml/imdn.cpp
xml/is-composing.cpp
xml/linphone-imdn.cpp
xml/resource-lists.cpp
xml/xml.cpp
)

View file

@ -26,8 +26,8 @@
#include "chat/chat-room/chat-room-id.h"
#include "chat/modifier/file-transfer-chat-message-modifier.h"
#include "chat/notification/imdn.h"
#include "content/content-type.h"
#include "content/content.h"
#include "content/content-type.h"
#include "content/file-content.h"
#include "content/file-transfer-content.h"
#include "db/main-db.h"
@ -44,6 +44,7 @@ class ChatMessagePrivate : public ObjectPrivate {
friend class CpimChatMessageModifier;
friend class EncryptionChatMessageModifier;
friend class MultipartChatMessageModifier;
friend class NotificationMessagePrivate;
public:
enum Step {
@ -61,7 +62,7 @@ public:
std::list<ParticipantImdnState> getParticipantsByImdnState (MainDb::ParticipantStateRetrievalFunc func) const;
void setParticipantState (const IdentityAddress &participantAddress, ChatMessage::State newState, time_t stateChangeTime);
void setState (ChatMessage::State newState, bool force = false);
virtual void setState (ChatMessage::State newState, bool force = false);
void setTime (time_t time);
@ -99,6 +100,13 @@ public:
SalOp *getSalOp () const;
void setSalOp (SalOp *op);
bool getDisplayNotificationRequired () const { return displayNotificationRequired; }
bool getNegativeDeliveryNotificationRequired () const { return negativeDeliveryNotificationRequired; }
bool getPositiveDeliveryNotificationRequired () const { return positiveDeliveryNotificationRequired; }
virtual void setDisplayNotificationRequired (bool value) { displayNotificationRequired = value; }
virtual void setNegativeDeliveryNotificationRequired (bool value) { negativeDeliveryNotificationRequired = value; }
virtual void setPositiveDeliveryNotificationRequired (bool value) { positiveDeliveryNotificationRequired = value; }
SalCustomHeader *getSalCustomHeaders () const;
void setSalCustomHeaders (SalCustomHeader *headers);
@ -146,8 +154,6 @@ public:
bool downloadFile ();
void sendImdn (Imdn::Type imdnType, LinphoneReason reason);
void notifyReceiving ();
LinphoneReason receive ();
void send ();
@ -156,11 +162,21 @@ public:
void updateInDb ();
private:
ChatMessagePrivate(const std::shared_ptr<AbstractChatRoom> &cr, ChatMessage::Direction dir);
static bool validStateTransition (ChatMessage::State currentState, ChatMessage::State newState);
public:
mutable MainDbChatMessageKey dbKey;
protected:
bool displayNotificationRequired = true;
bool negativeDeliveryNotificationRequired = true;
bool positiveDeliveryNotificationRequired = true;
bool toBeStored = true;
std::string contentEncoding;
private:
// TODO: Clean attributes.
time_t time = ::ms_time(0); // TODO: Change me in all files.
std::string imdnId;
@ -189,10 +205,6 @@ private:
// TODO: Remove my comment. VARIABLES OK.
// Do not expose.
public:
mutable MainDbChatMessageKey dbKey;
private:
std::weak_ptr<AbstractChatRoom> chatRoom;
ChatRoomId chatRoomId;
IdentityAddress fromAddress;
@ -204,7 +216,6 @@ private:
std::list<Content* > contents;
bool encryptionPrevented = false;
bool toBeStored = true;
mutable bool contentsNotLoadedFromDatabase = false;
L_DECLARE_PUBLIC(ChatMessage);
};

View file

@ -33,17 +33,15 @@
#include "chat/chat-room/real-time-text-chat-room.h"
#include "chat/modifier/cpim-chat-message-modifier.h"
#include "chat/modifier/encryption-chat-message-modifier.h"
#include "chat/modifier/file-transfer-chat-message-modifier.h"
#include "chat/modifier/multipart-chat-message-modifier.h"
#include "chat/notification/imdn.h"
#include "conference/participant.h"
#include "conference/participant-imdn-state.h"
#include "content/file-content.h"
#include "content/content-disposition.h"
#include "content/header/header-param.h"
#include "content/content.h"
#include "core/core.h"
#include "core/core-p.h"
#include "logger/logger.h"
#include "chat/notification/imdn.h"
#include "sip-tools/sip-headers.h"
#include "ortp/b64.h"
@ -181,8 +179,9 @@ void ChatMessagePrivate::setState (ChatMessage::State newState, bool force) {
if (state == ChatMessage::State::FileTransferDone && !hasFileTransferContent()) {
// We wait until the file has been downloaded to send the displayed IMDN
q->sendDisplayNotification();
setState(ChatMessage::State::Displayed);
bool doNotStoreInDb = static_cast<ChatRoomPrivate *>(q->getChatRoom()->getPrivate())->sendDisplayNotification(q->getSharedFromThis());
// Force the state so it is stored directly in DB, but when the IMDN has successfully been delivered
setState(ChatMessage::State::Displayed, doNotStoreInDb);
} else {
updateInDb();
}
@ -456,25 +455,6 @@ void ChatMessagePrivate::setChatRoom (const shared_ptr<AbstractChatRoom> &cr) {
// -----------------------------------------------------------------------------
void ChatMessagePrivate::sendImdn (Imdn::Type imdnType, LinphoneReason reason) {
L_Q();
shared_ptr<ChatMessage> msg = q->getChatRoom()->createChatMessage();
Content *content = new Content();
content->setContentType(ContentType::Imdn);
content->setBody(Imdn::createXml(imdnId, time, imdnType, reason));
msg->addContent(content);
if (reason != LinphoneReasonNone)
msg->getPrivate()->setEncryptionPrevented(true);
msg->setToBeStored(false);
msg->getPrivate()->addSalCustomHeader(PriorityHeader::HeaderName, PriorityHeader::NonUrgent);
msg->getPrivate()->send();
}
static void forceUtf8Content (Content &content) {
// TODO: Deal with other content type in the future.
ContentType contentType = content.getContentType();
@ -516,6 +496,11 @@ void ChatMessagePrivate::notifyReceiving () {
_linphone_chat_room_notify_chat_message_should_be_stored(chatRoom, L_GET_C_BACK_PTR(q->getSharedFromThis()));
if (toBeStored)
storeInDb();
} else {
// For compatibility, when CPIM is not used
positiveDeliveryNotificationRequired = false;
negativeDeliveryNotificationRequired = false;
displayNotificationRequired = false;
}
shared_ptr<ConferenceChatMessageEvent> event = make_shared<ConferenceChatMessageEvent>(
::time(nullptr), q->getSharedFromThis()
@ -524,9 +509,8 @@ void ChatMessagePrivate::notifyReceiving () {
// Legacy
q->getChatRoom()->getPrivate()->notifyChatMessageReceived(q->getSharedFromThis());
if ((getContentType() != ContentType::Imdn) && (getContentType() != ContentType::ImIsComposing)) {
q->sendDeliveryNotification(LinphoneReasonNone);
}
if (getPositiveDeliveryNotificationRequired())
static_cast<ChatRoomPrivate *>(q->getChatRoom()->getPrivate())->sendDeliveryNotification(q->getSharedFromThis());
}
LinphoneReason ChatMessagePrivate::receive () {
@ -550,7 +534,12 @@ LinphoneReason ChatMessagePrivate::receive () {
/* Unable to decrypt message */
chatRoom->getPrivate()->notifyUndecryptableChatMessageReceived(q->getSharedFromThis());
reason = linphone_error_code_to_reason(errorCode);
q->sendDeliveryNotification(reason);
if (getNegativeDeliveryNotificationRequired()) {
static_cast<ChatRoomPrivate *>(q->getChatRoom()->getPrivate())->sendDeliveryErrorNotification(
q->getSharedFromThis(),
reason
);
}
return reason;
} else if (result == ChatMessageModifier::Result::Suspended) {
currentRecvStep |= ChatMessagePrivate::Step::Encryption;
@ -634,7 +623,12 @@ LinphoneReason ChatMessagePrivate::receive () {
if (errorCode > 0) {
reason = linphone_error_code_to_reason(errorCode);
q->sendDeliveryNotification(reason);
if (getNegativeDeliveryNotificationRequired()) {
static_cast<ChatRoomPrivate *>(q->getChatRoom()->getPrivate())->sendDeliveryErrorNotification(
q->getSharedFromThis(),
reason
);
}
return reason;
}
@ -773,13 +767,18 @@ void ChatMessagePrivate::send () {
auto msgOp = dynamic_cast<SalMessageOpInterface *>(op);
if (!externalBodyUrl.empty()) {
char *content_type = ms_strdup_printf("message/external-body;access-type=URL;URL=\"%s\"", externalBodyUrl.c_str());
msgOp->send_message(content_type, NULL);
ms_free(content_type);
} else if (internalContent.getContentType().isValid()) {
msgOp->send_message(internalContent.getContentType().asString().c_str(), internalContent.getBodyAsUtf8String().c_str());
Content content;
ContentType contentType(ContentType::ExternalBody);
contentType.addParameter("access-type", "URL");
contentType.addParameter("URL", "\"" + externalBodyUrl + "\"");
content.setContentType(contentType);
msgOp->sendMessage(content);
} else {
msgOp->send_message(ContentType::PlainText.asString().c_str(), internalContent.getBodyAsUtf8String().c_str());
if (!internalContent.getContentType().isValid())
internalContent.setContentType(ContentType::PlainText);
if (!contentEncoding.empty())
internalContent.setContentEncoding(contentEncoding);
msgOp->sendMessage(internalContent);
}
// Restore FileContents and remove FileTransferContents
@ -892,7 +891,10 @@ bool ChatMessagePrivate::validStateTransition (ChatMessage::State currentState,
// -----------------------------------------------------------------------------
ChatMessage::ChatMessage (const shared_ptr<AbstractChatRoom> &chatRoom, ChatMessage::Direction direction) :
Object(*new ChatMessagePrivate(chatRoom,direction)), CoreAccessor(chatRoom->getCore()) {
Object(*new ChatMessagePrivate(chatRoom, direction)), CoreAccessor(chatRoom->getCore()) {
}
ChatMessage::ChatMessage (ChatMessagePrivate &p) : Object(p), CoreAccessor(p.getPublic()->getChatRoom()->getCore()) {
}
ChatMessage::~ChatMessage () {
@ -1115,22 +1117,6 @@ void ChatMessage::send () {
getChatRoom()->getPrivate()->sendChatMessage(getSharedFromThis());
}
void ChatMessage::sendDeliveryNotification (LinphoneReason reason) {
L_D();
LinphoneImNotifPolicy *policy = linphone_core_get_im_notif_policy(getCore()->getCCore());
if (linphone_im_notif_policy_get_send_imdn_delivered(policy))
d->sendImdn(Imdn::Type::Delivery, reason);
}
void ChatMessage::sendDisplayNotification () {
L_D();
LinphoneImNotifPolicy *policy = linphone_core_get_im_notif_policy(getCore()->getCCore());
if (linphone_im_notif_policy_get_send_imdn_displayed(policy))
d->sendImdn(Imdn::Type::Display, LinphoneReasonNone);
}
bool ChatMessage::downloadFile(FileTransferContent *fileTransferContent) {
L_D();
return d->fileTransferChatMessageModifier.downloadFile(getSharedFromThis(), fileTransferContent);

View file

@ -50,6 +50,7 @@ class LINPHONE_PUBLIC ChatMessage : public Object, public CoreAccessor {
friend class CpimChatMessageModifier;
friend class FileTransferChatMessageModifier;
friend class Imdn;
friend class ImdnMessagePrivate;
friend class MainDb;
friend class MainDbPrivate;
friend class RealTimeTextChatRoomPrivate;
@ -61,13 +62,11 @@ public:
L_DECLARE_ENUM(State, L_ENUM_VALUES_CHAT_MESSAGE_STATE);
L_DECLARE_ENUM(Direction, L_ENUM_VALUES_CHAT_MESSAGE_DIRECTION);
~ChatMessage ();
virtual ~ChatMessage ();
// ----- TODO: Remove me.
void cancelFileTransfer ();
int putCharacter (uint32_t character);
void sendDeliveryNotification (LinphoneReason reason);
void sendDisplayNotification ();
void setIsSecured (bool isSecured);
// ----- TODO: Remove me.
@ -93,7 +92,7 @@ public:
bool isReadOnly () const;
bool getToBeStored () const;
void setToBeStored (bool value);
virtual void setToBeStored (bool value);
std::list<ParticipantImdnState> getParticipantsThatHaveDisplayed () const;
std::list<ParticipantImdnState> getParticipantsThatHaveReceived () const;
@ -114,6 +113,9 @@ public:
bool downloadFile (FileTransferContent *content);
bool isFileTransferInProgress();
protected:
explicit ChatMessage (ChatMessagePrivate &p);
private:
ChatMessage (const std::shared_ptr<AbstractChatRoom> &chatRoom, ChatMessage::Direction direction);

View file

@ -0,0 +1,44 @@
/*
* imdn-message-p.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_IMDN_MESSAGE_P_H_
#define _L_IMDN_MESSAGE_P_H_
#include "chat/chat-message/imdn-message.h"
#include "chat/chat-message/notification-message-p.h"
// =============================================================================
LINPHONE_BEGIN_NAMESPACE
class ImdnMessagePrivate : public NotificationMessagePrivate {
private:
ImdnMessagePrivate (const ImdnMessage::Context &context)
: NotificationMessagePrivate(context.chatRoom, ChatMessage::Direction::Outgoing), context(context) {}
void setState (ChatMessage::State newState, bool force = false) override;
ImdnMessage::Context context;
L_DECLARE_PUBLIC(ImdnMessage);
};
LINPHONE_END_NAMESPACE
#endif // ifndef _L_IMDN_MESSAGE_P_H_

View file

@ -0,0 +1,93 @@
/*
* imdn-message.cpp
* 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.
*/
#include "chat/chat-message/imdn-message-p.h"
#include "chat/chat-room/chat-room-p.h"
#include "content/content-disposition.h"
#include "logger/logger.h"
#include "sip-tools/sip-headers.h"
// =============================================================================
using namespace std;
LINPHONE_BEGIN_NAMESPACE
// -----------------------------------------------------------------------------
void ImdnMessagePrivate::setState (ChatMessage::State newState, bool force) {
L_Q();
if (newState == ChatMessage::State::Delivered) {
for (const auto &message : context.deliveredMessages)
message->getPrivate()->updateInDb();
for (const auto &message : context.displayedMessages)
message->getPrivate()->updateInDb();
static_pointer_cast<ChatRoom>(context.chatRoom)->getPrivate()->getImdnHandler()->onImdnMessageDelivered(q->getSharedFromThis());
} else if (newState == ChatMessage::State::NotDelivered) {
// TODO: Maybe we should retry sending the IMDN message if we get an error here
}
}
// -----------------------------------------------------------------------------
ImdnMessage::ImdnMessage (
const shared_ptr<AbstractChatRoom> &chatRoom,
const list<shared_ptr<ChatMessage>> &deliveredMessages,
const list<shared_ptr<ChatMessage>> &displayedMessages
) : ImdnMessage(Context(chatRoom, deliveredMessages, displayedMessages)) {}
ImdnMessage::ImdnMessage (
const shared_ptr<AbstractChatRoom> &chatRoom,
const list<Imdn::MessageReason> &nonDeliveredMessages
) : ImdnMessage(Context(chatRoom, nonDeliveredMessages)) {}
ImdnMessage::ImdnMessage (const std::shared_ptr<ImdnMessage> &message) : ImdnMessage(message->getPrivate()->context) {}
ImdnMessage::ImdnMessage (const Context &context) : NotificationMessage(*new ImdnMessagePrivate(context)) {
L_D();
for (const auto &message : d->context.deliveredMessages) {
Content *content = new Content();
content->setContentDisposition(ContentDisposition::Notification);
content->setContentType(ContentType::Imdn);
content->setBody(Imdn::createXml(message->getImdnMessageId(), message->getTime(), Imdn::Type::Delivery, LinphoneReasonNone));
addContent(content);
}
for (const auto &message : d->context.displayedMessages) {
Content *content = new Content();
content->setContentDisposition(ContentDisposition::Notification);
content->setContentType(ContentType::Imdn);
content->setBody(Imdn::createXml(message->getImdnMessageId(), message->getTime(), Imdn::Type::Display, LinphoneReasonNone));
addContent(content);
}
for (const auto &mr : d->context.nonDeliveredMessages) {
Content *content = new Content();
content->setContentDisposition(ContentDisposition::Notification);
content->setContentType(ContentType::Imdn);
content->setBody(Imdn::createXml(mr.message->getImdnMessageId(), mr.message->getTime(), Imdn::Type::Delivery, mr.reason));
addContent(content);
}
d->addSalCustomHeader(PriorityHeader::HeaderName, PriorityHeader::NonUrgent);
if (!d->context.nonDeliveredMessages.empty())
d->setEncryptionPrevented(true);
}
LINPHONE_END_NAMESPACE

View file

@ -0,0 +1,76 @@
/*
* imdn-message.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_IMDN_MESSAGE_H_
#define _L_IMDN_MESSAGE_H_
#include "chat/chat-message/notification-message.h"
#include "chat/notification/imdn.h"
// =============================================================================
LINPHONE_BEGIN_NAMESPACE
class ImdnMessagePrivate;
class LINPHONE_PUBLIC ImdnMessage : public NotificationMessage {
public:
friend class ChatRoomPrivate;
L_OVERRIDE_SHARED_FROM_THIS(ImdnMessage);
virtual ~ImdnMessage () = default;
private:
struct Context {
Context (
const std::shared_ptr<AbstractChatRoom> &chatRoom,
const std::list<std::shared_ptr<ChatMessage>> &deliveredMessages,
const std::list<std::shared_ptr<ChatMessage>> &displayedMessages
) : chatRoom(chatRoom), deliveredMessages(deliveredMessages), displayedMessages(displayedMessages) {}
Context (
const std::shared_ptr<AbstractChatRoom> &chatRoom,
const std::list<Imdn::MessageReason> &nonDeliveredMessages
) : chatRoom(chatRoom), nonDeliveredMessages(nonDeliveredMessages) {}
std::shared_ptr<AbstractChatRoom> chatRoom;
std::list<std::shared_ptr<ChatMessage>> deliveredMessages;
std::list<std::shared_ptr<ChatMessage>> displayedMessages;
std::list<Imdn::MessageReason> nonDeliveredMessages;
};
ImdnMessage (
const std::shared_ptr<AbstractChatRoom> &chatRoom,
const std::list<std::shared_ptr<ChatMessage>> &deliveredMessages,
const std::list<std::shared_ptr<ChatMessage>> &displayedMessages
);
ImdnMessage (
const std::shared_ptr<AbstractChatRoom> &chatRoom,
const std::list<Imdn::MessageReason> &nonDeliveredMessages
);
ImdnMessage (const std::shared_ptr<ImdnMessage> &message);
ImdnMessage (const Context &context);
L_DECLARE_PRIVATE(ImdnMessage);
L_DISABLE_COPY(ImdnMessage);
};
LINPHONE_END_NAMESPACE
#endif // ifndef _L_IMDN_MESSAGE_H_

View file

@ -0,0 +1,46 @@
/*
* is-composing-message.cpp
* 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.
*/
#include "chat/chat-message/notification-message-p.h"
#include "chat/chat-message/is-composing-message.h"
#include "sip-tools/sip-headers.h"
// =============================================================================
using namespace std;
LINPHONE_BEGIN_NAMESPACE
// -----------------------------------------------------------------------------
IsComposingMessage::IsComposingMessage (
const shared_ptr<AbstractChatRoom> &chatRoom,
IsComposing &isComposingHandler,
bool isComposing
) : NotificationMessage(*new NotificationMessagePrivate(chatRoom, ChatMessage::Direction::Outgoing)) {
L_D();
Content *content = new Content();
content->setContentType(ContentType::ImIsComposing);
content->setBody(isComposingHandler.createXml(isComposing));
addContent(content);
d->addSalCustomHeader(PriorityHeader::HeaderName, PriorityHeader::NonUrgent);
d->addSalCustomHeader("Expires", "0");
}
LINPHONE_END_NAMESPACE

View file

@ -0,0 +1,51 @@
/*
* is-composing-message.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_IS_COMPOSING_MESSAGE_H_
#define _L_IS_COMPOSING_MESSAGE_H_
#include "chat/chat-message/notification-message.h"
#include "chat/notification/is-composing.h"
// =============================================================================
LINPHONE_BEGIN_NAMESPACE
class LINPHONE_PUBLIC IsComposingMessage : public NotificationMessage {
public:
friend class ChatRoomPrivate;
L_OVERRIDE_SHARED_FROM_THIS(IsComposingMessage);
virtual ~IsComposingMessage () = default;
private:
IsComposingMessage (
const std::shared_ptr<AbstractChatRoom> &chatRoom,
IsComposing &isComposingHandler,
bool isComposing
);
L_DECLARE_PRIVATE(NotificationMessage);
L_DISABLE_COPY(IsComposingMessage);
};
LINPHONE_END_NAMESPACE
#endif // ifndef _L_IS_COMPOSING_MESSAGE_H_

View file

@ -0,0 +1,50 @@
/*
* notification-message-p.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_NOTIFICATION_MESSAGE_P_H_
#define _L_NOTIFICATION_MESSAGE_P_H_
#include "chat/chat-message/chat-message-p.h"
#include "chat/chat-message/notification-message.h"
// =============================================================================
LINPHONE_BEGIN_NAMESPACE
class NotificationMessagePrivate : public ChatMessagePrivate {
friend class ImdnMessage;
friend class IsComposingMessage;
protected:
NotificationMessagePrivate(const std::shared_ptr<AbstractChatRoom> &cr, ChatMessage::Direction dir)
: ChatMessagePrivate(cr, dir) {}
void setState (ChatMessage::State newState, bool force = false) override {};
private:
void setDisplayNotificationRequired (bool value) override {}
void setNegativeDeliveryNotificationRequired (bool value) override {}
void setPositiveDeliveryNotificationRequired (bool value) override {}
L_DECLARE_PUBLIC(NotificationMessage);
};
LINPHONE_END_NAMESPACE
#endif // ifndef _L_NOTIFICATION_MESSAGE_P_H_

View file

@ -0,0 +1,46 @@
/*
* notification-message.cpp
* 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.
*/
#include "chat/chat-message/notification-message-p.h"
// =============================================================================
using namespace std;
LINPHONE_BEGIN_NAMESPACE
// -----------------------------------------------------------------------------
NotificationMessage::NotificationMessage (const shared_ptr<AbstractChatRoom> &chatRoom, ChatMessage::Direction direction) :
NotificationMessage(*new NotificationMessagePrivate(chatRoom, direction)) {
}
NotificationMessage::NotificationMessage (NotificationMessagePrivate &p) : ChatMessage(p) {
L_D();
d->displayNotificationRequired = false;
d->negativeDeliveryNotificationRequired = false;
d->positiveDeliveryNotificationRequired = false;
d->toBeStored = false;
d->contentEncoding = "deflate";
}
void NotificationMessage::setToBeStored (bool value) {
}
LINPHONE_END_NAMESPACE

View file

@ -0,0 +1,53 @@
/*
* notification-message.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_NOTIFICATION_MESSAGE_H_
#define _L_NOTIFICATION_MESSAGE_H_
#include "chat/chat-message/chat-message.h"
// =============================================================================
LINPHONE_BEGIN_NAMESPACE
class NotificationMessagePrivate;
class LINPHONE_PUBLIC NotificationMessage : public ChatMessage {
public:
friend class ChatRoomPrivate;
L_OVERRIDE_SHARED_FROM_THIS(NotificationMessage);
virtual ~NotificationMessage () = default;
void setToBeStored (bool value) override;
protected:
explicit NotificationMessage (NotificationMessagePrivate &p);
private:
NotificationMessage (const std::shared_ptr<AbstractChatRoom> &chatRoom, ChatMessage::Direction direction);
L_DECLARE_PRIVATE(NotificationMessage);
L_DISABLE_COPY(NotificationMessage);
};
LINPHONE_END_NAMESPACE
#endif // ifndef _L_NOTIFICATION_MESSAGE_H_

View file

@ -47,6 +47,8 @@ public:
virtual void addTransientEvent (const std::shared_ptr<EventLog> &eventLog) = 0;
virtual void removeTransientEvent (const std::shared_ptr<EventLog> &eventLog) = 0;
virtual void sendDeliveryNotifications () = 0;
virtual void notifyChatMessageReceived (const std::shared_ptr<ChatMessage> &chatMessage) = 0;
virtual void notifyUndecryptableChatMessageReceived (const std::shared_ptr<ChatMessage> &chatMessage) = 0;

View file

@ -25,12 +25,16 @@
#include "abstract-chat-room-p.h"
#include "chat-room-id.h"
#include "chat-room.h"
#include "chat/notification/imdn.h"
#include "chat/notification/is-composing.h"
// =============================================================================
LINPHONE_BEGIN_NAMESPACE
class ImdnMessage;
class IsComposingMessage;
class ChatRoomPrivate : public AbstractChatRoomPrivate, public IsComposingListener {
public:
inline void setProxyChatRoom (AbstractChatRoom *value) { proxyChatRoom = value; }
@ -54,8 +58,20 @@ public:
void removeTransientEvent (const std::shared_ptr<EventLog> &eventLog) override;
std::shared_ptr<ChatMessage> createChatMessage (ChatMessage::Direction direction);
std::shared_ptr<ImdnMessage> createImdnMessage (
const std::list<std::shared_ptr<ChatMessage>> &deliveredMessages,
const std::list<std::shared_ptr<ChatMessage>> &displayedMessages
);
std::shared_ptr<ImdnMessage> createImdnMessage (const std::list<Imdn::MessageReason> &nonDeliveredMessages);
std::shared_ptr<ImdnMessage> createImdnMessage (const std::shared_ptr<ImdnMessage> &message);
std::shared_ptr<IsComposingMessage> createIsComposingMessage ();
std::list<std::shared_ptr<ChatMessage>> findChatMessages (const std::string &messageId) const;
void sendDeliveryErrorNotification (const std::shared_ptr<ChatMessage> &message, LinphoneReason reason);
void sendDeliveryNotification (const std::shared_ptr<ChatMessage> &message);
void sendDeliveryNotifications () override;
bool sendDisplayNotification (const std::shared_ptr<ChatMessage> &message);
void notifyChatMessageReceived (const std::shared_ptr<ChatMessage> &chatMessage) override;
void notifyIsComposingReceived (const Address &remoteAddress, bool isComposing);
void notifyStateChanged ();
@ -69,6 +85,8 @@ public:
void onIsComposingStateChanged (bool isComposing) override;
void onIsRemoteComposingStateChanged (const Address &remoteAddress, bool isComposing) override;
Imdn *getImdnHandler () const { return imdnHandler.get(); }
LinphoneChatRoom *getCChatRoom () const;
std::list<IdentityAddress> remoteIsComposing;
@ -84,6 +102,7 @@ private:
time_t creationTime = std::time(nullptr);
time_t lastUpdateTime = std::time(nullptr);
std::unique_ptr<Imdn> imdnHandler;
std::unique_ptr<IsComposing> isComposingHandler;
bool isComposing = false;

View file

@ -23,9 +23,11 @@
#include "c-wrapper/c-wrapper.h"
#include "chat/chat-message/chat-message-p.h"
#include "chat/chat-message/imdn-message.h"
#include "chat/chat-message/is-composing-message.h"
#include "chat/chat-message/notification-message-p.h"
#include "chat/chat-room/chat-room-p.h"
#include "core/core-p.h"
#include "sip-tools/sip-headers.h"
#include "logger/logger.h"
// =============================================================================
@ -76,21 +78,8 @@ void ChatRoomPrivate::sendIsComposingNotification () {
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()->addSalCustomHeader("Expires", "0");
chatMessage->getPrivate()->send();
auto isComposingMsg = createIsComposingMessage();
isComposingMsg->getPrivate()->send();
}
// -----------------------------------------------------------------------------
@ -121,6 +110,28 @@ shared_ptr<ChatMessage> ChatRoomPrivate::createChatMessage (ChatMessage::Directi
return shared_ptr<ChatMessage>(new ChatMessage(q->getSharedFromThis(), direction));
}
shared_ptr<ImdnMessage> ChatRoomPrivate::createImdnMessage (
const list<shared_ptr<ChatMessage>> &deliveredMessages,
const list<shared_ptr<ChatMessage>> &displayedMessages
) {
L_Q();
return shared_ptr<ImdnMessage>(new ImdnMessage(q->getSharedFromThis(), deliveredMessages, displayedMessages));
}
shared_ptr<ImdnMessage> ChatRoomPrivate::createImdnMessage (const list<Imdn::MessageReason> &nonDeliveredMessages) {
L_Q();
return shared_ptr<ImdnMessage>(new ImdnMessage(q->getSharedFromThis(), nonDeliveredMessages));
}
shared_ptr<ImdnMessage> ChatRoomPrivate::createImdnMessage (const shared_ptr<ImdnMessage> &message) {
return shared_ptr<ImdnMessage>(new ImdnMessage(message));
}
shared_ptr<IsComposingMessage> ChatRoomPrivate::createIsComposingMessage () {
L_Q();
return shared_ptr<IsComposingMessage>(new IsComposingMessage(q->getSharedFromThis(), *isComposingHandler.get(), isComposing));
}
list<shared_ptr<ChatMessage>> ChatRoomPrivate::findChatMessages (const string &messageId) const {
L_Q();
return q->getCore()->getPrivate()->mainDb->findChatMessages(q->getChatRoomId(), messageId);
@ -128,6 +139,42 @@ list<shared_ptr<ChatMessage>> ChatRoomPrivate::findChatMessages (const string &m
// -----------------------------------------------------------------------------
void ChatRoomPrivate::sendDeliveryErrorNotification (const shared_ptr<ChatMessage> &message, LinphoneReason reason) {
L_Q();
LinphoneImNotifPolicy *policy = linphone_core_get_im_notif_policy(q->getCore()->getCCore());
if (linphone_im_notif_policy_get_send_imdn_delivered(policy))
imdnHandler->notifyDeliveryError(message, reason);
}
void ChatRoomPrivate::sendDeliveryNotification (const shared_ptr<ChatMessage> &message) {
L_Q();
LinphoneImNotifPolicy *policy = linphone_core_get_im_notif_policy(q->getCore()->getCCore());
if (linphone_im_notif_policy_get_send_imdn_delivered(policy))
imdnHandler->notifyDelivery(message);
}
void ChatRoomPrivate::sendDeliveryNotifications () {
L_Q();
LinphoneImNotifPolicy *policy = linphone_core_get_im_notif_policy(q->getCore()->getCCore());
if (linphone_im_notif_policy_get_send_imdn_delivered(policy)) {
auto messages = q->getCore()->getPrivate()->mainDb->findChatMessagesToBeNotifiedAsDelivered(q->getChatRoomId());
for (const auto message : messages)
imdnHandler->notifyDelivery(message);
}
}
bool ChatRoomPrivate::sendDisplayNotification (const shared_ptr<ChatMessage> &message) {
L_Q();
LinphoneImNotifPolicy *policy = linphone_core_get_im_notif_policy(q->getCore()->getCCore());
if (linphone_im_notif_policy_get_send_imdn_displayed(policy)) {
imdnHandler->notifyDisplay(message);
return true;
}
return false;
}
// -----------------------------------------------------------------------------
void ChatRoomPrivate::notifyChatMessageReceived (const shared_ptr<ChatMessage> &chatMessage) {
L_Q();
LinphoneChatRoom *cr = getCChatRoom();
@ -214,26 +261,21 @@ LinphoneReason ChatRoomPrivate::onSipMessageReceived (SalOp *op, const SalMessag
reason = msg->getPrivate()->receive();
if (reason == LinphoneReasonNotAcceptable || reason == LinphoneReasonUnknown) {
/* Return LinphoneReasonNone to avoid flexisip resending us a message we can't decrypt */
reason = LinphoneReasonNone;
goto end;
// Return LinphoneReasonNone to avoid flexisip resending us a message we can't decrypt
return LinphoneReasonNone;
}
if (msg->getPrivate()->getContentType() == ContentType::ImIsComposing) {
onIsComposingReceived(msg->getFromAddress(), msg->getPrivate()->getText());
if (lp_config_get_int(linphone_core_get_config(cCore), "sip", "deliver_imdn", 0) != 1) {
goto end;
}
if (lp_config_get_int(linphone_core_get_config(cCore), "sip", "deliver_imdn", 0) != 1)
return reason;
} else if (msg->getPrivate()->getContentType() == ContentType::Imdn) {
onImdnReceived(msg);
if (lp_config_get_int(linphone_core_get_config(cCore), "sip", "deliver_imdn", 0) != 1) {
goto end;
}
if (lp_config_get_int(linphone_core_get_config(cCore), "sip", "deliver_imdn", 0) != 1)
return reason;
}
onChatMessageReceived(msg);
end:
return reason;
}
@ -286,9 +328,16 @@ ChatRoom::ChatRoom (ChatRoomPrivate &p, const shared_ptr<Core> &core, const Chat
L_D();
d->chatRoomId = chatRoomId;
d->imdnHandler.reset(new Imdn(this));
d->isComposingHandler.reset(new IsComposing(core->getCCore(), d));
}
ChatRoom::~ChatRoom () {
L_D();
d->imdnHandler.reset();
}
// -----------------------------------------------------------------------------
const ChatRoomId &ChatRoom::getChatRoomId () const {
@ -377,7 +426,11 @@ int ChatRoom::getChatMessageCount () const {
}
int ChatRoom::getUnreadChatMessageCount () const {
return getCore()->getPrivate()->mainDb->getUnreadChatMessageCount(getChatRoomId());
L_D();
int dbUnreadCount = getCore()->getPrivate()->mainDb->getUnreadChatMessageCount(getChatRoomId());
int notifiedCount = d->imdnHandler->getDisplayNotificationCount();
L_ASSERT(dbUnreadCount >= notifiedCount);
return dbUnreadCount - notifiedCount;
}
// -----------------------------------------------------------------------------
@ -443,16 +496,21 @@ shared_ptr<ChatMessage> ChatRoom::findChatMessage (const string &messageId, Chat
void ChatRoom::markAsRead () {
L_D();
bool globallyMarkAsReadInDb = true;
CorePrivate *dCore = getCore()->getPrivate();
for (auto &chatMessage : dCore->mainDb->getUnreadChatMessages(d->chatRoomId)) {
// Do not send display notification for file transfer until it has been downloaded (it won't have a file transfer content anymore)
if (!chatMessage->getPrivate()->hasFileTransferContent()) {
chatMessage->sendDisplayNotification();
chatMessage->getPrivate()->setState(ChatMessage::State::Displayed, true); // True will ensure the setState won't update the database so it will be done below by the markChatMessagesAsRead
bool doNotStoreInDb = d->sendDisplayNotification(chatMessage);
// Force the state so it is stored directly in DB, but when the IMDN has successfully been delivered
chatMessage->getPrivate()->setState(ChatMessage::State::Displayed, doNotStoreInDb);
if (doNotStoreInDb)
globallyMarkAsReadInDb = false;
}
}
dCore->mainDb->markChatMessagesAsRead(d->chatRoomId);
if (globallyMarkAsReadInDb)
dCore->mainDb->markChatMessagesAsRead(d->chatRoomId);
}
LINPHONE_END_NAMESPACE

View file

@ -31,10 +31,14 @@ class ChatRoomPrivate;
class LINPHONE_PUBLIC ChatRoom : public AbstractChatRoom {
public:
friend class ChatMessagePrivate;
friend class Imdn;
friend class ImdnMessagePrivate;
friend class ProxyChatRoomPrivate;
L_OVERRIDE_SHARED_FROM_THIS(ChatRoom);
~ChatRoom ();
const ChatRoomId &getChatRoomId () const override;
const IdentityAddress &getPeerAddress () const override;

View file

@ -57,6 +57,10 @@ public:
chatRoom->getPrivate()->removeTransientEvent(eventLog);
}
inline void sendDeliveryNotifications () override {
chatRoom->getPrivate()->sendDeliveryNotifications();
}
inline void notifyChatMessageReceived (const std::shared_ptr<ChatMessage> &chatMessage) override {
chatRoom->getPrivate()->notifyChatMessageReceived(chatMessage);
}

View file

@ -69,7 +69,7 @@ public:
private:
struct Message {
Message (const std::string &from, const ContentType &contentType, const std::string &text, const SalCustomHeader *salCustomHeaders)
: fromAddr(from)
: fromAddr(from)
{
content.setContentType(contentType);
if (!text.empty())

View file

@ -49,7 +49,6 @@ MAKE_CORE_HEADER_IMPL(From);
MAKE_CORE_HEADER_IMPL(To);
MAKE_CORE_HEADER_IMPL(Cc);
MAKE_CORE_HEADER_IMPL(DateTime);
MAKE_CORE_HEADER_IMPL(MessageId);
MAKE_CORE_HEADER_IMPL(Ns);
MAKE_CORE_HEADER_IMPL(Require);

View file

@ -72,7 +72,6 @@ namespace Cpim {
MAKE_CORE_HEADER(To, "To");
MAKE_CORE_HEADER(Cc, "cc");
MAKE_CORE_HEADER(DateTime, "DateTime");
MAKE_CORE_HEADER(MessageId, "Message-ID");
MAKE_CORE_HEADER(Ns, "NS");
MAKE_CORE_HEADER(Require, "Require");

View file

@ -137,7 +137,6 @@ namespace Cpim {
{ "To", &HeaderNode::createCoreHeader<ToHeader> },
{ "cc", &HeaderNode::createCoreHeader<CcHeader> },
{ "DateTime", &HeaderNode::createCoreHeader<DateTimeHeader> },
{ "Message-ID", &HeaderNode::createCoreHeader<MessageIdHeader> },
{ "Subject", &HeaderNode::createCoreHeader<SubjectHeader> },
{ "NS", &HeaderNode::createCoreHeader<NsHeader> },
{ "Require", &HeaderNode::createCoreHeader<RequireHeader> }
@ -420,12 +419,6 @@ bool Cpim::Parser::coreHeaderIsValid<Cpim::DateTimeHeader> (const string &header
return true;
}
template<>
bool Cpim::Parser::coreHeaderIsValid<Cpim::MessageIdHeader> (const string &headerValue) const {
L_D();
return LinphonePrivate::coreHeaderIsValid(d->grammar, "Message-ID", headerValue);
}
template<>
bool Cpim::Parser::coreHeaderIsValid<Cpim::SubjectHeader> (const string &headerValue) const {
L_D();

View file

@ -70,9 +70,6 @@ namespace Cpim {
template<>
bool Parser::coreHeaderIsValid<DateTimeHeader>(const std::string &headerValue) const;
template<>
bool Parser::coreHeaderIsValid<MessageIdHeader>(const std::string &headerValue) const;
template<>
bool Parser::coreHeaderIsValid<SubjectHeader>(const std::string &headerValue) const;

View file

@ -25,8 +25,6 @@ To-header-value = [ Formal-name ] "<" URI ">"
DateTime-header = %d68.97.116.101.84.105.109.101 ": " DateTime-header-value
DateTime-header-value = date-time
Message-ID-header = %d77.101.115.115.97.103.101.45.73.68 ": " Token
cc-header = %d99.99 ": " cc-header-value
cc-header-value = [ Formal-name ] "<" URI ">"

View file

@ -17,11 +17,14 @@
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
*/
#include "linphone/utils/utils.h"
#include "address/address.h"
#include "chat/chat-message/chat-message-p.h"
#include "chat/cpim/cpim.h"
#include "content/content-type.h"
#include "content/content.h"
#include "content/content-disposition.h"
#include "content/content-type.h"
#include "logger/logger.h"
#include "cpim-chat-message-modifier.h"
@ -41,12 +44,36 @@ ChatMessageModifier::Result CpimChatMessageModifier::encode (const shared_ptr<Ch
Cpim::ToHeader cpimToHeader;
cpimToHeader.setValue(cpimAddressAsString(message->getToAddress()));
cpimMessage.addMessageHeader(cpimToHeader);
char token[13];
belle_sip_random_token(token, sizeof(token));
Cpim::MessageIdHeader cpimMessageIdHeader;
cpimMessageIdHeader.setValue(token);
cpimMessage.addMessageHeader(cpimMessageIdHeader);
message->getPrivate()->setImdnMessageId(token);
if (message->getPrivate()->getPositiveDeliveryNotificationRequired()
|| message->getPrivate()->getNegativeDeliveryNotificationRequired()
|| message->getPrivate()->getDisplayNotificationRequired()
) {
const string imdnNamespace = "imdn";
Cpim::NsHeader cpimNsHeader;
cpimNsHeader.setValue(imdnNamespace + " <urn:ietf:params:imdn>");
cpimMessage.addMessageHeader(cpimNsHeader);
char token[13];
belle_sip_random_token(token, sizeof(token));
Cpim::GenericHeader cpimMessageIdHeader;
cpimMessageIdHeader.setName("Message-ID"); // TODO: Replace by imdnNamespace + ".Message-ID");
cpimMessageIdHeader.setValue(token);
cpimMessage.addMessageHeader(cpimMessageIdHeader);
message->getPrivate()->setImdnMessageId(token);
Cpim::GenericHeader dispositionNotificationHeader;
dispositionNotificationHeader.setName(imdnNamespace + ".Disposition-Notification");
vector<string> dispositionNotificationValues;
if (message->getPrivate()->getPositiveDeliveryNotificationRequired())
dispositionNotificationValues.emplace_back("positive-delivery");
if (message->getPrivate()->getNegativeDeliveryNotificationRequired())
dispositionNotificationValues.emplace_back("negative-delivery");
if (message->getPrivate()->getDisplayNotificationRequired())
dispositionNotificationValues.emplace_back("display");
dispositionNotificationHeader.setValue(Utils::join(dispositionNotificationValues, ", "));
cpimMessage.addMessageHeader(dispositionNotificationHeader);
}
const Content *content;
if (!message->getInternalContent().isEmpty()) {
@ -59,12 +86,21 @@ ChatMessageModifier::Result CpimChatMessageModifier::encode (const shared_ptr<Ch
content = message->getContents().front();
}
const string contentBody = content->getBodyAsString();
if (content->getContentDisposition().isValid()) {
Cpim::GenericHeader contentDispositionHeader;
contentDispositionHeader.setName("Content-Disposition");
contentDispositionHeader.setValue(content->getContentDisposition().asString());
cpimMessage.addContentHeader(contentDispositionHeader);
}
Cpim::GenericHeader contentTypeHeader;
contentTypeHeader.setName("Content-Type");
contentTypeHeader.setValue(content->getContentType().asString());
cpimMessage.addContentHeader(contentTypeHeader);
const string contentBody = content->getBodyAsString();
Cpim::GenericHeader contentLengthHeader;
contentLengthHeader.setName("Content-Length");
contentLengthHeader.setValue(to_string(contentBody.size()));
cpimMessage.addContentHeader(contentLengthHeader);
cpimMessage.setContent(contentBody);
Content newContent;
@ -100,10 +136,11 @@ ChatMessageModifier::Result CpimChatMessageModifier::decode (const shared_ptr<Ch
Cpim::Message::HeaderList l = cpimMessage->getContentHeaders();
if (l) {
for (const auto &header : *l.get()) {
if (header->getName() == "Content-Type") {
if (header->getName() == "Content-Disposition") {
newContent.setContentDisposition(ContentDisposition(header->getValue()));
} else if (header->getName() == "Content-Type") {
contentTypeFound = true;
newContent.setContentType(ContentType(header->getValue()));
break;
}
}
}
@ -114,17 +151,47 @@ ChatMessageModifier::Result CpimChatMessageModifier::decode (const shared_ptr<Ch
}
newContent.setBody(cpimMessage->getContent());
message->getPrivate()->setPositiveDeliveryNotificationRequired(false);
message->getPrivate()->setNegativeDeliveryNotificationRequired(false);
message->getPrivate()->setDisplayNotificationRequired(false);
Address cpimFromAddress;
Address cpimToAddress;
l = cpimMessage->getMessageHeaders();
if (l) {
string imdnNamespace = "";
for (const auto &header : *l.get()) {
if (header->getName() == "NS") {
string val = header->getValue();
size_t startPos = 0;
startPos = val.find("<", startPos);
if (startPos == string::npos)
break;
size_t endPos = 0;
endPos = val.find(">", startPos);
if (endPos == string::npos)
break;
if (val.substr(startPos, endPos) == "<urn:ietf:params:imdn>")
imdnNamespace = Utils::trim(val.substr(0, startPos));
}
}
for (const auto &header : *l.get()) {
if (header->getName() == "From")
cpimFromAddress = Address(header->getValue());
else if (header->getName() == "To")
cpimToAddress = Address(header->getValue());
else if (header->getName() == "Message-ID")
else if ((header->getName() == "Message-ID") || (header->getName() == (imdnNamespace + ".Message-ID")))
message->getPrivate()->setImdnMessageId(header->getValue());
else if ((header->getName() == (imdnNamespace + ".Disposition-Notification"))) {
vector<string> values = Utils::split(header->getValue(), ", ");
for (const auto &value : values)
if (value == "positive-delivery")
message->getPrivate()->setPositiveDeliveryNotificationRequired(true);
else if (value == "negative-delivery")
message->getPrivate()->setNegativeDeliveryNotificationRequired(true);
else if (value == "display")
message->getPrivate()->setDisplayNotificationRequired(true);
}
}
}

View file

@ -17,10 +17,15 @@
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
*/
#include <algorithm>
#include "chat/chat-message/chat-message-p.h"
#include "chat/chat-room/chat-room.h"
#include "core/core.h"
#include "chat/chat-message/imdn-message.h"
#include "chat/chat-room/chat-room-p.h"
#include "core/core-p.h"
#include "logger/logger.h"
#include "xml/imdn.h"
#include "xml/linphone-imdn.h"
#include "imdn.h"
@ -30,182 +35,212 @@ using namespace std;
LINPHONE_BEGIN_NAMESPACE
const string Imdn::imdnPrefix = "/imdn:imdn";
// -----------------------------------------------------------------------------
string Imdn::createXml (const string &id, time_t time, Imdn::Type imdnType, LinphoneReason reason) {
xmlBufferPtr buf;
xmlTextWriterPtr writer;
int err;
string content;
char *datetime = nullptr;
Imdn::Imdn (ChatRoom *chatRoom) : chatRoom(chatRoom) {
chatRoom->getCore()->getPrivate()->registerListener(this);
}
// Check that the chat message has a message id.
if (id.empty())
return content;
Imdn::~Imdn () {
stopTimer();
chatRoom->getCore()->getPrivate()->unregisterListener(this);
}
buf = xmlBufferCreate();
if (buf == nullptr) {
lError() << "Error creating the XML buffer";
return content;
}
writer = xmlNewTextWriterMemory(buf, 0);
if (writer == nullptr) {
lError() << "Error creating the XML writer";
return content;
}
// -----------------------------------------------------------------------------
datetime = linphone_timestamp_to_rfc3339_string(time);
err = xmlTextWriterStartDocument(writer, "1.0", "UTF-8", nullptr);
if (err >= 0) {
err = xmlTextWriterStartElementNS(writer, nullptr, (const xmlChar *)"imdn",
(const xmlChar *)"urn:ietf:params:xml:ns:imdn");
int Imdn::getDisplayNotificationCount () const {
return static_cast<int>(displayedMessages.size());
}
// -----------------------------------------------------------------------------
void Imdn::notifyDelivery (const shared_ptr<ChatMessage> &message) {
if (find(deliveredMessages.begin(), deliveredMessages.end(), message) == deliveredMessages.end()) {
deliveredMessages.push_back(message);
startTimer();
}
if ((err >= 0) && (reason != LinphoneReasonNone)) {
err = xmlTextWriterWriteAttributeNS(writer, (const xmlChar *)"xmlns", (const xmlChar *)"linphoneimdn", nullptr, (const xmlChar *)"http://www.linphone.org/xsds/imdn.xsd");
}
void Imdn::notifyDeliveryError (const shared_ptr<ChatMessage> &message, LinphoneReason reason) {
auto it = find_if(nonDeliveredMessages.begin(), nonDeliveredMessages.end(), [message](const MessageReason mr) {
return message == mr.message;
});
if (it == nonDeliveredMessages.end()) {
nonDeliveredMessages.emplace_back(message, reason);
startTimer();
}
if (err >= 0) {
err = xmlTextWriterWriteElement(writer, (const xmlChar *)"message-id", (const xmlChar *)id.c_str());
}
void Imdn::notifyDisplay (const shared_ptr<ChatMessage> &message) {
auto it = find(deliveredMessages.begin(), deliveredMessages.end(), message);
if (it != deliveredMessages.end())
deliveredMessages.erase(it);
if (find(displayedMessages.begin(), displayedMessages.end(), message) == displayedMessages.end()) {
displayedMessages.push_back(message);
startTimer();
}
if (err >= 0) {
err = xmlTextWriterWriteElement(writer, (const xmlChar *)"datetime", (const xmlChar *)datetime);
}
// -----------------------------------------------------------------------------
void Imdn::onImdnMessageDelivered (const std::shared_ptr<ImdnMessage> &message) {
// If an IMDN has been successfully delivered, remove it from the list so that
// it does not get sent again
sentImdnMessages.remove(message);
}
// -----------------------------------------------------------------------------
void Imdn::onGlobalStateChanged (LinphoneGlobalState state) {
if (state == LinphoneGlobalShutdown) {
auto ref = chatRoom->getSharedFromThis();
deliveredMessages.clear();
displayedMessages.clear();
nonDeliveredMessages.clear();
sentImdnMessages.clear();
}
if (err >= 0) {
if (imdnType == Imdn::Type::Delivery) {
err = xmlTextWriterStartElement(writer, (const xmlChar *)"delivery-notification");
} else {
err = xmlTextWriterStartElement(writer, (const xmlChar *)"display-notification");
}
void Imdn::onNetworkReachable (bool sipNetworkReachable, bool mediaNetworkReachable) {
if (sipNetworkReachable) {
// When the SIP network gets up, retry sending every IMDN message that has not
// successfully been delivered
auto messages = sentImdnMessages;
sentImdnMessages.clear();
for (const auto &message : messages) {
auto imdnMessage = chatRoom->getPrivate()->createImdnMessage(message);
sentImdnMessages.push_back(imdnMessage);
imdnMessage->send();
}
}
if (err >= 0) {
err = xmlTextWriterStartElement(writer, (const xmlChar *)"status");
}
if (err >= 0) {
if (reason == LinphoneReasonNone) {
if (imdnType == Imdn::Type::Delivery) {
err = xmlTextWriterStartElement(writer, (const xmlChar *)"delivered");
} else {
err = xmlTextWriterStartElement(writer, (const xmlChar *)"displayed");
}
} else {
err = xmlTextWriterStartElement(writer, (const xmlChar *)"error");
}
}
if (err >= 0) {
// Close the "delivered", "displayed" or "error" element.
err = xmlTextWriterEndElement(writer);
}
if ((err >= 0) && (reason != LinphoneReasonNone)) {
err = xmlTextWriterStartElementNS(writer, (const xmlChar *)"linphoneimdn", (const xmlChar *)"reason", nullptr);
if (err >= 0) {
char codestr[16];
snprintf(codestr, 16, "%d", linphone_reason_to_error_code(reason));
err = xmlTextWriterWriteAttribute(writer, (const xmlChar *)"code", (const xmlChar *)codestr);
}
if (err >= 0) {
err = xmlTextWriterWriteString(writer, (const xmlChar *)linphone_reason_to_string(reason));
}
if (err >= 0) {
err = xmlTextWriterEndElement(writer);
}
}
if (err >= 0) {
// Close the "status" element.
err = xmlTextWriterEndElement(writer);
}
if (err >= 0) {
// Close the "delivery-notification" or "display-notification" element.
err = xmlTextWriterEndElement(writer);
}
if (err >= 0) {
// Close the "imdn" element.
err = xmlTextWriterEndElement(writer);
}
if (err >= 0) {
err = xmlTextWriterEndDocument(writer);
}
if (err > 0) {
// xmlTextWriterEndDocument returns the size of the content.
content = string((char *)buf->content);
}
xmlFreeTextWriter(writer);
xmlBufferFree(buf);
}
// -----------------------------------------------------------------------------
string Imdn::createXml (const string &id, time_t timestamp, Imdn::Type imdnType, LinphoneReason reason) {
char *datetime = linphone_timestamp_to_rfc3339_string(timestamp);
Xsd::Imdn::Imdn imdn(id, datetime);
ms_free(datetime);
return content;
if (imdnType == Imdn::Type::Delivery) {
Xsd::Imdn::Status status;
if (reason == LinphoneReasonNone) {
auto delivered = Xsd::Imdn::Delivered();
status.setDelivered(delivered);
} else {
auto failed = Xsd::Imdn::Failed();
status.setFailed(failed);
Xsd::LinphoneImdn::ImdnReason imdnReason(linphone_reason_to_string(reason));
imdnReason.setCode(linphone_reason_to_error_code(reason));
status.setReason(imdnReason);
}
Xsd::Imdn::DeliveryNotification deliveryNotification(status);
imdn.setDeliveryNotification(deliveryNotification);
} else if (imdnType == Imdn::Type::Display) {
Xsd::Imdn::Status1 status;
auto displayed = Xsd::Imdn::Displayed();
status.setDisplayed(displayed);
Xsd::Imdn::DisplayNotification displayNotification(status);
imdn.setDisplayNotification(displayNotification);
}
stringstream ss;
Xsd::XmlSchema::NamespaceInfomap map;
map[""].name = "urn:ietf:params:xml:ns:imdn";
map["imdn"].name = "http://www.linphone.org/xsds/imdn.xsd";
Xsd::Imdn::serializeImdn(ss, imdn, map);
return ss.str();
}
void Imdn::parse (const shared_ptr<ChatMessage> &chatMessage) {
xmlparsing_context_t *xmlCtx = linphone_xmlparsing_context_new();
xmlSetGenericErrorFunc(xmlCtx, linphone_xmlparsing_genericxml_error);
xmlCtx->doc = xmlReadDoc((const unsigned char *)chatMessage->getPrivate()->getText().c_str(), 0, nullptr, 0);
if (xmlCtx->doc)
parse(chatMessage, xmlCtx);
else
lWarning() << "Wrongly formatted IMDN XML: " << xmlCtx->errorBuffer;
linphone_xmlparsing_context_destroy(xmlCtx);
shared_ptr<AbstractChatRoom> cr = chatMessage->getChatRoom();
for (const auto &content : chatMessage->getPrivate()->getContents()) {
istringstream data(content->getBodyAsString());
unique_ptr<Xsd::Imdn::Imdn> imdn(Xsd::Imdn::parseImdn(data, Xsd::XmlSchema::Flags::dont_validate));
if (!imdn)
continue;
shared_ptr<ChatMessage> cm = cr->findChatMessage(imdn->getMessageId());
if (!cm) {
lWarning() << "Received IMDN for unknown message " << imdn->getMessageId();
} else {
auto policy = linphone_core_get_im_notif_policy(cr->getCore()->getCCore());
time_t imdnTime = chatMessage->getTime();
const IdentityAddress &participantAddress = chatMessage->getFromAddress().getAddressWithoutGruu();
auto &deliveryNotification = imdn->getDeliveryNotification();
auto &displayNotification = imdn->getDisplayNotification();
if (deliveryNotification.present()) {
auto &status = deliveryNotification.get().getStatus();
if (status.getDelivered().present() && linphone_im_notif_policy_get_recv_imdn_delivered(policy))
cm->getPrivate()->setParticipantState(participantAddress, ChatMessage::State::DeliveredToUser, imdnTime);
else if ((status.getFailed().present() || status.getError().present())
&& linphone_im_notif_policy_get_recv_imdn_delivered(policy)
)
cm->getPrivate()->setParticipantState(participantAddress, ChatMessage::State::NotDelivered, imdnTime);
} else if (displayNotification.present()) {
auto &status = displayNotification.get().getStatus();
if (status.getDisplayed().present() && linphone_im_notif_policy_get_recv_imdn_displayed(policy))
cm->getPrivate()->setParticipantState(participantAddress, ChatMessage::State::Displayed, imdnTime);
}
}
}
}
void Imdn::parse (const shared_ptr<ChatMessage> &imdnMessage, xmlparsing_context_t *xmlCtx) {
char xpathStr[MAX_XPATH_LENGTH];
char *messageIdStr = nullptr;
char *datetimeStr = nullptr;
if (linphone_create_xml_xpath_context(xmlCtx) < 0)
// -----------------------------------------------------------------------------
int Imdn::timerExpired (void *data, unsigned int revents) {
Imdn *d = reinterpret_cast<Imdn *>(data);
d->stopTimer();
d->send();
return BELLE_SIP_STOP;
}
// -----------------------------------------------------------------------------
void Imdn::send () {
bool networkReachable = linphone_core_is_network_reachable(chatRoom->getCore()->getCCore());
if (!deliveredMessages.empty() || !displayedMessages.empty()) {
auto imdnMessage = chatRoom->getPrivate()->createImdnMessage(deliveredMessages, displayedMessages);
sentImdnMessages.push_back(imdnMessage);
if (networkReachable)
imdnMessage->send();
deliveredMessages.clear();
displayedMessages.clear();
}
if (!nonDeliveredMessages.empty()) {
auto imdnMessage = chatRoom->getPrivate()->createImdnMessage(nonDeliveredMessages);
sentImdnMessages.push_back(imdnMessage);
if (networkReachable)
imdnMessage->send();
nonDeliveredMessages.clear();
}
}
void Imdn::startTimer () {
auto config = linphone_core_get_config(chatRoom->getCore()->getCCore());
bool aggregateImdn = linphone_config_get_bool(config, "misc", "aggregate_imdn", TRUE);
if (!chatRoom->canHandleCpim() || !aggregateImdn) {
// Compatibility mode for basic chat rooms, do not aggregate notifications
send();
return;
xmlXPathRegisterNs(xmlCtx->xpath_ctx, (const xmlChar *)"imdn", (const xmlChar *)"urn:ietf:params:xml:ns:imdn");
xmlXPathObjectPtr imdnObject = linphone_get_xml_xpath_object_for_node_list(xmlCtx, imdnPrefix.c_str());
if (imdnObject) {
if (imdnObject->nodesetval && (imdnObject->nodesetval->nodeNr >= 1)) {
snprintf(xpathStr, sizeof(xpathStr), "%s[1]/imdn:message-id", imdnPrefix.c_str());
messageIdStr = linphone_get_xml_text_content(xmlCtx, xpathStr);
snprintf(xpathStr, sizeof(xpathStr), "%s[1]/imdn:datetime", imdnPrefix.c_str());
datetimeStr = linphone_get_xml_text_content(xmlCtx, xpathStr);
}
xmlXPathFreeObject(imdnObject);
}
if (messageIdStr && datetimeStr) {
shared_ptr<AbstractChatRoom> cr = imdnMessage->getChatRoom();
shared_ptr<ChatMessage> cm = cr->findChatMessage(messageIdStr);
const IdentityAddress &participantAddress = imdnMessage->getFromAddress().getAddressWithoutGruu();
if (!cm) {
lWarning() << "Received IMDN for unknown message " << messageIdStr;
} else {
time_t imdnTime = imdnMessage->getTime();
LinphoneImNotifPolicy *policy = linphone_core_get_im_notif_policy(cr->getCore()->getCCore());
snprintf(xpathStr, sizeof(xpathStr), "%s[1]/imdn:delivery-notification/imdn:status", imdnPrefix.c_str());
xmlXPathObjectPtr deliveryStatusObject = linphone_get_xml_xpath_object_for_node_list(xmlCtx, xpathStr);
snprintf(xpathStr, sizeof(xpathStr), "%s[1]/imdn:display-notification/imdn:status", imdnPrefix.c_str());
xmlXPathObjectPtr displayStatusObject = linphone_get_xml_xpath_object_for_node_list(xmlCtx, xpathStr);
if (deliveryStatusObject && linphone_im_notif_policy_get_recv_imdn_delivered(policy)) {
if (deliveryStatusObject->nodesetval && (deliveryStatusObject->nodesetval->nodeNr >= 1)) {
xmlNodePtr node = deliveryStatusObject->nodesetval->nodeTab[0];
if (node->children && node->children->name) {
if (strcmp((const char *)node->children->name, "delivered") == 0) {
cm->getPrivate()->setParticipantState(participantAddress, ChatMessage::State::DeliveredToUser, imdnTime);
} else if (strcmp((const char *)node->children->name, "error") == 0) {
cm->getPrivate()->setParticipantState(participantAddress, ChatMessage::State::NotDelivered, imdnTime);
}
}
}
xmlXPathFreeObject(deliveryStatusObject);
}
if (displayStatusObject && linphone_im_notif_policy_get_recv_imdn_displayed(policy)) {
if (displayStatusObject->nodesetval && (displayStatusObject->nodesetval->nodeNr >= 1)) {
xmlNodePtr node = displayStatusObject->nodesetval->nodeTab[0];
if (node->children && node->children->name) {
if (strcmp((const char *)node->children->name, "displayed") == 0) {
cm->getPrivate()->setParticipantState(participantAddress, ChatMessage::State::Displayed, imdnTime);
}
}
}
xmlXPathFreeObject(displayStatusObject);
}
}
unsigned int duration = 500;
if (!timer)
timer = chatRoom->getCore()->getCCore()->sal->create_timer(timerExpired, this, duration, "imdn timeout");
else
belle_sip_source_set_timeout(timer, duration);
bgTask.start(chatRoom->getCore(), 1);
}
void Imdn::stopTimer () {
if (timer) {
auto core = chatRoom->getCore()->getCCore();
if (core && core->sal)
core->sal->cancel_timer(timer);
belle_sip_object_unref(timer);
timer = nullptr;
}
if (messageIdStr)
linphone_free_xml_text_content(messageIdStr);
if (datetimeStr)
linphone_free_xml_text_content(datetimeStr);
bgTask.stop();
}
LINPHONE_END_NAMESPACE

View file

@ -22,29 +22,67 @@
#include "linphone/utils/general.h"
#include "core/core-listener.h"
#include "utils/background-task.h"
#include "private.h"
// =============================================================================
LINPHONE_BEGIN_NAMESPACE
class ChatMessage;
class ChatRoom;
class ImdnMessage;
class Imdn {
class Imdn : public CoreListener {
public:
enum class Type {
Delivery,
Display
};
struct MessageReason {
MessageReason (const std::shared_ptr<ChatMessage> &message, LinphoneReason reason)
: message(message), reason(reason) {}
const std::shared_ptr<ChatMessage> message;
LinphoneReason reason;
};
Imdn (ChatRoom *chatRoom);
~Imdn ();
int getDisplayNotificationCount () const;
void notifyDelivery (const std::shared_ptr<ChatMessage> &message);
void notifyDeliveryError (const std::shared_ptr<ChatMessage> &message, LinphoneReason reason);
void notifyDisplay (const std::shared_ptr<ChatMessage> &message);
void onImdnMessageDelivered (const std::shared_ptr<ImdnMessage> &message);
// CoreListener
void onGlobalStateChanged (LinphoneGlobalState state) override;
void onNetworkReachable (bool sipNetworkReachable, bool mediaNetworkReachable) override;
static std::string createXml (const std::string &id, time_t time, Imdn::Type imdnType, LinphoneReason reason);
static void parse (const std::shared_ptr<ChatMessage> &chatMessage);
private:
static void parse (const std::shared_ptr<ChatMessage> &chatMessage, xmlparsing_context_t *xmlCtx);
static int timerExpired (void *data, unsigned int revents);
void send ();
void startTimer ();
void stopTimer ();
private:
static const std::string imdnPrefix;
ChatRoom *chatRoom = nullptr;
std::list<std::shared_ptr<ChatMessage>> deliveredMessages;
std::list<std::shared_ptr<ChatMessage>> displayedMessages;
std::list<MessageReason> nonDeliveredMessages;
std::list<std::shared_ptr<ImdnMessage>> sentImdnMessages;
belle_sip_source_t *timer = nullptr;
BackgroundTask bgTask { "IMDN sending" };
};
LINPHONE_END_NAMESPACE

View file

@ -24,6 +24,7 @@
#include "chat/chat-room/chat-room-p.h"
#include "chat/notification/is-composing.h"
#include "logger/logger.h"
#include "xml/is-composing.h"
// =============================================================================
@ -42,10 +43,6 @@ struct IsRemoteComposingData {
// -----------------------------------------------------------------------------
const string IsComposing::isComposingPrefix = "/xsi:isComposing";
// -----------------------------------------------------------------------------
IsComposing::IsComposing (LinphoneCore *core, IsComposingListener *listener)
: core(core), listener(listener) {}
@ -55,66 +52,34 @@ IsComposing::~IsComposing () {
// -----------------------------------------------------------------------------
string IsComposing::marshal (bool isComposing) {
string content;
string IsComposing::createXml (bool isComposing) {
Xsd::IsComposing::IsComposing node(isComposing ? "active" : "idle");
if (isComposing)
node.setRefresh(static_cast<unsigned long long>(lp_config_get_int(core->config, "sip", "composing_refresh_timeout", defaultRefreshTimeout)));
xmlBufferPtr buf = xmlBufferCreate();
if (!buf) {
lError() << "Error creating the XML buffer";
return content;
}
xmlTextWriterPtr writer = xmlNewTextWriterMemory(buf, 0);
if (!writer) {
lError() << "Error creating the XML writer";
return content;
}
int err = xmlTextWriterStartDocument(writer, "1.0", "UTF-8", nullptr);
if (err >= 0) {
err = xmlTextWriterStartElementNS(writer, nullptr, (const xmlChar *)"isComposing",
(const xmlChar *)"urn:ietf:params:xml:ns:im-iscomposing");
}
if (err >= 0) {
err = xmlTextWriterWriteAttributeNS(writer, (const xmlChar *)"xmlns", (const xmlChar *)"xsi", nullptr,
(const xmlChar *)"http://www.w3.org/2001/XMLSchema-instance");
}
if (err >= 0) {
err = xmlTextWriterWriteAttributeNS(writer, (const xmlChar *)"xsi", (const xmlChar *)"schemaLocation", nullptr,
(const xmlChar *)"urn:ietf:params:xml:ns:im-composing iscomposing.xsd");
}
if (err >= 0) {
err = xmlTextWriterWriteElement(writer, (const xmlChar *)"state",
isComposing ? (const xmlChar *)"active" : (const xmlChar *)"idle");
}
if ((err >= 0) && isComposing) {
int refreshTimeout = lp_config_get_int(core->config, "sip", "composing_refresh_timeout", defaultRefreshTimeout);
err = xmlTextWriterWriteElement(writer, (const xmlChar *)"refresh", (const xmlChar *)Utils::toString(refreshTimeout).c_str());
}
if (err >= 0) {
/* Close the "isComposing" element. */
err = xmlTextWriterEndElement(writer);
}
if (err >= 0) {
err = xmlTextWriterEndDocument(writer);
}
if (err > 0) {
/* xmlTextWriterEndDocument returns the size of the content. */
content = (char *)buf->content;
}
xmlFreeTextWriter(writer);
xmlBufferFree(buf);
return content;
stringstream ss;
Xsd::XmlSchema::NamespaceInfomap map;
map[""].name = "urn:ietf:params:xml:ns:im-iscomposing";
Xsd::IsComposing::serializeIsComposing(ss, node, map);
return ss.str();
}
void IsComposing::parse (const Address &remoteAddr, const string &text) {
xmlparsing_context_t *xmlCtx = linphone_xmlparsing_context_new();
xmlSetGenericErrorFunc(xmlCtx, linphone_xmlparsing_genericxml_error);
xmlCtx->doc = xmlReadDoc((const unsigned char *)text.c_str(), 0, nullptr, 0);
if (xmlCtx->doc)
parse(xmlCtx, remoteAddr);
else
lWarning() << "Wrongly formatted presence XML: " << xmlCtx->errorBuffer;
linphone_xmlparsing_context_destroy(xmlCtx);
istringstream data(text);
unique_ptr<Xsd::IsComposing::IsComposing> node(Xsd::IsComposing::parseIsComposing(data, Xsd::XmlSchema::Flags::dont_validate));
if (!node)
return;
if (node->getState() == "active") {
unsigned long long refresh = 0;
if (node->getRefresh().present())
refresh = node->getRefresh().get();
startRemoteRefreshTimer(remoteAddr.asStringUriOnly(), refresh);
listener->onIsRemoteComposingStateChanged(remoteAddr, true);
} else if (node->getState() == "idle") {
stopRemoteRefreshTimer(remoteAddr.asStringUriOnly());
listener->onIsRemoteComposingStateChanged(remoteAddr, false);
}
}
void IsComposing::startIdleTimer () {
@ -186,47 +151,6 @@ unsigned int IsComposing::getRemoteRefreshTimerDuration () {
return remoteRefreshTimerDuration < 0 ? 0 : static_cast<unsigned int>(remoteRefreshTimerDuration);
}
void IsComposing::parse (xmlparsing_context_t *xmlCtx, const Address &remoteAddr) {
char xpathStr[MAX_XPATH_LENGTH];
char *stateStr = nullptr;
char *refreshStr = nullptr;
int i;
bool state = false;
if (linphone_create_xml_xpath_context(xmlCtx) < 0)
return;
xmlXPathRegisterNs(xmlCtx->xpath_ctx, (const xmlChar *)"xsi", (const xmlChar *)"urn:ietf:params:xml:ns:im-iscomposing");
xmlXPathObjectPtr isComposingObject = linphone_get_xml_xpath_object_for_node_list(xmlCtx, isComposingPrefix.c_str());
if (isComposingObject) {
if (isComposingObject->nodesetval) {
for (i = 1; i <= isComposingObject->nodesetval->nodeNr; i++) {
snprintf(xpathStr, sizeof(xpathStr), "%s[%i]/xsi:state", isComposingPrefix.c_str(), i);
stateStr = linphone_get_xml_text_content(xmlCtx, xpathStr);
if (!stateStr)
continue;
snprintf(xpathStr, sizeof(xpathStr), "%s[%i]/xsi:refresh", isComposingPrefix.c_str(), i);
refreshStr = linphone_get_xml_text_content(xmlCtx, xpathStr);
}
}
xmlXPathFreeObject(isComposingObject);
}
if (stateStr) {
if (strcmp(stateStr, "active") == 0) {
state = true;
startRemoteRefreshTimer(remoteAddr.asStringUriOnly(), refreshStr);
} else {
stopRemoteRefreshTimer(remoteAddr.asStringUriOnly());
}
listener->onIsRemoteComposingStateChanged(remoteAddr, state);
linphone_free_xml_text_content(stateStr);
}
if (refreshStr)
linphone_free_xml_text_content(refreshStr);
}
int IsComposing::idleTimerExpired () {
stopRefreshTimer();
stopIdleTimer();
@ -245,10 +169,10 @@ int IsComposing::remoteRefreshTimerExpired (const string &uri) {
return BELLE_SIP_STOP;
}
void IsComposing::startRemoteRefreshTimer (const string &uri, const char *refreshStr) {
void IsComposing::startRemoteRefreshTimer (const string &uri, unsigned long long refresh) {
unsigned int duration = getRemoteRefreshTimerDuration();
if (refreshStr)
duration = static_cast<unsigned int>(Utils::stoi(refreshStr));
if (refresh != 0)
duration = static_cast<unsigned int>(refresh);
auto it = remoteRefreshTimers.find(uri);
if (it == remoteRefreshTimers.end()) {
IsRemoteComposingData *data = new IsRemoteComposingData(this, uri);

View file

@ -38,7 +38,7 @@ public:
IsComposing (LinphoneCore *core, IsComposingListener *listener);
~IsComposing ();
std::string marshal (bool isComposing);
std::string createXml (bool isComposing);
void parse (const Address &remoteAddr, const std::string &content);
void startIdleTimer ();
void startRefreshTimer ();
@ -51,11 +51,10 @@ private:
unsigned int getIdleTimerDuration ();
unsigned int getRefreshTimerDuration ();
unsigned int getRemoteRefreshTimerDuration ();
void parse (xmlparsing_context_t *xmlCtx, const Address &remoteAddr);
int idleTimerExpired ();
int refreshTimerExpired ();
int remoteRefreshTimerExpired (const std::string &uri);
void startRemoteRefreshTimer (const std::string &uri, const char *refreshStr);
void startRemoteRefreshTimer (const std::string &uri, unsigned long long refresh);
void stopAllRemoteRefreshTimers ();
std::unordered_map<std::string, belle_sip_source_t *>::iterator stopRemoteRefreshTimer (const std::unordered_map<std::string, belle_sip_source_t *>::const_iterator it);
@ -67,7 +66,6 @@ private:
static const int defaultIdleTimeout = 15;
static const int defaultRefreshTimeout = 60;
static const int defaultRemoteRefreshTimeout = 120;
static const std::string isComposingPrefix;
LinphoneCore *core = nullptr;
IsComposingListener *listener = nullptr;

View file

@ -38,6 +38,7 @@ public:
// -----------------------------------------------------------------------------
const ContentDisposition ContentDisposition::Notification("notification");
const ContentDisposition ContentDisposition::RecipientList("recipient-list");
const ContentDisposition ContentDisposition::RecipientListHistory("recipient-list-history; handling=optional");

View file

@ -52,6 +52,7 @@ public:
std::string asString () const;
static const ContentDisposition Notification;
static const ContentDisposition RecipientList;
static const ContentDisposition RecipientListHistory;

View file

@ -23,6 +23,7 @@
#include "linphone/api/c-content.h"
#include "content-disposition.h"
#include "content-manager.h"
#include "content-type.h"
#include "content/content.h"
@ -47,7 +48,10 @@ list<Content> ContentManager::multipartToContentList (const Content &content) {
for (const belle_sip_list_t *parts = sal_body_handler_get_parts(sbh); parts; parts = parts->next) {
SalBodyHandler *part = (SalBodyHandler *)parts->data;
LinphoneContent *cContent = linphone_content_from_sal_body_handler(part);
contents.push_back(*L_GET_CPP_PTR_FROM_C_OBJECT(cContent));
Content *cppContent = L_GET_CPP_PTR_FROM_C_OBJECT(cContent);
if (content.getContentDisposition().isValid())
cppContent->setContentDisposition(content.getContentDisposition());
contents.push_back(*cppContent);
linphone_content_unref(cContent);
}
@ -61,7 +65,12 @@ Content ContentManager::contentListToMultipart (const list<Content *> &contents)
);
mpbh = (belle_sip_multipart_body_handler_t *)belle_sip_object_ref(mpbh);
ContentDisposition disposition;
for (Content *content : contents) {
// Is this content-disposition stuff generic or only valid for notification content-disposition?
if (content->getContentDisposition().isValid())
disposition = content->getContentDisposition();
LinphoneContent *cContent = L_GET_C_BACK_PTR(content);
SalBodyHandler *sbh = sal_body_handler_from_content(cContent);
belle_sip_multipart_body_handler_add_part(mpbh, BELLE_SIP_BODY_HANDLER(sbh));
@ -76,6 +85,8 @@ Content ContentManager::contentListToMultipart (const list<Content *> &contents)
belle_sip_object_unref(mpbh);
Content content = *L_GET_CPP_PTR_FROM_C_OBJECT(cContent);
if (disposition.isValid())
content.setContentDisposition(disposition);
linphone_content_unref(cContent);
return content;
}

View file

@ -179,8 +179,10 @@ void CorePrivate::insertChatRoomWithDb (const shared_ptr<AbstractChatRoom> &chat
void CorePrivate::loadChatRooms () {
chatRooms.clear();
chatRoomsById.clear();
for (auto &chatRoom : mainDb->getChatRooms())
for (auto &chatRoom : mainDb->getChatRooms()) {
insertChatRoom(chatRoom);
chatRoom->getPrivate()->sendDeliveryNotifications();
}
}
void CorePrivate::replaceChatRoom (const shared_ptr<AbstractChatRoom> &replacedChatRoom, const shared_ptr<AbstractChatRoom> &newChatRoom) {

View file

@ -30,6 +30,7 @@ class CoreListener {
public:
virtual ~CoreListener () = default;
virtual void onGlobalStateChanged (LinphoneGlobalState state) {}
virtual void onNetworkReachable (bool sipNetworkReachable, bool mediaNetworkReachable) {}
virtual void onRegistrationStateChanged (LinphoneProxyConfig *cfg, LinphoneRegistrationState state, const std::string &message) {}
};

View file

@ -39,6 +39,7 @@ public:
void unregisterListener (CoreListener *listener);
void uninit ();
void notifyGlobalStateChanged (LinphoneGlobalState state);
void notifyNetworkReachable (bool sipNetworkReachable, bool mediaNetworkReachable);
void notifyRegistrationStateChanged (LinphoneProxyConfig *cfg, LinphoneRegistrationState state, const std::string &message);

View file

@ -86,13 +86,21 @@ void CorePrivate::uninit () {
// -----------------------------------------------------------------------------
void CorePrivate::notifyGlobalStateChanged (LinphoneGlobalState state) {
auto listenersCopy = listeners; // Allow removable of a listener in its own call
for (const auto &listener : listenersCopy)
listener->onGlobalStateChanged(state);
}
void CorePrivate::notifyNetworkReachable (bool sipNetworkReachable, bool mediaNetworkReachable) {
for (const auto &listener : listeners)
auto listenersCopy = listeners; // Allow removable of a listener in its own call
for (const auto &listener : listenersCopy)
listener->onNetworkReachable(sipNetworkReachable, mediaNetworkReachable);
}
void CorePrivate::notifyRegistrationStateChanged (LinphoneProxyConfig *cfg, LinphoneRegistrationState state, const string &message) {
for (const auto &listener : listeners)
auto listenersCopy = listeners; // Allow removable of a listener in its own call
for (const auto &listener : listenersCopy)
listener->onRegistrationStateChanged(cfg, state, message);
}

View file

@ -51,6 +51,7 @@ class LINPHONE_PUBLIC Core : public Object {
friend class ClientGroupChatRoom;
friend class ClientGroupChatRoomPrivate;
friend class ClientGroupToBasicChatRoomPrivate;
friend class Imdn;
friend class LocalConferenceEventHandlerPrivate;
friend class MainDb;
friend class MainDbChatMessageKey;

View file

@ -81,7 +81,7 @@ namespace Statements {
)",
[SelectConferenceEvent] = R"(
SELECT conference_event_view.id AS event_id, type, conference_event_view.creation_time, from_sip_address.value, to_sip_address.value, time, imdn_message_id, state, direction, is_secured, notify_id, device_sip_address.value, participant_sip_address.value, conference_event_view.subject, peer_sip_address.value, local_sip_address.value
SELECT conference_event_view.id AS event_id, type, conference_event_view.creation_time, from_sip_address.value, to_sip_address.value, time, imdn_message_id, state, direction, is_secured, notify_id, device_sip_address.value, participant_sip_address.value, conference_event_view.subject, delivery_notification_required, display_notification_required, peer_sip_address.value, local_sip_address.value
FROM conference_event_view
JOIN chat_room ON chat_room.id = chat_room_id
JOIN sip_address AS peer_sip_address ON peer_sip_address.id = peer_sip_address_id
@ -94,7 +94,7 @@ namespace Statements {
)",
[SelectConferenceEvents] = R"(
SELECT conference_event_view.id AS event_id, type, creation_time, from_sip_address.value, to_sip_address.value, time, imdn_message_id, state, direction, is_secured, notify_id, device_sip_address.value, participant_sip_address.value, subject
SELECT conference_event_view.id AS event_id, type, creation_time, from_sip_address.value, to_sip_address.value, time, imdn_message_id, state, direction, is_secured, notify_id, device_sip_address.value, participant_sip_address.value, subject, delivery_notification_required, display_notification_required
FROM conference_event_view
LEFT JOIN sip_address AS from_sip_address ON from_sip_address.id = from_sip_address_id
LEFT JOIN sip_address AS to_sip_address ON to_sip_address.id = to_sip_address_id

View file

@ -47,7 +47,7 @@ using namespace std;
LINPHONE_BEGIN_NAMESPACE
namespace {
constexpr unsigned int ModuleVersionEvents = makeVersion(1, 0, 3);
constexpr unsigned int ModuleVersionEvents = makeVersion(1, 0, 4);
constexpr unsigned int ModuleVersionFriends = makeVersion(1, 0, 0);
constexpr unsigned int ModuleVersionLegacyFriendsImport = makeVersion(1, 0, 0);
constexpr unsigned int ModuleVersionLegacyHistoryImport = makeVersion(1, 0, 0);
@ -612,6 +612,8 @@ shared_ptr<EventLog> MainDbPrivate::selectConferenceChatMessageEvent (
dChatMessage->setTime(Utils::getTmAsTimeT(row.get<tm>(5)));
dChatMessage->setImdnMessageId(row.get<string>(6));
dChatMessage->setPositiveDeliveryNotificationRequired(bool(row.get<int>(14)));
dChatMessage->setDisplayNotificationRequired(bool(row.get<int>(15)));
dChatMessage->markContentsAsNotLoaded();
dChatMessage->setIsReadOnly(true);
@ -728,16 +730,21 @@ long long MainDbPrivate::insertConferenceChatMessageEvent (const shared_ptr<Even
const int &direction = int(chatMessage->getDirection());
const string &imdnMessageId = chatMessage->getImdnMessageId();
const int &isSecured = chatMessage->isSecured() ? 1 : 0;
const int &deliveryNotificationRequired = chatMessage->getPrivate()->getPositiveDeliveryNotificationRequired();
const int &displayNotificationRequired = chatMessage->getPrivate()->getDisplayNotificationRequired();
*dbSession.getBackendSession() << "INSERT INTO conference_chat_message_event ("
" event_id, from_sip_address_id, to_sip_address_id,"
" time, state, direction, imdn_message_id, is_secured"
" time, state, direction, imdn_message_id, is_secured,"
" delivery_notification_required, display_notification_required"
") VALUES ("
" :eventId, :localSipaddressId, :remoteSipaddressId,"
" :time, :state, :direction, :imdnMessageId, :isSecured"
" :time, :state, :direction, :imdnMessageId, :isSecured,"
" :deliveryNotificationRequired, :displayNotificationRequired"
")", soci::use(eventId), soci::use(fromSipAddressId), soci::use(toSipAddressId),
soci::use(messageTime), soci::use(state), soci::use(direction),
soci::use(imdnMessageId), soci::use(isSecured);
soci::use(imdnMessageId), soci::use(isSecured),
soci::use(deliveryNotificationRequired), soci::use(displayNotificationRequired);
for (const Content *content : chatMessage->getContents())
insertContent(eventId, *content);
@ -998,6 +1005,27 @@ void MainDbPrivate::updateSchema () {
soci::use(capabilities), soci::use(capabilities);
linphone_config_set_bool(linphone_core_get_config(q->getCore()->getCCore()), "misc", "prefer_basic_chat_room", TRUE);
}
if (version < makeVersion(1, 0, 4)) {
*session << "ALTER TABLE conference_chat_message_event ADD COLUMN delivery_notification_required BOOLEAN NOT NULL DEFAULT 0";
*session << "ALTER TABLE conference_chat_message_event ADD COLUMN display_notification_required BOOLEAN NOT NULL DEFAULT 0";
*session << "DROP VIEW IF EXISTS conference_event_view";
string query;
if (q->getBackend() == AbstractDb::Backend::Mysql)
query = "CREATE OR REPLACE VIEW conference_event_view AS";
else
query = "CREATE VIEW IF NOT EXISTS conference_event_view AS";
*session << query +
" SELECT id, type, creation_time, chat_room_id, from_sip_address_id, to_sip_address_id, time, imdn_message_id, state, direction, is_secured, notify_id, device_sip_address_id, participant_sip_address_id, subject, delivery_notification_required, display_notification_required"
" FROM event"
" LEFT JOIN conference_event ON conference_event.event_id = event.id"
" LEFT JOIN conference_chat_message_event ON conference_chat_message_event.event_id = event.id"
" LEFT JOIN conference_notified_event ON conference_notified_event.event_id = event.id"
" LEFT JOIN conference_participant_device_event ON conference_participant_device_event.event_id = event.id"
" LEFT JOIN conference_participant_event ON conference_participant_event.event_id = event.id"
" LEFT JOIN conference_subject_event ON conference_subject_event.event_id = event.id";
}
}
// -----------------------------------------------------------------------------
@ -1226,19 +1254,23 @@ void MainDbPrivate::importLegacyHistory (DbSession &inDbSession) {
creationTime
);
const int &isSecured = message.get<int>(LegacyMessageColIsSecured, 0);
const int deliveryNotificationRequired = 0;
const int displayNotificationRequired = 0;
*session << "INSERT INTO conference_event (event_id, chat_room_id)"
" VALUES (:eventId, :chatRoomId)", soci::use(eventId), soci::use(chatRoomId);
*session << "INSERT INTO conference_chat_message_event ("
" event_id, from_sip_address_id, to_sip_address_id,"
" time, state, direction, imdn_message_id, is_secured"
" time, state, direction, imdn_message_id, is_secured,"
" delivery_notification_required, display_notification_required"
") VALUES ("
" :eventId, :localSipAddressId, :remoteSipAddressId,"
" :creationTime, :state, :direction, '', :isSecured"
" :creationTime, :state, :direction, '', :isSecured,"
" :deliveryNotificationRequired, :displayNotificationRequired"
")", soci::use(eventId), soci::use(localSipAddressId), soci::use(remoteSipAddressId),
soci::use(creationTime), soci::use(state), soci::use(direction),
soci::use(isSecured);
soci::use(creationTime), soci::use(state), soci::use(direction), soci::use(isSecured),
soci::use(deliveryNotificationRequired), soci::use(displayNotificationRequired);
if (content)
insertContent(eventId, *content);
@ -1584,24 +1616,6 @@ void MainDb::init () {
" ON DELETE CASCADE"
") " + charset;
{
string query;
if (getBackend() == Backend::Mysql)
query = "CREATE OR REPLACE VIEW conference_event_view AS";
else
query = "CREATE VIEW IF NOT EXISTS conference_event_view AS";
*session << query +
" SELECT id, type, creation_time, chat_room_id, from_sip_address_id, to_sip_address_id, time, imdn_message_id, state, direction, is_secured, notify_id, device_sip_address_id, participant_sip_address_id, subject"
" FROM event"
" LEFT JOIN conference_event ON conference_event.event_id = event.id"
" LEFT JOIN conference_chat_message_event ON conference_chat_message_event.event_id = event.id"
" LEFT JOIN conference_notified_event ON conference_notified_event.event_id = event.id"
" LEFT JOIN conference_participant_device_event ON conference_participant_device_event.event_id = event.id"
" LEFT JOIN conference_participant_event ON conference_participant_event.event_id = event.id"
" LEFT JOIN conference_subject_event ON conference_subject_event.event_id = event.id";
}
*session <<
"CREATE TABLE IF NOT EXISTS db_module_version ("
" name" + varcharPrimaryKeyStr(255) + ","
@ -1779,7 +1793,7 @@ shared_ptr<EventLog> MainDb::getEventFromKey (const MainDbKey &dbKey) {
*d->dbSession.getBackendSession() << Statements::get(Statements::SelectConferenceEvent),
soci::into(row), soci::use(eventId);
ChatRoomId chatRoomId(IdentityAddress(row.get<string>(14)), IdentityAddress(row.get<string>(15)));
ChatRoomId chatRoomId(IdentityAddress(row.get<string>(16)), IdentityAddress(row.get<string>(17)));
shared_ptr<AbstractChatRoom> chatRoom = d->findChatRoom(chatRoomId);
if (!chatRoom)
return shared_ptr<EventLog>();
@ -2134,6 +2148,43 @@ list<shared_ptr<ChatMessage>> MainDb::findChatMessages (
};
}
list<shared_ptr<ChatMessage>> MainDb::findChatMessagesToBeNotifiedAsDelivered (
const ChatRoomId &chatRoomId
) const {
static const string query = Statements::get(Statements::SelectConferenceEvents) +
string(" AND direction = :direction AND state = :state AND delivery_notification_required <> 0");
DurationLogger durationLogger(
"Find chat messages to be notified as delivered: (peer=" + chatRoomId.getPeerAddress().asString() +
", local=" + chatRoomId.getLocalAddress().asString() + ")."
);
return L_DB_TRANSACTION {
L_D();
shared_ptr<AbstractChatRoom> chatRoom = d->findChatRoom(chatRoomId);
list<shared_ptr<ChatMessage>> chatMessages;
if (!chatRoom)
return chatMessages;
const long long &dbChatRoomId = d->selectChatRoomId(chatRoomId);
const int &state = int(ChatMessage::State::Delivered);
const int &direction = int(ChatMessage::Direction::Incoming);
soci::rowset<soci::row> rows = (
d->dbSession.getBackendSession()->prepare << query, soci::use(dbChatRoomId), soci::use(direction), soci::use(state)
);
for (const auto &row : rows) {
shared_ptr<EventLog> event = d->selectGenericConferenceEvent(chatRoom, row);
if (event) {
L_ASSERT(event->getType() == EventLog::Type::ConferenceChatMessage);
chatMessages.push_back(static_pointer_cast<ConferenceChatMessageEvent>(event)->getChatMessage());
}
}
return chatMessages;
};
}
list<shared_ptr<EventLog>> MainDb::getHistory (const ChatRoomId &chatRoomId, int nLast, FilterMask mask) const {
return getHistoryRange(chatRoomId, 0, nLast, mask);
}

View file

@ -130,6 +130,10 @@ public:
const std::string &imdnMessageId
) const;
std::list<std::shared_ptr<ChatMessage>> findChatMessagesToBeNotifiedAsDelivered (
const ChatRoomId &chatRoomId
) const;
// ---------------------------------------------------------------------------
// Conference events.
// ---------------------------------------------------------------------------

View file

@ -1530,10 +1530,11 @@ void SalCallOp::process_notify(const belle_sip_request_event_t *event, belle_sip
}
}
int SalCallOp::send_message(const char* content_type, const char *msg) {
if (!this->dialog) return -1;
belle_sip_request_t* req=belle_sip_dialog_create_queued_request(this->dialog,"MESSAGE");
prepare_message_request(req, content_type, msg);
int SalCallOp::sendMessage (const Content &content) {
if (!this->dialog)
return -1;
belle_sip_request_t *req = belle_sip_dialog_create_queued_request(this->dialog, "MESSAGE");
prepareMessageRequest(req, content);
return send_request(req);
}

View file

@ -66,7 +66,7 @@ public:
void set_sdp_handling(SalOpSDPHandling handling);
// Implementation of SalMessageOpInterface
int send_message(const char* content_type, const char *msg) override;
int sendMessage (const Content &content) override;
int reply(SalReason reason) override {return SalOp::reply_message(reason);}
private:

View file

@ -20,17 +20,55 @@
#ifndef _L_SAL_MESSAGE_OP_INTERFACE_H_
#define _L_SAL_MESSAGE_OP_INTERFACE_H_
#include <ctime>
#include "content/content.h"
#include "content/content-type.h"
LINPHONE_BEGIN_NAMESPACE
class SalMessageOpInterface {
public:
virtual ~SalMessageOpInterface() = default;
virtual int send_message(const char* content_type, const char *msg) = 0;
virtual int sendMessage (const Content &content) = 0;
virtual int reply(SalReason reason) = 0;
protected:
void prepare_message_request(belle_sip_request_t *req, const char* content_type, const char *msg);
void prepareMessageRequest (belle_sip_request_t *req, const Content &content) {
time_t curtime = std::time(nullptr);
belle_sip_message_add_header(
BELLE_SIP_MESSAGE(req),
BELLE_SIP_HEADER(belle_sip_header_date_create_from_time(&curtime))
);
std::string contentEncoding = content.getContentEncoding();
if (!contentEncoding.empty())
belle_sip_message_add_header(
BELLE_SIP_MESSAGE(req),
belle_sip_header_create("Content-Encoding", contentEncoding.c_str())
);
const ContentType &contentType = content.getContentType();
std::string contentTypeStr = std::string(BELLE_SIP_CONTENT_TYPE ": ") + contentType.asString();
belle_sip_message_add_header(
BELLE_SIP_MESSAGE(req),
BELLE_SIP_HEADER(belle_sip_header_content_type_parse(contentTypeStr.c_str()))
);
if (content.isEmpty()) {
belle_sip_message_add_header(
BELLE_SIP_MESSAGE(req),
BELLE_SIP_HEADER(belle_sip_header_content_length_create(0))
);
} else {
std::string body = content.getBodyAsUtf8String();
size_t contentLength = body.size();
belle_sip_message_add_header(
BELLE_SIP_MESSAGE(req),
BELLE_SIP_HEADER(belle_sip_header_content_length_create(contentLength))
);
belle_sip_message_set_body(BELLE_SIP_MESSAGE(req), body.c_str(), contentLength);
}
}
};
LINPHONE_END_NAMESPACE

View file

@ -77,27 +77,13 @@ void SalMessageOp::fill_cbs() {
this->type=Type::Message;
}
void SalMessageOpInterface::prepare_message_request(belle_sip_request_t *req, const char* content_type, const char *msg) {
char content_type_raw[256];
size_t content_length = msg?strlen(msg):0;
time_t curtime = ms_time(NULL);
snprintf(content_type_raw,sizeof(content_type_raw),BELLE_SIP_CONTENT_TYPE ": %s",content_type);
belle_sip_message_add_header(BELLE_SIP_MESSAGE(req),BELLE_SIP_HEADER(belle_sip_header_content_type_parse(content_type_raw)));
belle_sip_message_add_header(BELLE_SIP_MESSAGE(req),BELLE_SIP_HEADER(belle_sip_header_content_length_create(content_length)));
belle_sip_message_add_header(BELLE_SIP_MESSAGE(req),BELLE_SIP_HEADER(belle_sip_header_date_create_from_time(&curtime)));
if (msg){
/*don't call set_body() with null argument because it resets content type and content length*/
belle_sip_message_set_body(BELLE_SIP_MESSAGE(req), msg, content_length);
}
}
int SalMessageOp::send_message(const char* content_type, const char *msg) {
int SalMessageOp::sendMessage (const Content &content) {
fill_cbs();
this->dir = Dir::Outgoing;
belle_sip_request_t *req = build_request("MESSAGE");
if (!req)
return -1;
prepare_message_request(req, content_type, msg);
prepareMessageRequest(req, content);
return send_request(req);
}

View file

@ -29,7 +29,7 @@ class SalMessageOp: public SalOp, public SalMessageOpInterface {
public:
SalMessageOp(Sal *sal): SalOp(sal) {}
int send_message(const char* content_type, const char *msg) override;
int sendMessage (const Content &content) override;
int reply(SalReason reason) override {return SalOp::reply_message(reason);}
private:

View file

@ -1040,7 +1040,7 @@ void SalOp::process_incoming_message(const belle_sip_request_event_t *event) {
salmsg.url = ms_strdup(belle_sip_parameters_get_parameter(BELLE_SIP_PARAMETERS(content_type),"URL")+1); /* skip first "*/
((char*)salmsg.url)[url_length-2]='\0'; /*remove trailing "*/
}
salmsg.message_id=message_id;
salmsg.time=date ? belle_sip_header_date_get_time(date) : time(NULL);
this->root->callbacks.message_received(this,&salmsg);

View file

@ -36,9 +36,10 @@
#if __clang__ || __GNUC__ >= 4
#pragma GCC diagnostic push
#pragma GCC diagnostic ignored "-Wfloat-equal"
#if __GNUC__ > 5 || (__GNUC__ == 5 && __GNUC_MINOR__ >= 1)
#pragma GCC diagnostic ignored "-Wsuggest-override"
#endif
#if __GNUC__ > 5 || (__GNUC__ == 5 && __GNUC_MINOR__ >= 1)
#pragma GCC diagnostic push
#pragma GCC diagnostic ignored "-Wsuggest-override"
#endif
//
// End prologue.
@ -54,7 +55,7 @@ namespace LinphonePrivate
namespace ConferenceInfo
{
// ConferenceType
//
//
const ConferenceType::ConferenceDescriptionOptional& ConferenceType::
getConferenceDescription () const
@ -376,7 +377,7 @@ namespace LinphonePrivate
// StateType
//
//
StateType::
StateType (Value v)
@ -413,7 +414,7 @@ namespace LinphonePrivate
StateType& StateType::
operator= (Value v)
{
static_cast< ::LinphonePrivate::Xsd::XmlSchema::String& > (*this) =
static_cast< ::LinphonePrivate::Xsd::XmlSchema::String& > (*this) =
::LinphonePrivate::Xsd::XmlSchema::String (_xsd_StateType_literals_[v]);
return *this;
@ -421,7 +422,7 @@ namespace LinphonePrivate
// ConferenceDescriptionType
//
//
const ConferenceDescriptionType::DisplayTextOptional& ConferenceDescriptionType::
getDisplayText () const
@ -707,7 +708,7 @@ namespace LinphonePrivate
// HostType
//
//
const HostType::DisplayTextOptional& HostType::
getDisplayText () const
@ -849,7 +850,7 @@ namespace LinphonePrivate
// ConferenceStateType
//
//
const ConferenceStateType::UserCountOptional& ConferenceStateType::
getUserCount () const
@ -973,7 +974,7 @@ namespace LinphonePrivate
// ConferenceMediaType
//
//
const ConferenceMediaType::EntrySequence& ConferenceMediaType::
getEntry () const
@ -1025,7 +1026,7 @@ namespace LinphonePrivate
// ConferenceMediumType
//
//
const ConferenceMediumType::DisplayTextOptional& ConferenceMediumType::
getDisplayText () const
@ -1197,7 +1198,7 @@ namespace LinphonePrivate
// UrisType
//
//
const UrisType::EntrySequence& UrisType::
getEntry () const
@ -1285,7 +1286,7 @@ namespace LinphonePrivate
// UriType
//
//
const UriType::UriType1& UriType::
getUri () const
@ -1481,7 +1482,7 @@ namespace LinphonePrivate
}
// UsersType
//
//
const UsersType::UserSequence& UsersType::
getUser () const
@ -1587,7 +1588,7 @@ namespace LinphonePrivate
// UserType
//
//
const UserType::DisplayTextOptional& UserType::
getDisplayText () const
@ -1873,7 +1874,7 @@ namespace LinphonePrivate
// UserRolesType
//
//
const UserRolesType::EntrySequence& UserRolesType::
getEntry () const
@ -1949,7 +1950,7 @@ namespace LinphonePrivate
}
// EndpointType
//
//
const EndpointType::DisplayTextOptional& EndpointType::
getDisplayText () const
@ -2325,7 +2326,7 @@ namespace LinphonePrivate
// EndpointStatusType
//
//
EndpointStatusType::
EndpointStatusType (Value v)
@ -2362,7 +2363,7 @@ namespace LinphonePrivate
EndpointStatusType& EndpointStatusType::
operator= (Value v)
{
static_cast< ::LinphonePrivate::Xsd::XmlSchema::String& > (*this) =
static_cast< ::LinphonePrivate::Xsd::XmlSchema::String& > (*this) =
::LinphonePrivate::Xsd::XmlSchema::String (_xsd_EndpointStatusType_literals_[v]);
return *this;
@ -2370,7 +2371,7 @@ namespace LinphonePrivate
// JoiningType
//
//
JoiningType::
JoiningType (Value v)
@ -2407,7 +2408,7 @@ namespace LinphonePrivate
JoiningType& JoiningType::
operator= (Value v)
{
static_cast< ::LinphonePrivate::Xsd::XmlSchema::String& > (*this) =
static_cast< ::LinphonePrivate::Xsd::XmlSchema::String& > (*this) =
::LinphonePrivate::Xsd::XmlSchema::String (_xsd_JoiningType_literals_[v]);
return *this;
@ -2415,7 +2416,7 @@ namespace LinphonePrivate
// DisconnectionType
//
//
DisconnectionType::
DisconnectionType (Value v)
@ -2452,7 +2453,7 @@ namespace LinphonePrivate
DisconnectionType& DisconnectionType::
operator= (Value v)
{
static_cast< ::LinphonePrivate::Xsd::XmlSchema::String& > (*this) =
static_cast< ::LinphonePrivate::Xsd::XmlSchema::String& > (*this) =
::LinphonePrivate::Xsd::XmlSchema::String (_xsd_DisconnectionType_literals_[v]);
return *this;
@ -2460,7 +2461,7 @@ namespace LinphonePrivate
// ExecutionType
//
//
const ExecutionType::WhenOptional& ExecutionType::
getWhen () const
@ -2584,7 +2585,7 @@ namespace LinphonePrivate
// CallType
//
//
const CallType::SipOptional& CallType::
getSip () const
@ -2666,7 +2667,7 @@ namespace LinphonePrivate
// SipDialogIdType
//
//
const SipDialogIdType::DisplayTextOptional& SipDialogIdType::
getDisplayText () const
@ -2838,7 +2839,7 @@ namespace LinphonePrivate
// MediaType
//
//
const MediaType::DisplayTextOptional& MediaType::
getDisplayText () const
@ -3070,7 +3071,7 @@ namespace LinphonePrivate
// MediaStatusType
//
//
MediaStatusType::
MediaStatusType (Value v)
@ -3107,7 +3108,7 @@ namespace LinphonePrivate
MediaStatusType& MediaStatusType::
operator= (Value v)
{
static_cast< ::LinphonePrivate::Xsd::XmlSchema::String& > (*this) =
static_cast< ::LinphonePrivate::Xsd::XmlSchema::String& > (*this) =
::LinphonePrivate::Xsd::XmlSchema::String (_xsd_MediaStatusType_literals_[v]);
return *this;
@ -3115,7 +3116,7 @@ namespace LinphonePrivate
// SidebarsByValType
//
//
const SidebarsByValType::EntrySequence& SidebarsByValType::
getEntry () const
@ -3208,6 +3209,15 @@ namespace LinphonePrivate
#include <xsd/cxx/xml/dom/parsing-source.hxx>
#include <xsd/cxx/tree/type-factory-map.hxx>
namespace _xsd
{
static
const ::xsd::cxx::tree::type_factory_plate< 0, char >
type_factory_plate_init;
}
namespace LinphonePrivate
{
namespace Xsd
@ -6779,6 +6789,15 @@ namespace LinphonePrivate
#include <ostream>
#include <xsd/cxx/tree/std-ostream-map.hxx>
namespace _xsd
{
static
const ::xsd::cxx::tree::std_ostream_plate< 0, char >
std_ostream_plate_init;
}
namespace LinphonePrivate
{
namespace Xsd
@ -7563,6 +7582,15 @@ namespace LinphonePrivate
#include <xsd/cxx/tree/error-handler.hxx>
#include <xsd/cxx/xml/dom/serialization-source.hxx>
#include <xsd/cxx/tree/type-serializer-map.hxx>
namespace _xsd
{
static
const ::xsd::cxx::tree::type_serializer_plate< 0, char >
type_serializer_plate_init;
}
namespace LinphonePrivate
{
namespace Xsd
@ -9304,8 +9332,12 @@ namespace LinphonePrivate
// Begin epilogue.
//
#if __GNUC__ > 5 || (__GNUC__ == 5 && __GNUC_MINOR__ >= 1)
#pragma GCC diagnostic pop
#endif
#if __clang__ || __GNUC__ >= 4
#pragma GCC diagnostic pop
#endif
//
// End epilogue.

View file

@ -51,9 +51,10 @@
#if __clang__ || __GNUC__ >= 4
#pragma GCC diagnostic push
#pragma GCC diagnostic ignored "-Wfloat-equal"
#if __GNUC__ > 5 || (__GNUC__ == 5 && __GNUC_MINOR__ >= 1)
#pragma GCC diagnostic ignored "-Wsuggest-override"
#endif
#if __GNUC__ > 5 || (__GNUC__ == 5 && __GNUC_MINOR__ >= 1)
#pragma GCC diagnostic push
#pragma GCC diagnostic ignored "-Wsuggest-override"
#endif
//
// End prologue.
@ -240,6 +241,8 @@ namespace LinphonePrivate
typedef ::xsd::cxx::tree::unexpected_enumerator< char > UnexpectedEnumerator;
typedef ::xsd::cxx::tree::expected_text_content< char > ExpectedTextContent;
typedef ::xsd::cxx::tree::no_prefix_mapping< char > NoPrefixMapping;
typedef ::xsd::cxx::tree::no_type_info< char > NoTypeInfo;
typedef ::xsd::cxx::tree::not_derived< char > NotDerived;
typedef ::xsd::cxx::tree::serialization< char > Serialization;
// Error handler callback interface.
@ -573,7 +576,7 @@ namespace LinphonePrivate
ConferenceType&
operator= (const ConferenceType& x);
virtual
virtual
~ConferenceType ();
// Implementation.
@ -882,7 +885,7 @@ namespace LinphonePrivate
ConferenceDescriptionType&
operator= (const ConferenceDescriptionType& x);
virtual
virtual
~ConferenceDescriptionType ();
// Implementation.
@ -1030,7 +1033,7 @@ namespace LinphonePrivate
HostType&
operator= (const HostType& x);
virtual
virtual
~HostType ();
// Implementation.
@ -1164,7 +1167,7 @@ namespace LinphonePrivate
ConferenceStateType&
operator= (const ConferenceStateType& x);
virtual
virtual
~ConferenceStateType ();
// Implementation.
@ -1246,7 +1249,7 @@ namespace LinphonePrivate
ConferenceMediaType&
operator= (const ConferenceMediaType& x);
virtual
virtual
~ConferenceMediaType ();
// Implementation.
@ -1406,7 +1409,7 @@ namespace LinphonePrivate
ConferenceMediumType&
operator= (const ConferenceMediumType& x);
virtual
virtual
~ConferenceMediumType ();
// Implementation.
@ -1512,7 +1515,7 @@ namespace LinphonePrivate
UrisType&
operator= (const UrisType& x);
virtual
virtual
~UrisType ();
// Implementation.
@ -1674,7 +1677,7 @@ namespace LinphonePrivate
UriType&
operator= (const UriType& x);
virtual
virtual
~UriType ();
// Implementation.
@ -1730,7 +1733,7 @@ namespace LinphonePrivate
_clone (::LinphonePrivate::Xsd::XmlSchema::Flags f = 0,
::LinphonePrivate::Xsd::XmlSchema::Container* c = 0) const;
virtual
virtual
~KeywordsType ();
};
@ -1834,7 +1837,7 @@ namespace LinphonePrivate
UsersType&
operator= (const UsersType& x);
virtual
virtual
~UsersType ();
// Implementation.
@ -2080,7 +2083,7 @@ namespace LinphonePrivate
UserType&
operator= (const UserType& x);
virtual
virtual
~UserType ();
// Implementation.
@ -2168,7 +2171,7 @@ namespace LinphonePrivate
UserRolesType&
operator= (const UserRolesType& x);
virtual
virtual
~UserRolesType ();
// Implementation.
@ -2220,7 +2223,7 @@ namespace LinphonePrivate
_clone (::LinphonePrivate::Xsd::XmlSchema::Flags f = 0,
::LinphonePrivate::Xsd::XmlSchema::Container* c = 0) const;
virtual
virtual
~UserLanguagesType ();
};
@ -2513,7 +2516,7 @@ namespace LinphonePrivate
EndpointType&
operator= (const EndpointType& x);
virtual
virtual
~EndpointType ();
// Implementation.
@ -2828,7 +2831,7 @@ namespace LinphonePrivate
ExecutionType&
operator= (const ExecutionType& x);
virtual
virtual
~ExecutionType ();
// Implementation.
@ -2928,7 +2931,7 @@ namespace LinphonePrivate
CallType&
operator= (const CallType& x);
virtual
virtual
~CallType ();
// Implementation.
@ -3089,7 +3092,7 @@ namespace LinphonePrivate
SipDialogIdType&
operator= (const SipDialogIdType& x);
virtual
virtual
~SipDialogIdType ();
// Implementation.
@ -3295,7 +3298,7 @@ namespace LinphonePrivate
MediaType&
operator= (const MediaType& x);
virtual
virtual
~MediaType ();
// Implementation.
@ -3461,7 +3464,7 @@ namespace LinphonePrivate
SidebarsByValType&
operator= (const SidebarsByValType& x);
virtual
virtual
~SidebarsByValType ();
// Implementation.
@ -3708,14 +3711,14 @@ namespace LinphonePrivate
void
serializeConferenceInfo (::std::ostream& os,
const ::LinphonePrivate::Xsd::ConferenceInfo::ConferenceType& x,
const ::LinphonePrivate::Xsd::ConferenceInfo::ConferenceType& x,
const ::LinphonePrivate::Xsd::XmlSchema::NamespaceInfomap& m = ::LinphonePrivate::Xsd::XmlSchema::NamespaceInfomap (),
const ::std::string& e = "UTF-8",
::LinphonePrivate::Xsd::XmlSchema::Flags f = 0);
void
serializeConferenceInfo (::std::ostream& os,
const ::LinphonePrivate::Xsd::ConferenceInfo::ConferenceType& x,
const ::LinphonePrivate::Xsd::ConferenceInfo::ConferenceType& x,
::LinphonePrivate::Xsd::XmlSchema::ErrorHandler& eh,
const ::LinphonePrivate::Xsd::XmlSchema::NamespaceInfomap& m = ::LinphonePrivate::Xsd::XmlSchema::NamespaceInfomap (),
const ::std::string& e = "UTF-8",
@ -3723,7 +3726,7 @@ namespace LinphonePrivate
void
serializeConferenceInfo (::std::ostream& os,
const ::LinphonePrivate::Xsd::ConferenceInfo::ConferenceType& x,
const ::LinphonePrivate::Xsd::ConferenceInfo::ConferenceType& x,
::xercesc::DOMErrorHandler& eh,
const ::LinphonePrivate::Xsd::XmlSchema::NamespaceInfomap& m = ::LinphonePrivate::Xsd::XmlSchema::NamespaceInfomap (),
const ::std::string& e = "UTF-8",
@ -3734,14 +3737,14 @@ namespace LinphonePrivate
void
serializeConferenceInfo (::xercesc::XMLFormatTarget& ft,
const ::LinphonePrivate::Xsd::ConferenceInfo::ConferenceType& x,
const ::LinphonePrivate::Xsd::ConferenceInfo::ConferenceType& x,
const ::LinphonePrivate::Xsd::XmlSchema::NamespaceInfomap& m = ::LinphonePrivate::Xsd::XmlSchema::NamespaceInfomap (),
const ::std::string& e = "UTF-8",
::LinphonePrivate::Xsd::XmlSchema::Flags f = 0);
void
serializeConferenceInfo (::xercesc::XMLFormatTarget& ft,
const ::LinphonePrivate::Xsd::ConferenceInfo::ConferenceType& x,
const ::LinphonePrivate::Xsd::ConferenceInfo::ConferenceType& x,
::LinphonePrivate::Xsd::XmlSchema::ErrorHandler& eh,
const ::LinphonePrivate::Xsd::XmlSchema::NamespaceInfomap& m = ::LinphonePrivate::Xsd::XmlSchema::NamespaceInfomap (),
const ::std::string& e = "UTF-8",
@ -3749,7 +3752,7 @@ namespace LinphonePrivate
void
serializeConferenceInfo (::xercesc::XMLFormatTarget& ft,
const ::LinphonePrivate::Xsd::ConferenceInfo::ConferenceType& x,
const ::LinphonePrivate::Xsd::ConferenceInfo::ConferenceType& x,
::xercesc::DOMErrorHandler& eh,
const ::LinphonePrivate::Xsd::XmlSchema::NamespaceInfomap& m = ::LinphonePrivate::Xsd::XmlSchema::NamespaceInfomap (),
const ::std::string& e = "UTF-8",
@ -3767,7 +3770,7 @@ namespace LinphonePrivate
//
::LinphonePrivate::Xsd::XmlSchema::dom::unique_ptr< ::xercesc::DOMDocument >
serializeConferenceInfo (const ::LinphonePrivate::Xsd::ConferenceInfo::ConferenceType& x,
serializeConferenceInfo (const ::LinphonePrivate::Xsd::ConferenceInfo::ConferenceType& x,
const ::LinphonePrivate::Xsd::XmlSchema::NamespaceInfomap& m = ::LinphonePrivate::Xsd::XmlSchema::NamespaceInfomap (),
::LinphonePrivate::Xsd::XmlSchema::Flags f = 0);
@ -3899,6 +3902,9 @@ namespace LinphonePrivate
// Begin epilogue.
//
#if __GNUC__ > 5 || (__GNUC__ == 5 && __GNUC_MINOR__ >= 1)
#pragma GCC diagnostic pop
#endif
#if __clang__ || __GNUC__ >= 4
#pragma GCC diagnostic pop
#endif

View file

@ -1,3 +1,6 @@
#if __GNUC__ > 5 || (__GNUC__ == 5 && __GNUC_MINOR__ >= 1)
#pragma GCC diagnostic pop
#endif
#if __clang__ || __GNUC__ >= 4
#pragma GCC diagnostic pop
#endif

View file

@ -51,6 +51,7 @@ def generate(name):
"--generate-serialization",
"--generate-ostream",
"--generate-detach",
"--generate-polymorphic",
"--std", "c++11",
"--type-naming", "java",
"--function-naming", "java",
@ -62,6 +63,7 @@ def generate(name):
"--show-sloc",
"--prologue-file", prologue_file,
"--epilogue-file", epilogue_file,
"--root-element-first",
"--type-regex", "%(?:[^ ]* )?([^,-]+)-([^,-]+)-([^,-]+)-?([^,-]*)%\\u$1\\u$2\\u$3\\u$4%",
"--type-regex", "%(?:[^ ]* )?([^,-]+)-([^,-]+)-?([^,-]*)%\\u$1\\u$2\\u$3%",
"--type-regex", "%(?:[^ ]* )?([^,-]+)-?([^,-]*)%\\u$1\\u$2%",
@ -90,6 +92,9 @@ def generate(name):
"--serializer-regex", "%([^-]+)-?([^-]*)%serialize\\u$1\\u$2%",
"--namespace-map", "http://www.w3.org/2001/XMLSchema=LinphonePrivate::Xsd::XmlSchema",
"--namespace-map", "urn:ietf:params:xml:ns:conference-info=LinphonePrivate::Xsd::ConferenceInfo",
"--namespace-map", "urn:ietf:params:xml:ns:imdn=LinphonePrivate::Xsd::Imdn",
"--namespace-map", "urn:ietf:params:xml:ns:im-iscomposing=LinphonePrivate::Xsd::IsComposing",
"--namespace-map", "http://www.linphone.org/xsds/imdn.xsd=LinphonePrivate::Xsd::LinphoneImdn",
"--namespace-map", "urn:ietf:params:xml:ns:resource-lists=LinphonePrivate::Xsd::ResourceLists",
source_file
], shell=False)
@ -100,6 +105,9 @@ def generate(name):
def main(argv = None):
generate("xml")
generate("conference-info")
generate("imdn")
generate("is-composing")
generate("linphone-imdn")
generate("resource-lists")
if __name__ == "__main__":

3440
src/xml/imdn.cpp Normal file

File diff suppressed because it is too large Load diff

1730
src/xml/imdn.h Normal file

File diff suppressed because it is too large Load diff

158
src/xml/imdn.xsd Normal file
View file

@ -0,0 +1,158 @@
<?xml version="1.0" encoding="UTF-8"?>
<xs:schema xmlns:xs="http://www.w3.org/2001/XMLSchema"
elementFormDefault="qualified"
targetNamespace="urn:ietf:params:xml:ns:imdn"
xmlns:ns1="urn:ietf:params:xml:ns:imdn"
xmlns:ns2="http://www.linphone.org/xsds/imdn.xsd">
<xs:import namespace="http://www.linphone.org/xsds/imdn.xsd" schemaLocation="linphone-imdn.xsd"/>
<xs:element name="imdn">
<xs:complexType>
<xs:sequence>
<xs:element ref="ns1:message-id"/>
<xs:element ref="ns1:datetime"/>
<xs:sequence minOccurs="0">
<xs:element ref="ns1:recipient-uri"/>
<xs:element ref="ns1:original-recipient-uri"/>
<xs:element minOccurs="0" ref="ns1:subject"/>
</xs:sequence>
<xs:choice minOccurs="0">
<xs:element ref="ns1:delivery-notification"/>
<xs:element ref="ns1:display-notification"/>
<xs:element ref="ns1:processing-notification"/>
</xs:choice>
<xs:group ref="ns1:imdnExtension"/>
</xs:sequence>
</xs:complexType>
</xs:element>
<xs:element name="message-id" type="xs:token"/>
<xs:element name="datetime" type="xs:string"/>
<xs:element name="recipient-uri" type="xs:anyURI"/>
<xs:element name="original-recipient-uri" type="xs:anyURI"/>
<xs:element name="subject" type="xs:string"/>
<xs:element name="delivery-notification">
<xs:complexType>
<xs:sequence>
<xs:element name="status">
<xs:complexType>
<xs:sequence>
<xs:choice>
<xs:element ref="ns1:delivered"/>
<xs:element ref="ns1:failed"/>
<xs:element ref="ns1:forbidden"/>
<xs:element ref="ns1:error"/>
</xs:choice>
<xs:group ref="ns1:deliveryExtension"/>
</xs:sequence>
</xs:complexType>
</xs:element>
</xs:sequence>
</xs:complexType>
</xs:element>
<xs:element name="delivered">
<xs:complexType/>
</xs:element>
<xs:element name="failed">
<xs:complexType/>
</xs:element>
<xs:element name="display-notification">
<xs:complexType>
<xs:sequence>
<xs:element name="status">
<xs:complexType>
<xs:sequence>
<xs:choice>
<xs:element ref="ns1:displayed"/>
<xs:element ref="ns1:forbidden"/>
<xs:element ref="ns1:error"/>
</xs:choice>
<xs:group ref="ns1:displayExtension"/>
</xs:sequence>
</xs:complexType>
</xs:element>
</xs:sequence>
</xs:complexType>
</xs:element>
<xs:element name="displayed">
<xs:complexType/>
</xs:element>
<xs:element name="processing-notification">
<xs:complexType>
<xs:sequence>
<xs:element name="status">
<xs:complexType>
<xs:sequence>
<xs:choice>
<xs:element ref="ns1:processed"/>
<xs:element ref="ns1:stored"/>
<xs:element ref="ns1:forbidden"/>
<xs:element ref="ns1:error"/>
</xs:choice>
<xs:group ref="ns1:processingExtension"/>
</xs:sequence>
</xs:complexType>
</xs:element>
</xs:sequence>
</xs:complexType>
</xs:element>
<xs:element name="processed">
<xs:complexType/>
</xs:element>
<xs:element name="stored">
<xs:complexType/>
</xs:element>
<xs:element name="forbidden">
<xs:complexType/>
</xs:element>
<xs:element name="error">
<xs:complexType/>
</xs:element>
<!--
<imdn> extension point for the extension schemas to add
new definitions with the combine="interleave" pattern.
Extension schemas should add proper cardinalities. For
example, the <zeroOrMore> cardinality should be used if
the extension is to allow multiple elements, and the
<optional> cardinality should be used if the extension
is to allow a single optional element.
-->
<xs:group name="imdnExtension">
<xs:sequence>
<xs:group minOccurs="0" maxOccurs="unbounded" ref="ns1:anyIMDN"/>
</xs:sequence>
</xs:group>
<!-- delivery-notification <status> extension point -->
<xs:group name="deliveryExtension">
<!--<xs:sequence>
<xs:group minOccurs="0" maxOccurs="unbounded" ref="ns1:anyIMDN"/>
</xs:sequence>-->
<xs:sequence>
<xs:element minOccurs="0" maxOccurs="1" ref="ns2:reason"/>
</xs:sequence>
</xs:group>
<!-- display-notification <status> extension point -->
<xs:group name="displayExtension">
<xs:sequence>
<xs:group minOccurs="0" maxOccurs="unbounded" ref="ns1:anyIMDN"/>
</xs:sequence>
</xs:group>
<!-- processing-notification <status> extension point -->
<xs:group name="processingExtension">
<xs:sequence>
<xs:group minOccurs="0" maxOccurs="unbounded" ref="ns1:anyIMDN"/>
</xs:sequence>
</xs:group>
<!--
wildcard definition for complex elements (of mixed type)
unqualified or qualified in the imdn namespace.
Extension schemas MUST redefine this or the
individual, previous definitions that use this definition.
In other words, the extension schema MUST reduce the
allowable content in order to maintain deterministic
and unambiguous schemas with the interleave pattern.
-->
<xs:group name="anyIMDN">
<xs:sequence>
<xs:any namespace="##other" processContents="skip"/>
</xs:sequence>
</xs:group>
</xs:schema>

962
src/xml/is-composing.cpp Normal file
View file

@ -0,0 +1,962 @@
// Copyright (c) 2005-2014 Code Synthesis Tools CC
//
// This program was generated by CodeSynthesis XSD, an XML Schema to
// C++ data binding compiler.
//
// This program is free software; you can redistribute it and/or modify
// it under the terms of the GNU General Public License version 2 as
// published by the Free Software Foundation.
//
// 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 St, Fifth Floor, Boston, MA 02110-1301 USA
//
// In addition, as a special exception, Code Synthesis Tools CC gives
// permission to link this program with the Xerces-C++ library (or with
// modified versions of Xerces-C++ that use the same license as Xerces-C++),
// and distribute linked combinations including the two. You must obey
// the GNU General Public License version 2 in all respects for all of
// the code used other than Xerces-C++. If you modify this copy of the
// program, you may extend this exception to your version of the program,
// but you are not obligated to do so. If you do not wish to do so, delete
// this exception statement from your version.
//
// Furthermore, Code Synthesis Tools CC makes a special exception for
// the Free/Libre and Open Source Software (FLOSS) which is described
// in the accompanying FLOSSE file.
//
// Begin prologue.
//
#if __clang__ || __GNUC__ >= 4
#pragma GCC diagnostic push
#pragma GCC diagnostic ignored "-Wfloat-equal"
#endif
#if __GNUC__ > 5 || (__GNUC__ == 5 && __GNUC_MINOR__ >= 1)
#pragma GCC diagnostic push
#pragma GCC diagnostic ignored "-Wsuggest-override"
#endif
//
// End prologue.
#include <xsd/cxx/pre.hxx>
#include "is-composing.h"
namespace LinphonePrivate
{
namespace Xsd
{
namespace IsComposing
{
// IsComposing
//
const IsComposing::StateType& IsComposing::
getState () const
{
return this->state_.get ();
}
IsComposing::StateType& IsComposing::
getState ()
{
return this->state_.get ();
}
void IsComposing::
setState (const StateType& x)
{
this->state_.set (x);
}
void IsComposing::
setState (::std::unique_ptr< StateType > x)
{
this->state_.set (std::move (x));
}
::std::unique_ptr< IsComposing::StateType > IsComposing::
setDetachState ()
{
return this->state_.detach ();
}
const IsComposing::LastactiveOptional& IsComposing::
getLastactive () const
{
return this->lastactive_;
}
IsComposing::LastactiveOptional& IsComposing::
getLastactive ()
{
return this->lastactive_;
}
void IsComposing::
setLastactive (const LastactiveType& x)
{
this->lastactive_.set (x);
}
void IsComposing::
setLastactive (const LastactiveOptional& x)
{
this->lastactive_ = x;
}
void IsComposing::
setLastactive (::std::unique_ptr< LastactiveType > x)
{
this->lastactive_.set (std::move (x));
}
const IsComposing::ContenttypeOptional& IsComposing::
getContenttype () const
{
return this->contenttype_;
}
IsComposing::ContenttypeOptional& IsComposing::
getContenttype ()
{
return this->contenttype_;
}
void IsComposing::
setContenttype (const ContenttypeType& x)
{
this->contenttype_.set (x);
}
void IsComposing::
setContenttype (const ContenttypeOptional& x)
{
this->contenttype_ = x;
}
void IsComposing::
setContenttype (::std::unique_ptr< ContenttypeType > x)
{
this->contenttype_.set (std::move (x));
}
const IsComposing::RefreshOptional& IsComposing::
getRefresh () const
{
return this->refresh_;
}
IsComposing::RefreshOptional& IsComposing::
getRefresh ()
{
return this->refresh_;
}
void IsComposing::
setRefresh (const RefreshType& x)
{
this->refresh_.set (x);
}
void IsComposing::
setRefresh (const RefreshOptional& x)
{
this->refresh_ = x;
}
const IsComposing::AnySequence& IsComposing::
getAny () const
{
return this->any_;
}
IsComposing::AnySequence& IsComposing::
getAny ()
{
return this->any_;
}
void IsComposing::
setAny (const AnySequence& s)
{
this->any_ = s;
}
const ::xercesc::DOMDocument& IsComposing::
getDomDocument () const
{
return *this->dom_document_;
}
::xercesc::DOMDocument& IsComposing::
getDomDocument ()
{
return *this->dom_document_;
}
}
}
}
#include <xsd/cxx/xml/dom/wildcard-source.hxx>
#include <xsd/cxx/xml/dom/parsing-source.hxx>
#include <xsd/cxx/tree/type-factory-map.hxx>
namespace _xsd
{
static
const ::xsd::cxx::tree::type_factory_plate< 0, char >
type_factory_plate_init;
}
namespace LinphonePrivate
{
namespace Xsd
{
namespace IsComposing
{
// IsComposing
//
IsComposing::
IsComposing (const StateType& state)
: ::LinphonePrivate::Xsd::XmlSchema::Type (),
dom_document_ (::xsd::cxx::xml::dom::create_document< char > ()),
state_ (state, this),
lastactive_ (this),
contenttype_ (this),
refresh_ (this),
any_ (this->getDomDocument ())
{
}
IsComposing::
IsComposing (const IsComposing& x,
::LinphonePrivate::Xsd::XmlSchema::Flags f,
::LinphonePrivate::Xsd::XmlSchema::Container* c)
: ::LinphonePrivate::Xsd::XmlSchema::Type (x, f, c),
dom_document_ (::xsd::cxx::xml::dom::create_document< char > ()),
state_ (x.state_, f, this),
lastactive_ (x.lastactive_, f, this),
contenttype_ (x.contenttype_, f, this),
refresh_ (x.refresh_, f, this),
any_ (x.any_, this->getDomDocument ())
{
}
IsComposing::
IsComposing (const ::xercesc::DOMElement& e,
::LinphonePrivate::Xsd::XmlSchema::Flags f,
::LinphonePrivate::Xsd::XmlSchema::Container* c)
: ::LinphonePrivate::Xsd::XmlSchema::Type (e, f | ::LinphonePrivate::Xsd::XmlSchema::Flags::base, c),
dom_document_ (::xsd::cxx::xml::dom::create_document< char > ()),
state_ (this),
lastactive_ (this),
contenttype_ (this),
refresh_ (this),
any_ (this->getDomDocument ())
{
if ((f & ::LinphonePrivate::Xsd::XmlSchema::Flags::base) == 0)
{
::xsd::cxx::xml::dom::parser< char > p (e, true, false, false);
this->parse (p, f);
}
}
void IsComposing::
parse (::xsd::cxx::xml::dom::parser< char >& p,
::LinphonePrivate::Xsd::XmlSchema::Flags f)
{
for (; p.more_content (); p.next_content (false))
{
const ::xercesc::DOMElement& i (p.cur_element ());
const ::xsd::cxx::xml::qualified_name< char > n (
::xsd::cxx::xml::dom::name< char > (i));
// state
//
if (n.name () == "state" && n.namespace_ () == "urn:ietf:params:xml:ns:im-iscomposing")
{
::std::unique_ptr< StateType > r (
StateTraits::create (i, f, this));
if (!state_.present ())
{
this->state_.set (::std::move (r));
continue;
}
}
// lastactive
//
if (n.name () == "lastactive" && n.namespace_ () == "urn:ietf:params:xml:ns:im-iscomposing")
{
::std::unique_ptr< LastactiveType > r (
LastactiveTraits::create (i, f, this));
if (!this->lastactive_)
{
this->lastactive_.set (::std::move (r));
continue;
}
}
// contenttype
//
if (n.name () == "contenttype" && n.namespace_ () == "urn:ietf:params:xml:ns:im-iscomposing")
{
::std::unique_ptr< ContenttypeType > r (
ContenttypeTraits::create (i, f, this));
if (!this->contenttype_)
{
this->contenttype_.set (::std::move (r));
continue;
}
}
// refresh
//
if (n.name () == "refresh" && n.namespace_ () == "urn:ietf:params:xml:ns:im-iscomposing")
{
if (!this->refresh_)
{
this->refresh_.set (RefreshTraits::create (i, f, this));
continue;
}
}
// any
//
if ((!n.namespace_ ().empty () && n.namespace_ () != "urn:ietf:params:xml:ns:im-iscomposing"))
{
::xercesc::DOMElement* r (
static_cast< ::xercesc::DOMElement* > (
this->getDomDocument ().importNode (
const_cast< ::xercesc::DOMElement* > (&i), true)));
this->any_.push_back (r);
continue;
}
break;
}
if (!state_.present ())
{
throw ::xsd::cxx::tree::expected_element< char > (
"state",
"urn:ietf:params:xml:ns:im-iscomposing");
}
}
IsComposing* IsComposing::
_clone (::LinphonePrivate::Xsd::XmlSchema::Flags f,
::LinphonePrivate::Xsd::XmlSchema::Container* c) const
{
return new class IsComposing (*this, f, c);
}
IsComposing& IsComposing::
operator= (const IsComposing& x)
{
if (this != &x)
{
static_cast< ::LinphonePrivate::Xsd::XmlSchema::Type& > (*this) = x;
this->state_ = x.state_;
this->lastactive_ = x.lastactive_;
this->contenttype_ = x.contenttype_;
this->refresh_ = x.refresh_;
this->any_ = x.any_;
}
return *this;
}
IsComposing::
~IsComposing ()
{
}
}
}
}
#include <ostream>
#include <xsd/cxx/tree/std-ostream-map.hxx>
namespace _xsd
{
static
const ::xsd::cxx::tree::std_ostream_plate< 0, char >
std_ostream_plate_init;
}
namespace LinphonePrivate
{
namespace Xsd
{
namespace IsComposing
{
::std::ostream&
operator<< (::std::ostream& o, const IsComposing& i)
{
o << ::std::endl << "state: " << i.getState ();
if (i.getLastactive ())
{
o << ::std::endl << "lastactive: " << *i.getLastactive ();
}
if (i.getContenttype ())
{
o << ::std::endl << "contenttype: " << *i.getContenttype ();
}
if (i.getRefresh ())
{
o << ::std::endl << "refresh: " << *i.getRefresh ();
}
return o;
}
}
}
}
#include <istream>
#include <xsd/cxx/xml/sax/std-input-source.hxx>
#include <xsd/cxx/tree/error-handler.hxx>
namespace LinphonePrivate
{
namespace Xsd
{
namespace IsComposing
{
::std::unique_ptr< ::LinphonePrivate::Xsd::IsComposing::IsComposing >
parseIsComposing (const ::std::string& u,
::LinphonePrivate::Xsd::XmlSchema::Flags f,
const ::LinphonePrivate::Xsd::XmlSchema::Properties& p)
{
::xsd::cxx::xml::auto_initializer i (
(f & ::LinphonePrivate::Xsd::XmlSchema::Flags::dont_initialize) == 0,
(f & ::LinphonePrivate::Xsd::XmlSchema::Flags::keep_dom) == 0);
::xsd::cxx::tree::error_handler< char > h;
::LinphonePrivate::Xsd::XmlSchema::dom::unique_ptr< ::xercesc::DOMDocument > d (
::xsd::cxx::xml::dom::parse< char > (
u, h, p, f));
h.throw_if_failed< ::xsd::cxx::tree::parsing< char > > ();
return ::std::unique_ptr< ::LinphonePrivate::Xsd::IsComposing::IsComposing > (
::LinphonePrivate::Xsd::IsComposing::parseIsComposing (
std::move (d), f | ::LinphonePrivate::Xsd::XmlSchema::Flags::own_dom, p));
}
::std::unique_ptr< ::LinphonePrivate::Xsd::IsComposing::IsComposing >
parseIsComposing (const ::std::string& u,
::LinphonePrivate::Xsd::XmlSchema::ErrorHandler& h,
::LinphonePrivate::Xsd::XmlSchema::Flags f,
const ::LinphonePrivate::Xsd::XmlSchema::Properties& p)
{
::xsd::cxx::xml::auto_initializer i (
(f & ::LinphonePrivate::Xsd::XmlSchema::Flags::dont_initialize) == 0,
(f & ::LinphonePrivate::Xsd::XmlSchema::Flags::keep_dom) == 0);
::LinphonePrivate::Xsd::XmlSchema::dom::unique_ptr< ::xercesc::DOMDocument > d (
::xsd::cxx::xml::dom::parse< char > (
u, h, p, f));
if (!d.get ())
throw ::xsd::cxx::tree::parsing< char > ();
return ::std::unique_ptr< ::LinphonePrivate::Xsd::IsComposing::IsComposing > (
::LinphonePrivate::Xsd::IsComposing::parseIsComposing (
std::move (d), f | ::LinphonePrivate::Xsd::XmlSchema::Flags::own_dom, p));
}
::std::unique_ptr< ::LinphonePrivate::Xsd::IsComposing::IsComposing >
parseIsComposing (const ::std::string& u,
::xercesc::DOMErrorHandler& h,
::LinphonePrivate::Xsd::XmlSchema::Flags f,
const ::LinphonePrivate::Xsd::XmlSchema::Properties& p)
{
::LinphonePrivate::Xsd::XmlSchema::dom::unique_ptr< ::xercesc::DOMDocument > d (
::xsd::cxx::xml::dom::parse< char > (
u, h, p, f));
if (!d.get ())
throw ::xsd::cxx::tree::parsing< char > ();
return ::std::unique_ptr< ::LinphonePrivate::Xsd::IsComposing::IsComposing > (
::LinphonePrivate::Xsd::IsComposing::parseIsComposing (
std::move (d), f | ::LinphonePrivate::Xsd::XmlSchema::Flags::own_dom, p));
}
::std::unique_ptr< ::LinphonePrivate::Xsd::IsComposing::IsComposing >
parseIsComposing (::std::istream& is,
::LinphonePrivate::Xsd::XmlSchema::Flags f,
const ::LinphonePrivate::Xsd::XmlSchema::Properties& p)
{
::xsd::cxx::xml::auto_initializer i (
(f & ::LinphonePrivate::Xsd::XmlSchema::Flags::dont_initialize) == 0,
(f & ::LinphonePrivate::Xsd::XmlSchema::Flags::keep_dom) == 0);
::xsd::cxx::xml::sax::std_input_source isrc (is);
return ::LinphonePrivate::Xsd::IsComposing::parseIsComposing (isrc, f, p);
}
::std::unique_ptr< ::LinphonePrivate::Xsd::IsComposing::IsComposing >
parseIsComposing (::std::istream& is,
::LinphonePrivate::Xsd::XmlSchema::ErrorHandler& h,
::LinphonePrivate::Xsd::XmlSchema::Flags f,
const ::LinphonePrivate::Xsd::XmlSchema::Properties& p)
{
::xsd::cxx::xml::auto_initializer i (
(f & ::LinphonePrivate::Xsd::XmlSchema::Flags::dont_initialize) == 0,
(f & ::LinphonePrivate::Xsd::XmlSchema::Flags::keep_dom) == 0);
::xsd::cxx::xml::sax::std_input_source isrc (is);
return ::LinphonePrivate::Xsd::IsComposing::parseIsComposing (isrc, h, f, p);
}
::std::unique_ptr< ::LinphonePrivate::Xsd::IsComposing::IsComposing >
parseIsComposing (::std::istream& is,
::xercesc::DOMErrorHandler& h,
::LinphonePrivate::Xsd::XmlSchema::Flags f,
const ::LinphonePrivate::Xsd::XmlSchema::Properties& p)
{
::xsd::cxx::xml::sax::std_input_source isrc (is);
return ::LinphonePrivate::Xsd::IsComposing::parseIsComposing (isrc, h, f, p);
}
::std::unique_ptr< ::LinphonePrivate::Xsd::IsComposing::IsComposing >
parseIsComposing (::std::istream& is,
const ::std::string& sid,
::LinphonePrivate::Xsd::XmlSchema::Flags f,
const ::LinphonePrivate::Xsd::XmlSchema::Properties& p)
{
::xsd::cxx::xml::auto_initializer i (
(f & ::LinphonePrivate::Xsd::XmlSchema::Flags::dont_initialize) == 0,
(f & ::LinphonePrivate::Xsd::XmlSchema::Flags::keep_dom) == 0);
::xsd::cxx::xml::sax::std_input_source isrc (is, sid);
return ::LinphonePrivate::Xsd::IsComposing::parseIsComposing (isrc, f, p);
}
::std::unique_ptr< ::LinphonePrivate::Xsd::IsComposing::IsComposing >
parseIsComposing (::std::istream& is,
const ::std::string& sid,
::LinphonePrivate::Xsd::XmlSchema::ErrorHandler& h,
::LinphonePrivate::Xsd::XmlSchema::Flags f,
const ::LinphonePrivate::Xsd::XmlSchema::Properties& p)
{
::xsd::cxx::xml::auto_initializer i (
(f & ::LinphonePrivate::Xsd::XmlSchema::Flags::dont_initialize) == 0,
(f & ::LinphonePrivate::Xsd::XmlSchema::Flags::keep_dom) == 0);
::xsd::cxx::xml::sax::std_input_source isrc (is, sid);
return ::LinphonePrivate::Xsd::IsComposing::parseIsComposing (isrc, h, f, p);
}
::std::unique_ptr< ::LinphonePrivate::Xsd::IsComposing::IsComposing >
parseIsComposing (::std::istream& is,
const ::std::string& sid,
::xercesc::DOMErrorHandler& h,
::LinphonePrivate::Xsd::XmlSchema::Flags f,
const ::LinphonePrivate::Xsd::XmlSchema::Properties& p)
{
::xsd::cxx::xml::sax::std_input_source isrc (is, sid);
return ::LinphonePrivate::Xsd::IsComposing::parseIsComposing (isrc, h, f, p);
}
::std::unique_ptr< ::LinphonePrivate::Xsd::IsComposing::IsComposing >
parseIsComposing (::xercesc::InputSource& i,
::LinphonePrivate::Xsd::XmlSchema::Flags f,
const ::LinphonePrivate::Xsd::XmlSchema::Properties& p)
{
::xsd::cxx::tree::error_handler< char > h;
::LinphonePrivate::Xsd::XmlSchema::dom::unique_ptr< ::xercesc::DOMDocument > d (
::xsd::cxx::xml::dom::parse< char > (
i, h, p, f));
h.throw_if_failed< ::xsd::cxx::tree::parsing< char > > ();
return ::std::unique_ptr< ::LinphonePrivate::Xsd::IsComposing::IsComposing > (
::LinphonePrivate::Xsd::IsComposing::parseIsComposing (
std::move (d), f | ::LinphonePrivate::Xsd::XmlSchema::Flags::own_dom, p));
}
::std::unique_ptr< ::LinphonePrivate::Xsd::IsComposing::IsComposing >
parseIsComposing (::xercesc::InputSource& i,
::LinphonePrivate::Xsd::XmlSchema::ErrorHandler& h,
::LinphonePrivate::Xsd::XmlSchema::Flags f,
const ::LinphonePrivate::Xsd::XmlSchema::Properties& p)
{
::LinphonePrivate::Xsd::XmlSchema::dom::unique_ptr< ::xercesc::DOMDocument > d (
::xsd::cxx::xml::dom::parse< char > (
i, h, p, f));
if (!d.get ())
throw ::xsd::cxx::tree::parsing< char > ();
return ::std::unique_ptr< ::LinphonePrivate::Xsd::IsComposing::IsComposing > (
::LinphonePrivate::Xsd::IsComposing::parseIsComposing (
std::move (d), f | ::LinphonePrivate::Xsd::XmlSchema::Flags::own_dom, p));
}
::std::unique_ptr< ::LinphonePrivate::Xsd::IsComposing::IsComposing >
parseIsComposing (::xercesc::InputSource& i,
::xercesc::DOMErrorHandler& h,
::LinphonePrivate::Xsd::XmlSchema::Flags f,
const ::LinphonePrivate::Xsd::XmlSchema::Properties& p)
{
::LinphonePrivate::Xsd::XmlSchema::dom::unique_ptr< ::xercesc::DOMDocument > d (
::xsd::cxx::xml::dom::parse< char > (
i, h, p, f));
if (!d.get ())
throw ::xsd::cxx::tree::parsing< char > ();
return ::std::unique_ptr< ::LinphonePrivate::Xsd::IsComposing::IsComposing > (
::LinphonePrivate::Xsd::IsComposing::parseIsComposing (
std::move (d), f | ::LinphonePrivate::Xsd::XmlSchema::Flags::own_dom, p));
}
::std::unique_ptr< ::LinphonePrivate::Xsd::IsComposing::IsComposing >
parseIsComposing (const ::xercesc::DOMDocument& doc,
::LinphonePrivate::Xsd::XmlSchema::Flags f,
const ::LinphonePrivate::Xsd::XmlSchema::Properties& p)
{
if (f & ::LinphonePrivate::Xsd::XmlSchema::Flags::keep_dom)
{
::LinphonePrivate::Xsd::XmlSchema::dom::unique_ptr< ::xercesc::DOMDocument > d (
static_cast< ::xercesc::DOMDocument* > (doc.cloneNode (true)));
return ::std::unique_ptr< ::LinphonePrivate::Xsd::IsComposing::IsComposing > (
::LinphonePrivate::Xsd::IsComposing::parseIsComposing (
std::move (d), f | ::LinphonePrivate::Xsd::XmlSchema::Flags::own_dom, p));
}
const ::xercesc::DOMElement& e (*doc.getDocumentElement ());
const ::xsd::cxx::xml::qualified_name< char > n (
::xsd::cxx::xml::dom::name< char > (e));
if (n.name () == "isComposing" &&
n.namespace_ () == "urn:ietf:params:xml:ns:im-iscomposing")
{
::std::unique_ptr< ::LinphonePrivate::Xsd::IsComposing::IsComposing > r (
::xsd::cxx::tree::traits< ::LinphonePrivate::Xsd::IsComposing::IsComposing, char >::create (
e, f, 0));
return r;
}
throw ::xsd::cxx::tree::unexpected_element < char > (
n.name (),
n.namespace_ (),
"isComposing",
"urn:ietf:params:xml:ns:im-iscomposing");
}
::std::unique_ptr< ::LinphonePrivate::Xsd::IsComposing::IsComposing >
parseIsComposing (::LinphonePrivate::Xsd::XmlSchema::dom::unique_ptr< ::xercesc::DOMDocument > d,
::LinphonePrivate::Xsd::XmlSchema::Flags f,
const ::LinphonePrivate::Xsd::XmlSchema::Properties&)
{
::LinphonePrivate::Xsd::XmlSchema::dom::unique_ptr< ::xercesc::DOMDocument > c (
((f & ::LinphonePrivate::Xsd::XmlSchema::Flags::keep_dom) &&
!(f & ::LinphonePrivate::Xsd::XmlSchema::Flags::own_dom))
? static_cast< ::xercesc::DOMDocument* > (d->cloneNode (true))
: 0);
::xercesc::DOMDocument& doc (c.get () ? *c : *d);
const ::xercesc::DOMElement& e (*doc.getDocumentElement ());
const ::xsd::cxx::xml::qualified_name< char > n (
::xsd::cxx::xml::dom::name< char > (e));
if (f & ::LinphonePrivate::Xsd::XmlSchema::Flags::keep_dom)
doc.setUserData (::LinphonePrivate::Xsd::XmlSchema::dom::treeNodeKey,
(c.get () ? &c : &d),
0);
if (n.name () == "isComposing" &&
n.namespace_ () == "urn:ietf:params:xml:ns:im-iscomposing")
{
::std::unique_ptr< ::LinphonePrivate::Xsd::IsComposing::IsComposing > r (
::xsd::cxx::tree::traits< ::LinphonePrivate::Xsd::IsComposing::IsComposing, char >::create (
e, f, 0));
return r;
}
throw ::xsd::cxx::tree::unexpected_element < char > (
n.name (),
n.namespace_ (),
"isComposing",
"urn:ietf:params:xml:ns:im-iscomposing");
}
}
}
}
#include <ostream>
#include <xsd/cxx/tree/error-handler.hxx>
#include <xsd/cxx/xml/dom/serialization-source.hxx>
#include <xsd/cxx/tree/type-serializer-map.hxx>
namespace _xsd
{
static
const ::xsd::cxx::tree::type_serializer_plate< 0, char >
type_serializer_plate_init;
}
namespace LinphonePrivate
{
namespace Xsd
{
namespace IsComposing
{
void
serializeIsComposing (::std::ostream& o,
const ::LinphonePrivate::Xsd::IsComposing::IsComposing& s,
const ::LinphonePrivate::Xsd::XmlSchema::NamespaceInfomap& m,
const ::std::string& e,
::LinphonePrivate::Xsd::XmlSchema::Flags f)
{
::xsd::cxx::xml::auto_initializer i (
(f & ::LinphonePrivate::Xsd::XmlSchema::Flags::dont_initialize) == 0);
::LinphonePrivate::Xsd::XmlSchema::dom::unique_ptr< ::xercesc::DOMDocument > d (
::LinphonePrivate::Xsd::IsComposing::serializeIsComposing (s, m, f));
::xsd::cxx::tree::error_handler< char > h;
::xsd::cxx::xml::dom::ostream_format_target t (o);
if (!::xsd::cxx::xml::dom::serialize (t, *d, e, h, f))
{
h.throw_if_failed< ::xsd::cxx::tree::serialization< char > > ();
}
}
void
serializeIsComposing (::std::ostream& o,
const ::LinphonePrivate::Xsd::IsComposing::IsComposing& s,
::LinphonePrivate::Xsd::XmlSchema::ErrorHandler& h,
const ::LinphonePrivate::Xsd::XmlSchema::NamespaceInfomap& m,
const ::std::string& e,
::LinphonePrivate::Xsd::XmlSchema::Flags f)
{
::xsd::cxx::xml::auto_initializer i (
(f & ::LinphonePrivate::Xsd::XmlSchema::Flags::dont_initialize) == 0);
::LinphonePrivate::Xsd::XmlSchema::dom::unique_ptr< ::xercesc::DOMDocument > d (
::LinphonePrivate::Xsd::IsComposing::serializeIsComposing (s, m, f));
::xsd::cxx::xml::dom::ostream_format_target t (o);
if (!::xsd::cxx::xml::dom::serialize (t, *d, e, h, f))
{
throw ::xsd::cxx::tree::serialization< char > ();
}
}
void
serializeIsComposing (::std::ostream& o,
const ::LinphonePrivate::Xsd::IsComposing::IsComposing& s,
::xercesc::DOMErrorHandler& h,
const ::LinphonePrivate::Xsd::XmlSchema::NamespaceInfomap& m,
const ::std::string& e,
::LinphonePrivate::Xsd::XmlSchema::Flags f)
{
::LinphonePrivate::Xsd::XmlSchema::dom::unique_ptr< ::xercesc::DOMDocument > d (
::LinphonePrivate::Xsd::IsComposing::serializeIsComposing (s, m, f));
::xsd::cxx::xml::dom::ostream_format_target t (o);
if (!::xsd::cxx::xml::dom::serialize (t, *d, e, h, f))
{
throw ::xsd::cxx::tree::serialization< char > ();
}
}
void
serializeIsComposing (::xercesc::XMLFormatTarget& t,
const ::LinphonePrivate::Xsd::IsComposing::IsComposing& s,
const ::LinphonePrivate::Xsd::XmlSchema::NamespaceInfomap& m,
const ::std::string& e,
::LinphonePrivate::Xsd::XmlSchema::Flags f)
{
::LinphonePrivate::Xsd::XmlSchema::dom::unique_ptr< ::xercesc::DOMDocument > d (
::LinphonePrivate::Xsd::IsComposing::serializeIsComposing (s, m, f));
::xsd::cxx::tree::error_handler< char > h;
if (!::xsd::cxx::xml::dom::serialize (t, *d, e, h, f))
{
h.throw_if_failed< ::xsd::cxx::tree::serialization< char > > ();
}
}
void
serializeIsComposing (::xercesc::XMLFormatTarget& t,
const ::LinphonePrivate::Xsd::IsComposing::IsComposing& s,
::LinphonePrivate::Xsd::XmlSchema::ErrorHandler& h,
const ::LinphonePrivate::Xsd::XmlSchema::NamespaceInfomap& m,
const ::std::string& e,
::LinphonePrivate::Xsd::XmlSchema::Flags f)
{
::LinphonePrivate::Xsd::XmlSchema::dom::unique_ptr< ::xercesc::DOMDocument > d (
::LinphonePrivate::Xsd::IsComposing::serializeIsComposing (s, m, f));
if (!::xsd::cxx::xml::dom::serialize (t, *d, e, h, f))
{
throw ::xsd::cxx::tree::serialization< char > ();
}
}
void
serializeIsComposing (::xercesc::XMLFormatTarget& t,
const ::LinphonePrivate::Xsd::IsComposing::IsComposing& s,
::xercesc::DOMErrorHandler& h,
const ::LinphonePrivate::Xsd::XmlSchema::NamespaceInfomap& m,
const ::std::string& e,
::LinphonePrivate::Xsd::XmlSchema::Flags f)
{
::LinphonePrivate::Xsd::XmlSchema::dom::unique_ptr< ::xercesc::DOMDocument > d (
::LinphonePrivate::Xsd::IsComposing::serializeIsComposing (s, m, f));
if (!::xsd::cxx::xml::dom::serialize (t, *d, e, h, f))
{
throw ::xsd::cxx::tree::serialization< char > ();
}
}
void
serializeIsComposing (::xercesc::DOMDocument& d,
const ::LinphonePrivate::Xsd::IsComposing::IsComposing& s,
::LinphonePrivate::Xsd::XmlSchema::Flags)
{
::xercesc::DOMElement& e (*d.getDocumentElement ());
const ::xsd::cxx::xml::qualified_name< char > n (
::xsd::cxx::xml::dom::name< char > (e));
if (n.name () == "isComposing" &&
n.namespace_ () == "urn:ietf:params:xml:ns:im-iscomposing")
{
e << s;
}
else
{
throw ::xsd::cxx::tree::unexpected_element < char > (
n.name (),
n.namespace_ (),
"isComposing",
"urn:ietf:params:xml:ns:im-iscomposing");
}
}
::LinphonePrivate::Xsd::XmlSchema::dom::unique_ptr< ::xercesc::DOMDocument >
serializeIsComposing (const ::LinphonePrivate::Xsd::IsComposing::IsComposing& s,
const ::LinphonePrivate::Xsd::XmlSchema::NamespaceInfomap& m,
::LinphonePrivate::Xsd::XmlSchema::Flags f)
{
::LinphonePrivate::Xsd::XmlSchema::dom::unique_ptr< ::xercesc::DOMDocument > d (
::xsd::cxx::xml::dom::serialize< char > (
"isComposing",
"urn:ietf:params:xml:ns:im-iscomposing",
m, f));
::LinphonePrivate::Xsd::IsComposing::serializeIsComposing (*d, s, f);
return d;
}
void
operator<< (::xercesc::DOMElement& e, const IsComposing& i)
{
e << static_cast< const ::LinphonePrivate::Xsd::XmlSchema::Type& > (i);
// state
//
{
::xercesc::DOMElement& s (
::xsd::cxx::xml::dom::create_element (
"state",
"urn:ietf:params:xml:ns:im-iscomposing",
e));
s << i.getState ();
}
// lastactive
//
if (i.getLastactive ())
{
::xercesc::DOMElement& s (
::xsd::cxx::xml::dom::create_element (
"lastactive",
"urn:ietf:params:xml:ns:im-iscomposing",
e));
s << *i.getLastactive ();
}
// contenttype
//
if (i.getContenttype ())
{
::xercesc::DOMElement& s (
::xsd::cxx::xml::dom::create_element (
"contenttype",
"urn:ietf:params:xml:ns:im-iscomposing",
e));
s << *i.getContenttype ();
}
// refresh
//
if (i.getRefresh ())
{
::xercesc::DOMElement& s (
::xsd::cxx::xml::dom::create_element (
"refresh",
"urn:ietf:params:xml:ns:im-iscomposing",
e));
s << *i.getRefresh ();
}
// any
//
for (IsComposing::AnyConstIterator
b (i.getAny ().begin ()), n (i.getAny ().end ());
b != n; ++b)
{
e.appendChild (
e.getOwnerDocument ()->importNode (
const_cast< ::xercesc::DOMElement* > (&(*b)), true));
}
}
}
}
}
#include <xsd/cxx/post.hxx>
// Begin epilogue.
//
#if __GNUC__ > 5 || (__GNUC__ == 5 && __GNUC_MINOR__ >= 1)
#pragma GCC diagnostic pop
#endif
#if __clang__ || __GNUC__ >= 4
#pragma GCC diagnostic pop
#endif
//
// End epilogue.

678
src/xml/is-composing.h Normal file
View file

@ -0,0 +1,678 @@
// Copyright (c) 2005-2014 Code Synthesis Tools CC
//
// This program was generated by CodeSynthesis XSD, an XML Schema to
// C++ data binding compiler.
//
// This program is free software; you can redistribute it and/or modify
// it under the terms of the GNU General Public License version 2 as
// published by the Free Software Foundation.
//
// 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 St, Fifth Floor, Boston, MA 02110-1301 USA
//
// In addition, as a special exception, Code Synthesis Tools CC gives
// permission to link this program with the Xerces-C++ library (or with
// modified versions of Xerces-C++ that use the same license as Xerces-C++),
// and distribute linked combinations including the two. You must obey
// the GNU General Public License version 2 in all respects for all of
// the code used other than Xerces-C++. If you modify this copy of the
// program, you may extend this exception to your version of the program,
// but you are not obligated to do so. If you do not wish to do so, delete
// this exception statement from your version.
//
// Furthermore, Code Synthesis Tools CC makes a special exception for
// the Free/Libre and Open Source Software (FLOSS) which is described
// in the accompanying FLOSSE file.
//
#ifndef XML_IS_COMPOSING_H
#define XML_IS_COMPOSING_H
#ifndef XSD_CXX11
#define XSD_CXX11
#endif
#ifndef XSD_USE_CHAR
#define XSD_USE_CHAR
#endif
#ifndef XSD_CXX_TREE_USE_CHAR
#define XSD_CXX_TREE_USE_CHAR
#endif
// Begin prologue.
//
#if __clang__ || __GNUC__ >= 4
#pragma GCC diagnostic push
#pragma GCC diagnostic ignored "-Wfloat-equal"
#endif
#if __GNUC__ > 5 || (__GNUC__ == 5 && __GNUC_MINOR__ >= 1)
#pragma GCC diagnostic push
#pragma GCC diagnostic ignored "-Wsuggest-override"
#endif
//
// End prologue.
#include <xsd/cxx/config.hxx>
#if (XSD_INT_VERSION != 4000000L)
#error XSD runtime version mismatch
#endif
#include <xsd/cxx/pre.hxx>
#include <xsd/cxx/xml/char-utf8.hxx>
#include <xsd/cxx/tree/exceptions.hxx>
#include <xsd/cxx/tree/elements.hxx>
#include <xsd/cxx/tree/types.hxx>
#include <xsd/cxx/xml/error-handler.hxx>
#include <xsd/cxx/xml/dom/auto-ptr.hxx>
#include <xsd/cxx/tree/parsing.hxx>
#include <xsd/cxx/tree/parsing/byte.hxx>
#include <xsd/cxx/tree/parsing/unsigned-byte.hxx>
#include <xsd/cxx/tree/parsing/short.hxx>
#include <xsd/cxx/tree/parsing/unsigned-short.hxx>
#include <xsd/cxx/tree/parsing/int.hxx>
#include <xsd/cxx/tree/parsing/unsigned-int.hxx>
#include <xsd/cxx/tree/parsing/long.hxx>
#include <xsd/cxx/tree/parsing/unsigned-long.hxx>
#include <xsd/cxx/tree/parsing/boolean.hxx>
#include <xsd/cxx/tree/parsing/float.hxx>
#include <xsd/cxx/tree/parsing/double.hxx>
#include <xsd/cxx/tree/parsing/decimal.hxx>
#include <xsd/cxx/xml/dom/serialization-header.hxx>
#include <xsd/cxx/tree/serialization.hxx>
#include <xsd/cxx/tree/serialization/byte.hxx>
#include <xsd/cxx/tree/serialization/unsigned-byte.hxx>
#include <xsd/cxx/tree/serialization/short.hxx>
#include <xsd/cxx/tree/serialization/unsigned-short.hxx>
#include <xsd/cxx/tree/serialization/int.hxx>
#include <xsd/cxx/tree/serialization/unsigned-int.hxx>
#include <xsd/cxx/tree/serialization/long.hxx>
#include <xsd/cxx/tree/serialization/unsigned-long.hxx>
#include <xsd/cxx/tree/serialization/boolean.hxx>
#include <xsd/cxx/tree/serialization/float.hxx>
#include <xsd/cxx/tree/serialization/double.hxx>
#include <xsd/cxx/tree/serialization/decimal.hxx>
#include <xsd/cxx/tree/std-ostream-operators.hxx>
namespace LinphonePrivate
{
namespace Xsd
{
namespace XmlSchema
{
// anyType and anySimpleType.
//
typedef ::xsd::cxx::tree::type Type;
typedef ::xsd::cxx::tree::simple_type< char, Type > SimpleType;
typedef ::xsd::cxx::tree::type Container;
// 8-bit
//
typedef signed char Byte;
typedef unsigned char UnsignedByte;
// 16-bit
//
typedef short Short;
typedef unsigned short UnsignedShort;
// 32-bit
//
typedef int Int;
typedef unsigned int UnsignedInt;
// 64-bit
//
typedef long long Long;
typedef unsigned long long UnsignedLong;
// Supposed to be arbitrary-length integral types.
//
typedef long long Integer;
typedef long long NonPositiveInteger;
typedef unsigned long long NonNegativeInteger;
typedef unsigned long long PositiveInteger;
typedef long long NegativeInteger;
// Boolean.
//
typedef bool Boolean;
// Floating-point types.
//
typedef float Float;
typedef double Double;
typedef double Decimal;
// String types.
//
typedef ::xsd::cxx::tree::string< char, SimpleType > String;
typedef ::xsd::cxx::tree::normalized_string< char, String > NormalizedString;
typedef ::xsd::cxx::tree::token< char, NormalizedString > Token;
typedef ::xsd::cxx::tree::name< char, Token > Name;
typedef ::xsd::cxx::tree::nmtoken< char, Token > Nmtoken;
typedef ::xsd::cxx::tree::nmtokens< char, SimpleType, Nmtoken > Nmtokens;
typedef ::xsd::cxx::tree::ncname< char, Name > Ncname;
typedef ::xsd::cxx::tree::language< char, Token > Language;
// ID/IDREF.
//
typedef ::xsd::cxx::tree::id< char, Ncname > Id;
typedef ::xsd::cxx::tree::idref< char, Ncname, Type > Idref;
typedef ::xsd::cxx::tree::idrefs< char, SimpleType, Idref > Idrefs;
// URI.
//
typedef ::xsd::cxx::tree::uri< char, SimpleType > Uri;
// Qualified name.
//
typedef ::xsd::cxx::tree::qname< char, SimpleType, Uri, Ncname > Qname;
// Binary.
//
typedef ::xsd::cxx::tree::buffer< char > Buffer;
typedef ::xsd::cxx::tree::base64_binary< char, SimpleType > Base64Binary;
typedef ::xsd::cxx::tree::hex_binary< char, SimpleType > HexBinary;
// Date/time.
//
typedef ::xsd::cxx::tree::time_zone TimeZone;
typedef ::xsd::cxx::tree::date< char, SimpleType > Date;
typedef ::xsd::cxx::tree::date_time< char, SimpleType > DateTime;
typedef ::xsd::cxx::tree::duration< char, SimpleType > Duration;
typedef ::xsd::cxx::tree::gday< char, SimpleType > Gday;
typedef ::xsd::cxx::tree::gmonth< char, SimpleType > Gmonth;
typedef ::xsd::cxx::tree::gmonth_day< char, SimpleType > GmonthDay;
typedef ::xsd::cxx::tree::gyear< char, SimpleType > Gyear;
typedef ::xsd::cxx::tree::gyear_month< char, SimpleType > GyearMonth;
typedef ::xsd::cxx::tree::time< char, SimpleType > Time;
// Entity.
//
typedef ::xsd::cxx::tree::entity< char, Ncname > Entity;
typedef ::xsd::cxx::tree::entities< char, SimpleType, Entity > Entities;
typedef ::xsd::cxx::tree::content_order ContentOrder;
// Namespace information and list stream. Used in
// serialization functions.
//
typedef ::xsd::cxx::xml::dom::namespace_info< char > NamespaceInfo;
typedef ::xsd::cxx::xml::dom::namespace_infomap< char > NamespaceInfomap;
typedef ::xsd::cxx::tree::list_stream< char > ListStream;
typedef ::xsd::cxx::tree::as_double< Double > AsDouble;
typedef ::xsd::cxx::tree::as_decimal< Decimal > AsDecimal;
typedef ::xsd::cxx::tree::facet Facet;
// Flags and properties.
//
typedef ::xsd::cxx::tree::flags Flags;
typedef ::xsd::cxx::tree::properties< char > Properties;
// Parsing/serialization diagnostics.
//
typedef ::xsd::cxx::tree::severity Severity;
typedef ::xsd::cxx::tree::error< char > Error;
typedef ::xsd::cxx::tree::diagnostics< char > Diagnostics;
// Exceptions.
//
typedef ::xsd::cxx::tree::exception< char > Exception;
typedef ::xsd::cxx::tree::bounds< char > Bounds;
typedef ::xsd::cxx::tree::duplicate_id< char > DuplicateId;
typedef ::xsd::cxx::tree::parsing< char > Parsing;
typedef ::xsd::cxx::tree::expected_element< char > ExpectedElement;
typedef ::xsd::cxx::tree::unexpected_element< char > UnexpectedElement;
typedef ::xsd::cxx::tree::expected_attribute< char > ExpectedAttribute;
typedef ::xsd::cxx::tree::unexpected_enumerator< char > UnexpectedEnumerator;
typedef ::xsd::cxx::tree::expected_text_content< char > ExpectedTextContent;
typedef ::xsd::cxx::tree::no_prefix_mapping< char > NoPrefixMapping;
typedef ::xsd::cxx::tree::no_type_info< char > NoTypeInfo;
typedef ::xsd::cxx::tree::not_derived< char > NotDerived;
typedef ::xsd::cxx::tree::serialization< char > Serialization;
// Error handler callback interface.
//
typedef ::xsd::cxx::xml::error_handler< char > ErrorHandler;
// DOM interaction.
//
namespace dom
{
// Automatic pointer for DOMDocument.
//
using ::xsd::cxx::xml::dom::unique_ptr;
#ifndef XSD_CXX_TREE_TREE_NODE_KEY__LINPHONEPRIVATE__XSD__XMLSCHEMA
#define XSD_CXX_TREE_TREE_NODE_KEY__LINPHONEPRIVATE__XSD__XMLSCHEMA
// DOM user data key for back pointers to tree nodes.
//
const XMLCh* const treeNodeKey = ::xsd::cxx::tree::user_data_keys::node;
#endif
}
}
}
}
// Forward declarations.
//
namespace LinphonePrivate
{
namespace Xsd
{
namespace IsComposing
{
class IsComposing;
}
}
}
#include <memory> // ::std::unique_ptr
#include <limits> // std::numeric_limits
#include <algorithm> // std::binary_search
#include <utility> // std::move
#include <xsd/cxx/xml/char-utf8.hxx>
#include <xsd/cxx/tree/exceptions.hxx>
#include <xsd/cxx/tree/elements.hxx>
#include <xsd/cxx/tree/containers.hxx>
#include <xsd/cxx/tree/list.hxx>
#include <xsd/cxx/xml/dom/parsing-header.hxx>
#include <xsd/cxx/tree/containers-wildcard.hxx>
namespace LinphonePrivate
{
namespace Xsd
{
namespace IsComposing
{
class IsComposing: public ::LinphonePrivate::Xsd::XmlSchema::Type
{
public:
// state
//
typedef ::LinphonePrivate::Xsd::XmlSchema::String StateType;
typedef ::xsd::cxx::tree::traits< StateType, char > StateTraits;
const StateType&
getState () const;
StateType&
getState ();
void
setState (const StateType& x);
void
setState (::std::unique_ptr< StateType > p);
::std::unique_ptr< StateType >
setDetachState ();
// lastactive
//
typedef ::LinphonePrivate::Xsd::XmlSchema::DateTime LastactiveType;
typedef ::xsd::cxx::tree::optional< LastactiveType > LastactiveOptional;
typedef ::xsd::cxx::tree::traits< LastactiveType, char > LastactiveTraits;
const LastactiveOptional&
getLastactive () const;
LastactiveOptional&
getLastactive ();
void
setLastactive (const LastactiveType& x);
void
setLastactive (const LastactiveOptional& x);
void
setLastactive (::std::unique_ptr< LastactiveType > p);
// contenttype
//
typedef ::LinphonePrivate::Xsd::XmlSchema::String ContenttypeType;
typedef ::xsd::cxx::tree::optional< ContenttypeType > ContenttypeOptional;
typedef ::xsd::cxx::tree::traits< ContenttypeType, char > ContenttypeTraits;
const ContenttypeOptional&
getContenttype () const;
ContenttypeOptional&
getContenttype ();
void
setContenttype (const ContenttypeType& x);
void
setContenttype (const ContenttypeOptional& x);
void
setContenttype (::std::unique_ptr< ContenttypeType > p);
// refresh
//
typedef ::LinphonePrivate::Xsd::XmlSchema::PositiveInteger RefreshType;
typedef ::xsd::cxx::tree::optional< RefreshType > RefreshOptional;
typedef ::xsd::cxx::tree::traits< RefreshType, char > RefreshTraits;
const RefreshOptional&
getRefresh () const;
RefreshOptional&
getRefresh ();
void
setRefresh (const RefreshType& x);
void
setRefresh (const RefreshOptional& x);
// any
//
typedef ::xsd::cxx::tree::element_sequence AnySequence;
typedef AnySequence::iterator AnyIterator;
typedef AnySequence::const_iterator AnyConstIterator;
const AnySequence&
getAny () const;
AnySequence&
getAny ();
void
setAny (const AnySequence& s);
// DOMDocument for wildcard content.
//
const ::xercesc::DOMDocument&
getDomDocument () const;
::xercesc::DOMDocument&
getDomDocument ();
// Constructors.
//
IsComposing (const StateType&);
IsComposing (const ::xercesc::DOMElement& e,
::LinphonePrivate::Xsd::XmlSchema::Flags f = 0,
::LinphonePrivate::Xsd::XmlSchema::Container* c = 0);
IsComposing (const IsComposing& x,
::LinphonePrivate::Xsd::XmlSchema::Flags f = 0,
::LinphonePrivate::Xsd::XmlSchema::Container* c = 0);
virtual IsComposing*
_clone (::LinphonePrivate::Xsd::XmlSchema::Flags f = 0,
::LinphonePrivate::Xsd::XmlSchema::Container* c = 0) const;
IsComposing&
operator= (const IsComposing& x);
virtual
~IsComposing ();
// Implementation.
//
protected:
void
parse (::xsd::cxx::xml::dom::parser< char >&,
::LinphonePrivate::Xsd::XmlSchema::Flags);
protected:
::LinphonePrivate::Xsd::XmlSchema::dom::unique_ptr< ::xercesc::DOMDocument > dom_document_;
::xsd::cxx::tree::one< StateType > state_;
LastactiveOptional lastactive_;
ContenttypeOptional contenttype_;
RefreshOptional refresh_;
AnySequence any_;
};
}
}
}
#include <iosfwd>
namespace LinphonePrivate
{
namespace Xsd
{
namespace IsComposing
{
::std::ostream&
operator<< (::std::ostream&, const IsComposing&);
}
}
}
#include <iosfwd>
#include <xercesc/sax/InputSource.hpp>
#include <xercesc/dom/DOMDocument.hpp>
#include <xercesc/dom/DOMErrorHandler.hpp>
namespace LinphonePrivate
{
namespace Xsd
{
namespace IsComposing
{
// Parse a URI or a local file.
//
::std::unique_ptr< ::LinphonePrivate::Xsd::IsComposing::IsComposing >
parseIsComposing (const ::std::string& uri,
::LinphonePrivate::Xsd::XmlSchema::Flags f = 0,
const ::LinphonePrivate::Xsd::XmlSchema::Properties& p = ::LinphonePrivate::Xsd::XmlSchema::Properties ());
::std::unique_ptr< ::LinphonePrivate::Xsd::IsComposing::IsComposing >
parseIsComposing (const ::std::string& uri,
::LinphonePrivate::Xsd::XmlSchema::ErrorHandler& eh,
::LinphonePrivate::Xsd::XmlSchema::Flags f = 0,
const ::LinphonePrivate::Xsd::XmlSchema::Properties& p = ::LinphonePrivate::Xsd::XmlSchema::Properties ());
::std::unique_ptr< ::LinphonePrivate::Xsd::IsComposing::IsComposing >
parseIsComposing (const ::std::string& uri,
::xercesc::DOMErrorHandler& eh,
::LinphonePrivate::Xsd::XmlSchema::Flags f = 0,
const ::LinphonePrivate::Xsd::XmlSchema::Properties& p = ::LinphonePrivate::Xsd::XmlSchema::Properties ());
// Parse std::istream.
//
::std::unique_ptr< ::LinphonePrivate::Xsd::IsComposing::IsComposing >
parseIsComposing (::std::istream& is,
::LinphonePrivate::Xsd::XmlSchema::Flags f = 0,
const ::LinphonePrivate::Xsd::XmlSchema::Properties& p = ::LinphonePrivate::Xsd::XmlSchema::Properties ());
::std::unique_ptr< ::LinphonePrivate::Xsd::IsComposing::IsComposing >
parseIsComposing (::std::istream& is,
::LinphonePrivate::Xsd::XmlSchema::ErrorHandler& eh,
::LinphonePrivate::Xsd::XmlSchema::Flags f = 0,
const ::LinphonePrivate::Xsd::XmlSchema::Properties& p = ::LinphonePrivate::Xsd::XmlSchema::Properties ());
::std::unique_ptr< ::LinphonePrivate::Xsd::IsComposing::IsComposing >
parseIsComposing (::std::istream& is,
::xercesc::DOMErrorHandler& eh,
::LinphonePrivate::Xsd::XmlSchema::Flags f = 0,
const ::LinphonePrivate::Xsd::XmlSchema::Properties& p = ::LinphonePrivate::Xsd::XmlSchema::Properties ());
::std::unique_ptr< ::LinphonePrivate::Xsd::IsComposing::IsComposing >
parseIsComposing (::std::istream& is,
const ::std::string& id,
::LinphonePrivate::Xsd::XmlSchema::Flags f = 0,
const ::LinphonePrivate::Xsd::XmlSchema::Properties& p = ::LinphonePrivate::Xsd::XmlSchema::Properties ());
::std::unique_ptr< ::LinphonePrivate::Xsd::IsComposing::IsComposing >
parseIsComposing (::std::istream& is,
const ::std::string& id,
::LinphonePrivate::Xsd::XmlSchema::ErrorHandler& eh,
::LinphonePrivate::Xsd::XmlSchema::Flags f = 0,
const ::LinphonePrivate::Xsd::XmlSchema::Properties& p = ::LinphonePrivate::Xsd::XmlSchema::Properties ());
::std::unique_ptr< ::LinphonePrivate::Xsd::IsComposing::IsComposing >
parseIsComposing (::std::istream& is,
const ::std::string& id,
::xercesc::DOMErrorHandler& eh,
::LinphonePrivate::Xsd::XmlSchema::Flags f = 0,
const ::LinphonePrivate::Xsd::XmlSchema::Properties& p = ::LinphonePrivate::Xsd::XmlSchema::Properties ());
// Parse xercesc::InputSource.
//
::std::unique_ptr< ::LinphonePrivate::Xsd::IsComposing::IsComposing >
parseIsComposing (::xercesc::InputSource& is,
::LinphonePrivate::Xsd::XmlSchema::Flags f = 0,
const ::LinphonePrivate::Xsd::XmlSchema::Properties& p = ::LinphonePrivate::Xsd::XmlSchema::Properties ());
::std::unique_ptr< ::LinphonePrivate::Xsd::IsComposing::IsComposing >
parseIsComposing (::xercesc::InputSource& is,
::LinphonePrivate::Xsd::XmlSchema::ErrorHandler& eh,
::LinphonePrivate::Xsd::XmlSchema::Flags f = 0,
const ::LinphonePrivate::Xsd::XmlSchema::Properties& p = ::LinphonePrivate::Xsd::XmlSchema::Properties ());
::std::unique_ptr< ::LinphonePrivate::Xsd::IsComposing::IsComposing >
parseIsComposing (::xercesc::InputSource& is,
::xercesc::DOMErrorHandler& eh,
::LinphonePrivate::Xsd::XmlSchema::Flags f = 0,
const ::LinphonePrivate::Xsd::XmlSchema::Properties& p = ::LinphonePrivate::Xsd::XmlSchema::Properties ());
// Parse xercesc::DOMDocument.
//
::std::unique_ptr< ::LinphonePrivate::Xsd::IsComposing::IsComposing >
parseIsComposing (const ::xercesc::DOMDocument& d,
::LinphonePrivate::Xsd::XmlSchema::Flags f = 0,
const ::LinphonePrivate::Xsd::XmlSchema::Properties& p = ::LinphonePrivate::Xsd::XmlSchema::Properties ());
::std::unique_ptr< ::LinphonePrivate::Xsd::IsComposing::IsComposing >
parseIsComposing (::LinphonePrivate::Xsd::XmlSchema::dom::unique_ptr< ::xercesc::DOMDocument > d,
::LinphonePrivate::Xsd::XmlSchema::Flags f = 0,
const ::LinphonePrivate::Xsd::XmlSchema::Properties& p = ::LinphonePrivate::Xsd::XmlSchema::Properties ());
}
}
}
#include <iosfwd>
#include <xercesc/dom/DOMDocument.hpp>
#include <xercesc/dom/DOMErrorHandler.hpp>
#include <xercesc/framework/XMLFormatter.hpp>
#include <xsd/cxx/xml/dom/auto-ptr.hxx>
namespace LinphonePrivate
{
namespace Xsd
{
namespace IsComposing
{
// Serialize to std::ostream.
//
void
serializeIsComposing (::std::ostream& os,
const ::LinphonePrivate::Xsd::IsComposing::IsComposing& x,
const ::LinphonePrivate::Xsd::XmlSchema::NamespaceInfomap& m = ::LinphonePrivate::Xsd::XmlSchema::NamespaceInfomap (),
const ::std::string& e = "UTF-8",
::LinphonePrivate::Xsd::XmlSchema::Flags f = 0);
void
serializeIsComposing (::std::ostream& os,
const ::LinphonePrivate::Xsd::IsComposing::IsComposing& x,
::LinphonePrivate::Xsd::XmlSchema::ErrorHandler& eh,
const ::LinphonePrivate::Xsd::XmlSchema::NamespaceInfomap& m = ::LinphonePrivate::Xsd::XmlSchema::NamespaceInfomap (),
const ::std::string& e = "UTF-8",
::LinphonePrivate::Xsd::XmlSchema::Flags f = 0);
void
serializeIsComposing (::std::ostream& os,
const ::LinphonePrivate::Xsd::IsComposing::IsComposing& x,
::xercesc::DOMErrorHandler& eh,
const ::LinphonePrivate::Xsd::XmlSchema::NamespaceInfomap& m = ::LinphonePrivate::Xsd::XmlSchema::NamespaceInfomap (),
const ::std::string& e = "UTF-8",
::LinphonePrivate::Xsd::XmlSchema::Flags f = 0);
// Serialize to xercesc::XMLFormatTarget.
//
void
serializeIsComposing (::xercesc::XMLFormatTarget& ft,
const ::LinphonePrivate::Xsd::IsComposing::IsComposing& x,
const ::LinphonePrivate::Xsd::XmlSchema::NamespaceInfomap& m = ::LinphonePrivate::Xsd::XmlSchema::NamespaceInfomap (),
const ::std::string& e = "UTF-8",
::LinphonePrivate::Xsd::XmlSchema::Flags f = 0);
void
serializeIsComposing (::xercesc::XMLFormatTarget& ft,
const ::LinphonePrivate::Xsd::IsComposing::IsComposing& x,
::LinphonePrivate::Xsd::XmlSchema::ErrorHandler& eh,
const ::LinphonePrivate::Xsd::XmlSchema::NamespaceInfomap& m = ::LinphonePrivate::Xsd::XmlSchema::NamespaceInfomap (),
const ::std::string& e = "UTF-8",
::LinphonePrivate::Xsd::XmlSchema::Flags f = 0);
void
serializeIsComposing (::xercesc::XMLFormatTarget& ft,
const ::LinphonePrivate::Xsd::IsComposing::IsComposing& x,
::xercesc::DOMErrorHandler& eh,
const ::LinphonePrivate::Xsd::XmlSchema::NamespaceInfomap& m = ::LinphonePrivate::Xsd::XmlSchema::NamespaceInfomap (),
const ::std::string& e = "UTF-8",
::LinphonePrivate::Xsd::XmlSchema::Flags f = 0);
// Serialize to an existing xercesc::DOMDocument.
//
void
serializeIsComposing (::xercesc::DOMDocument& d,
const ::LinphonePrivate::Xsd::IsComposing::IsComposing& x,
::LinphonePrivate::Xsd::XmlSchema::Flags f = 0);
// Serialize to a new xercesc::DOMDocument.
//
::LinphonePrivate::Xsd::XmlSchema::dom::unique_ptr< ::xercesc::DOMDocument >
serializeIsComposing (const ::LinphonePrivate::Xsd::IsComposing::IsComposing& x,
const ::LinphonePrivate::Xsd::XmlSchema::NamespaceInfomap& m = ::LinphonePrivate::Xsd::XmlSchema::NamespaceInfomap (),
::LinphonePrivate::Xsd::XmlSchema::Flags f = 0);
void
operator<< (::xercesc::DOMElement&, const IsComposing&);
}
}
}
#include <xsd/cxx/post.hxx>
// Begin epilogue.
//
#if __GNUC__ > 5 || (__GNUC__ == 5 && __GNUC_MINOR__ >= 1)
#pragma GCC diagnostic pop
#endif
#if __clang__ || __GNUC__ >= 4
#pragma GCC diagnostic pop
#endif
//
// End epilogue.
#endif // XML_IS_COMPOSING_H

18
src/xml/is-composing.xsd Normal file
View file

@ -0,0 +1,18 @@
<?xml version="1.0" encoding="UTF-8"?>
<xs:schema targetNamespace="urn:ietf:params:xml:ns:im-iscomposing"
elementFormDefault="qualified"
attributeFormDefault="unqualified"
xmlns:xs="http://www.w3.org/2001/XMLSchema"
xmlns:tns="urn:ietf:params:xml:ns:im-iscomposing">
<xs:element name="isComposing">
<xs:complexType>
<xs:sequence>
<xs:element name="state" type="xs:string"/>
<xs:element name="lastactive" type="xs:dateTime" minOccurs="0"/>
<xs:element name="contenttype" type="xs:string" minOccurs="0"/>
<xs:element name="refresh" type="xs:positiveInteger" minOccurs="0"/>
<xs:any namespace="##other" processContents="lax" minOccurs="0" maxOccurs="unbounded"/>
</xs:sequence>
</xs:complexType>
</xs:element>
</xs:schema>

717
src/xml/linphone-imdn.cpp Normal file
View file

@ -0,0 +1,717 @@
// Copyright (c) 2005-2014 Code Synthesis Tools CC
//
// This program was generated by CodeSynthesis XSD, an XML Schema to
// C++ data binding compiler.
//
// This program is free software; you can redistribute it and/or modify
// it under the terms of the GNU General Public License version 2 as
// published by the Free Software Foundation.
//
// 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 St, Fifth Floor, Boston, MA 02110-1301 USA
//
// In addition, as a special exception, Code Synthesis Tools CC gives
// permission to link this program with the Xerces-C++ library (or with
// modified versions of Xerces-C++ that use the same license as Xerces-C++),
// and distribute linked combinations including the two. You must obey
// the GNU General Public License version 2 in all respects for all of
// the code used other than Xerces-C++. If you modify this copy of the
// program, you may extend this exception to your version of the program,
// but you are not obligated to do so. If you do not wish to do so, delete
// this exception statement from your version.
//
// Furthermore, Code Synthesis Tools CC makes a special exception for
// the Free/Libre and Open Source Software (FLOSS) which is described
// in the accompanying FLOSSE file.
//
// Begin prologue.
//
#if __clang__ || __GNUC__ >= 4
#pragma GCC diagnostic push
#pragma GCC diagnostic ignored "-Wfloat-equal"
#endif
#if __GNUC__ > 5 || (__GNUC__ == 5 && __GNUC_MINOR__ >= 1)
#pragma GCC diagnostic push
#pragma GCC diagnostic ignored "-Wsuggest-override"
#endif
//
// End prologue.
#include <xsd/cxx/pre.hxx>
#include "linphone-imdn.h"
namespace LinphonePrivate
{
namespace Xsd
{
namespace LinphoneImdn
{
// ImdnReason
//
const ImdnReason::CodeType& ImdnReason::
getCode () const
{
return this->code_.get ();
}
ImdnReason::CodeType& ImdnReason::
getCode ()
{
return this->code_.get ();
}
void ImdnReason::
setCode (const CodeType& x)
{
this->code_.set (x);
}
ImdnReason::CodeType ImdnReason::
getCodeDefaultValue ()
{
return CodeType (200);
}
}
}
}
#include <xsd/cxx/xml/dom/wildcard-source.hxx>
#include <xsd/cxx/xml/dom/parsing-source.hxx>
#include <xsd/cxx/tree/type-factory-map.hxx>
namespace _xsd
{
static
const ::xsd::cxx::tree::type_factory_plate< 0, char >
type_factory_plate_init;
}
namespace LinphonePrivate
{
namespace Xsd
{
namespace LinphoneImdn
{
// ImdnReason
//
ImdnReason::
ImdnReason ()
: ::LinphonePrivate::Xsd::XmlSchema::String (),
code_ (getCodeDefaultValue (), this)
{
}
ImdnReason::
ImdnReason (const char* _xsd_String_base)
: ::LinphonePrivate::Xsd::XmlSchema::String (_xsd_String_base),
code_ (getCodeDefaultValue (), this)
{
}
ImdnReason::
ImdnReason (const ::std::string& _xsd_String_base)
: ::LinphonePrivate::Xsd::XmlSchema::String (_xsd_String_base),
code_ (getCodeDefaultValue (), this)
{
}
ImdnReason::
ImdnReason (const ::LinphonePrivate::Xsd::XmlSchema::String& _xsd_String_base)
: ::LinphonePrivate::Xsd::XmlSchema::String (_xsd_String_base),
code_ (getCodeDefaultValue (), this)
{
}
ImdnReason::
ImdnReason (const ImdnReason& x,
::LinphonePrivate::Xsd::XmlSchema::Flags f,
::LinphonePrivate::Xsd::XmlSchema::Container* c)
: ::LinphonePrivate::Xsd::XmlSchema::String (x, f, c),
code_ (x.code_, f, this)
{
}
ImdnReason::
ImdnReason (const ::xercesc::DOMElement& e,
::LinphonePrivate::Xsd::XmlSchema::Flags f,
::LinphonePrivate::Xsd::XmlSchema::Container* c)
: ::LinphonePrivate::Xsd::XmlSchema::String (e, f | ::LinphonePrivate::Xsd::XmlSchema::Flags::base, c),
code_ (this)
{
if ((f & ::LinphonePrivate::Xsd::XmlSchema::Flags::base) == 0)
{
::xsd::cxx::xml::dom::parser< char > p (e, false, false, true);
this->parse (p, f);
}
}
void ImdnReason::
parse (::xsd::cxx::xml::dom::parser< char >& p,
::LinphonePrivate::Xsd::XmlSchema::Flags f)
{
while (p.more_attributes ())
{
const ::xercesc::DOMAttr& i (p.next_attribute ());
const ::xsd::cxx::xml::qualified_name< char > n (
::xsd::cxx::xml::dom::name< char > (i));
if (n.name () == "code" && n.namespace_ ().empty ())
{
this->code_.set (CodeTraits::create (i, f, this));
continue;
}
}
if (!code_.present ())
{
this->code_.set (getCodeDefaultValue ());
}
}
ImdnReason* ImdnReason::
_clone (::LinphonePrivate::Xsd::XmlSchema::Flags f,
::LinphonePrivate::Xsd::XmlSchema::Container* c) const
{
return new class ImdnReason (*this, f, c);
}
ImdnReason& ImdnReason::
operator= (const ImdnReason& x)
{
if (this != &x)
{
static_cast< ::LinphonePrivate::Xsd::XmlSchema::String& > (*this) = x;
this->code_ = x.code_;
}
return *this;
}
ImdnReason::
~ImdnReason ()
{
}
}
}
}
#include <ostream>
#include <xsd/cxx/tree/std-ostream-map.hxx>
namespace _xsd
{
static
const ::xsd::cxx::tree::std_ostream_plate< 0, char >
std_ostream_plate_init;
}
namespace LinphonePrivate
{
namespace Xsd
{
namespace LinphoneImdn
{
::std::ostream&
operator<< (::std::ostream& o, const ImdnReason& i)
{
o << static_cast< const ::LinphonePrivate::Xsd::XmlSchema::String& > (i);
o << ::std::endl << "code: " << i.getCode ();
return o;
}
}
}
}
#include <istream>
#include <xsd/cxx/xml/sax/std-input-source.hxx>
#include <xsd/cxx/tree/error-handler.hxx>
namespace LinphonePrivate
{
namespace Xsd
{
namespace LinphoneImdn
{
::std::unique_ptr< ::LinphonePrivate::Xsd::LinphoneImdn::ImdnReason >
parseReason (const ::std::string& u,
::LinphonePrivate::Xsd::XmlSchema::Flags f,
const ::LinphonePrivate::Xsd::XmlSchema::Properties& p)
{
::xsd::cxx::xml::auto_initializer i (
(f & ::LinphonePrivate::Xsd::XmlSchema::Flags::dont_initialize) == 0,
(f & ::LinphonePrivate::Xsd::XmlSchema::Flags::keep_dom) == 0);
::xsd::cxx::tree::error_handler< char > h;
::LinphonePrivate::Xsd::XmlSchema::dom::unique_ptr< ::xercesc::DOMDocument > d (
::xsd::cxx::xml::dom::parse< char > (
u, h, p, f));
h.throw_if_failed< ::xsd::cxx::tree::parsing< char > > ();
return ::std::unique_ptr< ::LinphonePrivate::Xsd::LinphoneImdn::ImdnReason > (
::LinphonePrivate::Xsd::LinphoneImdn::parseReason (
std::move (d), f | ::LinphonePrivate::Xsd::XmlSchema::Flags::own_dom, p));
}
::std::unique_ptr< ::LinphonePrivate::Xsd::LinphoneImdn::ImdnReason >
parseReason (const ::std::string& u,
::LinphonePrivate::Xsd::XmlSchema::ErrorHandler& h,
::LinphonePrivate::Xsd::XmlSchema::Flags f,
const ::LinphonePrivate::Xsd::XmlSchema::Properties& p)
{
::xsd::cxx::xml::auto_initializer i (
(f & ::LinphonePrivate::Xsd::XmlSchema::Flags::dont_initialize) == 0,
(f & ::LinphonePrivate::Xsd::XmlSchema::Flags::keep_dom) == 0);
::LinphonePrivate::Xsd::XmlSchema::dom::unique_ptr< ::xercesc::DOMDocument > d (
::xsd::cxx::xml::dom::parse< char > (
u, h, p, f));
if (!d.get ())
throw ::xsd::cxx::tree::parsing< char > ();
return ::std::unique_ptr< ::LinphonePrivate::Xsd::LinphoneImdn::ImdnReason > (
::LinphonePrivate::Xsd::LinphoneImdn::parseReason (
std::move (d), f | ::LinphonePrivate::Xsd::XmlSchema::Flags::own_dom, p));
}
::std::unique_ptr< ::LinphonePrivate::Xsd::LinphoneImdn::ImdnReason >
parseReason (const ::std::string& u,
::xercesc::DOMErrorHandler& h,
::LinphonePrivate::Xsd::XmlSchema::Flags f,
const ::LinphonePrivate::Xsd::XmlSchema::Properties& p)
{
::LinphonePrivate::Xsd::XmlSchema::dom::unique_ptr< ::xercesc::DOMDocument > d (
::xsd::cxx::xml::dom::parse< char > (
u, h, p, f));
if (!d.get ())
throw ::xsd::cxx::tree::parsing< char > ();
return ::std::unique_ptr< ::LinphonePrivate::Xsd::LinphoneImdn::ImdnReason > (
::LinphonePrivate::Xsd::LinphoneImdn::parseReason (
std::move (d), f | ::LinphonePrivate::Xsd::XmlSchema::Flags::own_dom, p));
}
::std::unique_ptr< ::LinphonePrivate::Xsd::LinphoneImdn::ImdnReason >
parseReason (::std::istream& is,
::LinphonePrivate::Xsd::XmlSchema::Flags f,
const ::LinphonePrivate::Xsd::XmlSchema::Properties& p)
{
::xsd::cxx::xml::auto_initializer i (
(f & ::LinphonePrivate::Xsd::XmlSchema::Flags::dont_initialize) == 0,
(f & ::LinphonePrivate::Xsd::XmlSchema::Flags::keep_dom) == 0);
::xsd::cxx::xml::sax::std_input_source isrc (is);
return ::LinphonePrivate::Xsd::LinphoneImdn::parseReason (isrc, f, p);
}
::std::unique_ptr< ::LinphonePrivate::Xsd::LinphoneImdn::ImdnReason >
parseReason (::std::istream& is,
::LinphonePrivate::Xsd::XmlSchema::ErrorHandler& h,
::LinphonePrivate::Xsd::XmlSchema::Flags f,
const ::LinphonePrivate::Xsd::XmlSchema::Properties& p)
{
::xsd::cxx::xml::auto_initializer i (
(f & ::LinphonePrivate::Xsd::XmlSchema::Flags::dont_initialize) == 0,
(f & ::LinphonePrivate::Xsd::XmlSchema::Flags::keep_dom) == 0);
::xsd::cxx::xml::sax::std_input_source isrc (is);
return ::LinphonePrivate::Xsd::LinphoneImdn::parseReason (isrc, h, f, p);
}
::std::unique_ptr< ::LinphonePrivate::Xsd::LinphoneImdn::ImdnReason >
parseReason (::std::istream& is,
::xercesc::DOMErrorHandler& h,
::LinphonePrivate::Xsd::XmlSchema::Flags f,
const ::LinphonePrivate::Xsd::XmlSchema::Properties& p)
{
::xsd::cxx::xml::sax::std_input_source isrc (is);
return ::LinphonePrivate::Xsd::LinphoneImdn::parseReason (isrc, h, f, p);
}
::std::unique_ptr< ::LinphonePrivate::Xsd::LinphoneImdn::ImdnReason >
parseReason (::std::istream& is,
const ::std::string& sid,
::LinphonePrivate::Xsd::XmlSchema::Flags f,
const ::LinphonePrivate::Xsd::XmlSchema::Properties& p)
{
::xsd::cxx::xml::auto_initializer i (
(f & ::LinphonePrivate::Xsd::XmlSchema::Flags::dont_initialize) == 0,
(f & ::LinphonePrivate::Xsd::XmlSchema::Flags::keep_dom) == 0);
::xsd::cxx::xml::sax::std_input_source isrc (is, sid);
return ::LinphonePrivate::Xsd::LinphoneImdn::parseReason (isrc, f, p);
}
::std::unique_ptr< ::LinphonePrivate::Xsd::LinphoneImdn::ImdnReason >
parseReason (::std::istream& is,
const ::std::string& sid,
::LinphonePrivate::Xsd::XmlSchema::ErrorHandler& h,
::LinphonePrivate::Xsd::XmlSchema::Flags f,
const ::LinphonePrivate::Xsd::XmlSchema::Properties& p)
{
::xsd::cxx::xml::auto_initializer i (
(f & ::LinphonePrivate::Xsd::XmlSchema::Flags::dont_initialize) == 0,
(f & ::LinphonePrivate::Xsd::XmlSchema::Flags::keep_dom) == 0);
::xsd::cxx::xml::sax::std_input_source isrc (is, sid);
return ::LinphonePrivate::Xsd::LinphoneImdn::parseReason (isrc, h, f, p);
}
::std::unique_ptr< ::LinphonePrivate::Xsd::LinphoneImdn::ImdnReason >
parseReason (::std::istream& is,
const ::std::string& sid,
::xercesc::DOMErrorHandler& h,
::LinphonePrivate::Xsd::XmlSchema::Flags f,
const ::LinphonePrivate::Xsd::XmlSchema::Properties& p)
{
::xsd::cxx::xml::sax::std_input_source isrc (is, sid);
return ::LinphonePrivate::Xsd::LinphoneImdn::parseReason (isrc, h, f, p);
}
::std::unique_ptr< ::LinphonePrivate::Xsd::LinphoneImdn::ImdnReason >
parseReason (::xercesc::InputSource& i,
::LinphonePrivate::Xsd::XmlSchema::Flags f,
const ::LinphonePrivate::Xsd::XmlSchema::Properties& p)
{
::xsd::cxx::tree::error_handler< char > h;
::LinphonePrivate::Xsd::XmlSchema::dom::unique_ptr< ::xercesc::DOMDocument > d (
::xsd::cxx::xml::dom::parse< char > (
i, h, p, f));
h.throw_if_failed< ::xsd::cxx::tree::parsing< char > > ();
return ::std::unique_ptr< ::LinphonePrivate::Xsd::LinphoneImdn::ImdnReason > (
::LinphonePrivate::Xsd::LinphoneImdn::parseReason (
std::move (d), f | ::LinphonePrivate::Xsd::XmlSchema::Flags::own_dom, p));
}
::std::unique_ptr< ::LinphonePrivate::Xsd::LinphoneImdn::ImdnReason >
parseReason (::xercesc::InputSource& i,
::LinphonePrivate::Xsd::XmlSchema::ErrorHandler& h,
::LinphonePrivate::Xsd::XmlSchema::Flags f,
const ::LinphonePrivate::Xsd::XmlSchema::Properties& p)
{
::LinphonePrivate::Xsd::XmlSchema::dom::unique_ptr< ::xercesc::DOMDocument > d (
::xsd::cxx::xml::dom::parse< char > (
i, h, p, f));
if (!d.get ())
throw ::xsd::cxx::tree::parsing< char > ();
return ::std::unique_ptr< ::LinphonePrivate::Xsd::LinphoneImdn::ImdnReason > (
::LinphonePrivate::Xsd::LinphoneImdn::parseReason (
std::move (d), f | ::LinphonePrivate::Xsd::XmlSchema::Flags::own_dom, p));
}
::std::unique_ptr< ::LinphonePrivate::Xsd::LinphoneImdn::ImdnReason >
parseReason (::xercesc::InputSource& i,
::xercesc::DOMErrorHandler& h,
::LinphonePrivate::Xsd::XmlSchema::Flags f,
const ::LinphonePrivate::Xsd::XmlSchema::Properties& p)
{
::LinphonePrivate::Xsd::XmlSchema::dom::unique_ptr< ::xercesc::DOMDocument > d (
::xsd::cxx::xml::dom::parse< char > (
i, h, p, f));
if (!d.get ())
throw ::xsd::cxx::tree::parsing< char > ();
return ::std::unique_ptr< ::LinphonePrivate::Xsd::LinphoneImdn::ImdnReason > (
::LinphonePrivate::Xsd::LinphoneImdn::parseReason (
std::move (d), f | ::LinphonePrivate::Xsd::XmlSchema::Flags::own_dom, p));
}
::std::unique_ptr< ::LinphonePrivate::Xsd::LinphoneImdn::ImdnReason >
parseReason (const ::xercesc::DOMDocument& doc,
::LinphonePrivate::Xsd::XmlSchema::Flags f,
const ::LinphonePrivate::Xsd::XmlSchema::Properties& p)
{
if (f & ::LinphonePrivate::Xsd::XmlSchema::Flags::keep_dom)
{
::LinphonePrivate::Xsd::XmlSchema::dom::unique_ptr< ::xercesc::DOMDocument > d (
static_cast< ::xercesc::DOMDocument* > (doc.cloneNode (true)));
return ::std::unique_ptr< ::LinphonePrivate::Xsd::LinphoneImdn::ImdnReason > (
::LinphonePrivate::Xsd::LinphoneImdn::parseReason (
std::move (d), f | ::LinphonePrivate::Xsd::XmlSchema::Flags::own_dom, p));
}
const ::xercesc::DOMElement& e (*doc.getDocumentElement ());
const ::xsd::cxx::xml::qualified_name< char > n (
::xsd::cxx::xml::dom::name< char > (e));
if (n.name () == "reason" &&
n.namespace_ () == "http://www.linphone.org/xsds/imdn.xsd")
{
::std::unique_ptr< ::LinphonePrivate::Xsd::LinphoneImdn::ImdnReason > r (
::xsd::cxx::tree::traits< ::LinphonePrivate::Xsd::LinphoneImdn::ImdnReason, char >::create (
e, f, 0));
return r;
}
throw ::xsd::cxx::tree::unexpected_element < char > (
n.name (),
n.namespace_ (),
"reason",
"http://www.linphone.org/xsds/imdn.xsd");
}
::std::unique_ptr< ::LinphonePrivate::Xsd::LinphoneImdn::ImdnReason >
parseReason (::LinphonePrivate::Xsd::XmlSchema::dom::unique_ptr< ::xercesc::DOMDocument > d,
::LinphonePrivate::Xsd::XmlSchema::Flags f,
const ::LinphonePrivate::Xsd::XmlSchema::Properties&)
{
::LinphonePrivate::Xsd::XmlSchema::dom::unique_ptr< ::xercesc::DOMDocument > c (
((f & ::LinphonePrivate::Xsd::XmlSchema::Flags::keep_dom) &&
!(f & ::LinphonePrivate::Xsd::XmlSchema::Flags::own_dom))
? static_cast< ::xercesc::DOMDocument* > (d->cloneNode (true))
: 0);
::xercesc::DOMDocument& doc (c.get () ? *c : *d);
const ::xercesc::DOMElement& e (*doc.getDocumentElement ());
const ::xsd::cxx::xml::qualified_name< char > n (
::xsd::cxx::xml::dom::name< char > (e));
if (f & ::LinphonePrivate::Xsd::XmlSchema::Flags::keep_dom)
doc.setUserData (::LinphonePrivate::Xsd::XmlSchema::dom::treeNodeKey,
(c.get () ? &c : &d),
0);
if (n.name () == "reason" &&
n.namespace_ () == "http://www.linphone.org/xsds/imdn.xsd")
{
::std::unique_ptr< ::LinphonePrivate::Xsd::LinphoneImdn::ImdnReason > r (
::xsd::cxx::tree::traits< ::LinphonePrivate::Xsd::LinphoneImdn::ImdnReason, char >::create (
e, f, 0));
return r;
}
throw ::xsd::cxx::tree::unexpected_element < char > (
n.name (),
n.namespace_ (),
"reason",
"http://www.linphone.org/xsds/imdn.xsd");
}
}
}
}
#include <ostream>
#include <xsd/cxx/tree/error-handler.hxx>
#include <xsd/cxx/xml/dom/serialization-source.hxx>
#include <xsd/cxx/tree/type-serializer-map.hxx>
namespace _xsd
{
static
const ::xsd::cxx::tree::type_serializer_plate< 0, char >
type_serializer_plate_init;
}
namespace LinphonePrivate
{
namespace Xsd
{
namespace LinphoneImdn
{
void
serializeReason (::std::ostream& o,
const ::LinphonePrivate::Xsd::LinphoneImdn::ImdnReason& s,
const ::LinphonePrivate::Xsd::XmlSchema::NamespaceInfomap& m,
const ::std::string& e,
::LinphonePrivate::Xsd::XmlSchema::Flags f)
{
::xsd::cxx::xml::auto_initializer i (
(f & ::LinphonePrivate::Xsd::XmlSchema::Flags::dont_initialize) == 0);
::LinphonePrivate::Xsd::XmlSchema::dom::unique_ptr< ::xercesc::DOMDocument > d (
::LinphonePrivate::Xsd::LinphoneImdn::serializeReason (s, m, f));
::xsd::cxx::tree::error_handler< char > h;
::xsd::cxx::xml::dom::ostream_format_target t (o);
if (!::xsd::cxx::xml::dom::serialize (t, *d, e, h, f))
{
h.throw_if_failed< ::xsd::cxx::tree::serialization< char > > ();
}
}
void
serializeReason (::std::ostream& o,
const ::LinphonePrivate::Xsd::LinphoneImdn::ImdnReason& s,
::LinphonePrivate::Xsd::XmlSchema::ErrorHandler& h,
const ::LinphonePrivate::Xsd::XmlSchema::NamespaceInfomap& m,
const ::std::string& e,
::LinphonePrivate::Xsd::XmlSchema::Flags f)
{
::xsd::cxx::xml::auto_initializer i (
(f & ::LinphonePrivate::Xsd::XmlSchema::Flags::dont_initialize) == 0);
::LinphonePrivate::Xsd::XmlSchema::dom::unique_ptr< ::xercesc::DOMDocument > d (
::LinphonePrivate::Xsd::LinphoneImdn::serializeReason (s, m, f));
::xsd::cxx::xml::dom::ostream_format_target t (o);
if (!::xsd::cxx::xml::dom::serialize (t, *d, e, h, f))
{
throw ::xsd::cxx::tree::serialization< char > ();
}
}
void
serializeReason (::std::ostream& o,
const ::LinphonePrivate::Xsd::LinphoneImdn::ImdnReason& s,
::xercesc::DOMErrorHandler& h,
const ::LinphonePrivate::Xsd::XmlSchema::NamespaceInfomap& m,
const ::std::string& e,
::LinphonePrivate::Xsd::XmlSchema::Flags f)
{
::LinphonePrivate::Xsd::XmlSchema::dom::unique_ptr< ::xercesc::DOMDocument > d (
::LinphonePrivate::Xsd::LinphoneImdn::serializeReason (s, m, f));
::xsd::cxx::xml::dom::ostream_format_target t (o);
if (!::xsd::cxx::xml::dom::serialize (t, *d, e, h, f))
{
throw ::xsd::cxx::tree::serialization< char > ();
}
}
void
serializeReason (::xercesc::XMLFormatTarget& t,
const ::LinphonePrivate::Xsd::LinphoneImdn::ImdnReason& s,
const ::LinphonePrivate::Xsd::XmlSchema::NamespaceInfomap& m,
const ::std::string& e,
::LinphonePrivate::Xsd::XmlSchema::Flags f)
{
::LinphonePrivate::Xsd::XmlSchema::dom::unique_ptr< ::xercesc::DOMDocument > d (
::LinphonePrivate::Xsd::LinphoneImdn::serializeReason (s, m, f));
::xsd::cxx::tree::error_handler< char > h;
if (!::xsd::cxx::xml::dom::serialize (t, *d, e, h, f))
{
h.throw_if_failed< ::xsd::cxx::tree::serialization< char > > ();
}
}
void
serializeReason (::xercesc::XMLFormatTarget& t,
const ::LinphonePrivate::Xsd::LinphoneImdn::ImdnReason& s,
::LinphonePrivate::Xsd::XmlSchema::ErrorHandler& h,
const ::LinphonePrivate::Xsd::XmlSchema::NamespaceInfomap& m,
const ::std::string& e,
::LinphonePrivate::Xsd::XmlSchema::Flags f)
{
::LinphonePrivate::Xsd::XmlSchema::dom::unique_ptr< ::xercesc::DOMDocument > d (
::LinphonePrivate::Xsd::LinphoneImdn::serializeReason (s, m, f));
if (!::xsd::cxx::xml::dom::serialize (t, *d, e, h, f))
{
throw ::xsd::cxx::tree::serialization< char > ();
}
}
void
serializeReason (::xercesc::XMLFormatTarget& t,
const ::LinphonePrivate::Xsd::LinphoneImdn::ImdnReason& s,
::xercesc::DOMErrorHandler& h,
const ::LinphonePrivate::Xsd::XmlSchema::NamespaceInfomap& m,
const ::std::string& e,
::LinphonePrivate::Xsd::XmlSchema::Flags f)
{
::LinphonePrivate::Xsd::XmlSchema::dom::unique_ptr< ::xercesc::DOMDocument > d (
::LinphonePrivate::Xsd::LinphoneImdn::serializeReason (s, m, f));
if (!::xsd::cxx::xml::dom::serialize (t, *d, e, h, f))
{
throw ::xsd::cxx::tree::serialization< char > ();
}
}
void
serializeReason (::xercesc::DOMDocument& d,
const ::LinphonePrivate::Xsd::LinphoneImdn::ImdnReason& s,
::LinphonePrivate::Xsd::XmlSchema::Flags)
{
::xercesc::DOMElement& e (*d.getDocumentElement ());
const ::xsd::cxx::xml::qualified_name< char > n (
::xsd::cxx::xml::dom::name< char > (e));
if (n.name () == "reason" &&
n.namespace_ () == "http://www.linphone.org/xsds/imdn.xsd")
{
e << s;
}
else
{
throw ::xsd::cxx::tree::unexpected_element < char > (
n.name (),
n.namespace_ (),
"reason",
"http://www.linphone.org/xsds/imdn.xsd");
}
}
::LinphonePrivate::Xsd::XmlSchema::dom::unique_ptr< ::xercesc::DOMDocument >
serializeReason (const ::LinphonePrivate::Xsd::LinphoneImdn::ImdnReason& s,
const ::LinphonePrivate::Xsd::XmlSchema::NamespaceInfomap& m,
::LinphonePrivate::Xsd::XmlSchema::Flags f)
{
::LinphonePrivate::Xsd::XmlSchema::dom::unique_ptr< ::xercesc::DOMDocument > d (
::xsd::cxx::xml::dom::serialize< char > (
"reason",
"http://www.linphone.org/xsds/imdn.xsd",
m, f));
::LinphonePrivate::Xsd::LinphoneImdn::serializeReason (*d, s, f);
return d;
}
void
operator<< (::xercesc::DOMElement& e, const ImdnReason& i)
{
e << static_cast< const ::LinphonePrivate::Xsd::XmlSchema::String& > (i);
// code
//
{
::xercesc::DOMAttr& a (
::xsd::cxx::xml::dom::create_attribute (
"code",
e));
a << i.getCode ();
}
}
}
}
}
#include <xsd/cxx/post.hxx>
// Begin epilogue.
//
#if __GNUC__ > 5 || (__GNUC__ == 5 && __GNUC_MINOR__ >= 1)
#pragma GCC diagnostic pop
#endif
#if __clang__ || __GNUC__ >= 4
#pragma GCC diagnostic pop
#endif
//
// End epilogue.

592
src/xml/linphone-imdn.h Normal file
View file

@ -0,0 +1,592 @@
// Copyright (c) 2005-2014 Code Synthesis Tools CC
//
// This program was generated by CodeSynthesis XSD, an XML Schema to
// C++ data binding compiler.
//
// This program is free software; you can redistribute it and/or modify
// it under the terms of the GNU General Public License version 2 as
// published by the Free Software Foundation.
//
// 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 St, Fifth Floor, Boston, MA 02110-1301 USA
//
// In addition, as a special exception, Code Synthesis Tools CC gives
// permission to link this program with the Xerces-C++ library (or with
// modified versions of Xerces-C++ that use the same license as Xerces-C++),
// and distribute linked combinations including the two. You must obey
// the GNU General Public License version 2 in all respects for all of
// the code used other than Xerces-C++. If you modify this copy of the
// program, you may extend this exception to your version of the program,
// but you are not obligated to do so. If you do not wish to do so, delete
// this exception statement from your version.
//
// Furthermore, Code Synthesis Tools CC makes a special exception for
// the Free/Libre and Open Source Software (FLOSS) which is described
// in the accompanying FLOSSE file.
//
#ifndef XML_LINPHONE_IMDN_H
#define XML_LINPHONE_IMDN_H
#ifndef XSD_CXX11
#define XSD_CXX11
#endif
#ifndef XSD_USE_CHAR
#define XSD_USE_CHAR
#endif
#ifndef XSD_CXX_TREE_USE_CHAR
#define XSD_CXX_TREE_USE_CHAR
#endif
// Begin prologue.
//
#if __clang__ || __GNUC__ >= 4
#pragma GCC diagnostic push
#pragma GCC diagnostic ignored "-Wfloat-equal"
#endif
#if __GNUC__ > 5 || (__GNUC__ == 5 && __GNUC_MINOR__ >= 1)
#pragma GCC diagnostic push
#pragma GCC diagnostic ignored "-Wsuggest-override"
#endif
//
// End prologue.
#include <xsd/cxx/config.hxx>
#if (XSD_INT_VERSION != 4000000L)
#error XSD runtime version mismatch
#endif
#include <xsd/cxx/pre.hxx>
#include <xsd/cxx/xml/char-utf8.hxx>
#include <xsd/cxx/tree/exceptions.hxx>
#include <xsd/cxx/tree/elements.hxx>
#include <xsd/cxx/tree/types.hxx>
#include <xsd/cxx/xml/error-handler.hxx>
#include <xsd/cxx/xml/dom/auto-ptr.hxx>
#include <xsd/cxx/tree/parsing.hxx>
#include <xsd/cxx/tree/parsing/byte.hxx>
#include <xsd/cxx/tree/parsing/unsigned-byte.hxx>
#include <xsd/cxx/tree/parsing/short.hxx>
#include <xsd/cxx/tree/parsing/unsigned-short.hxx>
#include <xsd/cxx/tree/parsing/int.hxx>
#include <xsd/cxx/tree/parsing/unsigned-int.hxx>
#include <xsd/cxx/tree/parsing/long.hxx>
#include <xsd/cxx/tree/parsing/unsigned-long.hxx>
#include <xsd/cxx/tree/parsing/boolean.hxx>
#include <xsd/cxx/tree/parsing/float.hxx>
#include <xsd/cxx/tree/parsing/double.hxx>
#include <xsd/cxx/tree/parsing/decimal.hxx>
#include <xsd/cxx/xml/dom/serialization-header.hxx>
#include <xsd/cxx/tree/serialization.hxx>
#include <xsd/cxx/tree/serialization/byte.hxx>
#include <xsd/cxx/tree/serialization/unsigned-byte.hxx>
#include <xsd/cxx/tree/serialization/short.hxx>
#include <xsd/cxx/tree/serialization/unsigned-short.hxx>
#include <xsd/cxx/tree/serialization/int.hxx>
#include <xsd/cxx/tree/serialization/unsigned-int.hxx>
#include <xsd/cxx/tree/serialization/long.hxx>
#include <xsd/cxx/tree/serialization/unsigned-long.hxx>
#include <xsd/cxx/tree/serialization/boolean.hxx>
#include <xsd/cxx/tree/serialization/float.hxx>
#include <xsd/cxx/tree/serialization/double.hxx>
#include <xsd/cxx/tree/serialization/decimal.hxx>
#include <xsd/cxx/tree/std-ostream-operators.hxx>
namespace LinphonePrivate
{
namespace Xsd
{
namespace XmlSchema
{
// anyType and anySimpleType.
//
typedef ::xsd::cxx::tree::type Type;
typedef ::xsd::cxx::tree::simple_type< char, Type > SimpleType;
typedef ::xsd::cxx::tree::type Container;
// 8-bit
//
typedef signed char Byte;
typedef unsigned char UnsignedByte;
// 16-bit
//
typedef short Short;
typedef unsigned short UnsignedShort;
// 32-bit
//
typedef int Int;
typedef unsigned int UnsignedInt;
// 64-bit
//
typedef long long Long;
typedef unsigned long long UnsignedLong;
// Supposed to be arbitrary-length integral types.
//
typedef long long Integer;
typedef long long NonPositiveInteger;
typedef unsigned long long NonNegativeInteger;
typedef unsigned long long PositiveInteger;
typedef long long NegativeInteger;
// Boolean.
//
typedef bool Boolean;
// Floating-point types.
//
typedef float Float;
typedef double Double;
typedef double Decimal;
// String types.
//
typedef ::xsd::cxx::tree::string< char, SimpleType > String;
typedef ::xsd::cxx::tree::normalized_string< char, String > NormalizedString;
typedef ::xsd::cxx::tree::token< char, NormalizedString > Token;
typedef ::xsd::cxx::tree::name< char, Token > Name;
typedef ::xsd::cxx::tree::nmtoken< char, Token > Nmtoken;
typedef ::xsd::cxx::tree::nmtokens< char, SimpleType, Nmtoken > Nmtokens;
typedef ::xsd::cxx::tree::ncname< char, Name > Ncname;
typedef ::xsd::cxx::tree::language< char, Token > Language;
// ID/IDREF.
//
typedef ::xsd::cxx::tree::id< char, Ncname > Id;
typedef ::xsd::cxx::tree::idref< char, Ncname, Type > Idref;
typedef ::xsd::cxx::tree::idrefs< char, SimpleType, Idref > Idrefs;
// URI.
//
typedef ::xsd::cxx::tree::uri< char, SimpleType > Uri;
// Qualified name.
//
typedef ::xsd::cxx::tree::qname< char, SimpleType, Uri, Ncname > Qname;
// Binary.
//
typedef ::xsd::cxx::tree::buffer< char > Buffer;
typedef ::xsd::cxx::tree::base64_binary< char, SimpleType > Base64Binary;
typedef ::xsd::cxx::tree::hex_binary< char, SimpleType > HexBinary;
// Date/time.
//
typedef ::xsd::cxx::tree::time_zone TimeZone;
typedef ::xsd::cxx::tree::date< char, SimpleType > Date;
typedef ::xsd::cxx::tree::date_time< char, SimpleType > DateTime;
typedef ::xsd::cxx::tree::duration< char, SimpleType > Duration;
typedef ::xsd::cxx::tree::gday< char, SimpleType > Gday;
typedef ::xsd::cxx::tree::gmonth< char, SimpleType > Gmonth;
typedef ::xsd::cxx::tree::gmonth_day< char, SimpleType > GmonthDay;
typedef ::xsd::cxx::tree::gyear< char, SimpleType > Gyear;
typedef ::xsd::cxx::tree::gyear_month< char, SimpleType > GyearMonth;
typedef ::xsd::cxx::tree::time< char, SimpleType > Time;
// Entity.
//
typedef ::xsd::cxx::tree::entity< char, Ncname > Entity;
typedef ::xsd::cxx::tree::entities< char, SimpleType, Entity > Entities;
typedef ::xsd::cxx::tree::content_order ContentOrder;
// Namespace information and list stream. Used in
// serialization functions.
//
typedef ::xsd::cxx::xml::dom::namespace_info< char > NamespaceInfo;
typedef ::xsd::cxx::xml::dom::namespace_infomap< char > NamespaceInfomap;
typedef ::xsd::cxx::tree::list_stream< char > ListStream;
typedef ::xsd::cxx::tree::as_double< Double > AsDouble;
typedef ::xsd::cxx::tree::as_decimal< Decimal > AsDecimal;
typedef ::xsd::cxx::tree::facet Facet;
// Flags and properties.
//
typedef ::xsd::cxx::tree::flags Flags;
typedef ::xsd::cxx::tree::properties< char > Properties;
// Parsing/serialization diagnostics.
//
typedef ::xsd::cxx::tree::severity Severity;
typedef ::xsd::cxx::tree::error< char > Error;
typedef ::xsd::cxx::tree::diagnostics< char > Diagnostics;
// Exceptions.
//
typedef ::xsd::cxx::tree::exception< char > Exception;
typedef ::xsd::cxx::tree::bounds< char > Bounds;
typedef ::xsd::cxx::tree::duplicate_id< char > DuplicateId;
typedef ::xsd::cxx::tree::parsing< char > Parsing;
typedef ::xsd::cxx::tree::expected_element< char > ExpectedElement;
typedef ::xsd::cxx::tree::unexpected_element< char > UnexpectedElement;
typedef ::xsd::cxx::tree::expected_attribute< char > ExpectedAttribute;
typedef ::xsd::cxx::tree::unexpected_enumerator< char > UnexpectedEnumerator;
typedef ::xsd::cxx::tree::expected_text_content< char > ExpectedTextContent;
typedef ::xsd::cxx::tree::no_prefix_mapping< char > NoPrefixMapping;
typedef ::xsd::cxx::tree::no_type_info< char > NoTypeInfo;
typedef ::xsd::cxx::tree::not_derived< char > NotDerived;
typedef ::xsd::cxx::tree::serialization< char > Serialization;
// Error handler callback interface.
//
typedef ::xsd::cxx::xml::error_handler< char > ErrorHandler;
// DOM interaction.
//
namespace dom
{
// Automatic pointer for DOMDocument.
//
using ::xsd::cxx::xml::dom::unique_ptr;
#ifndef XSD_CXX_TREE_TREE_NODE_KEY__LINPHONEPRIVATE__XSD__XMLSCHEMA
#define XSD_CXX_TREE_TREE_NODE_KEY__LINPHONEPRIVATE__XSD__XMLSCHEMA
// DOM user data key for back pointers to tree nodes.
//
const XMLCh* const treeNodeKey = ::xsd::cxx::tree::user_data_keys::node;
#endif
}
}
}
}
// Forward declarations.
//
namespace LinphonePrivate
{
namespace Xsd
{
namespace LinphoneImdn
{
class ImdnReason;
}
}
}
#include <memory> // ::std::unique_ptr
#include <limits> // std::numeric_limits
#include <algorithm> // std::binary_search
#include <utility> // std::move
#include <xsd/cxx/xml/char-utf8.hxx>
#include <xsd/cxx/tree/exceptions.hxx>
#include <xsd/cxx/tree/elements.hxx>
#include <xsd/cxx/tree/containers.hxx>
#include <xsd/cxx/tree/list.hxx>
#include <xsd/cxx/xml/dom/parsing-header.hxx>
#include <xsd/cxx/tree/containers-wildcard.hxx>
namespace LinphonePrivate
{
namespace Xsd
{
namespace LinphoneImdn
{
class ImdnReason: public ::LinphonePrivate::Xsd::XmlSchema::String
{
public:
// code
//
typedef ::LinphonePrivate::Xsd::XmlSchema::Int CodeType;
typedef ::xsd::cxx::tree::traits< CodeType, char > CodeTraits;
const CodeType&
getCode () const;
CodeType&
getCode ();
void
setCode (const CodeType& x);
static CodeType
getCodeDefaultValue ();
// Constructors.
//
ImdnReason ();
ImdnReason (const char*);
ImdnReason (const ::std::string&);
ImdnReason (const ::LinphonePrivate::Xsd::XmlSchema::String&);
ImdnReason (const ::xercesc::DOMElement& e,
::LinphonePrivate::Xsd::XmlSchema::Flags f = 0,
::LinphonePrivate::Xsd::XmlSchema::Container* c = 0);
ImdnReason (const ImdnReason& x,
::LinphonePrivate::Xsd::XmlSchema::Flags f = 0,
::LinphonePrivate::Xsd::XmlSchema::Container* c = 0);
virtual ImdnReason*
_clone (::LinphonePrivate::Xsd::XmlSchema::Flags f = 0,
::LinphonePrivate::Xsd::XmlSchema::Container* c = 0) const;
ImdnReason&
operator= (const ImdnReason& x);
virtual
~ImdnReason ();
// Implementation.
//
protected:
void
parse (::xsd::cxx::xml::dom::parser< char >&,
::LinphonePrivate::Xsd::XmlSchema::Flags);
protected:
::xsd::cxx::tree::one< CodeType > code_;
};
}
}
}
#include <iosfwd>
namespace LinphonePrivate
{
namespace Xsd
{
namespace LinphoneImdn
{
::std::ostream&
operator<< (::std::ostream&, const ImdnReason&);
}
}
}
#include <iosfwd>
#include <xercesc/sax/InputSource.hpp>
#include <xercesc/dom/DOMDocument.hpp>
#include <xercesc/dom/DOMErrorHandler.hpp>
namespace LinphonePrivate
{
namespace Xsd
{
namespace LinphoneImdn
{
// Parse a URI or a local file.
//
::std::unique_ptr< ::LinphonePrivate::Xsd::LinphoneImdn::ImdnReason >
parseReason (const ::std::string& uri,
::LinphonePrivate::Xsd::XmlSchema::Flags f = 0,
const ::LinphonePrivate::Xsd::XmlSchema::Properties& p = ::LinphonePrivate::Xsd::XmlSchema::Properties ());
::std::unique_ptr< ::LinphonePrivate::Xsd::LinphoneImdn::ImdnReason >
parseReason (const ::std::string& uri,
::LinphonePrivate::Xsd::XmlSchema::ErrorHandler& eh,
::LinphonePrivate::Xsd::XmlSchema::Flags f = 0,
const ::LinphonePrivate::Xsd::XmlSchema::Properties& p = ::LinphonePrivate::Xsd::XmlSchema::Properties ());
::std::unique_ptr< ::LinphonePrivate::Xsd::LinphoneImdn::ImdnReason >
parseReason (const ::std::string& uri,
::xercesc::DOMErrorHandler& eh,
::LinphonePrivate::Xsd::XmlSchema::Flags f = 0,
const ::LinphonePrivate::Xsd::XmlSchema::Properties& p = ::LinphonePrivate::Xsd::XmlSchema::Properties ());
// Parse std::istream.
//
::std::unique_ptr< ::LinphonePrivate::Xsd::LinphoneImdn::ImdnReason >
parseReason (::std::istream& is,
::LinphonePrivate::Xsd::XmlSchema::Flags f = 0,
const ::LinphonePrivate::Xsd::XmlSchema::Properties& p = ::LinphonePrivate::Xsd::XmlSchema::Properties ());
::std::unique_ptr< ::LinphonePrivate::Xsd::LinphoneImdn::ImdnReason >
parseReason (::std::istream& is,
::LinphonePrivate::Xsd::XmlSchema::ErrorHandler& eh,
::LinphonePrivate::Xsd::XmlSchema::Flags f = 0,
const ::LinphonePrivate::Xsd::XmlSchema::Properties& p = ::LinphonePrivate::Xsd::XmlSchema::Properties ());
::std::unique_ptr< ::LinphonePrivate::Xsd::LinphoneImdn::ImdnReason >
parseReason (::std::istream& is,
::xercesc::DOMErrorHandler& eh,
::LinphonePrivate::Xsd::XmlSchema::Flags f = 0,
const ::LinphonePrivate::Xsd::XmlSchema::Properties& p = ::LinphonePrivate::Xsd::XmlSchema::Properties ());
::std::unique_ptr< ::LinphonePrivate::Xsd::LinphoneImdn::ImdnReason >
parseReason (::std::istream& is,
const ::std::string& id,
::LinphonePrivate::Xsd::XmlSchema::Flags f = 0,
const ::LinphonePrivate::Xsd::XmlSchema::Properties& p = ::LinphonePrivate::Xsd::XmlSchema::Properties ());
::std::unique_ptr< ::LinphonePrivate::Xsd::LinphoneImdn::ImdnReason >
parseReason (::std::istream& is,
const ::std::string& id,
::LinphonePrivate::Xsd::XmlSchema::ErrorHandler& eh,
::LinphonePrivate::Xsd::XmlSchema::Flags f = 0,
const ::LinphonePrivate::Xsd::XmlSchema::Properties& p = ::LinphonePrivate::Xsd::XmlSchema::Properties ());
::std::unique_ptr< ::LinphonePrivate::Xsd::LinphoneImdn::ImdnReason >
parseReason (::std::istream& is,
const ::std::string& id,
::xercesc::DOMErrorHandler& eh,
::LinphonePrivate::Xsd::XmlSchema::Flags f = 0,
const ::LinphonePrivate::Xsd::XmlSchema::Properties& p = ::LinphonePrivate::Xsd::XmlSchema::Properties ());
// Parse xercesc::InputSource.
//
::std::unique_ptr< ::LinphonePrivate::Xsd::LinphoneImdn::ImdnReason >
parseReason (::xercesc::InputSource& is,
::LinphonePrivate::Xsd::XmlSchema::Flags f = 0,
const ::LinphonePrivate::Xsd::XmlSchema::Properties& p = ::LinphonePrivate::Xsd::XmlSchema::Properties ());
::std::unique_ptr< ::LinphonePrivate::Xsd::LinphoneImdn::ImdnReason >
parseReason (::xercesc::InputSource& is,
::LinphonePrivate::Xsd::XmlSchema::ErrorHandler& eh,
::LinphonePrivate::Xsd::XmlSchema::Flags f = 0,
const ::LinphonePrivate::Xsd::XmlSchema::Properties& p = ::LinphonePrivate::Xsd::XmlSchema::Properties ());
::std::unique_ptr< ::LinphonePrivate::Xsd::LinphoneImdn::ImdnReason >
parseReason (::xercesc::InputSource& is,
::xercesc::DOMErrorHandler& eh,
::LinphonePrivate::Xsd::XmlSchema::Flags f = 0,
const ::LinphonePrivate::Xsd::XmlSchema::Properties& p = ::LinphonePrivate::Xsd::XmlSchema::Properties ());
// Parse xercesc::DOMDocument.
//
::std::unique_ptr< ::LinphonePrivate::Xsd::LinphoneImdn::ImdnReason >
parseReason (const ::xercesc::DOMDocument& d,
::LinphonePrivate::Xsd::XmlSchema::Flags f = 0,
const ::LinphonePrivate::Xsd::XmlSchema::Properties& p = ::LinphonePrivate::Xsd::XmlSchema::Properties ());
::std::unique_ptr< ::LinphonePrivate::Xsd::LinphoneImdn::ImdnReason >
parseReason (::LinphonePrivate::Xsd::XmlSchema::dom::unique_ptr< ::xercesc::DOMDocument > d,
::LinphonePrivate::Xsd::XmlSchema::Flags f = 0,
const ::LinphonePrivate::Xsd::XmlSchema::Properties& p = ::LinphonePrivate::Xsd::XmlSchema::Properties ());
}
}
}
#include <iosfwd>
#include <xercesc/dom/DOMDocument.hpp>
#include <xercesc/dom/DOMErrorHandler.hpp>
#include <xercesc/framework/XMLFormatter.hpp>
#include <xsd/cxx/xml/dom/auto-ptr.hxx>
namespace LinphonePrivate
{
namespace Xsd
{
namespace LinphoneImdn
{
// Serialize to std::ostream.
//
void
serializeReason (::std::ostream& os,
const ::LinphonePrivate::Xsd::LinphoneImdn::ImdnReason& x,
const ::LinphonePrivate::Xsd::XmlSchema::NamespaceInfomap& m = ::LinphonePrivate::Xsd::XmlSchema::NamespaceInfomap (),
const ::std::string& e = "UTF-8",
::LinphonePrivate::Xsd::XmlSchema::Flags f = 0);
void
serializeReason (::std::ostream& os,
const ::LinphonePrivate::Xsd::LinphoneImdn::ImdnReason& x,
::LinphonePrivate::Xsd::XmlSchema::ErrorHandler& eh,
const ::LinphonePrivate::Xsd::XmlSchema::NamespaceInfomap& m = ::LinphonePrivate::Xsd::XmlSchema::NamespaceInfomap (),
const ::std::string& e = "UTF-8",
::LinphonePrivate::Xsd::XmlSchema::Flags f = 0);
void
serializeReason (::std::ostream& os,
const ::LinphonePrivate::Xsd::LinphoneImdn::ImdnReason& x,
::xercesc::DOMErrorHandler& eh,
const ::LinphonePrivate::Xsd::XmlSchema::NamespaceInfomap& m = ::LinphonePrivate::Xsd::XmlSchema::NamespaceInfomap (),
const ::std::string& e = "UTF-8",
::LinphonePrivate::Xsd::XmlSchema::Flags f = 0);
// Serialize to xercesc::XMLFormatTarget.
//
void
serializeReason (::xercesc::XMLFormatTarget& ft,
const ::LinphonePrivate::Xsd::LinphoneImdn::ImdnReason& x,
const ::LinphonePrivate::Xsd::XmlSchema::NamespaceInfomap& m = ::LinphonePrivate::Xsd::XmlSchema::NamespaceInfomap (),
const ::std::string& e = "UTF-8",
::LinphonePrivate::Xsd::XmlSchema::Flags f = 0);
void
serializeReason (::xercesc::XMLFormatTarget& ft,
const ::LinphonePrivate::Xsd::LinphoneImdn::ImdnReason& x,
::LinphonePrivate::Xsd::XmlSchema::ErrorHandler& eh,
const ::LinphonePrivate::Xsd::XmlSchema::NamespaceInfomap& m = ::LinphonePrivate::Xsd::XmlSchema::NamespaceInfomap (),
const ::std::string& e = "UTF-8",
::LinphonePrivate::Xsd::XmlSchema::Flags f = 0);
void
serializeReason (::xercesc::XMLFormatTarget& ft,
const ::LinphonePrivate::Xsd::LinphoneImdn::ImdnReason& x,
::xercesc::DOMErrorHandler& eh,
const ::LinphonePrivate::Xsd::XmlSchema::NamespaceInfomap& m = ::LinphonePrivate::Xsd::XmlSchema::NamespaceInfomap (),
const ::std::string& e = "UTF-8",
::LinphonePrivate::Xsd::XmlSchema::Flags f = 0);
// Serialize to an existing xercesc::DOMDocument.
//
void
serializeReason (::xercesc::DOMDocument& d,
const ::LinphonePrivate::Xsd::LinphoneImdn::ImdnReason& x,
::LinphonePrivate::Xsd::XmlSchema::Flags f = 0);
// Serialize to a new xercesc::DOMDocument.
//
::LinphonePrivate::Xsd::XmlSchema::dom::unique_ptr< ::xercesc::DOMDocument >
serializeReason (const ::LinphonePrivate::Xsd::LinphoneImdn::ImdnReason& x,
const ::LinphonePrivate::Xsd::XmlSchema::NamespaceInfomap& m = ::LinphonePrivate::Xsd::XmlSchema::NamespaceInfomap (),
::LinphonePrivate::Xsd::XmlSchema::Flags f = 0);
void
operator<< (::xercesc::DOMElement&, const ImdnReason&);
}
}
}
#include <xsd/cxx/post.hxx>
// Begin epilogue.
//
#if __GNUC__ > 5 || (__GNUC__ == 5 && __GNUC_MINOR__ >= 1)
#pragma GCC diagnostic pop
#endif
#if __clang__ || __GNUC__ >= 4
#pragma GCC diagnostic pop
#endif
//
// End epilogue.
#endif // XML_LINPHONE_IMDN_H

15
src/xml/linphone-imdn.xsd Normal file
View file

@ -0,0 +1,15 @@
<?xml version="1.0" encoding="UTF-8"?>
<xs:schema xmlns:xs="http://www.w3.org/2001/XMLSchema"
targetNamespace="http://www.linphone.org/xsds/imdn.xsd"
xmlns:tns="http://www.linphone.org/xsds/imdn.xsd"
elementFormDefault="qualified">
<xs:element name="reason" type="tns:ImdnReason"/>
<xs:complexType name="ImdnReason">
<xs:simpleContent>
<xs:extension base="xs:string">
<xs:attribute name="code" type="xs:int" use="optional" default="200"/>
</xs:extension>
</xs:simpleContent>
</xs:complexType>
</xs:schema>

View file

@ -1,7 +1,8 @@
#if __clang__ || __GNUC__ >= 4
#pragma GCC diagnostic push
#pragma GCC diagnostic ignored "-Wfloat-equal"
#ifndef __ANDROID__
#endif
#if __GNUC__ > 5 || (__GNUC__ == 5 && __GNUC_MINOR__ >= 1)
#pragma GCC diagnostic push
#pragma GCC diagnostic ignored "-Wsuggest-override"
#endif
#endif

View file

@ -36,9 +36,10 @@
#if __clang__ || __GNUC__ >= 4
#pragma GCC diagnostic push
#pragma GCC diagnostic ignored "-Wfloat-equal"
#if __GNUC__ > 5 || (__GNUC__ == 5 && __GNUC_MINOR__ >= 1)
#pragma GCC diagnostic ignored "-Wsuggest-override"
#endif
#if __GNUC__ > 5 || (__GNUC__ == 5 && __GNUC_MINOR__ >= 1)
#pragma GCC diagnostic push
#pragma GCC diagnostic ignored "-Wsuggest-override"
#endif
//
// End prologue.
@ -54,7 +55,7 @@ namespace LinphonePrivate
namespace ResourceLists
{
// ListType
//
//
const ListType::DisplayNameOptional& ListType::
getDisplayName () const
@ -238,7 +239,7 @@ namespace LinphonePrivate
// EntryType
//
//
const EntryType::DisplayNameOptional& EntryType::
getDisplayName () const
@ -350,7 +351,7 @@ namespace LinphonePrivate
// EntryRefType
//
//
const EntryRefType::DisplayNameOptional& EntryRefType::
getDisplayName () const
@ -462,7 +463,7 @@ namespace LinphonePrivate
// ExternalType
//
//
const ExternalType::DisplayNameOptional& ExternalType::
getDisplayName () const
@ -574,7 +575,7 @@ namespace LinphonePrivate
// DisplayNameType
//
//
const DisplayNameType::LangOptional& DisplayNameType::
getLang () const
@ -608,15 +609,15 @@ namespace LinphonePrivate
// List
//
//
// DisplayName
//
//
// ResourceLists
//
//
const ResourceLists::ListSequence& ResourceLists::
getList () const
@ -643,6 +644,15 @@ namespace LinphonePrivate
#include <xsd/cxx/xml/dom/parsing-source.hxx>
#include <xsd/cxx/tree/type-factory-map.hxx>
namespace _xsd
{
static
const ::xsd::cxx::tree::type_factory_plate< 0, char >
type_factory_plate_init;
}
namespace LinphonePrivate
{
namespace Xsd
@ -1558,6 +1568,15 @@ namespace LinphonePrivate
#include <ostream>
#include <xsd/cxx/tree/std-ostream-map.hxx>
namespace _xsd
{
static
const ::xsd::cxx::tree::std_ostream_plate< 0, char >
std_ostream_plate_init;
}
namespace LinphonePrivate
{
namespace Xsd
@ -1976,6 +1995,15 @@ namespace LinphonePrivate
#include <xsd/cxx/tree/error-handler.hxx>
#include <xsd/cxx/xml/dom/serialization-source.hxx>
#include <xsd/cxx/tree/type-serializer-map.hxx>
namespace _xsd
{
static
const ::xsd::cxx::tree::type_serializer_plate< 0, char >
type_serializer_plate_init;
}
namespace LinphonePrivate
{
namespace Xsd
@ -2483,8 +2511,12 @@ namespace LinphonePrivate
// Begin epilogue.
//
#if __GNUC__ > 5 || (__GNUC__ == 5 && __GNUC_MINOR__ >= 1)
#pragma GCC diagnostic pop
#endif
#if __clang__ || __GNUC__ >= 4
#pragma GCC diagnostic pop
#endif
//
// End epilogue.

View file

@ -51,9 +51,10 @@
#if __clang__ || __GNUC__ >= 4
#pragma GCC diagnostic push
#pragma GCC diagnostic ignored "-Wfloat-equal"
#if __GNUC__ > 5 || (__GNUC__ == 5 && __GNUC_MINOR__ >= 1)
#pragma GCC diagnostic ignored "-Wsuggest-override"
#endif
#if __GNUC__ > 5 || (__GNUC__ == 5 && __GNUC_MINOR__ >= 1)
#pragma GCC diagnostic push
#pragma GCC diagnostic ignored "-Wsuggest-override"
#endif
//
// End prologue.
@ -240,6 +241,8 @@ namespace LinphonePrivate
typedef ::xsd::cxx::tree::unexpected_enumerator< char > UnexpectedEnumerator;
typedef ::xsd::cxx::tree::expected_text_content< char > ExpectedTextContent;
typedef ::xsd::cxx::tree::no_prefix_mapping< char > NoPrefixMapping;
typedef ::xsd::cxx::tree::no_type_info< char > NoTypeInfo;
typedef ::xsd::cxx::tree::not_derived< char > NotDerived;
typedef ::xsd::cxx::tree::serialization< char > Serialization;
// Error handler callback interface.
@ -480,7 +483,7 @@ namespace LinphonePrivate
ListType&
operator= (const ListType& x);
virtual
virtual
~ListType ();
// Implementation.
@ -604,7 +607,7 @@ namespace LinphonePrivate
EntryType&
operator= (const EntryType& x);
virtual
virtual
~EntryType ();
// Implementation.
@ -724,7 +727,7 @@ namespace LinphonePrivate
EntryRefType&
operator= (const EntryRefType& x);
virtual
virtual
~EntryRefType ();
// Implementation.
@ -845,7 +848,7 @@ namespace LinphonePrivate
ExternalType&
operator= (const ExternalType& x);
virtual
virtual
~ExternalType ();
// Implementation.
@ -913,7 +916,7 @@ namespace LinphonePrivate
DisplayNameType&
operator= (const DisplayNameType& x);
virtual
virtual
~DisplayNameType ();
// Implementation.
@ -946,7 +949,7 @@ namespace LinphonePrivate
_clone (::LinphonePrivate::Xsd::XmlSchema::Flags f = 0,
::LinphonePrivate::Xsd::XmlSchema::Container* c = 0) const;
virtual
virtual
~List ();
};
@ -975,7 +978,7 @@ namespace LinphonePrivate
_clone (::LinphonePrivate::Xsd::XmlSchema::Flags f = 0,
::LinphonePrivate::Xsd::XmlSchema::Container* c = 0) const;
virtual
virtual
~DisplayName ();
};
@ -1018,7 +1021,7 @@ namespace LinphonePrivate
ResourceLists&
operator= (const ResourceLists& x);
virtual
virtual
~ResourceLists ();
// Implementation.
@ -1209,14 +1212,14 @@ namespace LinphonePrivate
void
serializeResourceLists (::std::ostream& os,
const ::LinphonePrivate::Xsd::ResourceLists::ResourceLists& x,
const ::LinphonePrivate::Xsd::ResourceLists::ResourceLists& x,
const ::LinphonePrivate::Xsd::XmlSchema::NamespaceInfomap& m = ::LinphonePrivate::Xsd::XmlSchema::NamespaceInfomap (),
const ::std::string& e = "UTF-8",
::LinphonePrivate::Xsd::XmlSchema::Flags f = 0);
void
serializeResourceLists (::std::ostream& os,
const ::LinphonePrivate::Xsd::ResourceLists::ResourceLists& x,
const ::LinphonePrivate::Xsd::ResourceLists::ResourceLists& x,
::LinphonePrivate::Xsd::XmlSchema::ErrorHandler& eh,
const ::LinphonePrivate::Xsd::XmlSchema::NamespaceInfomap& m = ::LinphonePrivate::Xsd::XmlSchema::NamespaceInfomap (),
const ::std::string& e = "UTF-8",
@ -1224,7 +1227,7 @@ namespace LinphonePrivate
void
serializeResourceLists (::std::ostream& os,
const ::LinphonePrivate::Xsd::ResourceLists::ResourceLists& x,
const ::LinphonePrivate::Xsd::ResourceLists::ResourceLists& x,
::xercesc::DOMErrorHandler& eh,
const ::LinphonePrivate::Xsd::XmlSchema::NamespaceInfomap& m = ::LinphonePrivate::Xsd::XmlSchema::NamespaceInfomap (),
const ::std::string& e = "UTF-8",
@ -1235,14 +1238,14 @@ namespace LinphonePrivate
void
serializeResourceLists (::xercesc::XMLFormatTarget& ft,
const ::LinphonePrivate::Xsd::ResourceLists::ResourceLists& x,
const ::LinphonePrivate::Xsd::ResourceLists::ResourceLists& x,
const ::LinphonePrivate::Xsd::XmlSchema::NamespaceInfomap& m = ::LinphonePrivate::Xsd::XmlSchema::NamespaceInfomap (),
const ::std::string& e = "UTF-8",
::LinphonePrivate::Xsd::XmlSchema::Flags f = 0);
void
serializeResourceLists (::xercesc::XMLFormatTarget& ft,
const ::LinphonePrivate::Xsd::ResourceLists::ResourceLists& x,
const ::LinphonePrivate::Xsd::ResourceLists::ResourceLists& x,
::LinphonePrivate::Xsd::XmlSchema::ErrorHandler& eh,
const ::LinphonePrivate::Xsd::XmlSchema::NamespaceInfomap& m = ::LinphonePrivate::Xsd::XmlSchema::NamespaceInfomap (),
const ::std::string& e = "UTF-8",
@ -1250,7 +1253,7 @@ namespace LinphonePrivate
void
serializeResourceLists (::xercesc::XMLFormatTarget& ft,
const ::LinphonePrivate::Xsd::ResourceLists::ResourceLists& x,
const ::LinphonePrivate::Xsd::ResourceLists::ResourceLists& x,
::xercesc::DOMErrorHandler& eh,
const ::LinphonePrivate::Xsd::XmlSchema::NamespaceInfomap& m = ::LinphonePrivate::Xsd::XmlSchema::NamespaceInfomap (),
const ::std::string& e = "UTF-8",
@ -1268,7 +1271,7 @@ namespace LinphonePrivate
//
::LinphonePrivate::Xsd::XmlSchema::dom::unique_ptr< ::xercesc::DOMDocument >
serializeResourceLists (const ::LinphonePrivate::Xsd::ResourceLists::ResourceLists& x,
serializeResourceLists (const ::LinphonePrivate::Xsd::ResourceLists::ResourceLists& x,
const ::LinphonePrivate::Xsd::XmlSchema::NamespaceInfomap& m = ::LinphonePrivate::Xsd::XmlSchema::NamespaceInfomap (),
::LinphonePrivate::Xsd::XmlSchema::Flags f = 0);
@ -1291,6 +1294,9 @@ namespace LinphonePrivate
// Begin epilogue.
//
#if __GNUC__ > 5 || (__GNUC__ == 5 && __GNUC_MINOR__ >= 1)
#pragma GCC diagnostic pop
#endif
#if __clang__ || __GNUC__ >= 4
#pragma GCC diagnostic pop
#endif

View file

@ -36,9 +36,10 @@
#if __clang__ || __GNUC__ >= 4
#pragma GCC diagnostic push
#pragma GCC diagnostic ignored "-Wfloat-equal"
#if __GNUC__ > 5 || (__GNUC__ == 5 && __GNUC_MINOR__ >= 1)
#pragma GCC diagnostic ignored "-Wsuggest-override"
#endif
#if __GNUC__ > 5 || (__GNUC__ == 5 && __GNUC_MINOR__ >= 1)
#pragma GCC diagnostic push
#pragma GCC diagnostic ignored "-Wsuggest-override"
#endif
//
// End prologue.
@ -73,7 +74,7 @@ namespace namespace_
}
// Space
//
//
Space::
Space (Value v)
@ -110,7 +111,7 @@ namespace namespace_
Space& Space::
operator= (Value v)
{
static_cast< ::LinphonePrivate::Xsd::XmlSchema::Ncname& > (*this) =
static_cast< ::LinphonePrivate::Xsd::XmlSchema::Ncname& > (*this) =
::LinphonePrivate::Xsd::XmlSchema::Ncname (_xsd_Space_literals_[v]);
return *this;
@ -118,7 +119,7 @@ namespace namespace_
// Lang_member
//
//
Lang_member::
Lang_member (Value v)
@ -155,7 +156,7 @@ namespace namespace_
Lang_member& Lang_member::
operator= (Value v)
{
static_cast< ::LinphonePrivate::Xsd::XmlSchema::String& > (*this) =
static_cast< ::LinphonePrivate::Xsd::XmlSchema::String& > (*this) =
::LinphonePrivate::Xsd::XmlSchema::String (_xsd_Lang_member_literals_[v]);
return *this;
@ -166,6 +167,15 @@ namespace namespace_
#include <xsd/cxx/xml/dom/parsing-source.hxx>
#include <xsd/cxx/tree/type-factory-map.hxx>
namespace _xsd
{
static
const ::xsd::cxx::tree::type_factory_plate< 0, char >
type_factory_plate_init;
}
namespace namespace_
{
// Lang
@ -344,6 +354,15 @@ namespace namespace_
#include <ostream>
#include <xsd/cxx/tree/std-ostream-map.hxx>
namespace _xsd
{
static
const ::xsd::cxx::tree::std_ostream_plate< 0, char >
std_ostream_plate_init;
}
namespace namespace_
{
::std::ostream&
@ -389,6 +408,15 @@ namespace namespace_
#include <xsd/cxx/tree/error-handler.hxx>
#include <xsd/cxx/xml/dom/serialization-source.hxx>
#include <xsd/cxx/tree/type-serializer-map.hxx>
namespace _xsd
{
static
const ::xsd::cxx::tree::type_serializer_plate< 0, char >
type_serializer_plate_init;
}
namespace namespace_
{
void
@ -453,8 +481,12 @@ namespace namespace_
// Begin epilogue.
//
#if __GNUC__ > 5 || (__GNUC__ == 5 && __GNUC_MINOR__ >= 1)
#pragma GCC diagnostic pop
#endif
#if __clang__ || __GNUC__ >= 4
#pragma GCC diagnostic pop
#endif
//
// End epilogue.

View file

@ -51,9 +51,10 @@
#if __clang__ || __GNUC__ >= 4
#pragma GCC diagnostic push
#pragma GCC diagnostic ignored "-Wfloat-equal"
#if __GNUC__ > 5 || (__GNUC__ == 5 && __GNUC_MINOR__ >= 1)
#pragma GCC diagnostic ignored "-Wsuggest-override"
#endif
#if __GNUC__ > 5 || (__GNUC__ == 5 && __GNUC_MINOR__ >= 1)
#pragma GCC diagnostic push
#pragma GCC diagnostic ignored "-Wsuggest-override"
#endif
//
// End prologue.
@ -240,6 +241,8 @@ namespace LinphonePrivate
typedef ::xsd::cxx::tree::unexpected_enumerator< char > UnexpectedEnumerator;
typedef ::xsd::cxx::tree::expected_text_content< char > ExpectedTextContent;
typedef ::xsd::cxx::tree::no_prefix_mapping< char > NoPrefixMapping;
typedef ::xsd::cxx::tree::no_type_info< char > NoTypeInfo;
typedef ::xsd::cxx::tree::not_derived< char > NotDerived;
typedef ::xsd::cxx::tree::serialization< char > Serialization;
// Error handler callback interface.
@ -510,6 +513,9 @@ namespace namespace_
// Begin epilogue.
//
#if __GNUC__ > 5 || (__GNUC__ == 5 && __GNUC_MINOR__ >= 1)
#pragma GCC diagnostic pop
#endif
#if __clang__ || __GNUC__ >= 4
#pragma GCC diagnostic pop
#endif

View file

@ -3062,9 +3062,6 @@ static void imdn_for_group_chat_room (void) {
linphone_im_notif_policy_enable_all(linphone_core_get_im_notif_policy(marie->lc));
linphone_im_notif_policy_enable_all(linphone_core_get_im_notif_policy(pauline->lc));
linphone_im_notif_policy_enable_all(linphone_core_get_im_notif_policy(chloe->lc));
linphone_config_set_bool(linphone_core_get_config(marie->lc), "misc", "enable_simple_group_chat_message_state", FALSE);
linphone_config_set_bool(linphone_core_get_config(pauline->lc), "misc", "enable_simple_group_chat_message_state", FALSE);
linphone_config_set_bool(linphone_core_get_config(chloe->lc), "misc", "enable_simple_group_chat_message_state", FALSE);
// Marie creates a new group chat room
const char *initialSubject = "Colleagues";
@ -3080,8 +3077,8 @@ static void imdn_for_group_chat_room (void) {
// Chloe begins composing a message
const char *chloeTextMessage = "Hello";
LinphoneChatMessage *chloeMessage = _send_message(chloeCr, chloeTextMessage);
BC_ASSERT_TRUE(wait_for_list(coresList, &marie->stat.number_of_LinphoneMessageReceived, initialMarieStats.number_of_LinphoneMessageReceived + 1, 10000));
BC_ASSERT_TRUE(wait_for_list(coresList, &pauline->stat.number_of_LinphoneMessageReceived, initialPaulineStats.number_of_LinphoneMessageReceived + 1, 10000));
BC_ASSERT_TRUE(wait_for_list(coresList, &marie->stat.number_of_LinphoneMessageReceived, initialMarieStats.number_of_LinphoneMessageReceived + 1, 3000));
BC_ASSERT_TRUE(wait_for_list(coresList, &pauline->stat.number_of_LinphoneMessageReceived, initialPaulineStats.number_of_LinphoneMessageReceived + 1, 3000));
LinphoneChatMessage *marieLastMsg = marie->stat.last_received_chat_message;
if (!BC_ASSERT_PTR_NOT_NULL(marieLastMsg))
goto end;
@ -3091,7 +3088,7 @@ static void imdn_for_group_chat_room (void) {
linphone_address_unref(chloeAddr);
// Check that the message has been delivered to Marie and Pauline
BC_ASSERT_TRUE(wait_for_list(coresList, &chloe->stat.number_of_LinphoneMessageDeliveredToUser, initialChloeStats.number_of_LinphoneMessageDeliveredToUser + 1, 1000));
BC_ASSERT_TRUE(wait_for_list(coresList, &chloe->stat.number_of_LinphoneMessageDeliveredToUser, initialChloeStats.number_of_LinphoneMessageDeliveredToUser + 1, 3000));
BC_ASSERT_PTR_NULL(linphone_chat_message_get_participants_that_have_displayed(chloeMessage));
bctbx_list_t *participantsThatReceivedChloeMessage = linphone_chat_message_get_participants_that_have_received(chloeMessage);
if (BC_ASSERT_PTR_NOT_NULL(participantsThatReceivedChloeMessage)) {
@ -3108,7 +3105,7 @@ static void imdn_for_group_chat_room (void) {
// Marie marks the message as read, check that the state is not yet displayed on Chloe's side
linphone_chat_room_mark_as_read(marieCr);
BC_ASSERT_FALSE(wait_for_list(coresList, &chloe->stat.number_of_LinphoneMessageDisplayed, initialChloeStats.number_of_LinphoneMessageDisplayed + 1, 1000));
BC_ASSERT_FALSE(wait_for_list(coresList, &chloe->stat.number_of_LinphoneMessageDisplayed, initialChloeStats.number_of_LinphoneMessageDisplayed + 1, 3000));
bctbx_list_t *participantsThatDisplayedChloeMessage = linphone_chat_message_get_participants_that_have_displayed(chloeMessage);
if (BC_ASSERT_PTR_NOT_NULL(participantsThatDisplayedChloeMessage)) {
BC_ASSERT_EQUAL((int)bctbx_list_size(participantsThatDisplayedChloeMessage), 1, int, "%d");
@ -3123,7 +3120,7 @@ static void imdn_for_group_chat_room (void) {
// Pauline also marks the message as read, check that the state is now displayed on Chloe's side
linphone_chat_room_mark_as_read(paulineCr);
BC_ASSERT_TRUE(wait_for_list(coresList, &chloe->stat.number_of_LinphoneMessageDisplayed, initialChloeStats.number_of_LinphoneMessageDisplayed + 1, 1000));
BC_ASSERT_TRUE(wait_for_list(coresList, &chloe->stat.number_of_LinphoneMessageDisplayed, initialChloeStats.number_of_LinphoneMessageDisplayed + 1, 3000));
participantsThatDisplayedChloeMessage = linphone_chat_message_get_participants_that_have_displayed(chloeMessage);
if (BC_ASSERT_PTR_NOT_NULL(participantsThatDisplayedChloeMessage)) {
BC_ASSERT_EQUAL((int)bctbx_list_size(participantsThatDisplayedChloeMessage), 2, int, "%d");
@ -3147,6 +3144,194 @@ end:
linphone_core_manager_destroy(chloe);
}
static void aggregated_imdn_for_group_chat_room_base (bool_t read_while_offline) {
LinphoneCoreManager *marie = linphone_core_manager_create("marie_rc");
LinphoneCoreManager *pauline = linphone_core_manager_create("pauline_rc");
LinphoneCoreManager *chloe = linphone_core_manager_create("chloe_rc");
bctbx_list_t *coresManagerList = NULL;
bctbx_list_t *participantsAddresses = NULL;
coresManagerList = bctbx_list_append(coresManagerList, marie);
coresManagerList = bctbx_list_append(coresManagerList, pauline);
coresManagerList = bctbx_list_append(coresManagerList, chloe);
bctbx_list_t *coresList = init_core_for_conference(coresManagerList);
start_core_for_conference(coresManagerList);
participantsAddresses = bctbx_list_append(participantsAddresses, linphone_address_new(linphone_core_get_identity(pauline->lc)));
participantsAddresses = bctbx_list_append(participantsAddresses, linphone_address_new(linphone_core_get_identity(chloe->lc)));
stats initialMarieStats = marie->stat;
stats initialPaulineStats = pauline->stat;
stats initialChloeStats = chloe->stat;
// Enable IMDN
linphone_im_notif_policy_enable_all(linphone_core_get_im_notif_policy(marie->lc));
linphone_im_notif_policy_enable_all(linphone_core_get_im_notif_policy(pauline->lc));
linphone_im_notif_policy_enable_all(linphone_core_get_im_notif_policy(chloe->lc));
// Marie creates a new group chat room
const char *initialSubject = "Colleagues";
LinphoneChatRoom *marieCr = create_chat_room_client_side(coresList, marie, &initialMarieStats, participantsAddresses, initialSubject, -1);
const LinphoneAddress *confAddr = linphone_chat_room_get_conference_address(marieCr);
// Check that the chat room is correctly created on Pauline's side and that the participants are added
LinphoneChatRoom *paulineCr = check_creation_chat_room_client_side(coresList, pauline, &initialPaulineStats, confAddr, initialSubject, 2, FALSE);
// Check that the chat room is correctly created on Chloe's side and that the participants are added
LinphoneChatRoom *chloeCr = check_creation_chat_room_client_side(coresList, chloe, &initialChloeStats, confAddr, initialSubject, 2, FALSE);
// Chloe begins composing a message
const char *chloeTextMessage = "Hello";
const char *chloeTextMessage2 = "Long time no talk";
const char *chloeTextMessage3 = "How are you?";
LinphoneChatMessage *chloeMessage = _send_message(chloeCr, chloeTextMessage);
LinphoneChatMessage *chloeMessage2 = _send_message(chloeCr, chloeTextMessage2);
LinphoneChatMessage *chloeMessage3 = _send_message(chloeCr, chloeTextMessage3);
BC_ASSERT_TRUE(wait_for_list(coresList, &marie->stat.number_of_LinphoneMessageReceived, initialMarieStats.number_of_LinphoneMessageReceived + 3, 3000));
BC_ASSERT_TRUE(wait_for_list(coresList, &pauline->stat.number_of_LinphoneMessageReceived, initialPaulineStats.number_of_LinphoneMessageReceived + 3, 3000));
LinphoneChatMessage *marieLastMsg = marie->stat.last_received_chat_message;
if (!BC_ASSERT_PTR_NOT_NULL(marieLastMsg))
goto end;
BC_ASSERT_STRING_EQUAL(linphone_chat_message_get_text(marieLastMsg), chloeTextMessage3);
LinphoneAddress *chloeAddr = linphone_address_new(linphone_core_get_identity(chloe->lc));
BC_ASSERT_TRUE(linphone_address_weak_equal(chloeAddr, linphone_chat_message_get_from_address(marieLastMsg)));
linphone_address_unref(chloeAddr);
// Mark the messages as read on Marie's and Pauline's sides
linphone_chat_room_mark_as_read(marieCr);
if (read_while_offline) {
linphone_core_set_network_reachable(pauline->lc, FALSE);
linphone_chat_room_mark_as_read(paulineCr);
wait_for_list(coresList, 0, 1, 2000);
linphone_core_set_network_reachable(pauline->lc, TRUE);
} else {
linphone_chat_room_mark_as_read(paulineCr);
}
BC_ASSERT_TRUE(wait_for_list(coresList, &chloe->stat.number_of_LinphoneMessageDisplayed, initialChloeStats.number_of_LinphoneMessageDisplayed + 1, 3000));
BC_ASSERT_EQUAL(chloe->stat.number_of_LinphoneMessageDeliveredToUser, 0, int, "%d");
if (read_while_offline) {
wait_for_list(coresList, 0, 1, 2000); // To prevent memory leak
}
linphone_chat_message_unref(chloeMessage3);
linphone_chat_message_unref(chloeMessage2);
linphone_chat_message_unref(chloeMessage);
end:
// Clean db from chat room
linphone_core_manager_delete_chat_room(marie, marieCr, coresList);
linphone_core_manager_delete_chat_room(chloe, chloeCr, coresList);
linphone_core_manager_delete_chat_room(pauline, paulineCr, coresList);
bctbx_list_free(coresList);
bctbx_list_free(coresManagerList);
linphone_core_manager_destroy(marie);
linphone_core_manager_destroy(pauline);
linphone_core_manager_destroy(chloe);
}
static void aggregated_imdn_for_group_chat_room (void) {
aggregated_imdn_for_group_chat_room_base(FALSE);
}
static void aggregated_imdn_for_group_chat_room_read_while_offline (void) {
aggregated_imdn_for_group_chat_room_base(TRUE);
}
static void imdn_sent_from_db_state (void) {
LinphoneCoreManager *marie = linphone_core_manager_create("marie_rc");
LinphoneCoreManager *pauline = linphone_core_manager_create("pauline_rc");
LinphoneCoreManager *chloe = linphone_core_manager_create("chloe_rc");
bctbx_list_t *coresManagerList = NULL;
bctbx_list_t *participantsAddresses = NULL;
coresManagerList = bctbx_list_append(coresManagerList, marie);
coresManagerList = bctbx_list_append(coresManagerList, pauline);
coresManagerList = bctbx_list_append(coresManagerList, chloe);
bctbx_list_t *coresList = init_core_for_conference(coresManagerList);
start_core_for_conference(coresManagerList);
participantsAddresses = bctbx_list_append(participantsAddresses, linphone_address_new(linphone_core_get_identity(pauline->lc)));
participantsAddresses = bctbx_list_append(participantsAddresses, linphone_address_new(linphone_core_get_identity(chloe->lc)));
stats initialMarieStats = marie->stat;
stats initialPaulineStats = pauline->stat;
stats initialChloeStats = chloe->stat;
time_t initialTime = ms_time(NULL);
// Enable IMDN except for Marie
linphone_im_notif_policy_clear(linphone_core_get_im_notif_policy(marie->lc));
linphone_im_notif_policy_enable_all(linphone_core_get_im_notif_policy(pauline->lc));
linphone_im_notif_policy_enable_all(linphone_core_get_im_notif_policy(chloe->lc));
// Marie creates a new group chat room
const char *initialSubject = "Colleagues";
LinphoneChatRoom *marieCr = create_chat_room_client_side(coresList, marie, &initialMarieStats, participantsAddresses, initialSubject, -1);
LinphoneAddress *confAddr = linphone_address_clone(linphone_chat_room_get_conference_address(marieCr));
// Check that the chat room is correctly created on Pauline's side and that the participants are added
LinphoneChatRoom *paulineCr = check_creation_chat_room_client_side(coresList, pauline, &initialPaulineStats, confAddr, initialSubject, 2, FALSE);
// Check that the chat room is correctly created on Chloe's side and that the participants are added
LinphoneChatRoom *chloeCr = check_creation_chat_room_client_side(coresList, chloe, &initialChloeStats, confAddr, initialSubject, 2, FALSE);
// Chloe begins composing a message
const char *chloeTextMessage = "Hello";
LinphoneChatMessage *chloeMessage = _send_message(chloeCr, chloeTextMessage);
BC_ASSERT_TRUE(wait_for_list(coresList, &marie->stat.number_of_LinphoneMessageReceived, initialMarieStats.number_of_LinphoneMessageReceived + 1, 3000));
BC_ASSERT_TRUE(wait_for_list(coresList, &pauline->stat.number_of_LinphoneMessageReceived, initialPaulineStats.number_of_LinphoneMessageReceived + 1, 3000));
LinphoneChatMessage *marieLastMsg = marie->stat.last_received_chat_message;
if (!BC_ASSERT_PTR_NOT_NULL(marieLastMsg))
goto end;
BC_ASSERT_STRING_EQUAL(linphone_chat_message_get_text(marieLastMsg), chloeTextMessage);
LinphoneAddress *chloeAddr = linphone_address_new(linphone_core_get_identity(chloe->lc));
BC_ASSERT_TRUE(linphone_address_weak_equal(chloeAddr, linphone_chat_message_get_from_address(marieLastMsg)));
linphone_address_unref(chloeAddr);
// Check that the message is not globally marked as delivered to user since Marie do not notify its delivery
BC_ASSERT_FALSE(wait_for_list(coresList, &chloe->stat.number_of_LinphoneMessageDeliveredToUser, initialChloeStats.number_of_LinphoneMessageDeliveredToUser + 1, 3000));
// Restart Marie's core with IMDN enabled so that delivery notification is sent when chat room is loaded from DB
coresList = bctbx_list_remove(coresList, marie->lc);
linphone_core_manager_reinit(marie);
bctbx_list_t *tmpCoresManagerList = bctbx_list_append(NULL, marie);
bctbx_list_t *tmpCoresList = init_core_for_conference(tmpCoresManagerList);
bctbx_list_free(tmpCoresManagerList);
coresList = bctbx_list_concat(coresList, tmpCoresList);
linphone_im_notif_policy_enable_all(linphone_core_get_im_notif_policy(marie->lc));
linphone_core_manager_start(marie, TRUE);
char *marieIdentity = linphone_core_get_device_identity(marie->lc);
LinphoneAddress *marieAddr = linphone_address_new(marieIdentity);
bctbx_free(marieIdentity);
marieCr = linphone_core_find_chat_room(marie->lc, confAddr, marieAddr);
linphone_address_unref(marieAddr);
linphone_address_unref(confAddr);
// Check that the message has been delivered to Marie and Pauline
BC_ASSERT_TRUE(wait_for_list(coresList, &chloe->stat.number_of_LinphoneMessageDeliveredToUser, initialChloeStats.number_of_LinphoneMessageDeliveredToUser + 1, 3000));
BC_ASSERT_PTR_NULL(linphone_chat_message_get_participants_that_have_displayed(chloeMessage));
bctbx_list_t *participantsThatReceivedChloeMessage = linphone_chat_message_get_participants_that_have_received(chloeMessage);
if (BC_ASSERT_PTR_NOT_NULL(participantsThatReceivedChloeMessage)) {
BC_ASSERT_EQUAL((int)bctbx_list_size(participantsThatReceivedChloeMessage), 2, int, "%d");
for (bctbx_list_t *item = participantsThatReceivedChloeMessage; item; item = bctbx_list_next(item)) {
LinphoneParticipantImdnState *state = (LinphoneParticipantImdnState *)bctbx_list_get_data(item);
BC_ASSERT_GREATER(linphone_participant_imdn_state_get_state_change_time(state), initialTime, int, "%d");
BC_ASSERT_EQUAL(linphone_participant_imdn_state_get_state(state), LinphoneChatMessageStateDeliveredToUser, int, "%d");
BC_ASSERT_PTR_NOT_NULL(linphone_participant_imdn_state_get_participant(state));
}
bctbx_list_free_with_data(participantsThatReceivedChloeMessage, (bctbx_list_free_func)linphone_participant_imdn_state_unref);
}
BC_ASSERT_PTR_NULL(linphone_chat_message_get_participants_that_have_not_received(chloeMessage));
linphone_chat_message_unref(chloeMessage);
end:
// Clean db from chat room
linphone_core_manager_delete_chat_room(marie, marieCr, coresList);
linphone_core_manager_delete_chat_room(chloe, chloeCr, coresList);
linphone_core_manager_delete_chat_room(pauline, paulineCr, coresList);
bctbx_list_free(coresList);
bctbx_list_free(coresManagerList);
linphone_core_manager_destroy(marie);
linphone_core_manager_destroy(pauline);
linphone_core_manager_destroy(chloe);
}
static void find_one_to_one_chat_room (void) {
LinphoneCoreManager *marie = linphone_core_manager_create("marie_rc");
LinphoneCoreManager *pauline = linphone_core_manager_create("pauline_rc");
@ -3333,6 +3518,9 @@ test_t group_chat_tests[] = {
TEST_NO_TAG("New unique one-to-one chatroom after both participants left", group_chat_room_new_unique_one_to_one_chat_room_after_both_participants_left),
TEST_NO_TAG("Unique one-to-one chatroom re-created from the party that deleted it, with inactive devices", group_chat_room_unique_one_to_one_chat_room_recreated_from_message_2),
TEST_NO_TAG("IMDN for group chat room", imdn_for_group_chat_room),
TEST_NO_TAG("Aggregated IMDN for group chat room", aggregated_imdn_for_group_chat_room),
TEST_NO_TAG("Aggregated IMDN for group chat room read while offline", aggregated_imdn_for_group_chat_room_read_while_offline),
TEST_ONE_TAG("IMDN sent from DB state", imdn_sent_from_db_state, "LeaksMemory"),
TEST_NO_TAG("Find one to one chat room", find_one_to_one_chat_room),
TEST_NO_TAG("New device after group chat room creation", group_chat_room_new_device_after_creation)
};