Commit 3ccf8850 authored by Ronan's avatar Ronan

fix(EventsDb): use full name of ChatMessage state

parent 779646a3
......@@ -22,9 +22,10 @@
// TODO: Remove me in the future.
#include "linphone/types.h"
#include "linphone/utils/enum-generator.h"
#include "linphone/enums/chat-message-enums.h"
#include "linphone/enums/chat-room-enums.h"
#include "linphone/enums/event-log-enums.h"
#include "linphone/utils/enum-generator.h"
// =============================================================================
......@@ -129,6 +130,12 @@ typedef struct _LinphoneChatMessageEvent LinphoneChatMessageEvent;
// C Enums.
// =============================================================================
/**
* LinphoneChatMessageState is used to notify if messages have been succesfully delivered or not.
* @ingroup chatroom
*/
L_DECLARE_C_ENUM(ChatMessageState, L_ENUM_VALUES_CHAT_MESSAGE_STATE);
L_DECLARE_C_ENUM(ChatRoomState, L_ENUM_VALUES_CHAT_ROOM_STATE);
L_DECLARE_C_ENUM(EventLogType, L_ENUM_VALUES_EVENT_LOG_TYPE);
......
......@@ -318,21 +318,6 @@ typedef enum _LinphoneCallStatus {
LinphoneCallDeclinedElsewhere /**<The call was declined on another device*/
} LinphoneCallStatus;
/**
* LinphoneChatMessageState is used to notify if messages have been succesfully delivered or not.
* @ingroup chatroom
*/
typedef enum _LinphoneChatMessageState {
LinphoneChatMessageStateIdle, /**< Initial state */
LinphoneChatMessageStateInProgress, /**< Delivery in progress */
LinphoneChatMessageStateDelivered, /**< Message successfully delivered and acknowledged by server */
LinphoneChatMessageStateNotDelivered, /**< Message was not delivered */
LinphoneChatMessageStateFileTransferError, /**< Message was received(and acknowledged) but cannot get file from server */
LinphoneChatMessageStateFileTransferDone, /**< File transfer has been completed successfully */
LinphoneChatMessageStateDeliveredToUser, /**< Message successfully delivered and acknowledged to destination */
LinphoneChatMessageStateDisplayed /**< Message displayed to the remote user */
} LinphoneChatMessageState;
/**
* LinphoneConference class
* The _LinphoneConference struct does not exists, it's the Conference C++ class that is used behind
......
......@@ -75,15 +75,16 @@ EventsDb::EventsDb () : AbstractDb(*new EventsDbPrivate) {}
);
}
static constexpr EnumToSql<ChatMessage::State> messageStateToSql[] = {
{ ChatMessage::Idle, "1" },
{ ChatMessage::InProgress, "2" },
{ ChatMessage::Delivered, "3" },
{ ChatMessage::NotDelivered, "4" },
{ ChatMessage::FileTransferError, "5" },
{ ChatMessage::FileTransferDone, "6" },
{ ChatMessage::DeliveredToUser, "7" },
{ ChatMessage::Displayed, "8" }
{ ChatMessage::State::Idle, "1" },
{ ChatMessage::State::InProgress, "2" },
{ ChatMessage::State::Delivered, "3" },
{ ChatMessage::State::NotDelivered, "4" },
{ ChatMessage::State::FileTransferError, "5" },
{ ChatMessage::State::FileTransferDone, "6" },
{ ChatMessage::State::DeliveredToUser, "7" },
{ ChatMessage::State::Displayed, "8" }
};
static constexpr const char *mapMessageStateToSql (ChatMessage::State state) {
......@@ -408,7 +409,7 @@ EventsDb::EventsDb () : AbstractDb(*new EventsDbPrivate) {}
" )"
" )"
" AND direction_id = " + string(mapMessageDirectionToSql(ChatMessage::Incoming)) +
" AND state_id = " + string(mapMessageStateToSql(ChatMessage::Displayed));
" AND state_id = " + string(mapMessageStateToSql(ChatMessage::State::Displayed));
int count = 0;
L_BEGIN_LOG_EXCEPTION
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment