Commit 00544598 authored by Rafał Malinowski's avatar Rafał Malinowski

message: remove unused values of MessageStatus enum

Signed-off-by: Rafał Malinowski's avatarRafał Malinowski <rafal.przemyslaw.malinowski@gmail.com>
parent b1bc9f63
......@@ -2,9 +2,6 @@
// MessageStatus enum vaules identical with those defined in kadu-core/chat/message/message-common.h
StatusUnknown = 0;
StatusReceived = 1;
StatusRead = 2;
StatusSent = 3;
StatusDelivered = 4;
StatusWontDeliver = 5;
......
......@@ -480,7 +480,7 @@ void ChatWidget::appendMessages(const QVector<Message> &messages)
foreach (const Message &message, messages)
{
messageRenderInfos.append(new MessageRenderInfo(message));
unread = unread || message.status() == MessageStatusReceived;
unread = unread || message.type() == MessageTypeReceived || message.type() == MessageTypeSystem;
}
MessagesView->appendMessages(messageRenderInfos);
......@@ -492,7 +492,7 @@ void ChatWidget::appendMessage(const Message &message)
{
MessagesView->appendMessage(new MessageRenderInfo(message));
if (message.type() != MessageTypeReceived)
if (message.type() != MessageTypeReceived && message.type() != MessageTypeSystem)
return;
LastReceivedMessageTime = QDateTime::currentDateTime();
......@@ -513,7 +513,6 @@ void ChatWidget::appendSystemMessage(std::unique_ptr<FormattedString> &&content)
message.setContent(std::move(content));
message.setReceiveDate(QDateTime::currentDateTime());
message.setSendDate(QDateTime::currentDateTime());
message.setStatus(MessageStatusReceived);
MessagesView->appendMessage(message);
}
......@@ -830,7 +829,6 @@ void ChatWidget::contactActivityChanged(const Contact &contact, ChatStateService
message.setMessageChat(CurrentChat);
message.setType(MessageTypeSystem);
message.setMessageSender(contact);
message.setStatus(MessageStatusReceived);
message.setContent(CurrentFormattedStringFactory.data()->fromPlainText(msg));
message.setSendDate(QDateTime::currentDateTime());
message.setReceiveDate(QDateTime::currentDateTime());
......
......@@ -30,19 +30,16 @@
enum MessageStatus
{
MessageStatusUnknown = 0,
MessageStatusReceived = 1,
MessageStatusRead = 2,
MessageStatusSent = 3,
MessageStatusDelivered = 4,
MessageStatusWontDeliver = 5
};
enum MessageType
{
MessageTypeUnknown,
MessageTypeReceived,
MessageTypeSent,
MessageTypeSystem
MessageTypeUnknown = 0,
MessageTypeReceived = 1,
MessageTypeSent = 2,
MessageTypeSystem = 3
};
#endif // MESSAGE_COMMON_H
......@@ -119,7 +119,6 @@ Message MessageManager::createOutgoingMessage(const Chat &chat, std::unique_ptr<
message.setMessageChat(chat);
message.setType(MessageTypeSent);
message.setMessageSender(chat.chatAccount().accountContact());
message.setStatus(MessageStatusSent);
message.setContent(std::move(content));
message.setSendDate(QDateTime::currentDateTime());
message.setReceiveDate(QDateTime::currentDateTime());
......
......@@ -163,9 +163,7 @@ void UnreadMessageRepository::markMessagesAsRead(const QVector<Message> &message
for (const auto &message : messages)
if (m_unreadMessages.removeAll(message) > 0)
{
message.setStatus(MessageStatusRead);
message.data()->removeFromStorage();
emit unreadMessageRemoved(message);
}
}
......
......@@ -225,7 +225,6 @@ void GaduChatService::handleMsg(Contact sender, ContactSet recipients, MessageTy
message.setMessageChat(chat);
message.setType(type);
message.setMessageSender(sender);
message.setStatus(MessageTypeReceived == type ? MessageStatusReceived : MessageStatusSent);
message.setSendDate(QDateTime::fromTime_t(e->event.msg.time));
message.setReceiveDate(QDateTime::currentDateTime());
......
......@@ -330,10 +330,7 @@ void HintManager::processButtonPress(const QString &buttonName, Hint *hint)
{
auto unreadMessages = Core::instance()->unreadMessageRepository()->unreadMessagesForChat(hint->chat());
foreach (const Message &message, unreadMessages)
{
message.setStatus(MessageStatusRead);
Core::instance()->unreadMessageRepository()->removeUnreadMessage(message);
}
}
hint->discardNotification();
......
......@@ -1053,7 +1053,8 @@ QVector<Message> HistorySqlStorage::messagesFromQuery(QSqlQuery &query)
message.setContent(CurrentFormattedStringFactory.data()->fromHtml(stripAllScriptTags(query.value(2).toString())));
message.setSendDate(query.value(3).toDateTime());
message.setReceiveDate(query.value(4).toDateTime());
message.setStatus(outgoing ? MessageStatusDelivered : MessageStatusReceived);
if (outgoing)
message.setStatus(MessageStatusDelivered);
messages.append(message);
}
......@@ -1080,7 +1081,6 @@ QVector<Message> HistorySqlStorage::statusesFromQuery(const Contact &contact, QS
: Qt::escape(QString("%1 with description: %2").arg(typeData.name()).arg(description));
message.setContent(CurrentFormattedStringFactory.data()->fromHtml(htmlContent));
message.setStatus(MessageStatusReceived);
message.setType(MessageTypeSystem);
message.setMessageSender(contact);
message.setReceiveDate(query.value(3).toDateTime());
......@@ -1101,7 +1101,6 @@ QVector<Message> HistorySqlStorage::smsFromQuery(QSqlQuery &query)
while (query.next())
{
Message message = Message::create();
message.setStatus(MessageStatusSent);
message.setType(MessageTypeSystem);
message.setReceiveDate(query.value(1).toDateTime());
message.setSendDate(query.value(1).toDateTime());
......
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