summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorbrain <brain@e03df62e-2008-0410-955e-edbf42e46eb7>2006-03-07 23:07:47 +0000
committerbrain <brain@e03df62e-2008-0410-955e-edbf42e46eb7>2006-03-07 23:07:47 +0000
commit9ea4af047d33d552c953f4cdddf1250cd936323f (patch)
treec54771604688945d01324f263d7fdcabd8c6a8a8
parent22aae180a1302187b531d08476932798a08fa297 (diff)
*TEST* Server::DumpText - Dump a *stringstream* to a user with a std::string prefix, splitting at 512 boundaries.
Much more useful than cannibalizing a specialized function git-svn-id: http://svn.inspircd.org/repository/trunk/inspircd@3535 e03df62e-2008-0410-955e-edbf42e46eb7
-rw-r--r--include/modules.h2
-rw-r--r--src/modules.cpp16
-rwxr-xr-xsrc/svn-rev.sh2
3 files changed, 19 insertions, 1 deletions
diff --git a/include/modules.h b/include/modules.h
index 4dff5d48a..5b5b177a4 100644
--- a/include/modules.h
+++ b/include/modules.h
@@ -1749,6 +1749,8 @@ class Server : public classbase
virtual long GetChannelCount();
virtual chanrec* GetChannelIndex(long index);
+
+ void DumpText(userrec* User, std::string LinePrefix, stringstream &TextStream);
};
diff --git a/src/modules.cpp b/src/modules.cpp
index a267662df..437da4026 100644
--- a/src/modules.cpp
+++ b/src/modules.cpp
@@ -566,6 +566,22 @@ bool Server::CommonChannels(userrec* u1, userrec* u2)
return (common_channels(u1,u2) != 0);
}
+void Server::DumpText(userrec* User, std::string LinePrefix, stringstream &TextStream)
+{
+ std::string CompleteLine = LinePrefix;
+ std::string Word = "";
+ while (TextStream >> Word)
+ {
+ if (CompleteLine.length() + Word.length() + 3 > 500)
+ {
+ WriteServ_NoFormat(User->fd,CompleteLine.c_str());
+ CompleteLine = LinePrefix;
+ }
+ CompleteLine = CompleteLine + Word + " ";
+ }
+ WriteServ_NoFormat(User->fd,CompleteLine.c_str());
+}
+
void Server::SendCommon(userrec* User, std::string text,bool IncludeSender)
{
if (IncludeSender)
diff --git a/src/svn-rev.sh b/src/svn-rev.sh
index a1d51cc24..cfa11aa0f 100755
--- a/src/svn-rev.sh
+++ b/src/svn-rev.sh
@@ -1 +1 @@
-echo 3531
+echo 3533