summaryrefslogtreecommitdiff
path: root/src/modules/m_check.cpp
diff options
context:
space:
mode:
authordanieldg <danieldg@e03df62e-2008-0410-955e-edbf42e46eb7>2009-05-24 16:05:47 +0000
committerdanieldg <danieldg@e03df62e-2008-0410-955e-edbf42e46eb7>2009-05-24 16:05:47 +0000
commit52e139da19b6b1aed81e6d1c3ee3ad8712ce2273 (patch)
treef2dca58f4cb7b374571d6597d3dd49263fb05768 /src/modules/m_check.cpp
parent0da6b3a13def40e8fd002b9fc60f955467f6372d (diff)
Make timestamp output in /CHECK consistent
git-svn-id: http://svn.inspircd.org/repository/trunk/inspircd@11389 e03df62e-2008-0410-955e-edbf42e46eb7
Diffstat (limited to 'src/modules/m_check.cpp')
-rw-r--r--src/modules/m_check.cpp31
1 files changed, 14 insertions, 17 deletions
diff --git a/src/modules/m_check.cpp b/src/modules/m_check.cpp
index 7fe9bc8d5..7e6610901 100644
--- a/src/modules/m_check.cpp
+++ b/src/modules/m_check.cpp
@@ -26,6 +26,14 @@ class CommandCheck : public Command
syntax = "<nickname>|<ip>|<hostmask>|<channel>";
}
+ std::string timestring(time_t time)
+ {
+ char timebuf[60];
+ struct tm *mytime = gmtime(&time);
+ strftime(timebuf, 59, "%Y-%m-%d %H:%M:%S UTC (%s)", mytime);
+ return std::string(timebuf);
+ }
+
CmdResult Handle (const std::vector<std::string> &parameters, User *user)
{
User *targuser;
@@ -33,10 +41,6 @@ class CommandCheck : public Command
std::string checkstr;
std::string chliststr;
- char timebuf[60];
- struct tm *mytime;
-
-
checkstr = "304 " + std::string(user->nick) + " :CHECK";
targuser = ServerInstance->FindNick(parameters[0]);
@@ -61,15 +65,15 @@ class CommandCheck : public Command
user->WriteServ(checkstr + " snomasks +" + targuser->FormatNoticeMasks());
user->WriteServ(checkstr + " server " + targuser->server);
user->WriteServ(checkstr + " uid " + targuser->uuid);
- user->WriteServ(checkstr + " signon " + ConvToStr(targuser->signon));
- user->WriteServ(checkstr + " nickts " + ConvToStr(targuser->age));
+ user->WriteServ(checkstr + " signon " + timestring(targuser->signon));
+ user->WriteServ(checkstr + " nickts " + timestring(targuser->age));
if (IS_LOCAL(targuser))
- user->WriteServ(checkstr + " lastmsg " + ConvToStr(targuser->idle_lastmsg));
+ user->WriteServ(checkstr + " lastmsg " + timestring(targuser->idle_lastmsg));
if (IS_AWAY(targuser))
{
/* user is away */
- user->WriteServ(checkstr + " awaytime " + ConvToStr(targuser->awaytime));
+ user->WriteServ(checkstr + " awaytime " + timestring(targuser->awaytime));
user->WriteServ(checkstr + " awaymsg " + targuser->awaymsg);
}
@@ -96,21 +100,14 @@ class CommandCheck : public Command
else if (targchan)
{
/* /check on a channel */
- time_t creation_time = targchan->age;
- time_t topic_time = targchan->topicset;
-
- mytime = gmtime(&creation_time);
- strftime(timebuf, 59, "%Y/%m/%d - %H:%M:%S", mytime);
- user->WriteServ(checkstr + " timestamp " + timebuf);
+ user->WriteServ(checkstr + " timestamp " + timestring(targchan->age));
if (targchan->topic[0] != 0)
{
/* there is a topic, assume topic related information exists */
user->WriteServ(checkstr + " topic " + targchan->topic);
user->WriteServ(checkstr + " topic_setby " + targchan->setby);
- mytime = gmtime(&topic_time);
- strftime(timebuf, 59, "%Y/%m/%d - %H:%M:%S", mytime);
- user->WriteServ(checkstr + " topic_setat " + timebuf);
+ user->WriteServ(checkstr + " topic_setat " + timestring(targchan->topicset));
}
user->WriteServ(checkstr + " modes " + targchan->ChanModes(true));