diff options
| author | 2006-06-16 12:50:19 +0000 | |
|---|---|---|
| committer | 2006-06-16 12:50:19 +0000 | |
| commit | 06fa6bc5e9a5fda8d1182b58355c6683ae0fe260 (patch) | |
| tree | 252ce154bd429b19b1b68d786de75c58e7d4c093 /src/modules/m_check.cpp | |
| parent | Added FindMatchingLocal and FindMatchingGlobal exports (diff) | |
Sync m_check with trunk
git-svn-id: http://svn.inspircd.org/repository/branches/1_0_stable@4017 e03df62e-2008-0410-955e-edbf42e46eb7
Diffstat (limited to 'src/modules/m_check.cpp')
| -rw-r--r-- | src/modules/m_check.cpp | 62 |
1 files changed, 62 insertions, 0 deletions
diff --git a/src/modules/m_check.cpp b/src/modules/m_check.cpp index c60ff0abe..68c677d09 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,63 @@ 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 + " membercount " + ConvToStr(targchan->GetUserCounter())); + + /* now the ugly bit, spool current members of a channel. :| */ + + CUList *ulist= targchan->GetUsers(); + + /* note that unlike /names, we do NOT check +i vs in the channel */ + for (CUList::iterator i = ulist->begin(); i != ulist->end(); i++) + { + char list[MAXBUF]; + char tmpbuf[MAXBUF]; + char* ptr = list; + int flags = cflags(i->second, targchan); + /* + * find how many connections from this user's IP -- unlike Asuka, + * I define a clone as coming from the same host. --w00t + */ + sprintf(ptr, "%lu ", FindMatchingGlobal(i->second)); + + if (flags & UCMODE_OP) + { + strcat(ptr, "@"); + } + + if (flags & UCMODE_HOP) + { + strcat(ptr, "%"); + } + + if (flags & UCMODE_VOICE) + { + strcat(ptr, "+"); + } + + sprintf(tmpbuf, "%s (%s@%s) %s ", i->second->nick, i->second->ident, i->second->dhost, i->second->fullname); + strcat(ptr, tmpbuf); + + Srv->SendTo(NULL, user, checkstr + " member " + ptr); + } } else { |
