diff options
author | danieldg <danieldg@e03df62e-2008-0410-955e-edbf42e46eb7> | 2009-09-02 00:52:04 +0000 |
---|---|---|
committer | danieldg <danieldg@e03df62e-2008-0410-955e-edbf42e46eb7> | 2009-09-02 00:52:04 +0000 |
commit | df0489220c991cfe106c88fbfaa2a14be0682779 (patch) | |
tree | 051e2080109e6ece1c627d3629b4b3638c1713dd /src/modules.cpp | |
parent | 1b3dabf0ba0088bf7a8493fe89e478731ad0d307 (diff) |
Make CHECK work remotely with optional second parameter
git-svn-id: http://svn.inspircd.org/repository/trunk/inspircd@11651 e03df62e-2008-0410-955e-edbf42e46eb7
Diffstat (limited to 'src/modules.cpp')
-rw-r--r-- | src/modules.cpp | 32 |
1 files changed, 25 insertions, 7 deletions
diff --git a/src/modules.cpp b/src/modules.cpp index ab2975d7c..bea9cad0f 100644 --- a/src/modules.cpp +++ b/src/modules.cpp @@ -768,20 +768,38 @@ void InspIRCd::SendMode(const std::vector<std::string>& parameters, User *user) this->Modes->Process(parameters, user); } -void InspIRCd::DumpText(User* User, const std::string &LinePrefix, std::stringstream &TextStream) +void InspIRCd::DumpText(User* user, const std::string &text) { - std::string CompleteLine = LinePrefix; + if (IS_LOCAL(user)) + { + user->Write(text); + } + else + { + PI->PushToClient(user, ":" + text); + } +} + +void InspIRCd::DumpText(User* user, const std::string &LinePrefix, std::stringstream &TextStream) +{ + char line[MAXBUF]; + int start_pos = snprintf(line, MAXBUF, ":%s %s", Config->ServerName, LinePrefix.c_str()); + int pos = start_pos; std::string Word; while (TextStream >> Word) { - if (CompleteLine.length() + Word.length() + 3 > 500) + int len = Word.length(); + if (pos + len + 12 > MAXBUF) { - User->WriteServ(CompleteLine); - CompleteLine = LinePrefix; + line[pos] = '\0'; + DumpText(user, line); + pos = start_pos; } - CompleteLine = CompleteLine + Word + " "; + line[pos] = ' '; + memcpy(line + pos + 1, Word.data(), len); + pos += len + 1; } - User->WriteServ(CompleteLine); + DumpText(user, line); } bool InspIRCd::AddResolver(Resolver* r, bool cached) |