summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--ChangeLog1
-rw-r--r--src/gui/chat.cpp18
2 files changed, 18 insertions, 1 deletions
diff --git a/ChangeLog b/ChangeLog
index 93efa097..2b74e865 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,5 +1,6 @@
2005-09-21 Andrej Sinicyn <andrej4000@gmail.com>
+ * src/gui/chat.cpp: Show time of the messages in the chat window.
* The Mana World.dev: Removed reference to src/gui/stats.* since they
are in the attic now.
diff --git a/src/gui/chat.cpp b/src/gui/chat.cpp
index 70b39ae3..ab654440 100644
--- a/src/gui/chat.cpp
+++ b/src/gui/chat.cpp
@@ -23,6 +23,8 @@
#include "chat.h"
+#include <sstream>
+
#include <guichan/focushandler.hpp>
#include <guichan/key.hpp>
@@ -144,7 +146,21 @@ void ChatWindow::chat_log(std::string line, int own)
break;
}
- line = lineColor + tmp.nick + line;
+ // Get the current system time
+ time_t t;
+ time(&t);
+
+ // Format the time string properly
+ std::stringstream timeStr;
+ timeStr << "[";
+ timeStr << ((((t / 60) / 60) % 24 < 10) ? "0" : "");
+ timeStr << (int)(((t / 60) / 60) % 24);
+ timeStr << ":";
+ timeStr << (((t / 60) % 60 < 10) ? "0" : "");
+ timeStr << (int)((t / 60) % 60);
+ timeStr << "] ";
+
+ line = lineColor + timeStr.str() + tmp.nick + line;
textOutput->addRow(line);
scrollArea->setVerticalScrollAmount(scrollArea->getVerticalMaxScroll());