summaryrefslogtreecommitdiff
path: root/src/modules.cpp
diff options
context:
space:
mode:
authordanieldg <danieldg@e03df62e-2008-0410-955e-edbf42e46eb7>2009-09-02 00:53:03 +0000
committerdanieldg <danieldg@e03df62e-2008-0410-955e-edbf42e46eb7>2009-09-02 00:53:03 +0000
commit0377d937c5d1bf20fa0c29d4a41c7fd89502ab38 (patch)
tree4947668cb5670ced506dc3fb34e88e3f99b84734 /src/modules.cpp
parent8ca460a0e660f7ac6bae4dfdc88680876fd899f5 (diff)
Remote user messaging fixes
Add format string output to DumpText Fix PI->PushToClient prefixing issue Fix ENCAP routing to use SID rather than server name git-svn-id: http://svn.inspircd.org/repository/trunk/inspircd@11658 e03df62e-2008-0410-955e-edbf42e46eb7
Diffstat (limited to 'src/modules.cpp')
-rw-r--r--src/modules.cpp22
1 files changed, 18 insertions, 4 deletions
diff --git a/src/modules.cpp b/src/modules.cpp
index 9632718ee..2e3623b4a 100644
--- a/src/modules.cpp
+++ b/src/modules.cpp
@@ -777,15 +777,28 @@ void InspIRCd::DumpText(User* user, const std::string &text)
}
else
{
- PI->PushToClient(user, ":" + text);
+ PI->PushToClient(user, text);
}
}
+void InspIRCd::DumpText(User* user, const char *text, ...)
+{
+ va_list argsPtr;
+ char line[MAXBUF];
+
+ va_start(argsPtr, text);
+ vsnprintf(line, MAXBUF, text, argsPtr);
+ va_end(argsPtr);
+
+ DumpText(user, std::string(line));
+}
+
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 start_pos = LinePrefix.length();
int pos = start_pos;
+ memcpy(line, LinePrefix.data(), pos);
std::string Word;
while (TextStream >> Word)
{
@@ -793,14 +806,15 @@ void InspIRCd::DumpText(User* user, const std::string &LinePrefix, std::stringst
if (pos + len + 12 > MAXBUF)
{
line[pos] = '\0';
- DumpText(user, line);
+ DumpText(user, std::string(line));
pos = start_pos;
}
line[pos] = ' ';
memcpy(line + pos + 1, Word.data(), len);
pos += len + 1;
}
- DumpText(user, line);
+ line[pos] = '\0';
+ DumpText(user, std::string(line));
}
bool InspIRCd::AddResolver(Resolver* r, bool cached)