From 02ae8f8d8b1e0fe7ee1779351e694b527928e755 Mon Sep 17 00:00:00 2001 From: w00t Date: Mon, 27 Mar 2006 06:49:51 +0000 Subject: Experimental (it compiles..) channel support for /check. Not yet finished, but meh. git-svn-id: http://svn.inspircd.org/repository/trunk/inspircd@3769 e03df62e-2008-0410-955e-edbf42e46eb7 --- src/modules/m_check.cpp | 24 ++++++++++++++++++++++++ 1 file changed, 24 insertions(+) (limited to 'src') diff --git a/src/modules/m_check.cpp b/src/modules/m_check.cpp index c60ff0abe..0b93e0288 100644 --- a/src/modules/m_check.cpp +++ b/src/modules/m_check.cpp @@ -22,6 +22,7 @@ using namespace std; #include "message.h" #include "commands.h" #include "inspircd.h" +#include "helperfuncs.h" /* $ModDesc: Provides the /check command to retrieve information on a user, channel, or IP address */ @@ -42,6 +43,10 @@ class cmd_check : public command_t std::string checkstr; std::string chliststr; + char timebuf[60]; + struct tm *mytime; + + checkstr = "304 " + std::string(user->nick) + " :CHECK"; targuser = Srv->FindNick(std::string(parameters[0])); @@ -88,6 +93,25 @@ class cmd_check : public command_t else if (targchan) { /* /check on a channel */ + time_t creation_time = targchan->created; + time_t topic_time = targchan->topicset; + + mytime = gmtime(&creation_time); + strftime(timebuf, 59, "%Y/%m/%d - %H:%M:%S", mytime); + Srv->SendTo(NULL, user, checkstr + " created " + timebuf); + + if (targchan->topic[0] != 0) + { + /* there is a topic, assume topic related information exists */ + Srv->SendTo(NULL, user, checkstr + " topic " + targchan->topic); + Srv->SendTo(NULL, user, checkstr + " topic_setby " + targchan->setby); + mytime = gmtime(&topic_time); + strftime(timebuf, 59, "%Y/%m/%d - %H:%M:%S", mytime); + Srv->SendTo(NULL, user, checkstr + " topic_setat " + timebuf); + } + + Srv->SendTo(NULL, user, checkstr + " modes " + chanmodes(targchan, true)); + Srv->SendTo(NULL, user, checkstr + " usercount " + ConvToStr(targchan->GetUserCounter())); } else { -- cgit v1.2.3