summaryrefslogtreecommitdiff
path: root/src/modules/m_check.cpp
diff options
context:
space:
mode:
authorw00t <w00t@e03df62e-2008-0410-955e-edbf42e46eb7>2006-03-07 23:01:39 +0000
committerw00t <w00t@e03df62e-2008-0410-955e-edbf42e46eb7>2006-03-07 23:01:39 +0000
commit22aae180a1302187b531d08476932798a08fa297 (patch)
treeca99dd74ef3c19f7173996e3687f1eeedef03476 /src/modules/m_check.cpp
parent4f1945d30b3a616a4b32a5e91e405ae86f108c4e (diff)
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
Diffstat (limited to 'src/modules/m_check.cpp')
-rw-r--r--src/modules/m_check.cpp35
1 files changed, 34 insertions, 1 deletions
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]));
}
};