Add 'when' to queued messages

This commit is contained in:
Jaidyn Ann 2021-07-25 10:15:21 -05:00
parent 987dc252d5
commit fff36dff6f
2 changed files with 13 additions and 11 deletions

View File

@ -135,6 +135,7 @@ ConversationView::ImMessage(BMessage* msg)
} }
case IM_MESSAGE_RECEIVED: case IM_MESSAGE_RECEIVED:
{ {
msg->AddInt64("when", (int64)time(NULL));
_AppendOrEnqueueMessage(msg); _AppendOrEnqueueMessage(msg);
fReceiveView->ScrollToBottom(); fReceiveView->ScrollToBottom();
break; break;
@ -151,6 +152,7 @@ ConversationView::ImMessage(BMessage* msg)
{ {
BMessage msg; BMessage msg;
msg.AddString("body", B_TRANSLATE("** You joined the room.\n")); msg.AddString("body", B_TRANSLATE("** You joined the room.\n"));
msg.AddInt64("when", (int64)time(NULL));
_AppendOrEnqueueMessage(&msg); _AppendOrEnqueueMessage(&msg);
fReceiveView->ScrollToBottom(); fReceiveView->ScrollToBottom();
} }
@ -158,6 +160,7 @@ ConversationView::ImMessage(BMessage* msg)
{ {
BMessage msg; BMessage msg;
msg.AddString("body", B_TRANSLATE("** You created the room.\n")); msg.AddString("body", B_TRANSLATE("** You created the room.\n"));
msg.AddInt64("when", (int64)time(NULL));
_AppendOrEnqueueMessage(&msg); _AppendOrEnqueueMessage(&msg);
fReceiveView->ScrollToBottom(); fReceiveView->ScrollToBottom();
} }
@ -383,8 +386,7 @@ ConversationView::_UserMessage(const char* format, const char* bodyFormat,
BMessage newMsg; BMessage newMsg;
newMsg.AddString("body", newBody); newMsg.AddString("body", newBody);
newMsg.AddInt64("when", (int64)time(NULL));
_AppendOrEnqueueMessage(&newMsg); _AppendOrEnqueueMessage(&newMsg);
fReceiveView->ScrollToBottom(); fReceiveView->ScrollToBottom();
} }

View File

@ -54,17 +54,17 @@ private:
void _UserMessage(const char* format, const char* bodyFormat, void _UserMessage(const char* format, const char* bodyFormat,
BMessage* msg); BMessage* msg);
Conversation* fConversation; Conversation* fConversation;
BObjectList<BMessage> fMessageQueue; BObjectList<BMessage> fMessageQueue;
BTextView* fNameTextView; BTextView* fNameTextView;
BTextView* fSubjectTextView; BTextView* fSubjectTextView;
BitmapView* fProtocolView; BitmapView* fProtocolView;
BitmapView* fIcon; BitmapView* fIcon;
RenderView* fReceiveView; RenderView* fReceiveView;
UserListView* fUserList; UserListView* fUserList;
SendTextView* fSendView; SendTextView* fSendView;
}; };