diff --git a/application/Conversation.cpp b/application/Conversation.cpp index 5079a70..e534bee 100644 --- a/application/Conversation.cpp +++ b/application/Conversation.cpp @@ -5,6 +5,9 @@ #include "Conversation.h" +#include +#include + #include "CayaPreferences.h" #include "CayaProtocolMessages.h" #include "CayaUtils.h" @@ -24,7 +27,8 @@ Conversation::Conversation(BString id, BMessenger msgn) fMessenger(msgn), fChatWindow(NULL), fNewWindow(true), - fLooper(NULL) + fLooper(NULL), + fDateFormatter() { } @@ -215,11 +219,15 @@ Conversation::_CreateChatWindow() } +#include void Conversation::_LogChatMessage(BMessage* msg) { _EnsureLogPath(); + BString date; + fDateFormatter.Format(date, time(0), B_SHORT_DATE_FORMAT, B_MEDIUM_TIME_FORMAT); + BString id = msg->FindString("user_id"); BString uname; @@ -228,7 +236,11 @@ Conversation::_LogChatMessage(BMessage* msg) else uname = "You"; - BString logLine = uname; + + BString logLine("["); + logLine << date; + logLine << "] "; + logLine << uname; logLine << ": "; logLine << msg->FindString("body"); logLine << "\n"; diff --git a/application/Conversation.h b/application/Conversation.h index 2c6f6f0..77c1511 100644 --- a/application/Conversation.h +++ b/application/Conversation.h @@ -5,6 +5,7 @@ #ifndef CONVERSATION_H #define CONVERSATION_H +#include #include #include @@ -71,6 +72,7 @@ private: BString fName; BPath fLogPath; + BDateTimeFormat fDateFormatter; UserMap fUsers; };