From 22aae180a1302187b531d08476932798a08fa297 Mon Sep 17 00:00:00 2001 From: w00t Date: Tue, 7 Mar 2006 23:01:39 +0000 Subject: For the record, it's 17 lines - not 5. git-svn-id: http://svn.inspircd.org/repository/trunk/inspircd@3534 e03df62e-2008-0410-955e-edbf42e46eb7 --- src/modules/m_check.cpp | 35 ++++++++++++++++++++++++++++++++++- 1 file changed, 34 insertions(+), 1 deletion(-) diff --git a/src/modules/m_check.cpp b/src/modules/m_check.cpp index c6d8b08de..f1a160b98 100644 --- a/src/modules/m_check.cpp +++ b/src/modules/m_check.cpp @@ -19,6 +19,8 @@ using namespace std; #include "users.h" #include "channels.h" #include "modules.h" +#include "message.h" +#include "commands.h" /* $ModDesc: Provides the /check command to retrieve information on a user, channel, or IP address */ @@ -37,6 +39,7 @@ class cmd_check : public command_t userrec *targuser; chanrec *targchan; std::string checkstr; + std::string chliststr; checkstr = "304 " + std::string(user->nick) + " :CHECK"; @@ -75,6 +78,36 @@ class cmd_check : public command_t /* port information is only held for a local user! */ Srv->SendTo(NULL, user, checkstr + " onport " + ConvToStr(targuser->port)); } + + chliststr = chlist(targuser, targuser); + if (chliststr.length()) + { + if (chliststr.length() > 400) + { + /* XXX - this sucks. deal with it. */ + std::stringstream chstream(chliststr); + std::string line = ""; + std::string cname = ""; + while (!chstream.eof()) + { + chstream >> cname; + line = line + cname + " "; + if (line.length() > 400) + { + Srv->SendTo(NULL, user, checkstr + " onchans " + line); + line = ""; + } + } + if (line.length()) + { + Srv->SendTo(NULL, user, checkstr + " onchans " + line); + } + } + else + { + Srv->SendTo(NULL, user, checkstr + " onchans " + chliststr); + } + } } else if (targchan) { @@ -85,7 +118,7 @@ class cmd_check : public command_t /* /check on an IP address, or something that doesn't exist */ } - Srv->SendTo(NULL, user, "304 " + std::string(user->nick) + " :CHECK END " + std::string(parameters[0])); + Srv->SendTo(NULL, user, checkstr + " END " + std::string(parameters[0])); } }; -- cgit v1.2.3